Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

dagolden (6584)

  (email not shown publicly)
AOL IM: xdaveg (Add Buddy, Send Message)

Journal of dagolden (6584)

Tuesday July 25, 2006
06:01 PM

Test::Number::Delta 1.00... now with matrices

[ #30425 ]

As the synopsis says: Compare if the difference between two numbers is within a specified amount. Arriving soon at a CPAN near you.

Ron Grunwald sent an email asking if I'd add support for arrays to Test::Number::Delta. I decided to go one better and make it recursive to handle matrices as well.

  use Test::Number::Delta tests => 1;

  my @a = (   [ 3.14, 6.28 ],
              [ 1.41, 2.84 ]   );

  my @b = (   [ 3.14, 6.28 ],
              [ 1.42, 2.84 ]   );

  delta_ok( \@a, \@b, 'compare @a and @b' );

  not ok 1 - compare @a and @b
  # At [1][0]: 1.4100000 and 1.4200000 are not equal to within 0.000001

His email was also a good reminder that it had been stable for a while and I'd been meaning to bump it to 1.00 and call it "released".

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.