File Coverage

test_eng/Testout.pm
Criterion Covered Total %
statement 324 418 77.5
branch 146 208 70.1
condition 70 101 69.3
subroutine 30 37 81.0
pod n/a
total 570 764 74.6


line stmt bran cond sub pod time code
1             #! perl
2             # $rcs = ' $Id: testout.t,v 1.2 1997/09/22 10:13:37 ilya Exp ilya $ ' ;
3              
4 246     246   108815 use strict;
  246         460  
  246         7272  
5 244     244   133343 use Math::Pari qw(:DEFAULT pari_print :all);
  244         771  
  244         1219  
6 244     244   2665 use vars qw($x $y $z $k $t $q $a $u $i $j $l $name $other $n);
  244         419  
  244         212823  
7             die "Need a path to a testout file" unless @ARGV;
8              
9             my $file = CORE::shift;
10             my(@tests, %seen, $current_num, $userfun, $installed, $skip_gnuplot, %not_yet_defined, $printout, $intests, $rest, $popped);
11             {
12             open TO, "< $file" or die "open `$file': $!";
13             local $/ = "\n? ";
14             @tests = ;
15             close TO or die "close: $!";
16             }
17              
18             my $mess = '';
19             $mess = CORE::shift @tests if @tests and $tests[0] !~ /^\?/; # Messages
20             my @skip_fun;
21             my $skip_fun_rx = qr/(?!)/;
22             my $matched_par;
23             $matched_par = qr[[^()]*(?:\((??{$matched_par})\)[^()]*)*]; # arbitrary string with ( and ) matching
24             my %ourvars;
25             my $ourvars_rx = qr/(?!)/;
26             my $skipvars_rx = qr/(?!)/;
27              
28             my $can_matrix = eval {PARImat_tr([[3]]) == matrix(1, 1, my $x, my $y, sub{3})} ; # after 2.3.5, but before support
29             my $or_matrix = (not $can_matrix and "|matrix");
30             my $or_matrix_out = (not $can_matrix and " (or matrix())");
31              
32             (my $ifile = $file) =~ s[(?<=/test/)(32|64)/][in/];
33             {
34             open FROM, '<', $ifile or die "open `$file': $!";
35             local $/;
36             $intests = ;
37             close FROM or die "close: $!";
38             }
39             my $pref;
40             ($pref = $intests) =~ s/^(\\e|default\(echo,[^\n]*\n)(.*)//ms and CORE::length $pref and $rest = $2;
41              
42             $popped++, pop @tests if ($tests[-1] || 0) =~ /^\\q/;
43              
44             my $skip_eval = (Math::Pari::pari_version_exp() >= 2004002);
45             my $use_dollars_in_argsign = $skip_eval;
46              
47             if ($pref =~ /^\s*\\\\\s*package:(.*)/m) {
48             print "1..0 # skipped: package dependency: $1\n";
49             @tests = ();
50             } elsif (my $tests = @tests) {
51             $tests += !!$rest;
52             print "1..$tests\n";
53             } elsif ($rest) {
54             print "1..1\nnot ok 1 # no tests found in `$file', but input has echo enabled\n";
55             warn "unexpected format of GP/PARI test output file: echo enabled, but no echoed lines";
56             } else { # no echoed lines expected
57             print "1..0 # skipped: command-line echoing is not enabled in the test file `$ifile'\n";
58             }
59              
60             # prec($3 || $1, 1) if $mess =~ /.*realprecision = (\d+) significant digits( \((\d+) digits displayed\))?/; # take the latest one
61             if ($rest) { # 'define'
62             (my $Pref = $pref) =~ s/^(.*)$/### $1/mg ;
63             print("# The following `? ' are the output from parse_as_gp() for\n$Pref");
64             my $Err;
65             eval { parse_as_gp $pref, sub ($) {"main::".CORE::shift}, 'echo'; 1}
66             or $Err = $@;
67             $current_num++;
68             if (defined $Err) { # failed to process, but do emit the expected-for-test output
69             print "not ok $current_num # in no-echo group err=$Err\n";
70             } else {
71             print "ok $current_num # Skipping translation to Math::Pari (no-echo group done in PARI, see above)\n";
72             }
73             }
74             $rest ||= $intests;
75              
76             #Math::Pari::dumpStack,allocatemem(8e6),Math::Pari::dumpStack if $file =~ /intnum/; # Due to our allocation policy we need more?
77              
78              
79             $| = 1; # Need to list loop variables used by the code:
80             my @seen = qw(Euler Pi I getrand a x xx y z k t q u j l n v p e s
81             name other mhbi a2 a1 a0 b0 b1
82             acurve bcurve ccurve cmcurve tcurve mcurve ma mpoints);
83             my @VARS = map "\$$_", @seen;
84 242     242   1566 eval 'use vars @VARS; 1' or die "use vars: $@";
  242         397  
  242         32415  
85             @seen{@seen} = (' ', ' ', ' ', ' ', ('$') x 100);
86             $seen{oo} = ' ' if Math::Pari::pari_version_exp >= 2009000;
87             for (@seen) {
88 243     243   1693 no strict 'refs';
  243         382  
  243         962885  
89             $$_ = PARI($_) unless $seen{$_} eq ' ';
90             }
91             $seen{'random'} = ' ';
92             my $DEFAULT = undef;
93              
94             # Some of these are repeated below (look for XXXX), since they cause
95             # an early interpretation of unquoted args
96             @not_yet_defined{qw(
97             type
98             )} = (1) x 10000;
99              
100             if ($file =~ /plot|graph|all/) {
101             if ($ENV{MP_NOGNUPLOT}) {
102             $skip_gnuplot = 1;
103             } else {
104             eval { link_gnuplot() };
105             if ($@ =~ m%^Can't locate Term/Gnuplot.pm in \@INC%) {
106             print STDERR "# Can't locate Term/Gnuplot.pm in \@INC, ignoring plotting\n";
107             @not_yet_defined{qw(
108             plotbox plotcolor plotcursor plotdraw ploth plothraw plotinit plotlines
109             plotmove plotpoints plotrline plotrmove plotrpoint psdraw psploth
110             psplothraw plotscale
111             plotkill
112             )} = (1) x 10000;
113             $skip_gnuplot = 1;
114             } elsif ($@) {
115             die $@;
116             }
117             }
118             }
119              
120             my $started = 0;
121              
122             main_loop:
123             while (@tests) {
124             $_ = CORE::shift @tests;
125             #print "Doing `$_'";
126             1 while s/^\\\\.*\n//; # Comment
127             my $bad = /^\\(?!p[bs]?\s*\d)/; # \precision =
128             my $wasbadprint = /\b(plot)\b/;
129             my $wasprint = /\b((|p|tex)print(tex)?|plot)\b/;
130             s/\s*\n\?\s*\Z// or not $popped or die "Not terminated: `$_'\n";
131             s/\A(\s*\?)+\s*//;
132             # s/[^\S\n]+$//gm;
133             s/\A(.*)\s*; $ \s*(\w+)\s*\(/$1;$2(/mx; # Continuation lines of questions
134             # Special-case tests nfields-3 and intnum-23 with a wrapped question:
135             s/\A(p2=.*\d{10})\n(7\n)/$1$2/;
136             s/\n(?=\/\w)//;
137             s/\A(.*)\s*$//m or die "No question: `$_'\n";
138             my $in = $1;
139             1 while s/^\n//; # Before warnings
140             1 while s/^\s*\*+\s*warning.*\n?//i; # skip warnings
141             if (s/^\s*\*+\s*(.*)//) { # error
142             process_error($in,$_,$1);
143             next;
144             }
145             process_test($in, 'noans', []), next if /^$/; # Was a void
146             # s/^%\d+\s*=\s*// or die "Malformed answer: $_" unless $bad or $wasprint;
147             if ($_ eq '' or $wasprint) { # Answer is multiline
148             # @ans = $_ eq '' ? () : ($_) ;
149             # while (<>) {
150             # last if /^\?\s+/;
151             # next if /^$/;
152             # chomp;
153             # push @ans, $_;
154             # }
155             my @ans = split "\n";
156             if ($wasbadprint) {
157             process_print($in, @ans);
158             } elsif ($wasprint) {
159             process_test($in, 'print', [@ans]);
160             } else {
161             process_test($in, 0, [@ans]);
162             }
163             next main_loop;
164             }
165             if ($bad) {
166             process_set($in, $_);
167             } else {
168             process_test($in, 0, [$_]);
169             }
170             }
171              
172             sub format_matrix {
173 59     59   138 my $in = CORE::shift;
174 59         137 my @in = split /;/, $in;
175 59         373 'PARImat_tr([[' . join('], [', @in) . ']])';
176             }
177              
178             sub format_vvector {
179 16     16   48 my $in = CORE::shift;
180 16         19 $in =~ s/~\s*$//;
181 16         158 "PARIcolL($in)";
182             }
183              
184             sub re_format { # Convert PARI output to a regular expression
185 639     639   1384 my $in = join "\n", @_;
186 639         1344 $in = quotemeta $in;
187 639         1373 $in =~ s/\\\]\\\n\\\n\\\[/\\s*;\\s*/g; # row separator
188 639         1346 $in =~ s/\\\n/\\s*/g;
189 639         5569 $in =~ s/\\[ \t]/,?\\s*/g;
190             # This breaks a lot of linear.t tests
191             ### Allow for rounding 3999999 <=> 40000000, but only after . or immediately before it
192             ##$in =~ s/([0-8])((?:\\\.)?)(9+(\\s\*9+)?)(?![+\d])/$n=$1+1;"($1$2$3|$n${2}0+)"/ge;
193             ##$in =~ s/([1-9])((?:\\\.)?)(0+(\\s\*0+)?)(?![+\d])/$n=$1-1;"($1$2$3|$n${2}9+)"/ge;
194             ##$in =~ s/(\d{8,})([1-8])(?![+\d()]|\\s\*)/$n=$2-1;$m=$2+1;$1."[$2$n$m]\\d*"/ge;
195 639         1393 $in
196             }
197              
198             sub mformat {
199             # if not matrix, join with \t
200 69 50 33 73   341 return join("\t", @_) unless @_ > 1 and $_[0] =~ /^\[/;
201 0         0 @_ = grep {!/^$/} @_; # remove empty lines
  0         0  
202 0 0       0 return join("\t", @_) if grep {!/^\s*\[.*\]\s*$/} @_; # Not matrix
  0         0  
203             #return join("\t", @_) if grep {!/^\s*\([^,]*,\s*$/} @_; # Extra commas
204 0         0 map {s/^\s*\[\s*(.*?)\s*\]\s*$/$1/} @_;
  0         0  
205 0         0 my @arr = map { join ', ', split } @_;
  0         0  
206 0         0 '[' . join('; ', @arr) . ']';
207             }
208              
209             sub mformat_transp {
210 0 0 0 0   0 return join("\t", @_) unless @_ > 1 and $_[0] =~ /^\[/;
211 0         0 @_ = grep {!/^$/} @_;
  0         0  
212 0 0       0 return join("\t", @_) if grep {!/^\s*\[.*\]\s*$/} @_; # Not matrix
  0         0  
213             #return join("\t", @_) if grep {!/^\s*\([^,]*,\s*$/} @_; # Extra commas
214 0         0 map {s/^\s*\[(.*)\]\s*$/$1/} @_;
  0         0  
215 0         0 my @arr = map { [split] } @_;
  0         0  
216 0         0 my @out;
217 0         0 my @dummy = ('') x @{$arr[0]};
  0         0  
218 0         0 for my $ind (0..$#{$arr[0]}) {
  0         0  
219 0         0 for my $subarr (@arr) {
220 0 0       0 @$subarr > $ind or $subarr->[$ind] = '';
221             }
222 0         0 push @out, join ', ', map {$_->[$ind]} @arr;
  0         0  
223             }
224 0         0 '[' . join('; ', @out) . ']';
225             }
226              
227             sub massage_floats {
228 140     140   189 my $in = CORE::shift;
229 140   100     319 my $pre = CORE::shift || "16g";
230 140         159166 $in =~ s/(.\d*)\s+e/$1E/gi; # 1.74 E-78
231 140         820 $in =~ s/\b(\d+\.\d*(e[-+]?\d+)?|\d{10,})\b/sprintf "%.${pre}", $1/gei;
  214         1702  
232 140         306 $in;
233             }
234              
235             sub o_format {
236 13     13   42 my ($var,$power) = @_;
237 13 100       119 return " PARI('O($var^$power)') " if defined $power;
238 1         5 return " PARI('O($var)') ";
239             }
240              
241             sub process_cond {
242 15     15   76 my ($what, $cond, $then, $else, $initial) = @_;
243 15 100       63 die if $initial =~ /Skip this/;
244             # warn "Converting `$in'\n`$what', `$cond', `$then', `$else'\n";
245 13 100       42 if (($what eq 'if') ne (defined $else)) {
    100          
246 2         24 return "Skip this `$initial'";
247             } elsif ($what eq 'if') {
248 9         87 return "( ($cond) ? ($then) : ($else) )";
249             } else {
250 2         21 return "do { $what ($cond) { $then } }";
251             }
252             }
253              
254             sub nok_print {
255 0     0   0 my ($n, $in) = (CORE::shift, CORE::shift);
256 0 0       0 print(@_), return unless $ENV{AUTOMATED_TESTING};
257 0         0 warn("# in = `$in'\n", @_);
258 0         0 print("not ok $n\n");
259             }
260              
261             sub update_seen ($) {
262 699     699   984 my $seen_now = CORE::shift;
263 699         1880 @seen{keys %$seen_now} = values %$seen_now;
264             # my @VARS = map "\$$_", keys %$seen_now;
265             # eval 'use vars @VARS; 1' or die "use vars: $@";
266             }
267              
268             sub pre_update_seen ($) {
269 92     92   188 my $sym = CORE::shift;
270             # @seen{keys %$seen_now} = values %$seen_now;
271             # my @VARS = map "\$$_", keys %$seen_now;
272 92 50   12   5074 eval "use vars '\$$sym'; 1" or die "use vars: $@";
  12     10   87  
  12     9   21  
  12         339  
  10         71  
  10         16  
  10         239  
  9         54  
  9         18  
  9         195  
273             }
274              
275             sub subify_iterators ($$) {
276 128     128   373 my($pre, $code, $subargs, $subdecl) = (CORE::shift, CORE::shift, '', '');
277 128 50       265 if ($use_dollars_in_argsign) {
278 128         158 $subargs = ' ($) ';
279 128 100       388 if ($pre =~ /^(v?vector|fordiv|sumdiv|plothexport)\(/) {
280 30 50       111 $pre =~ /^\w+\s*\([^,]*,\s*([\$\w]+)\s*,/ or die "Cannot find iterator variable in `$pre\{\{\{$code\}\}\}'";
281 30         71 $subdecl = "my $1 = CORE::shift;"
282             } else {
283 98 50       373 $pre =~ /^\w+\s*\(\s*([\$\w]+)\s*,/ or die "Cannot find iterator variable in `$pre\{\{\{$code\}\}\}'";
284 98         221 $subdecl = "my $1 = CORE::shift;"
285             }
286             }
287             # /$1 sub$subargs\{$2}/xg;
288 128         4240 "$pre sub$subargs\{$subdecl$code\}";
289             }
290              
291             sub filter_res ($) { # In PARI’s Mod() output there is an extra space comparing to ours
292 126     126   156 my $r = CORE::shift;
293 126         171 $r =~ s/(\bmatrix\([^\s,]+)\s+/$1,/g;
294             # warn "### ->\t$r\n";
295 126 100       461 return $r unless $r =~ /\bMod\(/;
296 6         13 $r =~ s/,\s+/,/g;
297 6         19 return $r;
298             }
299              
300             my $prev;
301             sub process_test {
302 908     908   2343 my ($in, $noans, $out) = @_;
303             # warn("<<<$in>>>, $noans, <<<@$out>>>");
304 908         1278 my($IN, $res, $rres, $rout) = $in;
305 908         1040 my $ini_time = time;
306 908         779 my $doprint;
307 908 100       1402 $doprint = 1 if $noans eq 'print';
308 908         870 my $was_prev = $prev;
309 908         1066 undef $prev;
310 908         1000 $current_num++;
311             # First a trivial processing:
312 908         1216 $in =~ s/^\s*gettime\s*;//; # Starting lines of tests...
313 908         989 $in =~ s/\b(\d+|[a-z]+\(\))\s*\\\s*(\d+(\^\d+)?)/ gdivent($1,$2)/g; # \
314 908         1039 $in =~ s/\b(\d+)\s*\\\/\s*(\d+)/ gdivround($1,$2)/g; # \/
315 908         1000 $in =~ s/\b(\w+)\s*!/ ifact($1)/g; # !
316 908         1598 $in =~ s/,\s*(?=,)/, \$DEFAULT /g; # Default arguments?
317 908         1037 $in =~ s/^default\(realprecision,(.*)\)/\\p $1/; # Some cases of default()
318 908         858 $in =~ s/^default\(realbitprecision,(.*)\)/\\pb $1/; # Some cases of default()
319 908         849 $in =~ s/^default\(seriesprecision,(.*)\)/\\ps $1/; # Some cases of default()
320 908         959 $in =~ s/(\w+)\s*\\(\w+(\s*\^\s*\w+)?)/gdivent($1,$2)/g; # random\10^8
321 908         963 $in =~ s/%(?!\s*[\[_\w])/\$was_prev/g; # foo(%)
322 908         1052 $in =~ s/\b(for)\s*\(\s*(\w+)=/&$1($2,/g; # for(x=1,13,print(x))
323 908         909 $in =~ s/
324             ^
325             (
326             \(
327             (?:
328             [^(,)]+
329             (?=
330             [(,)]
331             )
332             |
333             \( [^()]* \)
334             )* # One level of parenths supported
335             \)
336             )
337             ' $
338             /deriv$1/x; # ((x+y)^5)'
339 908 100 100     6289 if ($in =~ /^\\p\s*(\d+)/) {
    100          
    100          
    100          
    50          
    100          
340 12         68 prec("$1");
341             } elsif ($in =~ /^\\pb\s*(\d+)/) { # \\ for division unsupported
342 1         4 bprec("$1");
343             } elsif ($in =~ /^\\ps\s*(\d+)/) { # \\ for division unsupported
344 1         5 sprec("$1");
345             } elsif ($in =~ /\\/) { # \\ for division unsupported
346 1         2 $current_num--;
347 1         4 process_error($in, $out, '\\');
348             } elsif ($in =~ /^(\w+)\s*\([^()]*\)\s*=/ and 0) { # XXXX Not implemented yet
349 0         0 $current_num--;
350 0         0 process_definition($1, $in);
351             } elsif ($in =~ /!(?![\(\w])|\'/) { # Factorial (unless in !foo())
352 13         1027 print "# `$in'\nok $current_num # Skipping (ifact/deriv)\n";
353             } else {
354             # work with "^", need to treat differently inside o()
355 880         1409 $in =~ s/\^/^^^/g;
356 880         2312 $in =~ s/\bo\(([^()^]*)(\^\^\^([^()]*))?\)/ o_format($1,$3) /gei;
  13         39  
357 880         1240 $in =~ s/\^\^\^/**/g; # Now treat it outside of O()
358 880         1067 $in =~ s/\[([^\[\];]*;[^\[\]]*)\]/format_matrix($1)/ge; # Matrix
  54         101  
359 880         1188 $in =~ s/\[([^\[\];]*)\]\s*~/format_vvector($1)/ge; # Vertical vector
  12         21  
360 880         948 eval {
361 880         2498 1 while $in =~ s/
362             \b (if|while|until) \(
363             (
364             (?:
365             [^(,)]+
366             (?=
367             [(,)]
368             )
369             |
370             \( [^()]* \)
371             )* # One level of parenths supported
372             )
373             ,
374             (
375             (?:
376             [^(,)]+
377             (?=
378             [(,)]
379             )
380             |
381             \( [^()]* \)
382             )* # One level of parenths supported
383             )
384             (?:
385             ,
386             (
387             (?:
388             [^(,)]+
389             (?=
390             [(,)]
391             )
392             |
393             \( [^()]* \)
394             )* # One level of parenths supported
395             )
396             )?
397             \)
398 15         53 /process_cond($1, $2, $3, $4, $in)/xge; # if(a,b,c)
399             };
400 880         919 my $RET;
401 880 50 100     37209 if ($in =~ /\[[^\]]*;/) { # Matrix
    100 33        
    50          
    50          
    100          
    100          
    100          
    50          
    100          
    100          
    50          
402 0         0 print "# `$in'\nok $current_num # Skipping (matrix notation)\n";
403 0         0 $RET = 1;
404             } elsif ($in =~ /Skip this `(.*)'/) {
405 2         182 print "# `$1'\nok $current_num # Skipping (runaway conversion)\n";
406 2         8 $RET = 1;
407             } elsif ($in =~ /&for\s*\([^\)]*$/) { # Special case
408 0         0 print "# `$in'\nok $current_num # Skipping (runaway input line)\n";
409 0         0 $RET = 1;
410             } elsif ($in =~ /(^|[\(=,])%/) {
411 0         0 print "# `$in'\nok $current_num # Skipping (history notation)\n";
412 0         0 $RET = 1;
413             } elsif ($in =~ /\b(get(heap|stack)|Total time spent.*gettime)\b/) {
414 19         1438 print "# `$in'\nok $current_num # Silently skipping: meaningless for Math::Pari\n";
415 19         91 $RET = 1;
416             } elsif ($in =~ /
417             (
418             \b
419             ( if | goto | label | input | break
420             # | while | until
421             | gettime | default
422             )
423             \b
424             |
425             (\w+) \s* \( \s* (?: (?!\d)\w+ \s* (?:, \s* (?!\d)\w+ \s* )* )? \) \s* =(?!=)
426             |
427             \b install \s* \( \s* (\w+) \s* , [^()]* \)
428             |
429             \b
430             (
431             my _
432             )?
433             (?: p? print $or_matrix ) \(
434             ( \[ | (1 ,)? PARImat )
435             | # Too many parens: will not be wrapped in sub{...}
436             \b forprime .* \){5}
437             )
438             /x) {
439 37 100       112 if (defined $3) {
440 25         2403 print "# User function `$3'.\n";
441             }
442 37 50       180 if (defined $4) {
443 0 0       0 if (defined $installed) {
444 0         0 $installed .= "|$4";
445             } else {
446 0         0 $installed = $4;
447             }
448 0         0 print "# Installed function `$4'.\n";
449             }
450 37 100 100     179 if ($1 eq 'default' and $in =~ /^default\s*\(\s*echo\s*,\s*0\s*\)\s*(;\s*)?$/) { # See the test 'ff' - but this is not present in the OUTPUT!!!???
451 4 50       50 if ($rest =~ s/\A.*?^default\s*\(\s*echo\s*,\s*0\s*\)\s*(;\s*)?$//ms) { # Try to matchin in $rest:
452 4 50       110 if ($rest =~ s/\A(.*?)^default\s*\(\s*echo\s*,\s*(?!0\b)\S[^\n]*\)\s*(;\s*)?$//ms) {
453 4         102 (my $Pref = my $cmd = "$1") =~ s/^(.*)$/### $1/mg ;
454 4 100 66     221 if ($cmd =~ /(?:^|;)\s*(?:print|error)\(/ or $userfun and $cmd =~ / \b ($userfun) \s* \( /x) {
      100        
455 3         6 my $with = '';
456 3 50       119 if ($cmd =~ /^\s*(\w+)\s*\($matched_par\)\s*=(?!=)/) {
457 3         11 $with = "with a user function $1() ";
458 3 100       5 if (defined $userfun) {
459 2         4 $userfun .= "|$1";
460             } else {
461 1         2 $userfun = $1;
462             }
463             }
464 3         82 print "${Pref}ok $current_num # Skipping (no-echo group ${with}containing print() or error() or a converted-to-Perl variable)\n";
465             } else {
466 1         12 print("# The following `? ' are the output from parse_as_gp() for\n$Pref");
467 1         4 my $Err;
468 1 50   1   2 eval { parse_as_gp $cmd, sub ($) {"main::".CORE::shift}, 'echo'; 1}
  1         11  
  1         11  
  1         5  
469             or $Err = $@;
470             # next # fail to process, but do emit the expected-for-test output
471 1 50       4 if (defined $Err) {
472 0         0 print "# `$in'\nnot ok $current_num # in no-echo group err=$Err\n";
473             } else {
474 1         32 print "# `$in'\nok $current_num # Skipping translation to Math::Pari (no-echo group done in PARI, see above)\n";
475             }
476             }
477 4         17 $RET = 1;
478             } else {
479 0         0 warn("Cannot find a matching echo-on command in input file"),
480             }
481             } else {
482 0         0 warn("Cannot find a matching echo-off command in input file"),
483             }
484             } else {
485             # It is not clear why changevar gives a different answer in GP
486 33         3970 print "# `$in'\nok $current_num # Skipping (converting test for '$1' needs additional work)\n";
487 33         157 $RET = 1;
488             }
489             } elsif ($userfun
490             and $in =~ / \b ($userfun) \s* \( /x) {
491 30         2066 print "# `$in'\nok $current_num # Skipping (user function containing print() or error() $or_matrix_out or a converted-to-Perl variable)\n";
492 30         96 $RET = 1;
493             } elsif ($installed
494             and $in =~ / \b ($installed) \s* \( /x) {
495 0         0 print "# `$in'\nok $current_num # Skipping (installed function)\n";
496 0         0 $RET = 1;
497             # } elsif ($in =~ / \b ( sizebyte ) \b /x
498             # and $file !~ /will_fail/) {
499             # # XXXX Will result in a wrong answer, but we moved these tests to a different
500             # print "# `$in'\nok $current_num # Skipping (would fail, checked in different place)\n";
501             # $RET = 1;
502             } elsif ($in =~ /\b(nonesuch now|nfisincl$or_matrix)\b/) {
503 14         1719 print "# `$in'\nok $current_num # Skipping (possibly FATAL $1)\n";
504 14         45 $RET = 1;
505             } elsif ($in =~ /\$?\b($skipvars_rx)\b/) {
506 4         115 print "# `$in'\nok $current_num # Skipping (a variable `$1' was possibly defined in a skipped statement)\n";
507 4         17 $RET = 1;
508             } elsif ($in =~ $skip_fun_rx) {
509 0         0 print "# `$in'\nok $current_num # Skipping (see a PARI function $1() calling print() or error())\n";
510 0         0 $RET = 1;
511             }
512             # Convert transposition
513 880         1552 $in =~ s/(\$?\w+(\([^()]*\))?|\[([^\[\]]+(?=[\[\]])|\[[^\[\]]*\])*\])~/mattranspose($1)/g;
514             # Convert strings with a simple word
515 880 100       1945 $in =~ s/("\w+")/'$1'/g unless $in =~ /\b(my_)?print\b/; # XXX Silly ad hoc trick (temporary???)
516 880 50       1527 if ($in =~ /~/) {
517 0         0 print "# `$in'\nok $current_num # Skipping (transpose notation)\n";
518 0         0 $RET = 1;
519             }
520 880 100       1336 if ($in =~ /->/) {
521 3         84 print "# `$in'\nok $current_num # Skipping (-> notation)\n";
522 3         10 $RET = 1;
523             }
524 880 100       1213 if ($RET) {
525 109         451 while ($in =~ /(?:^|;)\$?(\w+)=(?!=)/g) {
526 9         44 $skipvars_rx .= "|$1";
527             }
528             }
529 880 100 100     1655 if ($RET and $in =~ /(?:^|;)\$?(\w+)\([^()]*\)=(?!=)/) {
530 26         64 my $n = $1;
531 26 100       519 if ($in =~ /\b(print|error|$ourvars_rx)\b/) {
532 4         10 push @skip_fun, $n;
533 4         14 my $rx = join '|', @skip_fun;
534 4         48 $skip_fun_rx = qr/\b($rx)\(/;
535 4 50       13 if ($1 eq 'print') {
536 0         0 print "# NOT doing PARI-eval: print() seen\n";
537             } else {
538 4         394 print "# NOT doing PARI-eval: variable `$1' converted to Perl before was seen\n";
539             }
540 4 100       24 if (defined $userfun) {
541 2         8 $userfun .= "|$n";
542             } else {
543 2         4 $userfun = $n;
544             }
545 4         25 return;
546             }
547 22         1884 print "# doing PARI-eval of a function `$n' instead\n";
548 22         1761 PARI $IN;
549 242     242   2345 no strict 'refs';
  242         409  
  242         22122  
550 22         166 *$n = Math::Pari::__wrap_PARI_macro $n;
551             }
552 876 100       1598 return if $RET;
553 771 100       1245 if ($in =~ /^\s*alias\s*\(\s*(\w+)\s*,\s*(\w+)\s*\)$/) {
554 1         22 print "# Aliasing `$1' ==> `$2'\nok $current_num\n";
555 242     242   1344 no strict 'refs';
  242         476  
  242         966799  
556 1         3 *$1 = \&{$2};
  1         9  
557 1         6 return;
558             }
559 770 100       4436 if ($in !~ /\w\(/) { # No function calls
    100          
560             # XXXX Primitive!
561             # Constants: (.?) eats following + or - (2+3 ==> PARI(2)+PARI(3))
562 36         519 $in =~ s/(^|\G|\W)([-+]?)(\d+(\.\d*)?(?:e-?\d+)?)(.?)/$1 $2 PARI($3) $5/gi;
563             # Big integer constants:
564 36         116 $in =~ s/\bPARI\((\d{10,})\)/PARI('$1')/g;
565             } elsif ($in =~ /\b(elllseries|binomial|mathilbert|intnum|intfuncinit|intfuncinit)\b|\bint\w/) { # high precision needed?
566             # XXXX Primitive!
567             # Substitute constants where they are not arguments to functions,
568             # (except small half-integers, which should survive conversion)
569 86         234 $in =~ s/(^|\G|[^\w''])([-+]?)(?!\d{0,6}\.5\b)(\d+\.\d*(?:e-?\d+)?)/$1 $2 PARI('$3') /gi;
570             # The precision of 4.5 in intfuncinit(t=[-oo, 4.5],[oo, 4.5], gamma(2+I*t)^3, 1) may be less than current precision;
571 86 100       363 $in =~ s/(^|\G|[^\w''])([-+]?)(\d+\.\d*(?:e-?\d+)?)/$1 $2 PARI('$3') /gi
572             if $in =~ /\bint\w/;
573 86         444 $in =~ s/((?
574             # Big integer constants:
575 86         194 $in =~ s/\bPARI\((\d{10,})\)/PARI('$1')/g;
576             } else {
577             # Substitute big integer constants
578 648         3146 $in =~ s/(^|\G|\W)(\d{10,}(?!\.\d*(?:e-?\d+)?))(.?)/$1 PARI('$2') $3/gi;
579             # Substitute division
580 648         1129 $in =~ s/(^|[\-\(,\[=+*\/])(\d+)\s*\/\s*(\d+)(?=$|[*+\-\/\),\]])/$1 PARI($2)\/PARI($3) /g;
581             }
582 770         900 my %seen_now;
583             # Substitute i= in loop commands
584 770 100       2204 if ($in !~ /\b(hermite|mathnf|until)\s*\(/) { # Special case, not loop-with-=
585 749         1953 $in =~ s/([\(,])(\w+)=(?!=)/ $seen_now{$2} = '$'; "$1$2," /ge;
  103         368  
  103         379  
586             }
587             # Substitute print
588 770         974 $in =~ s/\b(|p|tex)print(tex|)\(/ 'my_' . $1 . $2 . 'print(1,' /ge;
  18         61  
589 770         836 $in =~ s/\b(|p|tex)print1\(/ 'my_' . $1 . 'print(0,'/ge;
  6         16  
590 770 100 66     2437 if ($skip_eval and $in =~ /\beval\(/g) { # eval($y)
591 1         18 print("# `$in'\nok $current_num # Skipping: eval's signature C is not supported yet\n"), return;
592             }
593 769         1447 $in =~ s/\b(eval|shift|sort)\(/&$1\(/g; # eval($y)
594             # Special case -oo (with $oo=[PARI(1)] done earlier;
595             # Having $oo defined without external PARI tests conversions; but it'sn't overloaded in older PARI
596 769 50 33     3235 $in =~ s/-oo\b/- PARI(\$oo)/ if $seen_now{oo} or Math::Pari::pari_version_exp < 2009000;
597             # Recognize variables and prepend $ in assignments
598             # s/\b(direuler\s*\(\s*\w+\s*),/$1=/; # direuler
599 769 100       1398 $in =~ s/\bX\b/PARIvar("X")/g if $in =~ /\bdireuler\b/;
600 769         4270 $in =~ s/(^\s*|[;(]\s*)(?=(\w+)\s*=\s*)/$seen_now{$2} = '$'; pre_update_seen($2); $1 . '$'/ge; # Assignment
  92         291  
  92         203  
  92         981  
601 769 100       1427 if ($in =~ /\.((?!\d|(?<=\d\.)e-?\d)\w+(?![\w"]))/) {
602 16         2231 print("# `$in'\nok $current_num # Skipping: methods not supported yet (.$1)\n"), return;
603             }
604 753 100       1150 if ($in =~ /(?
605 1         38 print("# `$in'\nok $current_num # Skipping: |var<- not supported yet\n"), return;
606             }
607             # Prepend $ to variables (not before '^' - inside of 'o(x^17)'):
608 752         4170 $in =~ s/(^|[^\$])\b([a-zA-Z]\w*)\b(?!\s*[\(^])/
609 1178   100     6771 ($1 || '') . ($seen{$2} || $seen_now{$2} || '') . $2
      100        
610             /ge;
611             # Skip if did not substitute variables:
612 752         5044 while ($in =~ /(^|[^\$])\b([a-zA-Z]\w*)\b(?!\s*[\{\(^])/g) {
613             print("# `$in'\nok $current_num # Skipping: variable `$2' was not set\n"), return
614 229 100 66     3608 unless $seen{$2} and $seen{$2} eq ' ' or $in =~ /\"/;
      100        
615             # Let us hope that lines which contain '"' do not contain unset vars
616             }
617             # Simplify for the following conversion:
618 718         1025 $in =~ s/\brandom\(\)/random/g;
619             # Sub-ify sum,prod,intnum* sumnum etc, psploth, ploth etc
620 718         1806 my $oneArg = qr/(?: # 3 levels of parentheses supported
621             [^(,)\[\]]+
622             (?=
623             [(,)\[\]]
624             )
625             |
626             \( # One level of parenths
627             (?:
628             [^()]+
629             (?=
630             [()]
631             )
632             |
633             \( # Second level of parenths
634             (?:
635             [^()]+
636             (?=
637             [()]
638             )
639             | \( [^()]* \) # Third level of parens
640             )*
641             \) # Second level of parenths ends
642             )*
643             \)
644             |
645             \[ # One level of brackets
646             (?:
647             [^\[\]]+
648             (?=
649             [\[\]]
650             )
651             |
652             \[ [^\[\]]+ \] # Second level of brackets
653             )*
654             \]
655             )* # 3 levels of parenths supported
656             /x;
657 718         17865 1 while
658             $in =~ s/ (
659             \b
660             (?:
661             (?: # For these, sub{}ify the fourth argument
662             sum
663             |
664             intnum(?!init\b)\w*
665             |
666             intfuncinit
667             |
668             int\w*inv
669             |
670             intcirc\w*
671             |
672             sumnum(?!init\b)\w*
673             |
674             forprime
675             |
676             psploth
677             |
678             ploth
679             |
680             prod (?: euler )?
681             |
682             direuler
683             ) \s*
684             \( (?: $oneArg [=,] ){3} # $x,1,100
685             | (?: # For these, sub{}ify the third argument
686             sumalt
687             |
688             prodinf
689             ) \s*
690             \( (?: $oneArg [=,] ){2} # $x,1
691             | (?: # For these, sub{}ify the fifth argument
692             plothexport
693             ) \s*
694             \( (?: $oneArg [=,] ){4} # "ps",$x,100
695             | ( # 2: For these, sub{}ify the last argument
696             solve
697             |
698             (?:
699             post
700             )?
701             ploth (?! raw (?:export)? \b | sizes \b | export \b ) \w+
702             |
703             # sum \w*
704             sum (?! alt | num (?:init)? \b) \w+
705             |
706             v? vector v?
707             |
708             matrix
709             |
710             intgen
711             |
712             intopen
713             |
714             for \w*
715             ) \s*
716             \( (?: $oneArg , )* # "ps",$x,1,100; do not accept "=" after the iterator variable
717             )
718             ) # end group 1
719             (?!\s*sub(?:\s*\(\$*\))?\s*\{) # Skip already converted...
720             ( $oneArg ) # 3: This follows after a comma on toplevel
721             (?(2) (?= \) ) | (?= [),] ) )
722 128         553 /subify_iterators("$1","$3")/xge;
723             # Convert 10*20 to integer
724 718         1986 $in =~ s/(\d+)(?=\*\*\d)/ PARI($1) /g;
725             # Convert blah[3], blah()[3] to blah->[-1+3]
726 718         1063 $in =~ s/([\w\)])\[/$1 -> [-1+/g;
727             # Fix [,3] converted to [-1+,3]
728 718         883 $in =~ s/\[-1\+,/\[-1+/g;
729             # Fix [2,3] converted to [-1+2,3]
730 718         873 $in =~ s/\[(-1\+[^,\[\]\(\)]+),([^\(\)\[\]]+)\]/\[-1+$2\]\[$1\]/g;
731             # Workaround for &eval test:
732 718         757 $in =~ s/\$y=\$x;&eval\b(.*)/PARI('y=x');&eval$1;\$y=\$x/;
733 718         709 $in =~ s/\$yy=\$xx;&eval\b(.*)/PARI('yy=xx');&eval$1;\$yy=\$xx/;
734             # Workaround for hardly-useful support for &:
735 718 100       1076 if ($in =~ s/([,\(]\s*)&(\$(\w+)\s*)(?=[,\)])/$1$2/) {
736             #$in = qq(\$$3 = PARI "'$3"; \$OUT = do { $in }; \$$3 = PARI "$3"; \$OUT)
737             }
738             # Workaround for kill:
739 718         706 $in =~ s/^kill\(\$(\w+)\);/kill('$1');\$$1=PARIvar '$1';/;
740             # Workaround for plothsizes:
741 718         767 $in =~ s/\bplothsizes\(/safe_sizes(/;
742             # XXXX Silly workaround for `my' (probably a side effect of replacing "var=" by "var," in iterators???)
743 718         2118 $in =~ s/(?<=\bmy\(\$)(\w+),(?=\w+\()/$1)=(/g;
744 718 100       40423 print "# eval", ($noans ? "-$noans" : '') ,": $in\n";
745 718         2213 $printout = '';
746 718   100     8131 my $have_floats = ($in =~ /\d+\.\d*|\d{10,}/
747             or $in =~ /\b( ellinit|zeta|bin|comprealraw|frac|
748             lseriesell|powrealraw|legendre|suminf|
749             forstep )\b/x);
750 718         757 my $newvars;
751 718   66     2352 $ourvars{$1}++ or $newvars++ while $in =~ /(?
752 718 100       1051 if ($newvars) {
753 57         394 $ourvars_rx = join '|', sort keys %ourvars;
754 57         1725 $ourvars_rx = qr($ourvars_rx);
755             }
756             # Remove the value from texprint:
757             # pop @$out if $in =~ /texprint/ and @$out == 2;
758 718         1005 my $pre_time = time() - $ini_time;
759 718         50802 $res = eval "$in";
760 718         4232 my $run_time = time() - $ini_time - $pre_time;
761 718         912 $rres = $res;
762 718 100 100     122323 $rres = pari_print $res if defined $res and ref $res;
763 718         976 my $re_out;
764 718 100       1170 if ($doprint) {
765 14 50       33 if ($in =~ /my_texprint/) { # Special-case, assume one wrapped with \n
766 0         0 $rout = join "", @$out, "\t";
767             } else {
768 14         38 $rout = join "\t", @$out, "";
769             }
770 14 100       33 if ($have_floats) {
771 1         4 $printout = massage_floats $printout, "14f";
772 1         4 $rout = massage_floats $rout, "14f";
773             }
774             # New wrapping code gets in the way:
775 14         90 $printout =~ s/\s+/ /g;
776 14         26 $rout =~ s/\t,/,/g;
777 14         104 $rout =~ s/\s+/ /g;
778              
779 14         30 $rout =~ s/,\s*/, /g;
780 14         24 $printout =~ s/,\s*/, /g;
781 14         73 $rout =~ s/\s*([-+])\s*/ $1 /g;
782 14         56 $printout =~ s/\s*([-+])\s*/ $1 /g;
783             } else {
784             # Special-case several tests in all.t
785 704 100 100     3785 if (($have_floats or $in =~ /^(sinh?|solve)\b/) and ref $res) {
      100        
786             # do it the hard way: we cannot massage floats before doing wrapping
787 69         279 $rout = mformat @$out;
788 69 50 33     407 if (defined $rres and $rres !~ /\n/) {
789 69         174 $rout =~ s/\]\s*\[/; /g;
790 69         122 $rout =~ s/\[\s+/[/g;
791 69         93 $rout =~ s/,\n/, \n/g; # Spaces were removed
792 69         196 $rout =~ s/\n//g; # Long wrapped text
793             }
794 69 100 100     341 if ($rout =~ /\[.*[-+,;]\s/ or $rout =~ /\bQfb\b/) {
795 22         507 $rout =~ s/,*\s+/ /g;
796 22 50       399 $rres =~ s/,*\s+/ /g if defined $res;
797 22 50       135 $rres =~ s/,/ /g if defined $res; # in 2.2.10 ", "
798 22         63 $rout =~ s/;\s*/; /g; # in 2.2.10 "; "
799 22 50       129 $rres =~ s/;\s*/; /g if defined $res; # in 2.2.10 "; "
800             }
801 69 100       344 if ($in =~ /\b(zeta|bin|comprealraw|frac|lseriesell|powrealraw|pollegendre|legendre|suminf|ellinit)\b/) {
802 14         49 $rres = massage_floats $rres, "14f";
803 14         29 $rout = massage_floats $rout, "14f";
804             } else {
805 55         145 $rres = massage_floats $rres;
806 55         134 $rout = massage_floats $rout;
807             }
808 69         305 $rout =~ s/\s*([-+])\s*/$1/g;
809 69 50       332 $rres =~ s/\s*([-+])\s*/$1/g if defined $res;
810             } else {
811 635         1457 $re_out = re_format @$out;
812             # $rout = mformat @$out;
813             # if (defined $rres and $rres !~ /\n/) {
814             # $rout =~ s/\]\s*\[/; /g;
815             # $rout =~ s/,\n/, \n/g; # Spaces were removed
816             # $rout =~ s/\n//g; # Long wrapped text
817             # }
818             # if ($rout =~ /\[.*[-+,;]\s/) {
819             # $rout =~ s/,*\s+/ /g;
820             # $rres =~ s/,*\s+/ /g if defined $res;
821             # }
822             # $rout =~ s/\s*([-+])\s*/$1/g;
823             # $rres =~ s/\s*([-+])\s*/$1/g if defined $res;
824             }
825             }
826              
827 718 100       1261 if ($@) {
828 19 50 33     177 if ($@ =~ /^Undefined subroutine &main::(\w+)/
    50 33        
    50 0        
    0          
829             and $not_yet_defined{$1}) {
830 0         0 print "# in='$in'\nok $current_num # Skipped: `$1' is known to be undefined\n";
831             } elsif ($@ =~ /high resolution graphics disabled/
832             and 0 >= Math::Pari::have_graphics()) {
833 0         0 print "# in='$in'\nok $current_num # Skipped: graphic is disabled in this build\n";
834             } elsif ($@ =~ /pari_daemon without waitpid & setsid is not yet implemented/) {
835 19         465 print "# in='$in'\nok $current_num # Skipped: graphic (pari_daemon) is disabled in this build\n";
836             } elsif ($@ =~ /gnuplot-like plotting environment not loaded yet/
837             and $skip_gnuplot) {
838 0         0 print "# in='$in'\nok $current_num # Skipped: Term::Gnuplot is not loaded\n";
839             } else { # XXXX Parens needed???
840 0         0 nok_print( $current_num, $in, "not ok $current_num # in='$in', err='$@'\n" );
841             }
842 19         242 return;
843             }
844 699         737 my $cmp;
845 699 100 100     1846 if (defined $rres and defined $re_out) {
846 561         921 for my $how (0,'Mat') {
847 610         686 my $RR = $rres;
848 610 100       2850 $RR =~ s/\bMat\(($matched_par)\)/[$1]/g if $how;
849 610         692 $cmp = eval { $RR =~ /^$re_out$/ };
  610         17754  
850 610 50 33     1423 if ($@ and $@ =~ /regexp too big/) {
851 0         0 print "ok $current_num # Skipped: $@\n";
852 0         0 update_seen \%seen_now;
853 0         0 $prev = $res;
854 0         0 return;
855             }
856 610 100       1141 last if $cmp
857             }
858             }
859 699         1005 my $post_time = time() - $ini_time - $pre_time - $run_time;
860 699 50 100     4528 if (not $noans and defined $re_out
    100 33        
    50 66        
    50 100        
      33        
      66        
      66        
861             and (not defined $rres or not $cmp)) {
862 0         0 $out->[0] =~ s/\n/\t/g; # @$out usually has 1 elt
863 0         0 nok_print $current_num, $in, "not ok $current_num # in='$in'\n# out='", $rres, "', type='", ref $res,
864             "'\n# pari==='", join("\t", @$out), "'\n# re_out='$re_out'\n";
865             } elsif (not $noans and defined $re_out) {
866 515         46345 print "ok $current_num # run_time=$run_time, post_time=$post_time, pre_time=$pre_time\n";
867 515         2306 update_seen \%seen_now;
868 515         5108 $prev = $res;
869             } elsif (not $noans and (not defined $rres or filter_res $rres ne filter_res $rout)) {
870 0         0 nok_print $current_num, $in, "not ok $current_num # in='$in'\n# out='", $rres, "', type='", ref $res,
871             "'\n# expect='$rout'\n";
872             } elsif ($doprint and $printout ne $rout) {
873 0         0 nok_print $current_num, $in, "not ok $current_num # in='$in'\n# printout='", $printout,
874             "'\n# expect='$rout', type='", ref $res,"'\n";
875             } else {
876 184         17042 print "ok $current_num # run_time=$run_time, post_time=$post_time, pre_time=$pre_time\n";
877 184         899 update_seen \%seen_now;
878 184         2470 $prev = $res;
879             }
880             }
881             }
882              
883             sub process_error {
884 37     37   94 my ($in, $out, $error) = @_;
885 37         50 $current_num++;
886 37         2761 print("# `$in'\nok $current_num # Skipping: test producing PARI error unsupported yet (err=$error)\n");
887             }
888              
889             sub process_definition {
890 0     0   0 my ($name, $def) = @_;
891 0         0 $current_num++;
892 0         0 eval "PARI('$def'); import Math::Pari $name;";
893 0 0       0 if ($@) {
894 0         0 chomp $@;
895 0         0 print("not ok $current_num # definition: `$def' error `$@'\n");
896             } else {
897 0         0 print("# definition $current_num: `$def'\nok $current_num\n");
898             }
899             }
900              
901             sub process_set {
902 0     0   0 my ($in, $out) = @_;
903 0 0       0 return process_test("setprecision($1)", 'noans', []) if $in =~ /^\\p\s*(\d+)$/;
904 0         0 $current_num++;
905 0         0 print("# `$in'\nok $current_num # Skipping setting test\n");
906             }
907              
908             sub process_print {
909 5     5   19 my ($in, @out) = @_;
910 5         6 $current_num++;
911 5         271 print("# $current_num: `$in'\nok $current_num # Skipping plot() - can't test it yet\n");
912             }
913              
914             sub process_multi {
915 0     0   0 my ($in, $out) = @_;
916 0         0 my @out = @$out;
917 0         0 $current_num++;
918 0         0 print("# `$in'\nok $current_num # Skipping multiline\n");
919             }
920              
921             sub my_print {
922 124     124   147 my $nl = CORE::shift;
923 124 100       139 @_ = map {(ref) ? (pari_print $_) : $_} @_;
  229         819  
924 124         217 $printout .= join '', @_;
925 124 100       171 $printout .= "\t" if $nl;
926 124         1674 return;
927             }
928              
929             sub my_pprint {
930 0     0   0 my $nl = CORE::shift;
931 0 0       0 @_ = map {(ref) ? (pari_pprint $_) : $_} @_;
  0         0  
932 0         0 $printout .= join '', @_;
933 0 0       0 $printout .= "\t" if $nl;
934 0         0 return;
935             }
936              
937             sub my_texprint {
938 0     0   0 my $nl = CORE::shift;
939 0 0       0 @_ = map {(ref) ? (pari_texprint $_) : $_} @_;
  0         0  
940 0         0 $printout .= join '', @_;
941 0 0       0 $printout .= "\t" if $nl;
942 0         0 return;
943             }
944              
945             sub prec {
946 12     12   93 setprecision($_[0]);
947 12         882 print "# Setting precision to $_[0] digits.\n";
948 12 50       1027 print "ok $current_num\n" unless $_[1];
949             }
950             sub bprec {
951 1     1   63 PARI("default(realbitprecision,$_[0])"); # setbitprecision($_[0]);
952 1         116 print "# Setting bitprecision to $_[0] bits.\n";
953 1         128 print "# bitprecision: res=", PARI("default(realbitprecision)"),"\n";
954 1 50       131 print "ok $current_num\n" unless $_[1];
955             }
956             sub sprec {
957 1     1   8 setseriesprecision($_[0]);
958 1         9 print "# Setting series precision to $_[0] digits.\n";
959 1         12 print "ok $current_num\n";
960             }
961              
962             # *Need* to convert to PARI, otherwise the arithmetic will propagate
963             # the values to floats
964              
965 2 50   2   3 sub safe_sizes { eval {plothsizes()} or PARI [1000,1000,20,20,20,20]}
  2         241