tweak RE for NaNQ? recognition
[p5sagit/p5-mst-13.2.git] / t / lib / bigfloatpm.t
index 566038e..a0f0f40 100755 (executable)
@@ -18,8 +18,14 @@ while (<DATA>) {
                eval "$_;";
        } else {
                ++$test;
-               @args = split(/:/,$_,99);
-               $ans = pop(@args);
+              if (m|^(.*?):(/.+)$|) {
+                  $ans = $2;
+                   @args = split(/:/,$1,99);
+              }
+              else {
+                   @args = split(/:/,$_,99);
+                   $ans = pop(@args);
+              }
                $try = "\$x = new Math::BigFloat \"$args[0]\";";
                if ($f eq "fnorm"){
                    $try .= "\$x+0;";
@@ -49,7 +55,17 @@ while (<DATA>) {
                }
                #print ">>>",$try,"<<<\n";
                $ans1 = eval $try;
-               if ("$ans1" eq $ans) { #bug!
+              if ($ans =~ m|^/(.*)$|) {
+                  my $pat = $1;
+                  if ($ans1 =~ /$pat/) {
+                       print "ok $test\n";
+                  }
+                  else {
+                       print "not ok $test\n";
+                       print "# '$try' expected: /$pat/ got: '$ans1'\n";
+                  }
+              }
+               elsif ("$ans1" eq $ans) { #bug!
                        print "ok $test\n";
                } else {
                        print "not ok $test\n";
@@ -429,10 +445,10 @@ $Math::BigFloat::div_scale = 20
 $Math::BigFloat::div_scale = 40
 &fsqrt
 +0:0
--1:NaN
--2:NaN
--16:NaN
--123.456:NaN
+-1:/^(?i:0|NaNQ?)$
+-2:/^(?i:0|NaNQ?)$
+-16:/^(?i:0|NaNQ?)$
+-123.456:/^(?i:0|NaNQ?)$
 +1:1.
 +1.44:1.2
 +2:1.41421356237309504880168872420969807857