mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-11 23:47:32 +08:00
34 lines
682 B
Go
34 lines
682 B
Go
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)
|
|
}
|
|
}
|
|
}
|