;;; This file contains WHITE-BOX tests (also known as GLASS-BOX tests) ;;; that rely on the particular representation used by queue1.scm (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 (empty) '()) (test (snoc (empty) 'a) '(a)) (test (head (snoc (empty) 'a)) 'a) (test (snoc (snoc (empty) 'a) 'b) '(a b)) (test (tail (snoc (snoc (empty) 'a) 'b)) '(b)) (test (tail (tail (tail (snoc (snoc (snoc (snoc (snoc (empty) 'a) 'b) 'c) 'd) 'e)))) '(d e))