[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

@@ -86,6 +86,9 @@ appx
appxmanifest appxmanifest
APSTUDIO APSTUDIO
AQS AQS
arcosh
arsinh
artanh
ARemapped ARemapped
argb argb
argc argc

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.86", 0D)]
[TestCase("8.43 + 4.43 - 12.8", 0.06D)] [TestCase("8.43 + 4.43 - 12.8", 0.06D)]
[TestCase("exp(5)", 148.413159102577D)] [TestCase("exp(5)", 148.413159102577D)]
[TestCase("cosh(0)", 1D)]
public void Interpret_NoErrors_WhenCalledWithRounding(string input, decimal expectedResult) public void Interpret_NoErrors_WhenCalledWithRounding(string input, decimal expectedResult)
{ {
// Arrange // Arrange
@@ -120,6 +121,10 @@ namespace Microsoft.Plugin.Calculator.UnitTests
[TestCase("sqrt( 36)", true)] [TestCase("sqrt( 36)", true)]
[TestCase("max 4", false)] [TestCase("max 4", false)]
[TestCase("sin(0)", true)] [TestCase("sin(0)", true)]
[TestCase("sinh(1)", true)]
[TestCase("tanh(0)", true)]
[TestCase("artanh(pi/2)", true)]
[TestCase("cosh", false)]
[TestCase("cos", false)] [TestCase("cos", false)]
[TestCase("abs", false)] [TestCase("abs", false)]
[TestCase("1+1.1e3", true)] [TestCase("1+1.1e3", true)]
@@ -136,6 +141,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
[TestCase("1-1")] [TestCase("1-1")]
[TestCase("sin(0)")] [TestCase("sin(0)")]
[TestCase("sinh(0)")]
public void Interpret_MustReturnResult_WhenResultIsZero(string input) public void Interpret_MustReturnResult_WhenResultIsZero(string input)
{ {
// Arrange // 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*\(|" + @"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*\(|" + @"factorial\s*\(|sign\s*\(|round\s*\(|rand\s*\(|" +
@"sin\s*\(|cos\s*\(|tan\s*\(|arcsin\s*\(|arccos\s*\(|arctan\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|" + @"pi|" +
@"==|~=|&&|\|\||" + @"==|~=|&&|\|\||" +
@"e|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" + @"e|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +