[Swift-devel] assertEqual

Tim Armstrong tim.g.armstrong at gmail.com
Mon Apr 6 09:38:03 CDT 2015


Right, the tests for those things in the Swift test suite are like:

assert(abs(sin(PI/2) - 1.0) < 1e-15, "sin");

Which is a little less convenient.

I think if we want almost equal semantics we could have assertAlmostEqual
with a tolerance parameter

-Tim

On 5 April 2015 at 21:17, Mihael Hategan <hategan at mcs.anl.gov> wrote:

> Hi,
>
> I found it useful to have a tolerance parameter for assertEqual(float,
> float).
>
> Checks like assertEqual(tan(x), sin(x) / cos(x)) are otherwise not going
> to work very well.
>
> Mihael
>
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20150406/91b75430/attachment.html>


More information about the Swift-devel mailing list