(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func TestFactorize(t *testing.T) { |
| 9 | var tests = []struct { |
| 10 | n int64 |
| 11 | expected map[int64]int64 |
| 12 | }{ |
| 13 | {4, map[int64]int64{2: 2}}, |
| 14 | {5, map[int64]int64{5: 1}}, |
| 15 | {7, map[int64]int64{7: 1}}, |
| 16 | {10, map[int64]int64{2: 1, 5: 1}}, |
| 17 | {999, map[int64]int64{3: 3, 37: 1}}, |
| 18 | {999999999999878, map[int64]int64{2: 1, 19: 1, 26315789473681: 1}}, |
| 19 | } |
| 20 | for _, test := range tests { |
| 21 | result := Factorize(test.n) |
| 22 | t.Log(test.n, " ", result) |
| 23 | if !reflect.DeepEqual(result, test.expected) { |
| 24 | t.Errorf("Wrong result! Expected:%v, returned:%v ", test.expected, result) |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | func BenchmarkFactorize(b *testing.B) { |
| 30 | for i := 0; i < b.N; i++ { |
nothing calls this directly
no test coverage detected