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

dagolden on 2006-07-25T23:01:02

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' );

  __RESULT__
  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".