use of de.prob.prolog.term.PrologTerm in project prob2 by bendisposto.
the class CheckBooleanPropertyCommandTest method testProcessIllegalResult.
@Test(expected = ResultParserException.class)
public void testProcessIllegalResult() {
ISimplifiedROMap<String, PrologTerm> map = TestHelper.mkAtomMock("PropResult", "fff");
CheckBooleanPropertyCommand cmd = new CheckBooleanPropertyCommand("BLAH_BLAH", "root");
cmd.processResult(map);
}
use of de.prob.prolog.term.PrologTerm in project prob2 by bendisposto.
the class CheckBooleanPropertyCommandTest method testProcessResultTrue.
@Test
public void testProcessResultTrue() {
ISimplifiedROMap<String, PrologTerm> map = TestHelper.mkAtomMock("PropResult", "true");
CheckBooleanPropertyCommand cmd = new CheckBooleanPropertyCommand("BLAH_BLAH", "root");
cmd.processResult(map);
assertTrue(cmd.getResult());
}
use of de.prob.prolog.term.PrologTerm in project prob2 by bendisposto.
the class EvaluateFormulasCommandTest method testWriteCommand.
@Test
public void testWriteCommand() throws Exception {
IEvalElement element = new ClassicalB("1<3", FormulaExpand.EXPAND);
StructuredPrologOutput prologTermOutput = new StructuredPrologOutput();
EvaluateFormulaCommand command = new EvaluateFormulaCommand(element, "root");
command.writeCommand(prologTermOutput);
prologTermOutput.fullstop().flush();
Collection<PrologTerm> sentences = prologTermOutput.getSentences();
PrologTerm t = sentences.iterator().next();
assertNotNull(t);
assertTrue(t instanceof CompoundPrologTerm);
assertEquals("evaluate_formula", t.getFunctor());
assertEquals(3, t.getArity());
PrologTerm t1 = t.getArgument(1);
assertEquals("root", t1.getFunctor());
PrologTerm t2 = t.getArgument(2);
assertEquals("eval", t2.getFunctor());
PrologTerm t3 = t.getArgument(3);
assertEquals("Res", t3.getFunctor());
}
use of de.prob.prolog.term.PrologTerm in project prob2 by bendisposto.
the class EvaluateFormulasCommandTest method testProcessResult.
@Test
public void testProcessResult() throws Exception {
IEvalElement element = new ClassicalB("1<3", FormulaExpand.EXPAND);
final CompoundPrologTerm lpt = mk_result("true");
ISimplifiedROMap<String, PrologTerm> m1 = new ISimplifiedROMap<String, PrologTerm>() {
@Override
public PrologTerm get(final String key) {
return lpt;
}
};
EvaluateFormulaCommand command = new EvaluateFormulaCommand(element, "root");
command.processResult(m1);
AbstractEvalResult value = command.getValue();
assertEquals(((EvalResult) value).getValue(), "true");
assertEquals(((EvalResult) value).getSolutions().get("a"), "3");
}
use of de.prob.prolog.term.PrologTerm in project prob2 by bendisposto.
the class GetOperationsWithTimeoutTest method testErrorProcessResults.
@Test(expected = ResultParserException.class)
public void testErrorProcessResults() {
@SuppressWarnings("unchecked") ISimplifiedROMap<String, PrologTerm> map = mock(ISimplifiedROMap.class);
when(map.get(anyString())).thenReturn(new CompoundPrologTerm("bang!!!"));
GetOperationsWithTimeout command = new GetOperationsWithTimeout("state");
command.processResult(map);
}
Aggregations