Tests
(t *testing.T)
| 4 | |
| 5 | // Tests |
| 6 | func TestProblem15_Func(t *testing.T) { |
| 7 | tests := []struct { |
| 8 | name string |
| 9 | input int |
| 10 | want int |
| 11 | }{ |
| 12 | {"Input 2", 2, 6}, |
| 13 | // This test case is disabled |
| 14 | // because it needs a big integer to run successfully |
| 15 | // and factorial package doesn't support it |
| 16 | // {"Input 20", 20, 137846528820}, |
| 17 | } |
| 18 | |
| 19 | for _, tt := range tests { |
| 20 | t.Run(tt.name, func(t *testing.T) { |
| 21 | got := Problem15(tt.input) |
| 22 | if got != tt.want { |
| 23 | t.Errorf("Problem15() = %v, want %v", got, tt.want) |
| 24 | } |
| 25 | }) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // Benchmarks |
| 30 | func BenchmarkProblem15_Func(b *testing.B) { |
nothing calls this directly
no test coverage detected