Skip to content

Commit

Permalink
[Run][Calculator Plugin] Add hyperbolic functions (#9104)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
pavelzw and crutkas committed Jan 15, 2021
1 parent ea21a11 commit 7514758
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spell-check/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ appx
appxmanifest
APSTUDIO
AQS
arcosh
arsinh
artanh
ARemapped
argb
argc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void Interpret_NoResult_WhenCalled(string input)
[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
Expand Down Expand Up @@ -120,6 +121,10 @@ public void Interpret_DifferentCulture_WhenCalled(string input, decimal expected
[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)]
Expand All @@ -136,6 +141,7 @@ public void InputValid_TestValid_WhenCalled(string input, bool valid)

[TestCase("1-1")]
[TestCase("sin(0)")]
[TestCase("sinh(0)")]
public void Interpret_MustReturnResult_WhenResultIsZero(string input)
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static class CalculateHelper
@"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]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
Expand Down

0 comments on commit 7514758

Please sign in to comment.