reject
def reject() -> None:
reject()
skips testing against the given example.
It is equivalent to assume(False)
.
danger
This cheatcode is only available in fuzz tests.
Example
%lang starknet
@external
func test_function_that_takes_nonzero_argument(value) {
if (value == 0) {
%{ reject() %}
assert 0 = 0;
}
// ...
return ();
}
tip
The reject
cheatcode should only be used for narrow checks dependent on logic written in Cairo,
as it can slow down the tests significantly due to the need for more specific inputs.
If the condition is independent of test code, using
the filter
method
on fuzzing strategies is preferred.
If you need to restrict example space by a vast range, consider using more
sophisticated fuzzing strategies instead.