Search in sources :

Example 96 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class DivisionTest method testPositiveDoubleDivisionByZero.

@Test
public void testPositiveDoubleDivisionByZero() {
    double op1 = 5;
    double op2 = 0;
    TestConfiguration config = availableTestConfigurations.get("PositiveDivisionByZeroTest");
    config.addVariable("vardeclaration", "");
    config.addVariable("op1", op1);
    config.addVariable("op2", op2);
    loadTestConfiguration(config);
    createHelperMatrix();
    writeExpectedHelperMatrix("computed", Double.POSITIVE_INFINITY);
    runTest();
    compareResults();
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration) Test(org.junit.Test)

Example 97 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class OrTest method testOr.

@Test
public void testOr() {
    TestConfiguration config = getTestConfiguration("OrTest");
    loadTestConfiguration(config);
    createHelperMatrix();
    writeExpectedHelperMatrix("left_1", 2);
    writeExpectedHelperMatrix("left_2", 2);
    writeExpectedHelperMatrix("left_3", 2);
    writeExpectedHelperMatrix("left_4", 1);
    writeExpectedHelperMatrix("right_1", 2);
    writeExpectedHelperMatrix("right_2", 2);
    writeExpectedHelperMatrix("right_3", 2);
    writeExpectedHelperMatrix("right_4", 1);
    runTest();
    compareResults();
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration) Test(org.junit.Test)

Example 98 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class PowerTest method setUp.

@Override
public void setUp() {
    addTestConfiguration("ConstConstTest", new TestConfiguration(TEST_CLASS_DIR, "PowerTest", new String[] { "int_int", "int_double", "double_double", "double_double" }));
    addTestConfiguration("VarConstTest", new TestConfiguration(TEST_CLASS_DIR, "PowerTest", new String[] { "int_int", "int_double", "double_double", "double_double" }));
    addTestConfiguration("ConstVarTest", new TestConfiguration(TEST_CLASS_DIR, "PowerTest", new String[] { "int_int", "int_double", "double_double", "double_double" }));
    addTestConfiguration("VarVarTest", new TestConfiguration(TEST_CLASS_DIR, "PowerTest", new String[] { "int_int", "int_double", "double_double", "double_double" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 99 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class PowerTest method testConstConst.

@Test
public void testConstConst() {
    int intIntValue1 = 2;
    int intIntValue2 = 3;
    int intDoubleValue1 = 2;
    double intDoubleValue2 = 3;
    double doubleDoubleValue1 = 2;
    double doubleDoubleValue2 = 3;
    double doubleIntValue1 = 2;
    int doubleIntValue2 = 3;
    TestConfiguration config = availableTestConfigurations.get("ConstConstTest");
    config.addVariable("intintvardeclaration", "");
    config.addVariable("intintop1", intIntValue1);
    config.addVariable("intintop2", intIntValue2);
    config.addVariable("intdoublevardeclaration", "");
    config.addVariable("intdoubleop1", intDoubleValue1);
    config.addVariable("intdoubleop2", intDoubleValue2);
    config.addVariable("doubledoublevardeclaration", "");
    config.addVariable("doubledoubleop1", doubleDoubleValue1);
    config.addVariable("doubledoubleop2", doubleDoubleValue2);
    config.addVariable("doubleintvardeclaration", "");
    config.addVariable("doubleintop1", doubleIntValue1);
    config.addVariable("doubleintop2", doubleIntValue2);
    loadTestConfiguration(config);
    double computedIntIntValue = Math.pow(intIntValue1, intIntValue2);
    double computedIntDoubleValue = Math.pow(intDoubleValue1, intDoubleValue2);
    double computedDoubleDoubleValue = Math.pow(doubleDoubleValue1, doubleDoubleValue2);
    double computedDoubleIntValue = Math.pow(doubleIntValue1, doubleIntValue2);
    createHelperMatrix();
    writeExpectedHelperMatrix("int_int", computedIntIntValue);
    writeExpectedHelperMatrix("int_double", computedIntDoubleValue);
    writeExpectedHelperMatrix("double_double", computedDoubleDoubleValue);
    writeExpectedHelperMatrix("double_int", computedDoubleIntValue);
    runTest();
    compareResults();
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration) Test(org.junit.Test)

Example 100 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class LessThanTest method setUp.

@Override
public void setUp() {
    TestUtils.clearAssertionInformation();
    addTestConfiguration("LessThanTest", new TestConfiguration(TEST_CLASS_DIR, "LessThanTest", new String[] { "left_1", "left_2", "left_3", "right_1", "right_2", "right_3" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Aggregations

TestConfiguration (org.apache.sysml.test.integration.TestConfiguration)781 Test (org.junit.Test)298 CellIndex (org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex)169 RUNTIME_PLATFORM (org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM)138 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)48 IOException (java.io.IOException)18 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)13 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)10 Modulus (org.apache.sysml.runtime.functionobjects.Modulus)9 HashMap (java.util.HashMap)8 FrameBlock (org.apache.sysml.runtime.matrix.data.FrameBlock)8 Random (java.util.Random)6 DMLException (org.apache.sysml.api.DMLException)6 ValueType (org.apache.sysml.parser.Expression.ValueType)5 Date (java.util.Date)3 BufferedReader (java.io.BufferedReader)2 FileReader (java.io.FileReader)2 Connection (org.apache.sysml.api.jmlc.Connection)2 DMLConfig (org.apache.sysml.conf.DMLConfig)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2