use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class SumTest method testGeneral.
@Test
public void testGeneral() {
int rows = 10;
int cols = 10;
TestConfiguration config = getTestConfiguration(TEST_GENERAL);
config.addVariable("rows", rows);
config.addVariable("cols", cols);
loadTestConfiguration(config);
createHelperMatrix();
double[][] vector = getRandomMatrix(rows, 1, 0, 1, 1, -1);
double vectorSum = 0;
for (int i = 0; i < rows; i++) {
vectorSum += vector[i][0];
}
writeInputMatrix("vector", vector);
writeExpectedHelperMatrix("vector_sum", vectorSum);
double[][] matrix = getRandomMatrix(rows, cols, 0, 1, 1, -1);
double matrixSum = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrixSum += matrix[i][j];
}
}
writeInputMatrix("matrix", matrix);
writeExpectedHelperMatrix("matrix_sum", matrixSum);
runTest();
compareResults(5e-14);
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class SumTest method setUp.
@Override
public void setUp() {
// positive tests
addTestConfiguration(TEST_GENERAL, new TestConfiguration(TEST_CLASS_DIR, "SumTest", new String[] { "vector_sum", "matrix_sum" }));
// negative tests
addTestConfiguration(TEST_SCALAR, new TestConfiguration(TEST_CLASS_DIR, "SumScalarTest", new String[] { "vector_sum", "matrix_sum" }));
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class TraceTest method testGeneral.
@Test
public void testGeneral() {
int rows = 10;
int cols = 10;
TestConfiguration config = getTestConfiguration(TEST_GENERAL);
config.addVariable("rows", rows);
config.addVariable("cols", cols);
loadTestConfiguration(config);
createHelperMatrix();
double[][] a = getRandomMatrix(rows, cols, -1, 1, 0.5, -1);
writeInputMatrix("a", a);
double b = 0;
for (int i = 0; i < rows; i++) {
b += a[i][i];
}
writeExpectedHelperMatrix("b", b);
runTest();
compareResults(1e-14);
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class TraceTest method testScalar.
@Test
public void testScalar() {
int scalar = 12;
TestConfiguration config = getTestConfiguration(TEST_SCALAR);
config.addVariable("scalar", scalar);
createHelperMatrix();
loadTestConfiguration(config);
runTest(true, DMLException.class);
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class TraceTest method setUp.
@Override
public void setUp() {
// positive tests
addTestConfiguration(TEST_GENERAL, new TestConfiguration(TEST_CLASS_DIR, "TraceTest", new String[] { "b" }));
// negative tests
addTestConfiguration(TEST_SCALAR, new TestConfiguration(TEST_CLASS_DIR, "TraceScalarTest", new String[] { "b" }));
}
Aggregations