[svn:parrot] r42967 - trunk/runtime/parrot/library/Test

coke at svn.parrot.org coke at svn.parrot.org
Wed Dec 9 22:08:23 UTC 2009

Author: coke
Date: Wed Dec  9 22:08:22 2009
New Revision: 42967
URL: https://trac.parrot.org/parrot/changeset/42967

Add some docs for is(N1, N2, desc, prec) (TT#1343)


Modified: trunk/runtime/parrot/library/Test/More.pir
--- trunk/runtime/parrot/library/Test/More.pir	Wed Dec  9 22:01:49 2009	(r42966)
+++ trunk/runtime/parrot/library/Test/More.pir	Wed Dec  9 22:08:22 2009	(r42967)
@@ -141,12 +141,17 @@
 If there is a mismatch, the current implementation takes the type of C<left> as
 the proper type for the comparison, converting any numeric arguments to floats.
 Note that there is a hard-coded precision check to avoid certain rounding
-errors.  It's not entirely robust, but it's not completely awful either.
-Patches very welcome.  Multi-dispatch is a bit tricky here.
+=item C<is( left, right, description, precision )>
-This probably doesn't handle all of the comparisons you want, but it's easy to
-add more.
+For C<Float> only, an optional 4th parameter is allowed, a numeric precision.
+If specified, then the floats are only compared within the tolerance of the
+precision: e.g.:
+ is(123.456, 123.457, 'close enough?', 1e-2)
+will pass.

More information about the parrot-commits mailing list