MCPcopy Create free account
hub / github.com/beeker1121/goque / TestStackOutOfBounds

Function TestStackOutOfBounds

stack_test.go:572–589  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

570}
571
572func TestStackOutOfBounds(t *testing.T) {
573 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())
574 s, err := OpenStack(file)
575 if err != nil {
576 t.Error(err)
577 }
578 defer s.Drop()
579
580 _, err = s.PushString("value for item")
581 if err != nil {
582 t.Error(err)
583 }
584
585 _, err = s.PeekByOffset(2)
586 if err != ErrOutOfBounds {
587 t.Errorf("Expected to get stack out of bounds error, got %s", err.Error())
588 }
589}
590
591func BenchmarkStackPush(b *testing.B) {
592 // Open test database

Callers

nothing calls this directly

Calls 4

OpenStackFunction · 0.85
PushStringMethod · 0.80
DropMethod · 0.45
PeekByOffsetMethod · 0.45

Tested by

no test coverage detected