There must be module with test assertions in Phobos

jmh530 john.michael.hall at gmail.com
Fri Apr 7 00:58:11 UTC 2023


On Tuesday, 4 April 2023 at 18:50:11 UTC, max haughton wrote:
> On Tuesday, 4 April 2023 at 16:01:17 UTC, Adam D Ruppe wrote:
>> On Tuesday, 4 April 2023 at 15:45:55 UTC, max haughton wrote:
>>> They are redundant but they allow some slightly nicer failure 
>>> messages upon failure (i.e. assert fail is not very helpful 
>>> unless you are at one with all the code)
>>
>>
>> I tend to use -checkaction=context together with -unitest...
>
> That too. Not massively in love with it for (say) approximately 
> equal testing floats but it's there.

mir.test's `shouldApprox` [1] handles that

https://github.com/libmir/mir-algorithm/blob/081418a5bb9f22861fc15cbf44045f7aef5c848f/source/mir/test.d#L17


More information about the Digitalmars-d mailing list