Skip to content

Commit

Permalink
Added function validators to ensure only valid values are computed
Browse files Browse the repository at this point in the history
  • Loading branch information
BLM16 committed Sep 16, 2023
1 parent 0348ebd commit 12feb1b
Show file tree
Hide file tree
Showing 6 changed files with 285 additions and 166 deletions.
2 changes: 1 addition & 1 deletion Calculator.Tests/Calculator.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RepositoryUrl>https://github.com/BLM16/Tokenized-Calculator</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl />
<Version>4.1.0</Version>
<Version>4.4.0</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageTags>calculator</PackageTags>
<RootNamespace>BLM16.Util.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
Expand Down
9 changes: 9 additions & 0 deletions Calculator.Tests/CalculatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public class CalculatorTests
public void Calculator_CalculatesEquation_WithDefaults(string equation, double expected)
=> Assert.AreEqual(expected, Calculator_WithDefaults.Calculate(equation));

[DataTestMethod]
[DataRow("sqrt(-1)")]
[DataRow("asin(5)")]
[DataRow("atanh(1)")]
[DataRow("ln(0)")]
[ExpectedException(typeof(MathSyntaxException))]
public void Calculator_ValidatesFunctions_ExceptionOnInvalidValues(string equation)
=> Calculator_WithDefaults.Calculate(equation);

#endregion

#region With Customs
Expand Down
2 changes: 1 addition & 1 deletion Calculator/Calculator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Copyright>Copyright © 2021 Bradley Myers. All rights reserved.</Copyright>
<RepositoryUrl>https://github.com/BLM16/Tokenized-Calculator</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>4.3.0</Version>
<Version>4.4.0</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageTags>calculator; math; solve</PackageTags>
<PackageId>BLM16.Util.$(AssemblyName)</PackageId>
Expand Down

0 comments on commit 12feb1b

Please sign in to comment.