diff options
author | Oskar Haarklou Veileborg <ohv1020@hotmail.com> | 2023-01-12 10:59:36 +0100 |
---|---|---|
committer | Oskar Haarklou Veileborg <ohv1020@hotmail.com> | 2023-01-12 10:59:36 +0100 |
commit | bdfdabc970ef286de9390ff0ab7740ff1145d388 (patch) | |
tree | 2e52253411977a11520a26fa368a214c9671c5bb /immutable_test.go | |
parent | sets & maps: remove varargs APIs & SetMany variants (diff) | |
download | pds-bdfdabc970ef286de9390ff0ab7740ff1145d388.tar.gz pds-bdfdabc970ef286de9390ff0ab7740ff1145d388.tar.xz |
list: fix Append & Prepend, remove varargs support
Similar reason for the API change as the previous commit.
Diffstat (limited to 'immutable_test.go')
-rw-r--r-- | immutable_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/immutable_test.go b/immutable_test.go index a878a78..9a0de37 100644 --- a/immutable_test.go +++ b/immutable_test.go @@ -223,6 +223,19 @@ func TestList(t *testing.T) { } }) + t.Run("AppendImmutable", func(t *testing.T) { + outer_l := NewList[int]() + for N := 0; N < 1_000; N++ { + l1 := outer_l.Append(0) + outer_l.Append(1) + if actual := l1.Get(N); actual != 0 { + t.Fatalf("Append mutates list with %d elements. Got %d instead of 0", N, actual) + } + + outer_l = outer_l.Append(0) + } + }) + RunRandom(t, "Random", func(t *testing.T, rand *rand.Rand) { l := NewTList() for i := 0; i < 100000; i++ { |