Description
Justification
I have a couple of unit tests where I have to check for floating point equality, and that can sometimes cause some problems. At the moment I have to make a separate function that returns a boolean and then use "IsTrue" instead.
Description
Would be great if we could have a separate AreEqualNumeric
or something like that which checks for value equality taking things like floating point quirks into account. Possibly also allowing optional arguments for setting absolute/relative precision so that one can get information in the test explorer on values if the assert fails.
Optional suggestion
Another possibility would be to let the user themselves define assert'ers and have a special ExpectThat
where you can pass an instance of an assert object defined in VBA with some expected methods such as Assert
, Report
etc which is what is used to fill out the test explorer with information. Then if I had implemented my own double precision assert class I could write
Assert.ExpectThat DoublesAreEqual, Number1, Number2, "Numbers from calculation are equal"
Where the DoublesAreEqual
is some class in my VBA project with the necessary methods.
I have probably been informed before, but I am not entirely sure to what extent the Rubberduck can interact with the VBA code, so obviously I have no idea if this can be done. If it is possible then I can always spin this into a separate suggestion. If it could then that would also provide an additional workaround for the PermissiveAssert
you have in your pipeline. This would also e.g. let users write special checkers for class equality etc so that you can reduce the number of asserts in a test.