44 lines
922 B
Go
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("验证错误 ")
|
|
}
|
|
|
|
}
|