public void Or_Optimize_FullyConstant_Value() { var originalnode = new OrComparisonNode(new ShortValueNode(1), new ShortValueNode(0)); var optimizednode = originalnode.Optimize(NoVariables); Assert.AreEqual(1, optimizednode.GetValue()); }
public void OrComparison_Optimize_Lazy_AnyConstantCollapses_Left() { var originalnode = new OrComparisonNode(new ShortValueNode(1), new VariableValueNode("x")); var optimizednode = originalnode.Optimize(NoVariables); Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode)); }
public void Or_Optimize_RecursiveReduction() { var originalnode = new OrComparisonNode( new VariableValueNode("a"), new VariableValueNode("b") ); var optimizednode = originalnode.Optimize(new Dictionary <string, ushort> { { "a", 0 }, { "b", 1 } }); Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode)); }