#python #sicp
Tests
typically take the form of another function that contains one or more sample
calls to the function being tested. The returned value is then verified against
an expected result. Unlike most functions, which are meant to be general, tests
involve selecting and validating calls with specific argument values. Tests
also serve as documentation: they demonstrate how to call a function and what
argument values are appropriate.
If you want to change selection, open document below and click on "Move attachment"
1.5 Controlof verifying that the function's behavior
matches expectations. Our language of functions is now sufficiently complex
that we need to start testing our implementations.
A test is a mechanism for systematically performing this verification. <span>Tests
typically take the form of another function that contains one or more sample
calls to the function being tested. The returned value is then verified against
an expected result. Unlike most functions, which are meant to be general, tests
involve selecting and validating calls with specific argument values. Tests
also serve as documentation: they demonstrate how to call a function and what
argument values are appropriate.
Assertions. Programmers use assert statements to verify expectations,
such as the output of a function being tested. An assert statement has an
expression in a boolean context, Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details