Tests
(t *testing.T)
| 4 | |
| 5 | // Tests |
| 6 | func TestProblem18_Func(t *testing.T) { |
| 7 | tests := []struct { |
| 8 | name string |
| 9 | input []string |
| 10 | deep int |
| 11 | expected int |
| 12 | }{ |
| 13 | { |
| 14 | name: "Test case 1", |
| 15 | input: problem18_test_parsed_string, |
| 16 | deep: 2, |
| 17 | expected: 23, |
| 18 | }, |
| 19 | { |
| 20 | name: "Test case 2", |
| 21 | input: problem18_input_parsed_string, |
| 22 | deep: 2, |
| 23 | expected: 1074, |
| 24 | }, |
| 25 | } |
| 26 | |
| 27 | for _, test := range tests { |
| 28 | t.Run(test.name, func(t *testing.T) { |
| 29 | actual := Problem18(test.input, test.deep) |
| 30 | if actual != test.expected { |
| 31 | t.Errorf("Expected %d, but got %d", test.expected, actual) |
| 32 | } |
| 33 | }) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // Benchmarks |
| 38 | func BenchmarkProblem18_Func(b *testing.B) { |
nothing calls this directly
no test coverage detected