Skip to content

Commit

Permalink
improve precision tests, looks quite sane now
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Sep 10, 2012
1 parent e2811df commit b3b7395
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions t/native_pbc/number.t
Expand Up @@ -111,12 +111,15 @@ sub test_pbc_number {

# required precision: 7 for float, 15 for double, ...
my $out = $output;
my $minprec = min_precision($id, $myprec) - 1;
my $prec1 = $minprec - 1; # 4.398046511104
my $prec2 = $minprec - 2; # -10.48576
$out =~ s/(^-?\d{1,$minprec})\d*/$1.'\d+'/eg;
$out =~ s/(^-?\d\.\d{1,$prec1})\d*/$1.'\d+'/eg;
$out =~ s/(^-?\d\d\.\d{1,$prec2})\d*/$1.'\d+'/eg;
my $minprec = min_precision($id, $myprec);
# [GH #xxx] Looks like we cannot guarantee more then 15 digits
$minprec = 15 if $minprec > 15 and $id ne $arch;
$minprec--;
my $prec1 = $minprec - 1; # 4.398046511104 => 4.398046\d*
my $prec2 = $minprec - 2; # -10.48576 => -10.48576\*
$out =~ s/(^-?\d\d\.\d{$prec2,})\d*/$1\\d*/mg;
$out =~ s/(^-?\d\.\d{$prec1,})\d*/$1\\d*/mg;
$out =~ s/(^-?\d{$minprec,})\d*/$1\\d*/mg;
my $qr = qr/$out/;

test_native_pbc($id, "number", $qr, $desc, $skip, $todo);
Expand Down

0 comments on commit b3b7395

Please sign in to comment.