MCPcopy Create free account
hub / github.com/copernet/copernicus / TestSwapStack

Function TestSwapStack

util/stack_test.go:125–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func TestSwapStack(t *testing.T) {
126 stack := NewStack()
127 stack.Push(1)
128 stack.Push(2)
129
130 stackTest := NewStack()
131 stackTest.Push(1)
132 stackTest.Push(2)
133
134 stackOther := NewStack()
135 stackOther.Push(3)
136 stackOther.Push(4)
137
138 stackOtherTest := NewStack()
139 stackOtherTest.Push(3)
140 stackOtherTest.Push(4)
141
142 Swap(stack, stackOther)
143
144 if !stack.Equal(stackOtherTest) || !stackOther.Equal(stackTest) {
145 t.Errorf("swap stack failed")
146 }
147 stackOther.Pop()
148 stackOther.Pop()
149
150 Swap(stack, stackOther)
151 if !stack.Empty() || !stackOther.Equal(stackOtherTest) {
152 t.Errorf("swap empty stacl failed")
153 }
154
155}

Callers

nothing calls this directly

Calls 6

PushMethod · 0.95
EqualMethod · 0.95
PopMethod · 0.95
EmptyMethod · 0.95
NewStackFunction · 0.85
SwapFunction · 0.85

Tested by

no test coverage detected