Skip to content

Commit fe88247

Browse files
committed
Test adding matrices of the wrong size.
1 parent e5290e1 commit fe88247

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/MatrixTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ public function testAddMatrix()
134134
static::assertEquals(11, $added->get(2, 2));
135135
}
136136

137+
public function testAddMatrixWrongSizes()
138+
{
139+
$matrix1 = $this->buildMatrix();
140+
141+
$matrix2 = new Matrix([
142+
[4, 2, 6],
143+
[1, 7, 3],
144+
[7, 3, 2],
145+
]);
146+
147+
static::expectException(MatrixException::class);
148+
149+
$matrix1->addMatrix($matrix2);
150+
}
151+
137152
public function testAddScalar()
138153
{
139154
$matrix = new Matrix([

0 commit comments

Comments
 (0)