(bind-func queue_test
(lambda ()
(let ((myqueue:|2,list_t*|* (salloc))
(stuff:|8,i64|* (salloc))
(i 0))
;; first we must set queue front and back to null
(afill! myqueue null null)
;; initialize stuff array
(dotimes (i 8) (aset! stuff i i))
;; what happens if we dequeue an empty queue (-1)
(printf "dequeue 1: %lld\n" (dequeue myqueue))
;; add something to the queue
(enqueue myqueue (aref stuff 1))
;; dequeue something
(printf "dequeue 2: %lld\n" (dequeue myqueue))
;; back to nothing?
(printf "dequeue 4: %lld\n" (dequeue myqueue))
;; etc..
(enqueue myqueue (aref stuff 2))
(printf "dequeue 5: %lld\n" (dequeue myqueue))
(enqueue myqueue (aref stuff 3))
(enqueue myqueue (aref stuff 4))
(printf "dequeue 6: %lld\n" (dequeue myqueue))
(printf "dequeue 7: %lld\n" (dequeue myqueue))
(printf "dequeue 8: %lld\n" (dequeue myqueue))
1)))