#lang racket ;; CSE 413 19wi hw3demo-tests.rkt ;; Unit tests for example function in hw3demo.rkt ;; This file has many comments to explain what's going on; you would ;; not include extensive notes like this in your own tests. Instead, ;; include comments if needed so the reader can locate tests for ;; particular features and functions. ;; These tests are meant to give an idea of how unit testing works in ;; Racket. For more information see the RackUnit section of the ;; Racket documentation under tools. For CSE 413, the Quick Start ;; Guide is probably sufficient. ;; import testing framework (require rackunit) ;; Import file containing code to be tested. Replace the file name as ;; appropriate. Be sure to save that file before running the tests or ;; you may get an error message about unknown function names. (require "hw3demo.rkt") ;; Some simple tests. When this test file is run, checks that pass ;; will do so silently. Checks that fail will print details of the ;; failure along with the message. See the RackUnit documentation for ;; information about other available test functions. (check-equal? (app '() '()) '() "append of empty lists") (check-equal? (app '(a b c) '(x y z)) '(a b c x y z) "append of simple lists") ;; Larger collections of tests can be grouped into test suites. See ;; the end of the RackUnit quick start guide for an example. Not ;; required, but, for example, if you implement any extra credit, it ;; could be helpful to organize the tests into suites that cover basic ;; requirements and others that check specific extensions.