1 package demo9.test;
2 import static org.junit.Assert.*;
4 import org.junit.*;
5 import static demo9.PanelMatriisi.*;
6
8
13 @SuppressWarnings({ "PMD" })
14 public class PanelMatriisiTest {
15
16
17
18
20 @Test
21 public void testGetMatriisi51() { int[][] m = getMatriisi(new String[]{ "1 -2 3 4","5","6 7 8 9 10 11"} );
23 assertEquals("From: PanelMatriisi line: 53", 3, m.length); assertEquals("From: PanelMatriisi line: 53", 4, m[0].length); assertEquals("From: PanelMatriisi line: 53", 4, m[2].length);
24 assertEquals("From: PanelMatriisi line: 54", 1, m[0][0]); assertEquals("From: PanelMatriisi line: 54", -2, m[0][1]); assertEquals("From: PanelMatriisi line: 54", 3, m[0][2]); assertEquals("From: PanelMatriisi line: 54", 4, m[0][3]);
25 assertEquals("From: PanelMatriisi line: 55", 5, m[1][0]); assertEquals("From: PanelMatriisi line: 55", 0, m[1][1]); assertEquals("From: PanelMatriisi line: 55", 0, m[1][2]); assertEquals("From: PanelMatriisi line: 55", 0, m[1][3]);
26 assertEquals("From: PanelMatriisi line: 56", 6, m[2][0]); assertEquals("From: PanelMatriisi line: 56", 7, m[2][1]); assertEquals("From: PanelMatriisi line: 56", 8, m[2][2]); assertEquals("From: PanelMatriisi line: 56", 9, m[2][3]);
27 int[][] m2 = getMatriisi(new String[0]);
28 assertEquals("From: PanelMatriisi line: 59", 1, m2.length); assertEquals("From: PanelMatriisi line: 59", 1, m2[0].length);
29 assertEquals("From: PanelMatriisi line: 60", 1, m2[0][0]);
30 }
32
33
35 @Test
36 public void testGetMatriisi97() { int[][] m = getMatriisi("1,-2\n3 4\na\t6\n\n");
38 assertEquals("From: PanelMatriisi line: 99", 3, m.length);
39 assertEquals("From: PanelMatriisi line: 100", 1, m[0][0]); assertEquals("From: PanelMatriisi line: 100", -2, m[0][1]);
40 assertEquals("From: PanelMatriisi line: 101", 3, m[1][0]); assertEquals("From: PanelMatriisi line: 101", 4, m[1][1]);
41 assertEquals("From: PanelMatriisi line: 102", 0, m[2][0]); assertEquals("From: PanelMatriisi line: 102", 6, m[2][1]);
42 int[][] m2 = getMatriisi("\n\n");
43 assertEquals("From: PanelMatriisi line: 105", 1, m2.length); assertEquals("From: PanelMatriisi line: 105", 1, m2[0].length);
44 assertEquals("From: PanelMatriisi line: 106", 1, m2[0][0]);
45 } }