Skip to content

Commit

Permalink
added if function + upgraded version number
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterderycke committed Oct 30, 2014
1 parent b46563e commit ee149e7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 deletions.
11 changes: 10 additions & 1 deletion Jace.Tests/CalculationEngineTests.cs
Expand Up @@ -429,14 +429,23 @@ public void TestComplicatedPrecedence2()
}

[TestMethod]
public void TestExpressionArguments()
public void TestExpressionArguments1()
{
CalculationEngine engine = new CalculationEngine(CultureInfo.InvariantCulture);

double result = engine.Calculate("ifless(0.57, (3000-500)/(1500-500), 10, 20)");
Assert.AreEqual(10, result);
}

[TestMethod]
public void TestExpressionArguments2()
{
CalculationEngine engine = new CalculationEngine(CultureInfo.InvariantCulture);

double result = engine.Calculate("if(0.57 < (3000-500)/(1500-500), 10, 20)");
Assert.AreEqual(10, result);
}

[TestMethod]
public void TestNestedFunctions()
{
Expand Down
4 changes: 2 additions & 2 deletions Jace.WP7/Properties/AssemblyInfo.cs
Expand Up @@ -32,6 +32,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.8.6")]
[assembly: AssemblyFileVersion("0.8.6")]
[assembly: AssemblyVersion("0.8.7")]
[assembly: AssemblyFileVersion("0.8.7")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
4 changes: 2 additions & 2 deletions Jace.WP8/Properties/AssemblyInfo.cs
Expand Up @@ -32,6 +32,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.8.6")]
[assembly: AssemblyFileVersion("0.8.6")]
[assembly: AssemblyVersion("0.8.7")]
[assembly: AssemblyFileVersion("0.8.7")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
4 changes: 2 additions & 2 deletions Jace.WinRT/Properties/AssemblyInfo.cs
Expand Up @@ -24,6 +24,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.6")]
[assembly: AssemblyFileVersion("0.8.6")]
[assembly: AssemblyVersion("0.8.7")]
[assembly: AssemblyFileVersion("0.8.7")]
[assembly: ComVisible(false)]
1 change: 1 addition & 0 deletions Jace/CalculationEngine.cs
Expand Up @@ -262,6 +262,7 @@ private void RegisterDefaultFunctions()
FunctionRegistry.RegisterFunction("abs", (Func<double, double>)((a) => Math.Abs(a)), false);
FunctionRegistry.RegisterFunction("max", (Func<double, double, double>)((a, b) => Math.Max(a, b)), false);
FunctionRegistry.RegisterFunction("min", (Func<double, double, double>)((a, b) => Math.Min(a, b)), false);
FunctionRegistry.RegisterFunction("if", (Func<double, double, double, double>)((a, b, c) => (a != 0.0 ? b : c)), false);
FunctionRegistry.RegisterFunction("ifless", (Func<double, double, double, double, double>)((a, b, c, d) => (a < b ? c : d)), false);
FunctionRegistry.RegisterFunction("ifmore", (Func<double, double, double, double, double>)((a, b, c, d) => (a > b ? c : d)), false);
FunctionRegistry.RegisterFunction("ifequal", (Func<double, double, double, double, double>)((a, b, c, d) => (a == b ? c : d)), false);
Expand Down
4 changes: 2 additions & 2 deletions Jace/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.6")]
[assembly: AssemblyFileVersion("0.8.6")]
[assembly: AssemblyVersion("0.8.7")]
[assembly: AssemblyFileVersion("0.8.7")]
2 changes: 1 addition & 1 deletion buildNuGetPackage.cmd
@@ -1,4 +1,4 @@
SET version="0.8.6"
SET version="0.8.7"

msbuild /p:Configuration=Release Jace\Jace.csproj
MKDIR nuget\lib\net40
Expand Down
2 changes: 1 addition & 1 deletion buildZipPackage.cmd
@@ -1,4 +1,4 @@
SET version=0.8.6
SET version=0.8.7

msbuild /p:Configuration=Release Jace\Jace.csproj
MKDIR zip\net40
Expand Down

0 comments on commit ee149e7

Please sign in to comment.