func TestSubtractionInt64SetWithoutAdds(t *testing.T) { first := set.Int64Set{1, 2, 7, 9, 52, 53, 55, 63, 180, 212, 291, 307, 329, 365, 394, 395, 421, 448, 457, 484, 523, 533, 554, 561, 706, 896, 901, 906, 931, 959, 1081, 1086, 1088, 1090} second := set.Int64Set{1, 2, 7, 52, 55, 63, 180, 212, 291, 394, 395, 421, 448, 457, 533, 554, 561, 706, 901, 906, 1081, 1086, 1088, 1090} firstMinusSecond := first.Remove(second...) for _, i := range second { if firstMinusSecond.Exists(i) { t.Errorf("Error! %v shouldn't be in firstMinusSecond", i) } } }
func TestExistsInDescendingInt64Set(t *testing.T) { s := set.Int64Set{} s = s.Add(100) s = s.Add(10) s = s.Add(1) for _, v := range []int64{100, 10, 1} { if !s.Exists(v) { t.Errorf("expecting value %v to exist in the set", v) } } if !reflect.DeepEqual([]int64(s), []int64{1, 10, 100}) { t.Error("invalid set") } }