function checkNear(val1, val2, tolerance) {
                expect(Math.abs(Number(val1) - Number(val2)) < (tolerance || 1.0)).toBe(true);
            }
Checks whether the difference between val1 and val2 is within the given tolerance.
(We can't use Jasmine's .toBeCloseTo() because that takes a precision in decimal places,
whereas we often need to check an absolute distance.)
@param {(number|string)} val1 The first value to check.
@param {(number|string)} val2 The second value to check.
@param {number} tolerance The desired tolerance.