Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: e6befbee45
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (29 sloc) 1.232 kb
use Test::More tests => 3;
use File::Spec;
use lib File::Spec->catfile("..","lib");
use Math::MatrixReal;
do 'funcs.pl';
my $matrix = Math::MatrixReal->new_diag([1,2,3,4]);
$matrix->display_precision(5);
my $correct = Math::MatrixReal->new_from_string(<<END);
[ 1.00000 0.00000 0.00000 0.00000 ]
[ 0.00000 2.00000 0.00000 0.00000 ]
[ 0.00000 0.00000 3.00000 0.00000 ]
[ 0.00000 0.00000 0.00000 4.00000 ]
END
$correct->display_precision(5);
ok( "$matrix" eq "$correct", 'display_precision(n)' );
$matrix->display_precision(0);
$correct = Math::MatrixReal->new_from_string(<<END);
[ 1 0 0 0 ]
[ 0 2 0 0 ]
[ 0 0 3 0 ]
[ 0 0 0 4 ]
END
$correct->display_precision(0);
ok( "$matrix" eq "$correct", 'display_precision(0)' );
{
assert_dies ( sub { Math::MatrixReal->new(5,5)->display_precision(-42) },
'display_precision dies on negative arg, matey!'
);
}
Jump to Line
Something went wrong with that request. Please try again.