; You can uncomment this line out to enable tracing ; (require (lib "trace.ss")) ; This will test the test cases given above and print nicely each ; case and its value. (define (test) (for-each (lambda (x) (print x) (newline) (print (eval x)) (newline)) test-cases)) ; The test cases for Assignment 2 (define test-cases '((add-number-to-symbol 'g 123) (add-number-to-symbol 'stu -456) (add-number-to-symbol "s" 789) (add-number-to-symbol 's 6.78) (add-number-to-symbol 's #f) (add-number-to-symbol 's (/ 6 3)) (number-of-binary-trees 0) (number-of-binary-trees 1) (number-of-binary-trees 2) (number-of-binary-trees 3) (number-of-binary-trees 4) (number-of-binary-trees 5) (number-of-binary-trees 6) (number-of-binary-trees 7) (number-of-binary-trees 8) (filter-and-apply '(a 3 #f -5 6.8 "xx") number? - ) (filter-and-apply '((a b) (c (d e)) (f)) list? reverse) (filter-and-apply '(3 4 5) boolean? not) (filter-and-apply '("abc" 4 "San Jose" #f) string? (lambda (x) (list->string (map char-upcase (string->list x))))) (append-all-pairs '((1) (2)) '()) (append-all-pairs '() '((1) (2))) (append-all-pairs '((1) (2)) '((3))) (append-all-pairs '((1) (2)) '((3 4) (5 6))) (append-all-pairs '((a) (b b) (c c c)) '((1) (2 2) (3 3 3))) (define w (build-3D-point 1 -2 #t)) (define p (build-3D-point 4 -5 6)) (define q (build-3D-point -2 -8 0)) (define r (build-3D-point -2 -8 0)) w p q (3D-point-printname w) (3D-point-printname p) (3D-point-printname q) (equal-3D-points? p q) (equal-3D-points? p r) (equal-3D-points? q r) (equal-3D-points? q w) (equal-3D-points? w r) (3D-distance p q) (3D-distance p r) (3D-distance q r) (3D-distance q w) (3D-distance w r) ))