Test programs according to good software engineering principles.
Consider the following not-yet-implemented procedure.
;;; (median numbers) -> real?
;;; numbers : list-of real?
;;; Find the median of a list of a nonempty list of numbers using
;;; the standard approach.
(define median
(lambda (numbers)
(car numbers))) ; Incorrect, but a good placeholder.
Write a set of tests for median. Make sure to include at least three “expected” cases and at least three “edge” cases.
Here are some examples to get you started.
(test-case "an easy list of integers"
equal? 2
(lambda () (median (list 1 2 3))))
(test-case "a list of exact and inexact numbers of even length"
equal? 2.5
(lambda () (median (list 1.0 2 3 4))))