(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestParseNumber(t *testing.T) { |
| 68 | testCases := []struct { |
| 69 | input string |
| 70 | expectedPass bool |
| 71 | expectedValue int |
| 72 | expectedError string |
| 73 | }{ |
| 74 | {"123", true, 123, ""}, |
| 75 | {"abc123", true, 123, ""}, |
| 76 | {"123abc", true, 123, ""}, |
| 77 | {"abc", false, 0, "could not be parsed into a number"}, |
| 78 | } |
| 79 | |
| 80 | for _, tc := range testCases { |
| 81 | pass, value, _ := ParseNumber(tc.input) |
| 82 | if pass != tc.expectedPass { |
| 83 | t.Errorf("ParseNumber(%s) passing is %v, expected %v", tc.input, pass, tc.expectedPass) |
| 84 | } |
| 85 | |
| 86 | if value != tc.expectedValue { |
| 87 | t.Errorf("ParseNumber(%s) got new value %v, expected %v", tc.input, value, tc.expectedValue) |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestParseBool(t *testing.T) { |
| 93 | testCases := []struct { |
nothing calls this directly
no test coverage detected