1+ using NUnit . Framework ;
2+
3+ public class MatrixTest
4+ {
5+ [ TestCase ( "1" , ExpectedResult = new [ ] { 1 } ) ]
6+ [ TestCase ( "4 7" , ExpectedResult = new [ ] { 4 , 7 } , Ignore = "Remove to run test case" ) ]
7+ [ TestCase ( "1 2\n 10 20" , ExpectedResult = new [ ] { 1 , 2 } , Ignore = "Remove to run test case" ) ]
8+ [ TestCase ( "9 7 6\n 8 6 5\n 5 3 2" , ExpectedResult = new [ ] { 9 , 7 , 6 } , Ignore = "Remove to run test case" ) ]
9+ public int [ ] Extract_first_row ( string input )
10+ {
11+ var matrix = new Matrix ( input ) ;
12+ return matrix . Row ( 0 ) ;
13+ }
14+
15+ [ TestCase ( "5" , ExpectedResult = new [ ] { 5 } , Ignore = "Remove to run test case" ) ]
16+ [ TestCase ( "9 7" , ExpectedResult = new [ ] { 9 , 7 } , Ignore = "Remove to run test case" ) ]
17+ [ TestCase ( "9 8 7\n 19 18 17" , ExpectedResult = new [ ] { 19 , 18 , 17 } , Ignore = "Remove to run test case" ) ]
18+ [ TestCase ( "1 4 9\n 16 25 36\n 5 6 7" , ExpectedResult = new [ ] { 5 , 6 , 7 } , Ignore = "Remove to run test case" ) ]
19+ public int [ ] Extract_last_row ( string input )
20+ {
21+ var matrix = new Matrix ( input ) ;
22+ return matrix . Row ( matrix . Rows - 1 ) ;
23+ }
24+
25+ [ TestCase ( "55 44" , ExpectedResult = new [ ] { 55 } , Ignore = "Remove to run test case" ) ]
26+ [ TestCase ( "89 1903\n 18 3" , ExpectedResult = new [ ] { 89 , 18 } , Ignore = "Remove to run test case" ) ]
27+ [ TestCase ( "1 2 3\n 4 5 6\n 7 8 9\n 8 7 6" , ExpectedResult = new [ ] { 1 , 4 , 7 , 8 } , Ignore = "Remove to run test case" ) ]
28+ public int [ ] Extract_first_column ( string input )
29+ {
30+ var matrix = new Matrix ( input ) ;
31+ return matrix . Col ( 0 ) ;
32+ }
33+
34+ [ TestCase ( "28" , ExpectedResult = new [ ] { 28 } , Ignore = "Remove to run test case" ) ]
35+ [ TestCase ( "13\n 16\n 19" , ExpectedResult = new [ ] { 13 , 16 , 19 } , Ignore = "Remove to run test case" ) ]
36+ [ TestCase ( "289 21903 23\n 218 23 21" , ExpectedResult = new [ ] { 23 , 21 } , Ignore = "Remove to run test case" ) ]
37+ [ TestCase ( "11 12 13\n 14 15 16\n 17 18 19\n 18 17 16" , ExpectedResult = new [ ] { 13 , 16 , 19 , 16 } , Ignore = "Remove to run test case" ) ]
38+ public int [ ] Extract_last_column ( string input )
39+ {
40+ var matrix = new Matrix ( input ) ;
41+ return matrix . Col ( matrix . Cols - 1 ) ;
42+ }
43+
44+ [ TestCase ( "28" , ExpectedResult = 1 , Ignore = "Remove to run test case" ) ]
45+ [ TestCase ( "13\n 16" , ExpectedResult = 2 , Ignore = "Remove to run test case" ) ]
46+ [ TestCase ( "289 21903\n 23 218\n 23 21" , ExpectedResult = 3 , Ignore = "Remove to run test case" ) ]
47+ [ TestCase ( "11 12 13\n 14 15 16\n 17 18 19\n 18 17 16" , ExpectedResult = 4 , Ignore = "Remove to run test case" ) ]
48+ public int Number_of_rows ( string input )
49+ {
50+ var matrix = new Matrix ( input ) ;
51+ return matrix . Rows ;
52+ }
53+
54+ [ TestCase ( "28" , ExpectedResult = 1 , Ignore = "Remove to run test case" ) ]
55+ [ TestCase ( "13 2\n 16 3\n 19 4" , ExpectedResult = 2 , Ignore = "Remove to run test case" ) ]
56+ [ TestCase ( "289 21903\n 23 218\n 23 21" , ExpectedResult = 2 , Ignore = "Remove to run test case" ) ]
57+ [ TestCase ( "11 12 13\n 14 15 16\n 17 18 19\n 18 17 16" , ExpectedResult = 3 , Ignore = "Remove to run test case" ) ]
58+ public int Number_of_columns ( string input )
59+ {
60+ var matrix = new Matrix ( input ) ;
61+ return matrix . Cols ;
62+ }
63+ }
0 commit comments