use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_logicalNotFalseValue_assertTrue.
public void testEvaluate_logicalNotFalseValue_assertTrue() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_NOT));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_regExStringNotMatch_assertFalse.
public void testEvaluate_regExStringNotMatch_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("cccc")));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("a|b")));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.REG_EX));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_bitwiseOrBitSetOnNeither_assertEquals.
public void testEvaluate_bitwiseOrBitSetOnNeither_assertEquals() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.BITWISE_OR));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.EQUALS));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_regExStringMatches_assertTrue.
public void testEvaluate_regExStringMatches_assertTrue() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("bbbbb")));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("a|b*")));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.REG_EX));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_bitwiseOrBitSetOnOne_assertEquals.
public void testEvaluate_bitwiseOrBitSetOnOne_assertEquals() throws Exception {
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.BITWISE_OR));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(1)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.EQUALS));
StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(1)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.BITWISE_OR));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(1)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.EQUALS));
stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
Aggregations