Skip to content

Commit f9fcd2f

Browse files
committed
Bring coverage up to 100%.
1 parent a669580 commit f9fcd2f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/LUDecompTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,44 @@ private function buildMatrix()
1818
]);
1919
}
2020

21+
public function testNonSquare()
22+
{
23+
static::setExpectedException(MatrixException::class);
24+
25+
new LUDecomposition(new Matrix([[1, 2, 3]]));
26+
}
27+
28+
public function testSingularByZeroes()
29+
{
30+
static::setExpectedException(MatrixException::class);
31+
32+
new LUDecomposition(new Matrix([
33+
[0, 0],
34+
[0, 0],
35+
]));
36+
}
37+
38+
public function testWrongSizeKnowns()
39+
{
40+
$matrix = $this->buildMatrix();
41+
$decomp = new LUDecomposition($matrix);
42+
43+
static::setExpectedException(MatrixException::class);
44+
45+
$decomp->solve([1]);
46+
}
47+
48+
public function testSingularByDiagonal()
49+
{
50+
static::setExpectedException(MatrixException::class);
51+
52+
new LUDecomposition(new Matrix([
53+
[1, -1, 2],
54+
[1, 0, 1],
55+
[2, 3, -1],
56+
]));
57+
}
58+
2159
public function testLUDecompConstructor()
2260
{
2361
$matrix = $this->buildMatrix();

0 commit comments

Comments
 (0)