File tree Expand file tree Collapse file tree 1 file changed +33
-11
lines changed
Expand file tree Collapse file tree 1 file changed +33
-11
lines changed Original file line number Diff line number Diff 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 ()
You can’t perform that action at this time.
0 commit comments