コード例 #1
0
        public void VariableComparisonCondition()
        {
            var command = ParseCommand("if 3 > 2 set the \"rotors\" height to 5");

            Assert.IsTrue(command is ConditionalCommand);
            ConditionalCommand conditionalCommand = (ConditionalCommand)command;

            Assert.IsTrue(conditionalCommand.Condition is ComparisonVariable);
            ComparisonVariable variable = (ComparisonVariable)conditionalCommand.Condition;

            Assert.IsTrue(variable.GetValue() is BooleanPrimitive);
            BooleanPrimitive boolean = (BooleanPrimitive)variable.GetValue();

            Assert.IsTrue(boolean.GetBooleanValue());
            Assert.IsTrue(variable.a is StaticVariable);
            Assert.IsTrue(variable.b is StaticVariable);
        }
コード例 #2
0
        public void VariableComparisonCondition()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("if 3 > 2 set the \"rotors\" height to 5");

            Assert.IsTrue(command is ConditionalCommand);
            ConditionalCommand conditionalCommand = (ConditionalCommand)command;

            Assert.IsTrue(conditionalCommand.Condition is ComparisonVariable);
            ComparisonVariable variable = (ComparisonVariable)conditionalCommand.Condition;

            Assert.IsTrue(variable.GetValue() is BooleanPrimitive);
            BooleanPrimitive boolean = (BooleanPrimitive)variable.GetValue();

            Assert.IsTrue(boolean.GetTypedValue());
            Assert.IsTrue(variable.a is StaticVariable);
            Assert.IsTrue(variable.b is StaticVariable);
        }