コード例 #1
0
        public void Subtraction_Optimize_UnknownVariableRemains()
        {
            var originalnode = new SubtractionNode(new ShortValueNode(1), new VariableValueNode("x"));

            var optimizednode = originalnode.Optimize(NoVariables);

            Assert.IsInstanceOfType(optimizednode, typeof(SubtractionNode));
        }
コード例 #2
0
        public void Subtraction_Optimize_FullyConstant_Value()
        {
            var originalnode = new SubtractionNode(new ShortValueNode(1), new ShortValueNode(1));

            var optimizednode = originalnode.Optimize(NoVariables);

            Assert.AreEqual(0, optimizednode.GetValue());
        }
コード例 #3
0
        public void Subtraction_Optimize_FullyConstantCollapses()
        {
            var originalnode = new SubtractionNode(new ShortValueNode(1), new ShortValueNode(1));

            var optimizednode = originalnode.Optimize(NoVariables);

            Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode));
        }
コード例 #4
0
        public void Subtraction_Optimize_RecursiveReduction()
        {
            var originalnode = new SubtractionNode(
                new VariableValueNode("a"),
                new VariableValueNode("b")
                );

            var optimizednode = originalnode.Optimize(new Dictionary <string, ushort> {
                { "a", 1 },
                { "b", 1 }
            });

            Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode));
        }