use of com.sri.ai.grinder.application.CommonTheory in project aic-expresso by aic-sri-international.
the class IfThenElseStepSolverTest method test15.
@Test
public void test15() {
Expression expression = parse("if (X=0) or (Y=1) then if (Z = 1) then (X + Z) else (Y + Z) else 4");
String[] symbolsAndTypes = { "X", "0..1", "Y", "0..1", "Z", "0..1" };
Context context = new TrueContext(new CommonTheory()).extendWithSymbolsAndTypes(symbolsAndTypes);
Expression expectedResult = parse("if X = 0 then if Z = 1 then 1 else Y + Z else if Y = 1 then if Z = 1 then X + 1 else 1 + Z else 4");
// get method name as string
String testName = new Object() {
}.getClass().getEnclosingMethod().getName();
runIfThenElseStepSolverTest(expression, context, expectedResult, testName);
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-expresso by aic-sri-international.
the class IfThenElseStepSolverTest method test10.
@Test
public void test10() {
Expression expression = parse("if (X=1) or (Y=1) then 2 else 3");
String[] symbolsAndTypes = { "X", "0..1", "Y", "0..0" };
Context context = new TrueContext(new CommonTheory()).extendWithSymbolsAndTypes(symbolsAndTypes);
Expression expectedResult = parse("if X = 1 then 2 else 3");
// get method name as string
String testName = new Object() {
}.getClass().getEnclosingMethod().getName();
runIfThenElseStepSolverTest(expression, context, expectedResult, testName);
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-expresso by aic-sri-international.
the class IfThenElseStepSolverTest method test02.
@Test
public void test02() {
Expression expression = parse("if X=1 then 2 else 3");
String[] symbolsAndTypes = { "X", "0..1" };
Context context = new TrueContext(new CommonTheory()).extendWithSymbolsAndTypes(symbolsAndTypes);
Expression expectedResult = parse("if X = 1 then 2 else 3");
// get method name as string
String testName = new Object() {
}.getClass().getEnclosingMethod().getName();
runIfThenElseStepSolverTest(expression, context, expectedResult, testName);
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-expresso by aic-sri-international.
the class IfThenElseStepSolverTest method test13.
@Test
public void test13() {
Expression expression = parse("if (X=1) and (Y=1) then (X!=1) and (Y!=1) else (X!=1) or (Y!=1)");
String[] symbolsAndTypes = { "X", "0..1", "Y", "0..1" };
Context context = new TrueContext(new CommonTheory()).extendWithSymbolsAndTypes(symbolsAndTypes);
Expression expectedResult = parse("if X = 1 then if Y = 1 then false else true else true");
// get method name as string
String testName = new Object() {
}.getClass().getEnclosingMethod().getName();
runIfThenElseStepSolverTest(expression, context, expectedResult, testName);
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-expresso by aic-sri-international.
the class IfThenElseStepSolverTest method test00.
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////// JUNIT TESTS /////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Test
public void test00() {
Expression expression = parse("if true then 2 else 3");
Context context = new TrueContext(new CommonTheory());
Expression expectedResult = parse("2");
// get method name as string
String testName = new Object() {
}.getClass().getEnclosingMethod().getName();
runIfThenElseStepSolverTest(expression, context, expectedResult, testName);
}
Aggregations