BEGIN {
chdir 't' if -d 't';
- unshift @INC, '../lib';
+ @INC = '../lib';
}
use Math::Complex;
-my $VERSION = sprintf("%s", q$Id: complex.t,v 1.9 1998/11/01 00:00:00 dsl Exp $ =~ /(\d+\.d+)/);
+use vars qw($VERSION);
+
+$VERSION = 1.91;
my ($args, $op, $target, $test, $test_set, $try, $val, $zvalue, @set, @val);
test_broot(qw(-3 -2.1 0 0.99));
sub test_display_format {
+ $test++;
+ push @script, <<EOS;
+ print "# package display_format cartesian?\n";
+ print "not " unless Math::Complex->display_format eq 'cartesian';
+ print "ok $test\n";
+EOS
+
push @script, <<EOS;
my \$j = (root(1,3))[1];
$test++;
push @script, <<EOS;
- print "# display_format polar?\n";
+ print "# j display_format polar?\n";
print "not " unless \$j->display_format eq 'polar';
print "ok $test\n";
EOS
$test++;
push @script, <<EOS;
print "# j = \$j\n";
- print "not " unless "\$j" =~ /^-0(?:\\.50000\\d+\\|\\.49999\\d+)+0.86602540\\d+i\$/;
+ print "not " unless "\$j" =~ /^-0(?:\\.5(?:0000\\d+)?|\\.49999\\d+)\\+0.86602540\\d+i\$/;
print "ok $test\n";
\$j->display_format('style' => 'polar', 'polar_pretty_print' => 0);
\$j->display_format('style' => 'cartesian', 'format' => '(%.5g)');
EOS
+
$test++;
push @script, <<EOS;
print "# j = \$j\n";
print "not " unless "\$j" eq "(-0.5)+(0.86603)i";
print "ok $test\n";
EOS
+
+ $test++;
+ push @script, <<EOS;
+ print "# j display_format cartesian?\n";
+ print "not " unless \$j->display_format eq 'cartesian';
+ print "ok $test\n";
+EOS
}
test_display_format();