Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }