(t *testing.T)
| 22 | } |
| 23 | |
| 24 | func TestRomanToInt(t *testing.T) { |
| 25 | for input, expected := range romanTestCases { |
| 26 | out, err := RomanToInt(input) |
| 27 | if err != nil { |
| 28 | t.Errorf("RomanToInt(%s) returned an error %s", input, err.Error()) |
| 29 | } |
| 30 | if out != expected { |
| 31 | t.Errorf("RomanToInt(%s) = %d; want %d", input, out, expected) |
| 32 | } |
| 33 | } |
| 34 | _, err := RomanToInt("IVCMXCIX") |
| 35 | if err == nil { |
| 36 | t.Error("RomanToInt(IVCMXCIX) expected an error") |
| 37 | } |
| 38 | |
| 39 | val, err := RomanToInt("") |
| 40 | if val != 0 { |
| 41 | t.Errorf("RomanToInt(\"\") = %d; want 0", val) |
| 42 | } |
| 43 | if err != nil { |
| 44 | t.Errorf("RomanToInt(\"\") returned an error %s", err.Error()) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func BenchmarkRomanToInt(b *testing.B) { |
| 49 | b.ReportAllocs() |
nothing calls this directly
no test coverage detected