You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
922 B
Go

package collection
import (
"fmt"
"testing"
)
func TestCodetInfo(t *testing.T) {
var first = []string{"a", "b", "c"}
var second = []string{"a", "b", "c"}
result := DiffArrayString(first, second)
result2 := IntersectArrayString(first, second)
fmt.Println(result, result2)
if len(result) != 0 {
t.Errorf("验证错误 ")
}
second = []string{}
result = DiffArrayString(first, second)
result2 = IntersectArrayString(first, second)
fmt.Println(result, result2)
if len(result) != 3 {
t.Errorf("验证错误 ")
}
second = []string{"a"}
result = DiffArrayString(first, second)
result2 = IntersectArrayString(first, second)
fmt.Println(result, result2)
if len(result) != 2 {
t.Errorf("验证错误 ")
}
first = []string{}
result = DiffArrayString(first, second)
result2 = IntersectArrayString(first, second)
fmt.Println(result, result2)
if len(result) != 0 {
t.Errorf("验证错误 ")
}
}