diff --git a/CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs b/CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs
index 423fc78..690189f 100644
--- a/CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs
+++ b/CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs
@@ -617,6 +617,8 @@ public void TypeTesting(string expression, Type type)
[TestCase("Abs(-4) > 10 / 2 ? Abs(-3) : (Abs(-4) + 4) / 2", ExpectedResult = 4, Category = "Conditional Operator t ? x : y")]
[TestCase("Abs(-4) < 10 / 2 ? (true ? 6 : 3+2) : (false ? Abs(-18) : 100 / 2)", ExpectedResult = 6, Category = "Conditional Operator t ? x : y")]
[TestCase("Abs(-4) > 10 / 2 ? (true ? 6 : 3+2) : (false ? Abs(-18) : 100 / 2)", ExpectedResult = 50, Category = "Conditional Operator t ? x : y")]
+ [TestCase("Abs(-4) > 10 / 2?(true ? 6 : 3+2):(false?Abs(-18):100 / 2)", ExpectedResult = 50, Category = "Conditional Operator t ? x : y")]
+ [TestCase("1==1?true:false", ExpectedResult = true, Category = "Conditional Operator t ? x : y")]
#endregion
#region Math Constants
@@ -1773,12 +1775,13 @@ void Evaluator_PreEvaluateVariable(object sender, VariablePreEvaluationEventArg
.Returns("Hello Bob")
.SetCategory("Context object");
- ExpressionEvaluator evaluatorWithPersonContext = new ExpressionEvaluator();
-
- evaluatorWithPersonContext.Context = new Person1()
+ ExpressionEvaluator evaluatorWithPersonContext = new ExpressionEvaluator
{
- name = "John",
- LastName = "Smith"
+ Context = new Person1()
+ {
+ name = "John",
+ LastName = "Smith"
+ }
};
yield return new TestCaseData(evaluatorWithPersonContext
diff --git a/CodingSeb.ExpressionEvaluator/CodingSeb.ExpressionEvaluator.csproj b/CodingSeb.ExpressionEvaluator/CodingSeb.ExpressionEvaluator.csproj
index 635270f..1da540e 100644
--- a/CodingSeb.ExpressionEvaluator/CodingSeb.ExpressionEvaluator.csproj
+++ b/CodingSeb.ExpressionEvaluator/CodingSeb.ExpressionEvaluator.csproj
@@ -5,9 +5,9 @@
CodingSeb.ExpressionEvaluator
A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts
Copyright © Coding Seb 2017
- 1.4.10.0
- 1.4.10.0
- 1.4.10.0
+ 1.4.11.0
+ 1.4.11.0
+ 1.4.11.0
bin\$(Configuration)\
Coding Seb
CodingSeb.ExpressionEvaluator
@@ -18,7 +18,7 @@
true
https://github.com/codingseb/ExpressionEvaluator/blob/master/Icon.png?raw=true
false
- * Correction of some bugs linked to nullconditional operator
+ * Correction of Ternary conditional operator bug
LICENSE.md
https://github.com/codingseb/ExpressionEvaluator
diff --git a/CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs b/CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs
index cb0a5a2..8a14432 100644
--- a/CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs
+++ b/CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs
@@ -1,6 +1,6 @@
/******************************************************************************************************
Title : ExpressionEvaluator (https://github.com/codingseb/ExpressionEvaluator)
- Version : 1.4.10.0
+ Version : 1.4.11.0
(if last digit (the forth) is not a zero, the version is an intermediate version and can be unstable)
Author : Coding Seb
@@ -22,7 +22,7 @@
namespace CodingSeb.ExpressionEvaluator
{
///
- /// This class allow to evaluate a string math or pseudo C# expression
+ /// This class allow to evaluate a string math or pseudo C# expression
///
public partial class ExpressionEvaluator
{
@@ -653,8 +653,8 @@ public string OptionNumberParsingThousandSeparator
public bool OptionFluidPrefixingActive { get; set; } = true;
///
- /// if true allow the use of inline namespace (Can be slow, and is less secure).
- /// if false unactive inline namespace (only namespaces in Namespaces list are available).
+ /// if true allow the use of inline namespace (Can be slow, and is less secure).
+ /// if false unactive inline namespace (only namespaces in Namespaces list are available).
/// By default : true
///
public bool OptionInlineNamespacesEvaluationActive { get; set; } = true;
@@ -744,7 +744,7 @@ public bool OptionNewFunctionEvaluationActive
///
/// If true Evaluate function is callables in an expression. If false Evaluate is not callable.
- /// By default : true
+ /// By default : true
/// if set to false for security (also ensure that ExpressionEvaluator type is in TypesToBlock list)
///
public bool OptionEvaluateFunctionActive { get; set; } = true;
@@ -772,7 +772,7 @@ public bool OptionNewFunctionEvaluationActive
///
/// If true ScriptEvaluate function is callables in an expression. If false Evaluate is not callable.
- /// By default : true
+ /// By default : true
/// if set to false for security (also ensure that ExpressionEvaluator type is in TypesToBlock list)
///
public bool OptionScriptEvaluateFunctionActive { get; set; } = true;
@@ -1394,7 +1394,7 @@ void forAction(int index)
bool executed = false;
- if (TryParseStringAndParenthisAndCurlyBrackets(ref i)){}
+ if (TryParseStringAndParenthisAndCurlyBrackets(ref i)) { }
else if (script.Length - i > 2 && script.Substring(i, 3).Equals("';'"))
{
i += 2;
@@ -1454,7 +1454,7 @@ public T Evaluate(string expression)
private IList parsingMethods;
- protected virtual IList ParsingMethods => parsingMethods ?? (parsingMethods = new List()
+ protected virtual IList ParsingMethods => parsingMethods ?? (parsingMethods = new List()
{
EvaluateCast,
EvaluateNumber,
@@ -1809,7 +1809,7 @@ protected virtual bool EvaluateVarOrFunc(string expression, Stack