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
This introduces relative equality checks, which makes it easier to do equality checks without knowing the values or units in advance.
It also improves the existing absolute equality checks to more intuitively use `this` as the reference value/unit instead of the base unit.
* Add `static Comparison` type for absolute and relative equality logic, that take a tolerance and a `ComparisonType`
* Add new overload for instance method `Equals()` on quantity types
* Adding ability to compare by relative and absolute values
* Fixing units and tests due to new relative tolerance
* Removing default parameters for windows runtime component
* Fixing therm(UK) values
* Relative difference calculation should be against expected value
* Make sure comparison is done to the current units of [this] to avoid uneccessary scaling
* Fix obsolete message of Equals($quantityName other, $quantityName maxError).
* Fix Equals methods that were scaling to base units when unnecessary
Assert.True(actual>=expected-tolerance&&actual<=expected+tolerance,$"Values are not equal within tolerance: {tolerance}\nExpected: {expected}\nActual: {actual}\nDiff: {actual-expected:e}");
Assert.True(areEqual,$"Values are not equal within relative tolerance: {tolerance:P4}\nExpected: {expected}\nActual: {actual}\nDiff: {relativeDifference:P4}");
Assert.True(areEqual,$"Values are not equal within absolute tolerance: {tolerance}\nExpected: {expected}\nActual: {actual}\nDiff: {actual-expected:e}");
0 commit comments