aboutsummaryrefslogtreecommitdiff
path: root/pkg/pointer/stack_test.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-11-12 15:26:16 +0100
committerJulien Dessaux2021-11-12 15:28:09 +0100
commitc913c2ae46fd81a3274ef16c64c78ea2ed421de8 (patch)
treec454e21bfe42080fae433eae402b9f3a1c68783a /pkg/pointer/stack_test.go
parentFixed tricky field loading bug (diff)
downloadgofunge98-c913c2ae46fd81a3274ef16c64c78ea2ed421de8.tar.gz
gofunge98-c913c2ae46fd81a3274ef16c64c78ea2ed421de8.tar.bz2
gofunge98-c913c2ae46fd81a3274ef16c64c78ea2ed421de8.zip
Refactoring : isolate stack manipulation into their own package
Diffstat (limited to '')
-rw-r--r--pkg/stack/stack_test.go (renamed from pkg/pointer/stack_test.go)24
1 files changed, 16 insertions, 8 deletions
diff --git a/pkg/pointer/stack_test.go b/pkg/stack/stack_test.go
index 35700fd..2f15d3a 100644
--- a/pkg/pointer/stack_test.go
+++ b/pkg/stack/stack_test.go
@@ -1,4 +1,4 @@
-package pointer
+package stack
import (
"testing"
@@ -7,15 +7,15 @@ import (
)
func TestClear(t *testing.T) {
- s := NewStack()
+ s := NewStack(32, nil)
s.Clear()
require.Equal(t, 0, s.height)
}
func TestDupicate(t *testing.T) {
- expected := NewStack()
+ expected := NewStack(32, nil)
expected.height = 2
- s := NewStack()
+ s := NewStack(32, nil)
s.Duplicate()
require.Equal(t, expected.height, s.height)
s.Push(12)
@@ -27,7 +27,7 @@ func TestDupicate(t *testing.T) {
}
func TestPop(t *testing.T) {
- s := NewStack()
+ s := NewStack(32, nil)
v := s.Pop()
require.Equal(t, 0, v)
s.Push(12)
@@ -41,7 +41,7 @@ func TestPop(t *testing.T) {
}
func TestPush(t *testing.T) {
- s := NewStack()
+ s := NewStack(32, nil)
for i := 0; i < 32; i++ {
s.Push(i)
}
@@ -51,8 +51,8 @@ func TestPush(t *testing.T) {
}
func TestSwap(t *testing.T) {
- s := NewStack()
- s2 := NewStack()
+ s := NewStack(32, nil)
+ s2 := NewStack(32, nil)
s.Swap()
s2.Push(0)
s2.Push(0)
@@ -73,3 +73,11 @@ func TestSwap(t *testing.T) {
s.Swap()
require.Equal(t, s2, s)
}
+
+func TestHeights(t *testing.T) {
+ // TODO
+}
+
+func TestTransfert(t *testing.T) {
+ // TODO
+}