示例#1
0
        public void StringArithmeticWithVars()
        {
            var e = new E("'cold='+(-(2+2)*x)");

            e.OnIdentifierLookup += new NFX.Parsing.IdentifierLookup((ident) => ident == "x"?"100":ident);
            Assert.AreEqual("cold=-400", e.Evaluate());
        }
示例#2
0
        public void ConditionalWithVars_Lambda()
        {
            var e = new E("'less:'+(?x<y;'yes';'no')");

            var x = "10";
            var y = "20";

            Assert.AreEqual("less:yes", e.Evaluate((ident) => ident == "x"?x:ident == "y"?y:ident));

            y = "0";
            Assert.AreEqual("less:no", e.Evaluate((ident) => ident == "x"?x:ident == "y"?y:ident));
        }
示例#3
0
        public void ConditionalWithVars_Lambda()
        {
            var e = new E("'less:'+(?x<y;'yes';'no')");

               var x = "10";
               var y = "20";

               Assert.AreEqual("less:yes",  e.Evaluate((ident)=>ident=="x"?x:ident=="y"?y:ident));

               y = "0";
               Assert.AreEqual("less:no",  e.Evaluate((ident)=>ident=="x"?x:ident=="y"?y:ident));
        }
示例#4
0
        public void ConditionalWithVars()
        {
            var e = new E("'less:'+(?x<y;'yes';'no')");

               var x = "10";
               var y = "20";
               e.OnIdentifierLookup += new NFX.Parsing.IdentifierLookup((ident)=>ident=="x"?x:ident=="y"?y:ident);

               Assert.AreEqual("less:yes",  e.Evaluate());

               y = "0";
               Assert.AreEqual("less:no",  e.Evaluate());
        }
示例#5
0
        public void ConditionalWithVars()
        {
            var e = new E("'less:'+(?x<y;'yes';'no')");

            var x = "10";
            var y = "20";

            e.OnIdentifierLookup += new NFX.Parsing.IdentifierLookup((ident) => ident == "x"?x:ident == "y"?y:ident);

            Assert.AreEqual("less:yes", e.Evaluate());

            y = "0";
            Assert.AreEqual("less:no", e.Evaluate());
        }
示例#6
0
        public void Conditional()
        {
            var e = new E("'less:'+(?10<20;'yes';'no')");

            Assert.AreEqual("less:yes", e.Evaluate());
        }
示例#7
0
 public void StringArithmetic2()
 {
     var e = new E("'cold='+'hot'");
        Assert.AreEqual("cold=hot",  e.Evaluate());
 }
示例#8
0
        public void StringArithmeticWithVars_Lambda()
        {
            var e = new E("'cold='+(-(2+2)*x)");

            Assert.AreEqual("cold=-400", e.Evaluate((ident) => ident == "x"?"100":ident));
        }
示例#9
0
        public void StringArithmetic()
        {
            var e = new E("'cold='+(-(2+2)*10)");

            Assert.AreEqual("cold=-40", e.Evaluate());
        }
示例#10
0
        public void Precedence2()
        {
            var e = new E("(2+2)*10");

            Assert.AreEqual("40", e.Evaluate());
        }
示例#11
0
 public void Conditional()
 {
     var e = new E("'less:'+(?10<20;'yes';'no')");
        Assert.AreEqual("less:yes",  e.Evaluate());
 }
示例#12
0
 public void BasicArithmetic()
 {
     var e = new E("2+2-4");
        Assert.AreEqual("0",  e.Evaluate());
 }
示例#13
0
 public void Unary()
 {
     var e = new E("-(2+2)*10");
        Assert.AreEqual("-40",  e.Evaluate());
 }
示例#14
0
 public void StringArithmeticWithVars_Lambda()
 {
     var e = new E("'cold='+(-(2+2)*x)");
        Assert.AreEqual("cold=-400",  e.Evaluate((ident)=>ident=="x"?"100":ident));
 }
示例#15
0
 public void StringArithmeticWithVars()
 {
     var e = new E("'cold='+(-(2+2)*x)");
        e.OnIdentifierLookup += new NFX.Parsing.IdentifierLookup((ident)=>ident=="x"?"100":ident);
        Assert.AreEqual("cold=-400",  e.Evaluate());
 }
示例#16
0
        public void BasicArithmetic()
        {
            var e = new E("2+2-4");

            Assert.AreEqual("0", e.Evaluate());
        }
示例#17
0
        public void Precedence()
        {
            var e = new E("2+2*10");

            Assert.AreEqual("22", e.Evaluate());
        }
示例#18
0
 public void Constants()
 {
     var e = new E("Pi*2");
        Assert.AreEqual("6.2831",  e.Evaluate().Substring(0, 6));
 }
示例#19
0
        public void Unary()
        {
            var e = new E("-(2+2)*10");

            Assert.AreEqual("-40", e.Evaluate());
        }
示例#20
0
 public void Precedence()
 {
     var e = new E("2+2*10");
        Assert.AreEqual("22",  e.Evaluate());
 }
示例#21
0
        public void StringArithmetic2()
        {
            var e = new E("'cold='+'hot'");

            Assert.AreEqual("cold=hot", e.Evaluate());
        }
示例#22
0
 public void Precedence2()
 {
     var e = new E("(2+2)*10");
        Assert.AreEqual("40",  e.Evaluate());
 }
示例#23
0
        public void Constants()
        {
            var e = new E("Pi*2");

            Assert.AreEqual("6.2831", e.Evaluate().Substring(0, 6));
        }
示例#24
0
 public void StringArithmetic()
 {
     var e = new E("'cold='+(-(2+2)*10)");
        Assert.AreEqual("cold=-40",  e.Evaluate());
 }