Sha256: caee2b360f11eb6181f2a567db152f4080cefb0253284b605ecd1f63e67b7213
Contents?: true
Size: 830 Bytes
Versions: 122
Compression:
Stored size: 830 Bytes
Contents
package wordsearch import ( "reflect" "testing" ) // Define a function Solve(words []string, puzzle []string) (map[string][2][2]int, error). func TestSolve(t *testing.T) { for _, tc := range testCases { actual, err := Solve(tc.words, tc.puzzle) if err != nil { var _ error = err if !tc.expectError { t.Fatalf("FAIL: %s\nExpected %#v\nGot error: %v", tc.description, tc.expected, err) } } else if tc.expectError { t.Fatalf("FAIL: %s\nExpected error\nGot %v", tc.description, actual) } else if !reflect.DeepEqual(actual, tc.expected) { t.Fatalf("FAIL: %s\nExpected %v,\nGot %v", tc.description, tc.expected, actual) } t.Logf("PASS: %s", tc.description) } } func BenchmarkSolve(b *testing.B) { for i := 0; i < b.N; i++ { for _, tc := range testCases { Solve(tc.words, tc.puzzle) } } }
Version data entries
122 entries across 122 versions & 1 rubygems