File: arith.t

package info (click to toggle)
libmath-matrixreal-perl 2.13-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,120 kB
  • sloc: perl: 2,837; makefile: 8
file content (25 lines) | stat: -rw-r--r-- 613 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use Test::More tests => 4;
use File::Spec;
use lib File::Spec->catfile("..","lib");
use Math::MatrixReal;

do 'funcs.pl';

$matrix = Math::MatrixReal->new_random(20);
$matrix2 = $matrix->shadow();
$matrix2->one();
$matrix3 = $matrix;

ok_matrix( $matrix * 2 , $matrix + $matrix, ' twice a = a + a ' );

$matrix3 -= $matrix2;
ok_matrix( $matrix3 + $matrix2, $matrix, ' subtraction undoes addition' );

$matrix3 = $matrix;
$matrix3 += $matrix2;
ok_matrix($matrix3 - $matrix2, $matrix, ' addition undoes subtraction' );

$matrix3 = $matrix;
$matrix3 *= 5;
ok_matrix( $matrix3, $matrix * 5, 'overloaded *= works' );