mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-15 16:16:35 +03:00
- test iterator reset on all structures
This commit is contained in:
@@ -176,6 +176,22 @@ func TestStackIteratorPrev(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListIteratorReset(t *testing.T) {
|
||||
stack := New()
|
||||
it := stack.Iterator()
|
||||
it.Reset()
|
||||
stack.Push("a")
|
||||
stack.Push("b")
|
||||
stack.Push("c")
|
||||
for it.Next() {
|
||||
}
|
||||
it.Reset()
|
||||
it.Next()
|
||||
if index, value := it.Index(), it.Value(); index != 0 || value != "c" {
|
||||
t.Errorf("Got %v,%v expected %v,%v", index, value, 0, "c")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkStack(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
stack := New()
|
||||
|
||||
Reference in New Issue
Block a user