Posting comments on code changes may fail, looking into the issue currently.

Commit 51c461b9 authored by Phillip Couto's avatar Phillip Couto 🔨

Added additional unit testing scenarios

parent 1ac10be0
Pipeline #12123 passed with stage
in 25 seconds
......@@ -27,4 +27,19 @@ func TestInt32s(t *testing.T) {
s1Slice := i.Slice()
require.ElementsMatch(t, s1Slice, []int32{1, 2})
i4 := NewInt32s(1, 2, 2, 2, 3, 2, 2)
require.Equal(t, 3, i4.Cardinality())
require.True(t, i4.Contains(1))
require.True(t, i4.Contains(2))
require.True(t, i4.Contains(3))
require.False(t, i4.Contains(4))
i4.Add(3)
require.Equal(t, 3, i4.Cardinality())
i5 := i4.Intersect(i3)
require.Equal(t, 1, i5.Cardinality())
require.True(t, i5.Contains(2))
}
......@@ -27,4 +27,19 @@ func TestInt64s(t *testing.T) {
s1Slice := i.Slice()
require.ElementsMatch(t, s1Slice, []int64{1, 2})
i4 := NewInt64s(1, 2, 2, 2, 3, 2, 2)
require.Equal(t, 3, i4.Cardinality())
require.True(t, i4.Contains(1))
require.True(t, i4.Contains(2))
require.True(t, i4.Contains(3))
require.False(t, i4.Contains(4))
i4.Add(3)
require.Equal(t, 3, i4.Cardinality())
i5 := i4.Intersect(i3)
require.Equal(t, 1, i5.Cardinality())
require.True(t, i5.Contains(2))
}
......@@ -27,4 +27,22 @@ func TestInts(t *testing.T) {
s1Slice := i.Slice()
require.ElementsMatch(t, s1Slice, []int{1, 2})
i4 := NewInts(1, 2, 2, 2, 3, 2, 2)
require.Equal(t, 3, i4.Cardinality())
require.True(t, i4.Contains(1))
require.True(t, i4.Contains(2))
require.True(t, i4.Contains(3))
require.False(t, i4.Contains(4))
i4.Add(3)
require.Equal(t, 3, i4.Cardinality())
i5 := i4.Intersect(i3)
require.Equal(t, 1, i5.Cardinality())
require.True(t, i5.Contains(2))
require.False(t, i5.Contains(1))
require.False(t, i5.Contains(3))
require.False(t, i5.Contains(4))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment