EvaluateFormulasCommand extends AbstractCommand { @Override public void writeCommand(final IPrologTermOutput pout) { pout.openTerm(PROLOG_COMMAND_NAME); pout.printAtomOrNumber(stateId); pout.openList(); for (IEvalElement evalElement : evalElements) { printEvalTerm(pout, evalElement); } pout.closeList(); pout.printVariable(EVALUATE_RESULT_VARIABLE); pout.closeTerm(); } EvaluateFormulasCommand(final List<IEvalElement> evalElements, final String stateId); @Override void processResult(final ISimplifiedROMap<String, PrologTerm> bindings); @Override void writeCommand(final IPrologTermOutput pout); List<AbstractEvalResult> getValues(); Map<IEvalElement, AbstractEvalResult> getResultMap();  }
@Test public void testWriteCommand() { 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()); }