diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2019-03-02 07:29:50 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2019-03-02 07:29:50 -0700 |
commit | cc1145d5460a2b31e0b9cb01af525ab938cbd5f2 (patch) | |
tree | cad2678327b272333982fb027a33312973f366d3 | |
parent | Fix sorted map iterator initialization. (diff) | |
download | pds-cc1145d5460a2b31e0b9cb01af525ab938cbd5f2.tar.gz pds-cc1145d5460a2b31e0b9cb01af525ab938cbd5f2.tar.xz |
Fix test coverage.
-rw-r--r-- | immutable_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
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) |