Archived
1
0
Fork 0

Simplified unnecessary code

This commit is contained in:
Julien Dessaux 2022-02-17 02:04:42 +01:00
parent 76e291bbd2
commit 4d03541e52
Signed by: adyxax
GPG key ID: F92E51B86E07177E
2 changed files with 1 additions and 5 deletions

View file

@ -48,8 +48,6 @@ func Clear*(s: var Stack) =
func Duplicate*(s: var Stack) =
if s.height > 0:
s.Push(s.data[s.height-1])
else:
s.PushVector((0, 0))
func Swap*(s: var Stack) =
let a = s.Pop

View file

@ -72,9 +72,7 @@ suite "Stack":
test "Duplicate":
var empty = NewStack()
empty[].Duplicate()
check empty.height == 2
check empty.data[0] == 0
check empty.data[1] == 0
check empty[].Pop() == 0
var some = NewStack()
some[].Push(2)
some[].Push(-4)