use of org.nhindirect.policy.Opcode 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.Opcode 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.Opcode 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.Opcode 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));
}
use of org.nhindirect.policy.Opcode in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_singleBooleanEntry_assertTrue.
public void testEvaluate_singleBooleanEntry_assertTrue() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
Aggregations