Simplified unnecessary code
This commit is contained in:
parent
76e291bbd2
commit
4d03541e52
2 changed files with 1 additions and 5 deletions
|
@ -48,8 +48,6 @@ func Clear*(s: var Stack) =
|
||||||
func Duplicate*(s: var Stack) =
|
func Duplicate*(s: var Stack) =
|
||||||
if s.height > 0:
|
if s.height > 0:
|
||||||
s.Push(s.data[s.height-1])
|
s.Push(s.data[s.height-1])
|
||||||
else:
|
|
||||||
s.PushVector((0, 0))
|
|
||||||
|
|
||||||
func Swap*(s: var Stack) =
|
func Swap*(s: var Stack) =
|
||||||
let a = s.Pop
|
let a = s.Pop
|
||||||
|
|
|
@ -72,9 +72,7 @@ suite "Stack":
|
||||||
test "Duplicate":
|
test "Duplicate":
|
||||||
var empty = NewStack()
|
var empty = NewStack()
|
||||||
empty[].Duplicate()
|
empty[].Duplicate()
|
||||||
check empty.height == 2
|
check empty[].Pop() == 0
|
||||||
check empty.data[0] == 0
|
|
||||||
check empty.data[1] == 0
|
|
||||||
var some = NewStack()
|
var some = NewStack()
|
||||||
some[].Push(2)
|
some[].Push(2)
|
||||||
some[].Push(-4)
|
some[].Push(-4)
|
||||||
|
|
Reference in a new issue