@0x/contracts-staking
: Finalizer tests passing.
This commit is contained in:
committed by
Lawrence Forman
parent
b4b6d4d969
commit
d33080cf08
@@ -90,6 +90,17 @@ export function assertRoughlyEquals(actual: Numberish, expected: Numberish, prec
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two numbers are equal with up to `maxError` difference between them.
|
||||
*/
|
||||
export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberish, maxError: number = 1): void {
|
||||
const diff = new BigNumber(actual).minus(expected).abs().toNumber();
|
||||
if (diff <= maxError) {
|
||||
return;
|
||||
}
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `amount` into a base unit amount with 18 digits.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user