Asserts that the two values are recursively equal but the difference to assertEquals is that numbers are considered to be equal when they are close enough to each other (configurable by number of decimal digits to compare).
Examples:
assertCloseTo(10.351, 10.352, 2);assertCloseTo({ value: 1.999 }, { value: 1.9992, 3 });assertCloseTo([ 1, 2.1, 3 ], [ 1, 2.10001, 3 ], 3); Copy
assertCloseTo(10.351, 10.352, 2);assertCloseTo({ value: 1.999 }, { value: 1.9992, 3 });assertCloseTo([ 1, 2.1, 3 ], [ 1, 2.10001, 3 ], 3);
The type of the actual value.
The type of the expected value.
The actual value to compare.
The expected value to compare with.
The number of decimal digits to round numbers to before comparing. Defaults to 2.
Optional
Optional reason added to exception message when assertion fails.
AssertionError when values are not close enough.
Asserts that the two values are recursively equal but the difference to assertEquals is that numbers are considered to be equal when they are close enough to each other (configurable by number of decimal digits to compare).
Examples: