*/
public class TestIfThenElseNode extends TestNode {
@Override
public void testCalc() {
IfThenElseNode ifN =
new IfThenElseNode(new ValueNode<>(true), new ValueNode<>(5),
new ValueNode<>(7));
ValueNode<Integer> res = ifN.calc(null);
assertTrue(res.getValue().compareTo(5) == 0);
ifN =
new IfThenElseNode(new ValueNode<>(false), new ValueNode<>(5),
new ValueNode<>(7));
res = ifN.calc(null);
assertTrue(res.getValue().compareTo(7) == 0);
ifN =
new IfThenElseNode(new OrNode(new ValueNode<>(false), new ValueNode<>(
false)), new ValueNode<>(5), new ValueNode<>(7));
res = ifN.calc(null);
assertTrue(res.getValue().compareTo(7) == 0);
ifN =
new IfThenElseNode(new OrNode(new ValueNode<>(true), new ValueNode<>(
false)), new ValueNode<>(5), new ValueNode<>(7));
res = ifN.calc(null);
assertTrue(res.getValue().compareTo(5) == 0);
ifN =
new IfThenElseNode(new ValueNode<>(false), new ValueNode<>(5),
new OrNode(new ValueNode<>(true), new ValueNode<>(true)));
ValueNode<Boolean> res2 = ifN.calc(null);
assertTrue(res2.getValue().compareTo(true) == 0);
ifN =
new IfThenElseNode(new ValueNode<>(true), new OrNode(new ValueNode<>(
true), new ValueNode<>(true)), new ValueNode<>(5));
res2 = ifN.calc(null);
assertTrue(res2.getValue().compareTo(true) == 0);
}