Add queue helpers, with tests
[8sync.git] / tests / test-agenda.scm
index a41be0adfe58431b272923bc76fcba685db825f1..ef2c74f13abe7a6c20392f445fd78b6e97efe9a0 100644 (file)
       messages)))
 
 \f
-;; Timer tests
-;; ===========
+;;; queue helpers
+;;; =============
+
+(define test-q (list->q '(1 2 3)))
+(test-equal (deq! test-q) 1)
+(test-equal (deq! test-q) 2)
+(test-equal (deq! test-q) 3)
+(test-assert (q-empty? test-q))
+
+(define test-q (make-q* 'apple 'banana 'carrot))
+(test-equal (deq! test-q) 'apple)
+(test-equal (deq! test-q) 'banana)
+(test-equal (deq! test-q) 'carrot)
+(test-assert (q-empty? test-q))
+
+
+\f
+;;; Timer tests
+;;; ===========
 
 (test-assert (time= '(1 . 1) '(1 . 1)))
 (test-assert (not (time= '(1 . 1) '(1 . 0))))
   (catch-8sync
    (begin
      (speaker "hello")
-     (throw '%8sync-caught-error
+     (throw '8sync-caught-error
             'my-orig-key '(apple orange banana) '(*fake-stack* *fake-stack* *fake-stack*))
      (speaker "no goodbyes"))
    ('some-key