public void Addition_Optimize_UnknownVariableRemains() { var originalnode = new AdditionNode(new ShortValueNode(1), new VariableValueNode("x")); var optimizednode = originalnode.Optimize(NoVariables); Assert.IsInstanceOfType(optimizednode, typeof(AdditionNode)); }
public void Addition_Optimize_FullyConstant_Value() { var originalnode = new AdditionNode(new ShortValueNode(1), new ShortValueNode(1)); var optimizednode = originalnode.Optimize(NoVariables); Assert.AreEqual(2, optimizednode.GetValue()); }
public void Addition_Optimize_FullyConstantCollapses() { var originalnode = new AdditionNode(new ShortValueNode(1), new ShortValueNode(1)); var optimizednode = originalnode.Optimize(NoVariables); Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode)); }
public void Addition_Optimize_RecursiveReduction() { var originalnode = new AdditionNode( new VariableValueNode("a"), new VariableValueNode("b") ); var optimizednode = originalnode.Optimize(new Dictionary <string, ushort> { { "a", 1 }, { "b", 1 } }); Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode)); }