| 150 | } |
| 151 | |
| 152 | func TestDistinct(t *testing.T) { |
| 153 | for i, tt := range []testDistinct[int]{ |
| 154 | testDistinct[int]{ |
| 155 | input: testDistinctInput[int]{ |
| 156 | []int{1, 2, 3, 3, 4}, |
| 157 | }, |
| 158 | output: []int{1, 2, 3, 4}, |
| 159 | }, |
| 160 | } { |
| 161 | t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { |
| 162 | actual := Distinct(tt.input...) |
| 163 | |
| 164 | if !isEqual(actual, tt.output) { |
| 165 | t.Errorf("expected: %v %T, received: %v %T", tt.output, tt.output, actual, actual) |
| 166 | } |
| 167 | }) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | type testIntersectInput[T comparable] [][]T |
| 172 | type testIntersectOutput[T comparable] []T |