smaller()
API > @betterer/constraints > smaller
Betterer
constraint function for when a numeric result is expected to get smaller.
Signature
export declare function smaller(result: number, expected: number): BettererConstraintResult;
Parameters
Parameter | Type | Description |
---|---|---|
result | number | Result from the current test run. |
expected | number | Expected result from the results file. |
Returns
Example
import { smaller } from '@betterer/constraints';
smaller(2, 1); // worse
smaller(1, 1); // worse
smaller(1, 2); // better
smaller(2, 2); // same