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