assertEqualsWithTolerance function
Throws an AssertionError when a and b differ by more than tolerance.
Use for comparing floating-point values where exact equality is unreliable.
Example:
assertEqualsWithTolerance(0.1 + 0.2, 0.3, 1e-9); // passes
Implementation
void assertEqualsWithTolerance(double a, double b, double tolerance) {
if ((a - b).abs() > tolerance) throw AssertionError('Expected $a ≈ $b (tolerance $tolerance)');
}