aboutsummaryrefslogtreecommitdiff
path: root/sets_test.go
diff options
context:
space:
mode:
authorOskar Haarklou Veileborg <ohv1020@hotmail.com>2023-01-12 10:22:46 +0100
committerOskar Haarklou Veileborg <ohv1020@hotmail.com>2023-01-12 10:25:31 +0100
commita74b83e3f275e44f686066081c7fdb665180ff9e (patch)
tree1b38c8dd10962017a600b46d704b11cde3ba7c00 /sets_test.go
parentEnsure immutability of sets (and maps with SetMany) (diff)
downloadpds-a74b83e3f275e44f686066081c7fdb665180ff9e.tar.gz
pds-a74b83e3f275e44f686066081c7fdb665180ff9e.tar.xz
sets & maps: remove varargs APIs & SetMany variants
The implementation behind the API is not more efficient than manually looping over a data structure and inserting elements one-by-one.
Diffstat (limited to 'sets_test.go')
-rw-r--r--sets_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/sets_test.go b/sets_test.go
index 5a83eb9..ca3aa3d 100644
--- a/sets_test.go
+++ b/sets_test.go
@@ -6,8 +6,8 @@ import (
func TestSetsPut(t *testing.T) {
s := NewSet[string](nil)
- s2 := s.Set("1").Set("1")
- s2.Set("2")
+ s2 := s.Add("1").Add("1")
+ s2.Add("2")
if s.Len() != 0 {
t.Fatalf("Unexpected mutation of set")
}
@@ -34,7 +34,7 @@ func TestSetsPut(t *testing.T) {
func TestSetsDelete(t *testing.T) {
s := NewSet[string](nil)
- s2 := s.Set("1")
+ s2 := s.Add("1")
s3 := s.Delete("1")
if s2.Len() != 1 {
t.Fatalf("Unexpected non-mutation of set")
@@ -52,7 +52,7 @@ func TestSetsDelete(t *testing.T) {
func TestSortedSetsPut(t *testing.T) {
s := NewSortedSet[string](nil)
- s2 := s.Set("1").Set("1").Set("0")
+ s2 := s.Add("1").Add("1").Add("0")
if s.Len() != 0 {
t.Fatalf("Unexpected mutation of set")
}
@@ -86,7 +86,7 @@ func TestSortedSetsPut(t *testing.T) {
func TestSortedSetsDelete(t *testing.T) {
s := NewSortedSet[string](nil)
- s2 := s.Set("1")
+ s2 := s.Add("1")
s3 := s.Delete("1")
if s2.Len() != 1 {
t.Fatalf("Unexpected non-mutation of set")