;;; This file contains BLACK-BOX tests that rely *only* ;;; on guarantees provided by the Queue abstract data type (ADT). (define-syntax test (syntax-rules () ((_ EXPR EXPECTED) (let ((actual-val EXPR) (expect-val EXPECTED)) (cond ((equal? actual-val expect-val) (display "success") (newline)) (else (display "FAILURE ") (display 'EXPR) (display " should be ") (display expect-val) (display "; got ") (display actual-val) (newline))))))) (test (isEmpty (empty)) #t) (test (isEmpty (snoc (empty) 'a)) #f) (test (head (snoc (empty) 'a)) 'a) (test (head (snoc (snoc (empty) 'a) 'b)) 'a) (test (head (tail (snoc (snoc (empty) 'a) 'b))) 'b) (test (head (tail (tail (tail (snoc (snoc (snoc (snoc (snoc (empty) 'a) 'b) 'c) 'd) 'e))))) 'd)