use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class MaxTest 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 vectorMax = Double.NEGATIVE_INFINITY;
for (int i = 0; i < rows; i++) {
vectorMax = Math.max(vectorMax, vector[i][0]);
}
writeInputMatrix("vector", vector);
writeExpectedHelperMatrix("vector_max", vectorMax);
double[][] matrix = getRandomMatrix(rows, cols, 0, 1, 1, -1);
double matrixMax = Double.NEGATIVE_INFINITY;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrixMax = Math.max(matrixMax, matrix[i][j]);
}
}
writeInputMatrix("matrix", matrix);
writeExpectedHelperMatrix("matrix_max", matrixMax);
runTest();
compareResults();
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class MaxTest 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 MinTest method setUp.
@Override
public void setUp() {
// positive tests
addTestConfiguration(TEST_GENERAL, new TestConfiguration(TEST_CLASS_DIR, "MinTest", new String[] { "vector_min", "matrix_min" }));
// negative tests
addTestConfiguration(TEST_SCALAR, new TestConfiguration(TEST_CLASS_DIR, "MinScalarTest", new String[] { "vector_min", "matrix_min" }));
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class MinTest 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 NColTest 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);
writeInputMatrix("vector", vector);
writeExpectedHelperMatrix("vector_cols", 1);
double[][] matrix = getRandomMatrix(rows, cols, 0, 1, 1, -1);
writeInputMatrix("matrix", matrix);
writeExpectedHelperMatrix("matrix_cols", cols);
runTest();
compareResults();
}
Aggregations