Tests
(t *testing.T)
| 4 | |
| 5 | // Tests |
| 6 | func TestProblem20_Func(t *testing.T) { |
| 7 | tests := []struct { |
| 8 | name string |
| 9 | input int |
| 10 | expected int |
| 11 | }{ |
| 12 | {"Problem 20 - Factorial digit sum", 10, 27}, |
| 13 | {"Problem 20 - Factorial digit sum", 100, 648}, |
| 14 | } |
| 15 | |
| 16 | for _, test := range tests { |
| 17 | t.Run(test.name, func(t *testing.T) { |
| 18 | got := Problem20(test.input) |
| 19 | if got != test.expected { |
| 20 | t.Errorf("Problem20() = got %v, want %v", got, test.expected) |
| 21 | } |
| 22 | }) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | // Benchmarks |
| 27 | func BenchmarkProblem20_Func(b *testing.B) { |
nothing calls this directly
no test coverage detected