Please test all your programs carefully and include all the test cases with your program. You should have at least 3 tests for each function, except the ones that produce an image or a scene.
How to run a world program:
(main
10)
(10 is the number of seconds you want to run
your program for; change this number as needed), press enter.Your task is to clean up and finish the example that we did in class. Specifically, you need to do the following:
punctuation-color
that, given a
character, returns the color according to the following rules:
"red" for "!", "yellow" for "?", "blue" for "." and "black" for
everything else. Write its signature (description of the parameters
and the function, as we did in class). Write
check-expect
tests for your function, such as
(check-expect (punctuation-color "!") "red")
Test the function thoroughly.
punctuation-color
. Add new functionality one step
at a time, test after every addition.
You might want to add more helper functions. Recall that you have written a function that returns the last character of a string as a part of the previous problem set, feel free to use it here (copy its check-expect tests into this file as well). Write signatures for all functions that you define and check-expect tests for all functions that do not return images.
Exercise 49 in section 4.3.