[Run][Calculator Plugin] Add hyperbolic functions (#9104)

* Add hyperbolic functions as valid input

* Add test cases for hyperbolic functions

* Update expect.txt

Adding in spelling

Co-authored-by: Clint Rutkas <clint@rutkas.com>
This commit is contained in:
Pavel Zwerschke
2021-01-15 16:05:56 +01:00
committed by GitHub
parent ea21a11259
commit 7514758b8c
3 changed files with 10 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
[TestCase("8.43 + 4.43 - 12.86", 0D)]
[TestCase("8.43 + 4.43 - 12.8", 0.06D)]
[TestCase("exp(5)", 148.413159102577D)]
[TestCase("cosh(0)", 1D)]
public void Interpret_NoErrors_WhenCalledWithRounding(string input, decimal expectedResult)
{
// Arrange
@@ -120,6 +121,10 @@ namespace Microsoft.Plugin.Calculator.UnitTests
[TestCase("sqrt( 36)", true)]
[TestCase("max 4", false)]
[TestCase("sin(0)", true)]
[TestCase("sinh(1)", true)]
[TestCase("tanh(0)", true)]
[TestCase("artanh(pi/2)", true)]
[TestCase("cosh", false)]
[TestCase("cos", false)]
[TestCase("abs", false)]
[TestCase("1+1.1e3", true)]
@@ -136,6 +141,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
[TestCase("1-1")]
[TestCase("sin(0)")]
[TestCase("sinh(0)")]
public void Interpret_MustReturnResult_WhenResultIsZero(string input)
{
// Arrange

View File

@@ -14,6 +14,7 @@ namespace Microsoft.Plugin.Calculator
@"ceil\s*\(|floor\s*\(|exp\s*\(|max\s*\(|min\s*\(|abs\s*\(|log\s*\(|ln\s*\(|sqrt\s*\(|pow\s*\(|" +
@"factorial\s*\(|sign\s*\(|round\s*\(|rand\s*\(|" +
@"sin\s*\(|cos\s*\(|tan\s*\(|arcsin\s*\(|arccos\s*\(|arctan\s*\(|" +
@"sinh\s*\(|cosh\s*\(|tanh\s*\(|arsinh\s*\(|arcosh\s*\(|artanh\s*\(|" +
@"pi|" +
@"==|~=|&&|\|\||" +
@"e|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +