You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I quite often have objects that include a double, and use a deep matcher (via equals()), e.g
import'dart:math';
List<Point<double>> a =resultOfSomeFunction();
expect(a, equals([Point<double>(1.2, 3.4), ...]);
In this case, I want to compare a list of Point<double>, but sometimes the test fails, because the double precision, and I really should compare the numbers with closeTo() instead of a simple ==.
Would it be possible to customise equals() so when it does a deep comparison, the individual values can be compared with a different matcher.
Something like, equals([Point<double>(1.2, 3.4), ...], matcher=closeTo)? Until then, I've effectively forked the equals/_DeepMatcher and replaced one line with a closeTo() instead of a ==.
The text was updated successfully, but these errors were encountered:
I quite often have objects that include a double, and use a deep matcher (via
equals()
), e.gIn this case, I want to compare a list of
Point<double>
, but sometimes the test fails, because the double precision, and I really should compare the numbers withcloseTo()
instead of a simple ==.Would it be possible to customise
equals()
so when it does a deep comparison, the individual values can be compared with a different matcher.Something like,
equals([Point<double>(1.2, 3.4), ...], matcher=closeTo)
? Until then, I've effectively forked theequals
/_DeepMatcher
and replaced one line with a closeTo() instead of a ==.The text was updated successfully, but these errors were encountered: