Example #1
0
        public void Converter_BooleanNotTests()
        {
            BooleanNot conv = new BooleanNot();

            // Convert tests
            Assert.AreEqual(true, conv.Convert(false, typeof(bool), null, null),
                            "BooleanNot Convert returned false instead of true");
            Assert.AreEqual(false, conv.Convert(true, typeof(bool), null, null),
                            "BooleanNot Convert returned true instead of false");

            // ConvertBack tests
            Assert.AreEqual(true, conv.ConvertBack(false, typeof(bool), null, null),
                            "BooleanNot Convert returned false instead of true");
            Assert.AreEqual(false, conv.ConvertBack(true, typeof(bool), null, null),
                            "BooleanNot Convert returned true instead of false");
        }
Example #2
0
 protected abstract void TranslateBooleanNot(List <string> output, BooleanNot booleanNot);
Example #3
0
        public static void Compile(ByteCodeCompiler bcc, ParserContext parser, ByteBuffer buffer, BooleanNot boolNot, bool outputUsed)
        {
            if (!outputUsed)
            {
                throw new ParserException(boolNot, "Cannot have this expression here.");
            }

            bcc.CompileExpression(parser, buffer, boolNot.Root, true);
            buffer.Add(boolNot.FirstToken, OpCode.BOOLEAN_NOT);
        }
Example #4
0
 protected override void TranslateBooleanNot(List <string> output, BooleanNot booleanNot)
 {
     output.Add("!(");
     this.TranslateExpression(output, booleanNot.Root);
     output.Add(")");
 }