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