aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/util/atomic-stack.scm
blob: 46a16bfb1f17728a4d70728a028d9d56712f0ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(define-module (test atomic-stack)
  :use-module (srfi srfi-64)
  :use-module (srfi srfi-88)
  :use-module (hnh util atomic-stack))

(define stack (atomic-stack))

(test-equal "Fresh stacks are empty"
  '() (stack->list stack))

(push! 1 stack)
(push! 2 stack)
(push! 3 stack)

(test-equal "Stack contents when content"
  '(3 2 1) (stack->list stack))

(test-equal "Poped correctly 3" 3 (pop! stack))
(push! 4 stack)
(test-equal "Poped correctly 4" 4 (pop! stack))
(test-equal "Poped correctly 2" 2 (pop! stack))
(test-equal "Poped correctly 1" 1 (pop! stack))
(test-equal "Poped correctly #f" #f (pop! stack))

'((hnh util atomic-stack))