MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_romanToInt

Function Test_romanToInt

roman_to_integer_13/solution_test.go:8–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func 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}

Callers

nothing calls this directly

Calls 1

romanToIntFunction · 0.85

Tested by

no test coverage detected