Browse Source

Tests 2D-Array to String funtionality, this functionallity was extracted and can now be tested.

featureMatrixCalculator
Lukas Reichwein 6 years ago
parent
commit
dd72739d3c
  1. 31
      src/test/java/com/ugsbo/matrixcalc/MatrixIOUtilsTest.java

31
src/test/java/com/ugsbo/matrixcalc/MatrixIOUtilsTest.java

@ -1,6 +1,7 @@
package com.ugsbo.matrixcalc;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
@ -117,4 +118,34 @@ public class MatrixIOUtilsTest {
assertArrayEquals("The second row is not correct", expected[1], result[1], 0.1);
assertArrayEquals("The thierd row is not correct", expected[2], result[2], 0.1);
}
@Test
public void convertsArrayToString_SingleNumber() {
double[][] matrix = { { 1.0 } };
String expected = "1.0 \n\n";
String result = util.convertsArrayToStringInOrderToDisplayIt(matrix);
assertEquals("The Strings do not Match", expected, result);
}
@Test
public void convertsArrayToString_FourNumbersInARow() {
double[][] matrix = { { 1.0, 2.0, 3.0, 4.0 } };
String expected = "1.0 2.0 3.0 4.0 \n\n";
String result = util.convertsArrayToStringInOrderToDisplayIt(matrix);
assertEquals("The Strings do not Match", expected, result);
}
@Test
public void convertsArrayToString_FourNumbersInTwoRows() {
double[][] matrix = { { 1.0, 2.0 }, { 3.0, 4.0 } };
String expected = "1.0 2.0 \n\n3.0 4.0 \n\n";
String result = util.convertsArrayToStringInOrderToDisplayIt(matrix);
assertEquals("The Strings do not Match", expected, result);
}
}
Loading…
Cancel
Save