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)); }
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)); }
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()); }
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()); }
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()); }
public void BasicArithmetic() { var e = new E("2+2-4"); Assert.AreEqual("0", e.Evaluate()); }
public void StringArithmetic2() { var e = new E("'cold='+'hot'"); Assert.AreEqual("cold=hot", e.Evaluate()); }
public void StringArithmeticWithVars_Lambda() { var e = new E("'cold='+(-(2+2)*x)"); Assert.AreEqual("cold=-400", e.Evaluate((ident) => ident == "x"?"100":ident)); }
public void StringArithmetic2() { var e = new E("'cold='+'hot'"); Assert.AreEqual("cold=hot", e.Evaluate()); }
public void Unary() { var e = new E("-(2+2)*10"); Assert.AreEqual("-40", e.Evaluate()); }
public void Conditional() { var e = new E("'less:'+(?10<20;'yes';'no')"); Assert.AreEqual("less:yes", e.Evaluate()); }
public void BasicArithmetic() { var e = new E("2+2-4"); Assert.AreEqual("0", e.Evaluate()); }
public void Unary() { var e = new E("-(2+2)*10"); Assert.AreEqual("-40", e.Evaluate()); }
public void StringArithmeticWithVars_Lambda() { var e = new E("'cold='+(-(2+2)*x)"); Assert.AreEqual("cold=-400", e.Evaluate((ident)=>ident=="x"?"100":ident)); }
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()); }
public void Precedence() { var e = new E("2+2*10"); Assert.AreEqual("22", e.Evaluate()); }
public void Precedence2() { var e = new E("(2+2)*10"); Assert.AreEqual("40", e.Evaluate()); }
public void Constants() { var e = new E("Pi*2"); Assert.AreEqual("6.2831", e.Evaluate().Substring(0, 6)); }
public void StringArithmetic() { var e = new E("'cold='+(-(2+2)*10)"); Assert.AreEqual("cold=-40", e.Evaluate()); }
public void Precedence() { var e = new E("2+2*10"); Assert.AreEqual("22", e.Evaluate()); }
public void Precedence2() { var e = new E("(2+2)*10"); Assert.AreEqual("40", e.Evaluate()); }
public void Conditional() { var e = new E("'less:'+(?10<20;'yes';'no')"); Assert.AreEqual("less:yes", e.Evaluate()); }
public void Constants() { var e = new E("Pi*2"); Assert.AreEqual("6.2831", e.Evaluate().Substring(0, 6)); }
public void StringArithmetic() { var e = new E("'cold='+(-(2+2)*10)"); Assert.AreEqual("cold=-40", e.Evaluate()); }