Reputation: 602
I am new to Racket.
Can someone give me a simple example on how to use check expect
in Racket, preferably with numbers?
Upvotes: 1
Views: 2401
Reputation: 236004
The documentation is your best friend.
It's really simple: the first parameter to check-expect
is the expression or procedure to be tested, and the second one is the expected result (hence the name). Assuming that you've selected an adequate language (for example: Beginning Student
)
(check-expect (+ 1 1) 2)
(check-expect (+ 1 1) 1)
The above will produce an output such as this:
Ran 2 tests.
1 of the 2 tests failed.
No signature violations.
Check failures:
Actual value 2 differs from 1, the expected value.
at line 2, column 0
Upvotes: 2