tracks/go/exercises/isogram/isogram_test.go in trackler-2.2.1.60 vs tracks/go/exercises/isogram/isogram_test.go in trackler-2.2.1.61
- old
+ new
@@ -1,41 +1,25 @@
package isogram
import "testing"
-var testCases = []struct {
- word string
- expected bool
-}{
- {"duplicates", true},
- {"eleven", false},
- {"subdermatoglyphic", true},
- {"Alphabet", false},
- {"thumbscrew-japingly", true},
- {"Hjelmqvist-Gryb-Zock-Pfund-Wax", true},
- {"Heizölrückstoßabdämpfung", true},
- {"the quick brown fox", false},
- {"Emily Jung Schwartzkopf", true},
- {"éléphant", false},
-}
-
func TestIsIsogram(t *testing.T) {
for _, c := range testCases {
- if IsIsogram(c.word) != c.expected {
- t.Fatalf("FAIL: Word %q, expected %v, got %v", c.word, c.expected, !c.expected)
+ if IsIsogram(c.input) != c.expected {
+ t.Fatalf("FAIL: %s\nWord %q, expected %t, got %t", c.description, c.input, c.expected, !c.expected)
}
- t.Logf("PASS: Word %q", c.word)
+ t.Logf("PASS: Word %q", c.input)
}
}
func BenchmarkIsIsogram(b *testing.B) {
b.StopTimer()
for _, c := range testCases {
b.StartTimer()
for i := 0; i < b.N; i++ {
- IsIsogram(c.word)
+ IsIsogram(c.input)
}
b.StopTimer()
}
}