MCPcopy Create free account
hub / github.com/coder/coder / TestIndentGCD

Function TestIndentGCD

agent/agentfiles/files_indent_internal_test.go:109–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestIndentGCD(t *testing.T) {
110 t.Parallel()
111
112 tests := []struct {
113 name string
114 a, b int
115 want int
116 }{
117 {"BothZero", 0, 0, 0},
118 {"AZero", 0, 4, 4},
119 {"BZero", 4, 0, 4},
120 {"Equal", 4, 4, 4},
121 {"Coprime", 3, 5, 1},
122 {"CommonFactorTwo", 4, 6, 2},
123 {"CommonFactorFour", 8, 12, 4},
124 {"TwoSpaceAndFourSpace", 2, 4, 2},
125 }
126
127 for _, tc := range tests {
128 t.Run(tc.name, func(t *testing.T) {
129 t.Parallel()
130 require.Equal(t, tc.want, indentGCD(tc.a, tc.b))
131 })
132 }
133}
134
135func TestIndentLevel(t *testing.T) {
136 t.Parallel()

Callers

nothing calls this directly

Calls 3

indentGCDFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected