use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_finalEmptyStack_assertException.
public void testEvaluate_finalEmptyStack_assertException() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
boolean exceptionOccured = false;
final StackMachine stMachine = new StackMachine();
try {
stMachine.evaluate(stuffToProcess);
} catch (IllegalStateException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_less_topOfStackIsLess_assertFalse.
public void testEvaluate_less_topOfStackIsLess_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(1)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LESS));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_logicalNotTrueValue_assertFalse.
public void testEvaluate_logicalNotTrueValue_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_NOT));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_greater_bottomOfStockIsGreater_assertTrue.
public void testEvaluate_greater_bottomOfStockIsGreater_assertTrue() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(1)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.GREATER));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_logicalAndBothFalse_assertFalse.
public void testEvaluate_logicalAndBothFalse_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_AND));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
Aggregations