diff options
Diffstat (limited to 'tests/unit/util/atomic-stack.scm')
-rw-r--r-- | tests/unit/util/atomic-stack.scm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/util/atomic-stack.scm b/tests/unit/util/atomic-stack.scm new file mode 100644 index 00000000..46a16bfb --- /dev/null +++ b/tests/unit/util/atomic-stack.scm @@ -0,0 +1,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)) |