Exemplo n.º 1
0
        public void CheckOperand_double_separatorDot()
        {
            string           expr       = "12.34";
            List <ExprToken> listTokens = TestCommon.AddTokens("12.34");

            // decoder, renvoie un arbre de node
            ExprTokensParser parser = new ExprTokensParser();

            // the default list: =, <, >, >=, <=, <>
            var dictOperators = TestCommon.BuildConfig(DecimalAndFunctionSeparators.Standard);

            parser.SetConfiguration(dictOperators);

            // decode the list of tokens
            ParseResult result = parser.Parse(expr, listTokens);

            // finished with no error
            Assert.AreEqual(0, result.ListError.Count, "The tokens 12.34 should be decoded with success");

            // check the root node
            ExprFinalOperand rootBinExpr = result.RootExpr as ExprFinalOperand;

            Assert.IsNotNull(rootBinExpr, "The root node type should be BoolBinExprOperand");

            Assert.AreEqual("12.34", rootBinExpr.Operand, "The left operand should be 12.34");
            Assert.AreEqual(OperandType.ValueDouble, rootBinExpr.ContentType, "The operand type should be a double");
        }