Add generic set type (#21408)
This PR adds a generic set type to get rid of maps used as sets. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
e84558b093
commit
0e57ff7eee
41 changed files with 328 additions and 324 deletions
|
@ -214,16 +214,7 @@ func TestInt64sToStrings(t *testing.T) {
|
|||
)
|
||||
}
|
||||
|
||||
func TestInt64sToMap(t *testing.T) {
|
||||
assert.Equal(t, map[int64]bool{}, Int64sToMap([]int64{}))
|
||||
assert.Equal(t,
|
||||
map[int64]bool{1: true, 4: true, 16: true},
|
||||
Int64sToMap([]int64{1, 4, 16}),
|
||||
)
|
||||
}
|
||||
|
||||
func TestInt64sContains(t *testing.T) {
|
||||
assert.Equal(t, map[int64]bool{}, Int64sToMap([]int64{}))
|
||||
assert.True(t, Int64sContains([]int64{6, 44324, 4324, 32, 1, 2323}, 1))
|
||||
assert.True(t, Int64sContains([]int64{2323}, 2323))
|
||||
assert.False(t, Int64sContains([]int64{6, 44324, 4324, 32, 1, 2323}, 232))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue