Skip to content

Commit 2ece0e7

Browse files
committed
Drop unused helper.SliceStringEqual()
1 parent 1671924 commit 2ece0e7

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

helper/Slices.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ func SliceStringUnique(input []string) []string {
2424
return output
2525
}
2626

27-
// SliceStringEqual checks if the slices contain the same string values without
28-
// considering the order of the items. This means [foo bar] is equal to
29-
// [bar foo] but not equal to [foo baz].
30-
func SliceStringEqual(a []string, b []string) bool {
31-
// return early if the lengths do not match to avoid costly sorting and comparing
32-
if len(a) != len(b) {
33-
return false
34-
}
35-
slices.Sort(a)
36-
slices.Sort(b)
37-
return slices.Compare(a, b) == 0
38-
}
39-
4027
// SliceStringReverse reverses the input slice. If the input slice is nil, an empty slice is returned.
4128
func SliceStringReverse(input []string) []string {
4229
slices.Reverse(input)

helper/Slices_test.go

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -103,66 +103,6 @@ func TestSliceStringUnique(t *testing.T) {
103103
}
104104
}
105105

106-
func TestSliceStringEqual(t *testing.T) {
107-
type args struct {
108-
a []string
109-
b []string
110-
}
111-
tests := []struct {
112-
name string
113-
args args
114-
want bool
115-
}{
116-
{
117-
name: "Empty slices",
118-
args: args{
119-
a: []string{},
120-
b: []string{},
121-
},
122-
want: true,
123-
},
124-
{
125-
name: "Differing length",
126-
args: args{
127-
a: []string{"foo", "bar"},
128-
b: []string{"foo", "bar", "baz"},
129-
},
130-
want: false,
131-
},
132-
{
133-
name: "Equal slices, different order",
134-
args: args{
135-
a: []string{"foo", "bar"},
136-
b: []string{"bar", "foo"},
137-
},
138-
want: true,
139-
},
140-
{
141-
name: "Equal slices, equal order",
142-
args: args{
143-
a: []string{"foo", "bar"},
144-
b: []string{"foo", "bar"},
145-
},
146-
want: true,
147-
},
148-
{
149-
name: "Unequal slices",
150-
args: args{
151-
a: []string{"foo", "bar"},
152-
b: []string{"foo", "baz"},
153-
},
154-
want: false,
155-
},
156-
}
157-
for _, tt := range tests {
158-
t.Run(tt.name, func(t *testing.T) {
159-
if got := SliceStringEqual(tt.args.a, tt.args.b); got != tt.want {
160-
t.Errorf("SliceStringEqual() = %v, want %v", got, tt.want)
161-
}
162-
})
163-
}
164-
}
165-
166106
func TestSliceStringReverse(t *testing.T) {
167107
type args struct {
168108
input []string

0 commit comments

Comments
 (0)