feat: Add unit test for RemoveRepeatedElementsInLi

pull/1224/head
sweep-ai[bot] 2 years ago committed by GitHub
parent 8e6430625c
commit 5f8764b82a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,33 @@
package cache
import (
"testing"
"reflect"
)
func TestRemoveRepeatedElementsInList(t *testing.T) {
testCases := []struct {
input []string
expected []string
}{
{
input: []string{},
expected: []string{},
},
{
input: []string{"a", "b", "c"},
expected: []string{"a", "b", "c"},
},
{
input: []string{"a", "a", "b", "b", "c", "c"},
expected: []string{"a", "b", "c"},
},
}
for _, testCase := range testCases {
result := RemoveRepeatedElementsInList(testCase.input)
if !reflect.DeepEqual(result, testCase.expected) {
t.Errorf("RemoveRepeatedElementsInList(%v) = %v; want %v", testCase.input, result, testCase.expected)
}
}
}
Loading…
Cancel
Save