1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 15:52:27 +08:00

feat: add ReverseIntersect function

This commit is contained in:
dudaodong
2022-03-31 19:42:27 +08:00
parent 19939c2b03
commit 79867e8a63
2 changed files with 47 additions and 14 deletions

View File

@@ -407,7 +407,18 @@ func TestIntersection(t *testing.T) {
for i := 0; i < len(res); i++ {
assert.Equal(expected[i], res[i])
}
// assert.IsNil(Intersection())
}
func TestReverseIntersect(t *testing.T) {
assert := internal.NewAssert(t, "TestIntersection")
s1 := []int{1, 2, 3}
s2 := []int{1, 2, 4}
s3 := []int{1, 2, 3, 5}
assert.Equal([]int{1, 2, 3}, ReverseIntersect(s1))
assert.Equal([]int{3, 4}, ReverseIntersect(s1, s2))
assert.Equal([]int{3, 4, 5}, ReverseIntersect(s1, s2, s3))
}
func TestReverse(t *testing.T) {