Skip to content

Commit 121b7b9

Browse files
committed
Increase test coverage.
1 parent d7d253f commit 121b7b9

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

tests/MatrixTest.php

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,41 @@ private function buildMatrix()
1313
]);
1414
}
1515

16+
public function testProperties()
17+
{
18+
$matrix = $this->buildMatrix();
19+
20+
static::assertEquals(4, $matrix->columns);
21+
static::assertEquals(3, $matrix->rows);
22+
static::assertNull($matrix->fubar);
23+
}
24+
1625
public function testBadConstruction()
1726
{
18-
try {
19-
new Matrix([
20-
[1, 2, 3, 4],
21-
[5, 6, 7],
22-
[9, 10],
23-
]);
24-
} catch (MatrixException $exception) {
25-
return;
26-
}
27-
28-
$this->fail('MatrixException not raised.');
27+
$this->setExpectedException(MatrixException::class);
28+
29+
new Matrix([
30+
[1, 2, 3, 4],
31+
[5, 6, 7],
32+
[9, 10],
33+
]);
34+
}
35+
36+
public function testEmptyRows()
37+
{
38+
$this->setExpectedException(MatrixException::class);
39+
40+
new Matrix([]);
41+
}
42+
43+
public function testEmptyColumns()
44+
{
45+
$this->setExpectedException(MatrixException::class);
46+
47+
new Matrix([
48+
[],
49+
[],
50+
]);
2951
}
3052

3153
public function testSize()

0 commit comments

Comments
 (0)