MCPcopy
hub / github.com/jesseduffield/lazygit / TestModuloWithWrap

Function TestModuloWithWrap

pkg/utils/utils_test.go:60–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func 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}

Callers

nothing calls this directly

Calls 2

ModuloWithWrapFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected