| 107 | } |
| 108 | |
| 109 | func 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 | |
| 135 | func TestIndentLevel(t *testing.T) { |
| 136 | t.Parallel() |