(t *testing.T)
| 58 | } |
| 59 | |
| 60 | func TestModuloWithWrap(t *testing.T) { |
| 61 | type scenario struct { |
| 62 | n int |
| 63 | max int |
| 64 | expected int |
| 65 | } |
| 66 | |
| 67 | scenarios := []scenario{ |
| 68 | { |
| 69 | n: 0, |
| 70 | max: 0, |
| 71 | expected: 0, |
| 72 | }, |
| 73 | { |
| 74 | n: 0, |
| 75 | max: 1, |
| 76 | expected: 0, |
| 77 | }, |
| 78 | { |
| 79 | n: 1, |
| 80 | max: 0, |
| 81 | expected: 0, |
| 82 | }, |
| 83 | { |
| 84 | n: 3, |
| 85 | max: 2, |
| 86 | expected: 1, |
| 87 | }, |
| 88 | { |
| 89 | n: -1, |
| 90 | max: 2, |
| 91 | expected: 1, |
| 92 | }, |
| 93 | } |
| 94 | |
| 95 | for _, s := range scenarios { |
| 96 | if s.expected != ModuloWithWrap(s.n, s.max) { |
| 97 | t.Errorf("expected %d, got %d, for n: %d, max: %d", s.expected, ModuloWithWrap(s.n, s.max), s.n, s.max) |
| 98 | } |
| 99 | } |
| 100 | } |
nothing calls this directly
no test coverage detected