Class 3 Objectives
At the end of today's class you should
KNOW:
- that the Racket function check-expect can be used to automate testing
- that tests should be written before the function is defined
- that if is the way to ask a true/false question in a Racket program
- that Racket has a Boolean data type to represent true/false values
BE ABLE TO:
- write test cases for a function using check-expect
- write a Racket program that makes a decision using if
Vocabulary: predicate, test case
Sample Exam Question:
Write a Racket function called sign that consumes a number, and returns one of
the words positive or negative, depending on the sign of the number (consider
0 a positive number).
For example,
(sign -2)
would return "negative"
Comment your function with a signature and purpose, and write a set of test cases
for your function.