Skip to main content

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

ParameterTypeDescription
resultnumberResult from the current test run.
expectednumberExpected result from the results file.

Returns

BettererConstraintResult

Example

import { smaller } from '@betterer/constraints';

smaller(2, 1); // worse
smaller(1, 1); // worse
smaller(1, 2); // better
smaller(2, 2); // same