package set import ( "reflect" "testing" ) func TestSet_ToCustomSortSlice(t *testing.T) { type args struct { f func(i, j int) bool } type testCase[T Comparable] struct { name string s Set[T] args args want []T } tests := []testCase[int]{ { name: "test1", s: NewSetWithItems(1, 2, 3, 4, 5), args: args{ f: func(i, j int) bool { return i > j }, }, want: []int{5, 4, 3, 2, 1}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.s.ToCustomSortSlice(tt.args.f); !reflect.DeepEqual(got, tt.want) { t.Errorf("ToCustomSortSlice() = %v, want %v", got, tt.want) } }) } }