(define (test-divisible-by-7?) (let ([correct '(#f #t #t #f)] [answers (list (divisible-by-7? 12) (divisible-by-7? 42) (divisible-by-7? 0) (divisible-by-7? 19))]) (display-results correct answers equal?))) (define (test-ends-with-7?) (let ([correct '(#f #t)] [answers (list (ends-with-7? 172) (ends-with-7? 4412368939284856837))]) (display-results correct answers equal?))) (define (test-Fahrenheit->Celsius) (let ([correct '(0 -40 9 -160/9)] [answers (list (Fahrenheit->Celsius 32) (Fahrenheit->Celsius -40) (Fahrenheit->Celsius 241/5) (Fahrenheit->Celsius 0))]) (display-results correct answers equal?))) (display 'test-Fahrenheit->Celsius) (test-Fahrenheit->Celsius) (display 'divisible-by-7?) (test-divisible-by-7?) (display 'ends-with-7?) (test-ends-with-7?) ;-------------- End of problems removed from A1 ---------------- (define (test-max-edges) (let ([correct '(0 0 1 91)] [answers (list (max-edges 0) (max-edges 1) (max-edges 2) (max-edges 14) )]) (display-results correct answers equal?))) (define (test-complete?) (let ([correct '(#t #f #t #f)] [answers (list (complete? '((a (b c d)) (b (a c d)) (c (a b d)) (d (a b c)))) (complete? '((alpha (beta)) (beta (alpha)) (gamma ()))) (complete? '()) (complete? '((a (b d)) (b (a c)) (d (c a)) (c (b d)))) )]) (display-results correct answers equal?))) (define (test-complete) (let ([correct '(((a ())) ((a (b c)) (b (c a)) (c (a b))) () #t )] [answers (list (complete '(a)) (complete '(a b c)) (complete '()) (complete? (complete '(q w e r t y u i o p))) )]) (display-results correct answers (lambda (x y) (or (equal? x y) ; accommodate the boolean case (graph-equal? x y)))))) (define (test-remove-first) (let ([correct '((a c b d) (a c d) (a c d) ()) ] [answers (list (remove-first 'b '(a b c b d)) (remove-first 'b '(a c d)) (remove-first 'b '(a c b d)) (remove-first 'b '()) )]) (display-results correct answers equal?))) (display 'max-edges) (test-max-edges) (display 'complete?) (test-complete?) (display 'complete) (test-complete) (display 'remove-first) (test-remove-first) ;-------------- End of problems removed from A5 ---------------- (define (test-connected?) (let ([correct '( #t #t #t #t #t )] [answers (list (and (connected? (quote ((a ())))) (not (connected? (quote ((a ()) (b ())))))) (and (connected? (quote ((a (b)) (b (a))))) (not (connected? (quote ((a (b)) (c ()) (b (a))))))) (and (connected? (quote ((a (b c)) (b (c a)) (c (b a))))) (not (connected? (quote ((a (b c)) (b (c a)) (c (b a)) (d (e f g)) (e (d f g)) (f (d e g)) (g (d e f))))))) (and (not (connected? (quote ((a (b)) (b (a)) (c (d)) (d (c)))))) (connected? (quote ((a (b)) (k (j)) (j (k i)) (c (b d)) (i (h j)) (h (i g)) (g (f h)) (b (c a)) (f (e g)) (e (d f)) (d (c e)))))) (and (connected? (quote ((a ())))) (not (connected? (quote ((a (b c)) (b (a c)) (c (b a)) (d (e f)) (e (d f)) (f (d e))))))) )]) (display-results correct answers equal?))) ;-----------------------------End of tests removed from A7 ----------