anchor.diff:      :queue-count spin-queue-count)
   
   #-lparallel.with-stealing-scheduler
  -(define-grind-queue grind-biased-queue-1-test
  +(define-grind-queue grind-biased-queue-test
       :make-queue  lparallel.biased-queue:make-biased-queue
       :push-queue  lparallel.biased-queue:push-biased-queue
       :pop-queue   lparallel.biased-queue:pop-biased-queue
       :queue-count lparallel.biased-queue:biased-queue-count)
   
   #-lparallel.with-stealing-scheduler
  -(define-grind-queue grind-biased-queue-2-test
  +(define-grind-queue grind-biased-queue-low-test
       :make-queue  lparallel.biased-queue:make-biased-queue
       :push-queue  lparallel.biased-queue:push-biased-queue/low
       :pop-queue   lparallel.biased-queue:pop-biased-queue
       :queue-count lparallel.biased-queue:biased-queue-count)
   
  -(base-test fixed-capacity-queue-test
  +(base-test filled-queue-test
     (loop
        :for n :from 1 :to 3
        :do (let ((queue (make-queue :fixed-capacity n)))
  
positive.code:        (is (eq t (,queue-empty-p q)))
         (is (eq 0 (,queue-count q))))))
  
  (define-queue-test raw-queue-test
    :make-queue    make-raw-queue
    :push-queue    push-raw-queue
  
negative.code:   :queue-count   spin-queue-count
    :peek-queue    peek-spin-queue)
  
  (define-queue-test fixed-capacity-queue-test
    :make-queue    make-fixed-capacity-queue
    :push-queue    push-queue
    :pop-queue     pop-queue
    :try-pop-queue try-pop-queue
    :queue-empty-p queue-empty-p
    :queue-count   queue-count
    :peek-queue    peek-queue)
  
  #-lparallel.with-stealing-scheduler
  (define-queue-test biased-queue-test
    :make-queue    lparallel.biased-queue:make-biased-queue
    :push-queue    lparallel.biased-queue:push-biased-queue
    :pop-queue     lparallel.biased-queue:pop-biased-queue
    :try-pop-queue lparallel.biased-queue:try-pop-biased-queue
    :queue-empty-p lparallel.biased-queue:biased-queue-empty-p
    :queue-count   lparallel.biased-queue:biased-queue-count
    :peek-queue    lparallel.biased-queue:peek-biased-queue)
  
  #-lparallel.with-stealing-scheduler
  (define-queue-test biased-queue-low-test
    :make-queue    lparallel.biased-queue:make-biased-queue
    :push-queue    lparallel.biased-queue:push-biased-queue/low
    :pop-queue     lparallel.biased-queue:pop-biased-queue
    :try-pop-queue lparallel.biased-queue:try-pop-biased-queue
    :queue-empty-p lparallel.biased-queue:biased-queue-empty-p
    :queue-count   lparallel.biased-queue:biased-queue-count
    :peek-queue    lparallel.biased-queue:peek-biased-queue)
  
  (defmacro define-grind-queue (name
                                &key make-queue push-queue pop-queue queue-count)
    `(base-test ,name
       (flet ((grind (producer-count consumer-count objects-per-producer)
                (let ((data-queue (,make-queue))
                      (done-queue (,make-queue)))
                  (repeat producer-count
                    (with-thread ()
                      (repeat objects-per-producer
                        (,push-queue 'hello data-queue))
                      (,push-queue t done-queue)))
                  (repeat consumer-count
                    (with-thread ()
                      (loop :until (eq :end (,pop-queue data-queue)))
                      (,push-queue t done-queue)))
                  (repeat producer-count
                    (,pop-queue done-queue))
                  (repeat consumer-count
                    (,push-queue :end data-queue))
                  (repeat consumer-count
                    (,pop-queue done-queue))
                  (is (= 0 (,queue-count data-queue))))))
         (with-thread-count-check
           (let ((n 100000))
             (grind 4 1 n)
             (grind 1 4 n)
             (grind 1 1 n)
             (grind 4 4 n))
           (sleep 0.5)))))
  
  (defun try-pop-queue/wait/no-timeout (queue)
    (loop (multiple-value-bind (value presentp) (try-pop-queue queue)
            (when presentp
              (return value)))))
  
  (defun try-pop-queue/wait/timeout (queue)
    (multiple-value-bind (value presentp) (try-pop-queue queue :timeout 9999)
      (assert presentp)
      value))
  
  (define-grind-queue grind-queue-test
      :make-queue  make-queue
  