(t *testing.T)
| 3 | import "testing" |
| 4 | |
| 5 | func TestIntToRoman(t *testing.T) { |
| 6 | for expected, input := range romanTestCases { |
| 7 | out, err := IntToRoman(input) |
| 8 | if err != nil { |
| 9 | t.Errorf("IntToRoman(%d) returned an error %s", input, err.Error()) |
| 10 | } |
| 11 | if out != expected { |
| 12 | t.Errorf("IntToRoman(%d) = %s; want %s", input, out, expected) |
| 13 | } |
| 14 | } |
| 15 | _, err := IntToRoman(100000) |
| 16 | if err == nil { |
| 17 | t.Errorf("IntToRoman(%d) expected an error", 100000) |
| 18 | } |
| 19 | _, err = IntToRoman(0) |
| 20 | if err == nil { |
| 21 | t.Errorf("IntToRoman(%d) expected an error", 0) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func BenchmarkIntToRoman(b *testing.B) { |
| 26 | b.ReportAllocs() |
nothing calls this directly
no test coverage detected