Exemple #1
0
        public void MoreThan_Optimize_FullyConstant_Value()
        {
            var originalnode = new MoreThanComparisonNode(new ShortValueNode(2), new ShortValueNode(1));

            var optimizednode = originalnode.Optimize(NoVariables);

            Assert.AreEqual(1, optimizednode.GetValue());
        }
Exemple #2
0
        public void MoreThanComparison_Optimize_UnknownVariableRemains()
        {
            var originalnode = new MoreThanComparisonNode(new ShortValueNode(1), new VariableValueNode("x"));

            var optimizednode = originalnode.Optimize(NoVariables);

            Assert.IsInstanceOfType(optimizednode, typeof(MoreThanComparisonNode));
        }
Exemple #3
0
        public void MoreThanComparison_Optimize_FullyConstantCollapses()
        {
            var originalnode = new MoreThanComparisonNode(new ShortValueNode(1), new ShortValueNode(1));

            var optimizednode = originalnode.Optimize(NoVariables);

            Assert.IsInstanceOfType(optimizednode, typeof(ConstantNode));
        }
Exemple #4
0
        public void MoreThan_Optimize_RecursiveReduction()
        {
            var originalnode = new MoreThanComparisonNode(
                new VariableValueNode("a"),
                new VariableValueNode("b")
                );

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

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