diff options
Diffstat (limited to 'go/hamming/cases_test.go')
-rw-r--r-- | go/hamming/cases_test.go | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/go/hamming/cases_test.go b/go/hamming/cases_test.go new file mode 100644 index 0000000..84e867c --- /dev/null +++ b/go/hamming/cases_test.go @@ -0,0 +1,67 @@ +package hamming + +// Source: exercism/problem-specifications +// Commit: 4119671 Hamming: Add a tests to avoid wrong recursion solution (#1450) +// Problem Specifications Version: 2.3.0 + +var testCases = []struct { + s1 string + s2 string + want int + expectError bool +}{ + { // empty strands + "", + "", + 0, + false, + }, + { // single letter identical strands + "A", + "A", + 0, + false, + }, + { // single letter different strands + "G", + "T", + 1, + false, + }, + { // long identical strands + "GGACTGAAATCTG", + "GGACTGAAATCTG", + 0, + false, + }, + { // long different strands + "GGACGGATTCTG", + "AGGACGGATTCT", + 9, + false, + }, + { // disallow first strand longer + "AATG", + "AAA", + 0, + true, + }, + { // disallow second strand longer + "ATA", + "AGTG", + 0, + true, + }, + { // disallow left empty strand + "", + "G", + 0, + true, + }, + { // disallow right empty strand + "G", + "", + 0, + true, + }, +} |