diff options
Diffstat (limited to 'lexical/slowsort_test.go')
-rw-r--r-- | lexical/slowsort_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lexical/slowsort_test.go b/lexical/slowsort_test.go new file mode 100644 index 0000000..20e1a3c --- /dev/null +++ b/lexical/slowsort_test.go @@ -0,0 +1,19 @@ +package lexical + +import "testing" + +// TestSlowSort tests the SlowSort func. +func TestSlowSort(t *testing.T) { + words := make(map[string]string) + + words["dcba"] = "abcd" + words["zyx"] = "xyz" + + for word, sorted := range words { + s := SlowSort(word) + if s != sorted { + t.Errorf("Sort func failed, got %s, want %s", + s, sorted) + } + } +} |