(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func Test_romanToInt(t *testing.T) { |
| 9 | type args struct { |
| 10 | s string |
| 11 | } |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | args args |
| 15 | want int |
| 16 | }{ |
| 17 | { |
| 18 | name: "roman numeral to int", |
| 19 | args: args{ |
| 20 | s: "III", |
| 21 | }, |
| 22 | want: 3, |
| 23 | }, |
| 24 | { |
| 25 | name: "roman numeral to int", |
| 26 | args: args{ |
| 27 | s: "IV", |
| 28 | }, |
| 29 | want: 4, |
| 30 | }, |
| 31 | { |
| 32 | name: "roman numeral to int", |
| 33 | args: args{ |
| 34 | s: "IX", |
| 35 | }, |
| 36 | want: 9, |
| 37 | }, |
| 38 | { |
| 39 | name: "roman numeral to int", |
| 40 | args: args{ |
| 41 | s: "LVIII", |
| 42 | }, |
| 43 | want: 58, |
| 44 | }, |
| 45 | { |
| 46 | name: "roman numeral to int", |
| 47 | args: args{ |
| 48 | s: "MCMXCIV", |
| 49 | }, |
| 50 | want: 1994, |
| 51 | }, |
| 52 | } |
| 53 | for _, tt := range tests { |
| 54 | t.Run(tt.name, func(t *testing.T) { |
| 55 | assert.Equal(t, tt.want, romanToInt(tt.args.s)) |
| 56 | }) |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected