Croissant Runtime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crsn/examples/test_stacks.csn

37 lines
532 B

4 years ago
(
(mkbf r0)
4 years ago
(bfpush @r0 1)
(bfpush @r0 2)
4 years ago
(bfpop r1 @r0)
4 years ago
(cmp r1 2 (ne? (fault)))
(bfpop r1 @r0)
4 years ago
(cmp r1 1 (ne? (fault)))
; test reverse push
(bfpush @r0 '🐈')
(bfpush @r0 7)
(bfrpush @r0 8)
(bfpop r1 @r0)
(cmp r1 7 (ne? (fault)))
(bfpop r1 @r0)
(cmp r1 '🐈' (ne? (fault)))
(bfpop r1 @r0)
(cmp r1 8 (ne? (fault)))
; test reverse pop
(bfpush @r0 1000)
(bfpush @r0 2000)
(bfrpop r1 @r0)
(cmp r1 1000 (ne? (fault)))
(del @r0)
4 years ago
)