Tests
(t *testing.T)
| 4 | |
| 5 | // Tests |
| 6 | func TestProblem2_Func(t *testing.T) { |
| 7 | tests := []struct { |
| 8 | name string |
| 9 | input uint |
| 10 | want uint |
| 11 | }{ |
| 12 | { |
| 13 | name: "Testcase 1 - input 10", |
| 14 | input: 10, |
| 15 | want: 10, |
| 16 | }, |
| 17 | { |
| 18 | name: "Testcase 2 - input 100", |
| 19 | input: 100, |
| 20 | want: 44, |
| 21 | }, |
| 22 | { |
| 23 | name: "Testcase 3 - input 4e6", |
| 24 | input: 4e6, |
| 25 | want: 4613732, |
| 26 | }, |
| 27 | } |
| 28 | |
| 29 | for _, tt := range tests { |
| 30 | t.Run(tt.name, func(t *testing.T) { |
| 31 | n := Problem2(tt.input) |
| 32 | |
| 33 | if n != tt.want { |
| 34 | t.Errorf("Problem2() = %v, want %v", n, tt.want) |
| 35 | } |
| 36 | }) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | // Benchmarks |
| 41 | func BenchmarkProblem2(b *testing.B) { |
nothing calls this directly
no test coverage detected