From cc1145d5460a2b31e0b9cb01af525ab938cbd5f2 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sat, 2 Mar 2019 07:29:50 -0700 Subject: Fix test coverage. --- immutable_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'immutable_test.go') diff --git a/immutable_test.go b/immutable_test.go index 460392c..7418250 100644 --- a/immutable_test.go +++ b/immutable_test.go @@ -1686,6 +1686,32 @@ func TestSortedMap_Delete(t *testing.T) { } func TestSortedMap_Iterator(t *testing.T) { + t.Run("Empty", func(t *testing.T) { + t.Run("First", func(t *testing.T) { + itr := NewSortedMap(nil).Iterator() + itr.First() + if k, v := itr.Next(); k != nil || v != nil { + t.Fatalf("SortedMapIterator.Next()=<%v,%v>, expected nil", k, v) + } + }) + + t.Run("Last", func(t *testing.T) { + itr := NewSortedMap(nil).Iterator() + itr.Last() + if k, v := itr.Prev(); k != nil || v != nil { + t.Fatalf("SortedMapIterator.Prev()=<%v,%v>, expected nil", k, v) + } + }) + + t.Run("Seek", func(t *testing.T) { + itr := NewSortedMap(nil).Iterator() + itr.Seek("foo") + if k, v := itr.Next(); k != nil || v != nil { + t.Fatalf("SortedMapIterator.Next()=<%v,%v>, expected nil", k, v) + } + }) + }) + t.Run("Seek", func(t *testing.T) { const n = 100 m := NewSortedMap(nil) -- cgit v1.2.3