aboutsummaryrefslogtreecommitdiff
path: root/sets_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2023-01-17 18:40:25 -0700
committerGitHub <noreply@github.com>2023-01-17 18:40:25 -0700
commitd6cf261856fd48f51b6afa23ed4bcb5342c4a014 (patch)
treeab8c4c0cf317173da970218d5970e4ac18bb31a7 /sets_test.go
parentMerge pull request #35 from laher/sets-maps-append-multi (diff)
parentFix random seed for TestRandom (diff)
downloadpds-d6cf261856fd48f51b6afa23ed4bcb5342c4a014.tar.gz
pds-d6cf261856fd48f51b6afa23ed4bcb5342c4a014.tar.xz
Merge pull request #39 from BarrensZeppelin/fix-sets
Ensure immutability of sets, maps & lists
Diffstat (limited to 'sets_test.go')
-rw-r--r--sets_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/sets_test.go b/sets_test.go
index b3900fc..ca3aa3d 100644
--- a/sets_test.go
+++ b/sets_test.go
@@ -6,7 +6,8 @@ import (
func TestSetsPut(t *testing.T) {
s := NewSet[string](nil)
- s2 := s.Set("1").Set("1")
+ s2 := s.Add("1").Add("1")
+ s2.Add("2")
if s.Len() != 0 {
t.Fatalf("Unexpected mutation of set")
}
@@ -33,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")
@@ -51,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")
}
@@ -85,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")