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

Function TestStackPush

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

Source from the content-addressed store, hash-verified

67}
68
69func TestStackPush(t *testing.T) {
70 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())
71 s, err := OpenStack(file)
72 if err != nil {
73 t.Error(err)
74 }
75 defer s.Drop()
76
77 for i := 1; i <= 10; i++ {
78 if _, err = s.PushString(fmt.Sprintf("value for item %d", i)); err != nil {
79 t.Error(err)
80 }
81 }
82
83 if s.Length() != 10 {
84 t.Errorf("Expected stack size of 10, got %d", s.Length())
85 }
86}
87
88func TestStackPop(t *testing.T) {
89 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())

Callers

nothing calls this directly

Calls 4

OpenStackFunction · 0.85
PushStringMethod · 0.80
DropMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected