Sha256: d765f454c4fdc4e8ffe72d3a3e617cbe174323caac1b441b8a2c795b07454f9c
Contents?: true
Size: 921 Bytes
Versions: 113
Compression:
Stored size: 921 Bytes
Contents
package collatzconjecture import ( "testing" ) func TestCollatzConjecture(t *testing.T) { for _, testCase := range testCases { steps, err := CollatzConjecture(testCase.input) if testCase.expectError { if err == nil { t.Fatalf("FAIL: %s\n\tCollatzConjecture(%v) expected an error, got %v", testCase.description, testCase.input, steps) } } else { if err != nil { t.Fatalf("FAIL: %s\n\tCollatzConjecture(%v) returns unexpected error %s", testCase.description, testCase.input, err.Error()) } if steps != testCase.expected { t.Fatalf("FAIL: %s\n\tCollatzConjecture(%v) expected %v, got %v", testCase.description, testCase.input, testCase.expected, steps) } } t.Logf("PASS: %s", testCase.description) } } func BenchmarkCollatzConjecture(b *testing.B) { for i := 0; i < b.N; i++ { for _, testCase := range testCases { CollatzConjecture(testCase.input) } } }
Version data entries
113 entries across 113 versions & 1 rubygems