When
I was doing Project 1, I found I did not understand what the examples in
check-expect expressions should look like. For example, when I was answering
the first question, I initially wrote down that:
(check-expect
(clarify-color (make-color 78 89 98 23))
(make-color (color-red (make-color 78 89 98 23))
(color-green (make-color 78 89 98 23))
(color-blue (make-color 78 89 98 23))
(cond
[(> (+ (color-red (make-color 78 89 98 23)) (color-green (make-color 78 89 98 23)) (color-blue (make-color 78 89 98 23))) 650) 0]
[else (color-alpha (make-color 78 89 98 23))])))
Then, after I finished
all the questions, I thought this is wrong. Since this check-expect expression
was not different from its definition, though the test passed. Then I changed
this check-expect expression to that:
(check-expect
(clarify-color (make-color 78 89 98 23))
(make-color 78 89 98 23))
So, I just conclude that usually, check-expect
expression is simpler than its definition expression, since the result can be directly
written in it.
No comments:
Post a Comment