Skip to content

Commit

Permalink
[PTRun][Calculator]Update mages to v3.0.0 and support for randi(n) (#…
Browse files Browse the repository at this point in the history
…36560)

* update to mages 3.0.0

* allow randi() in calculator plugin

* fix tests and input validation

* fix spell check
  • Loading branch information
htcfreek authored Jan 3, 2025
1 parent 1eec678 commit 94d7121
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/actions/spell-check/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@ QUEUESYNC
QUNS
RAII
RAlt
randi
Rasterize
RAWINPUTDEVICE
RAWINPUTHEADER
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageVersion Include="hyjiacan.pinyin4net" Version="4.1.1" />
<PackageVersion Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0.2" />
<PackageVersion Include="LazyCache" Version="2.4.0" />
<PackageVersion Include="Mages" Version="2.0.2" />
<PackageVersion Include="Mages" Version="3.0.0" />
<PackageVersion Include="Markdig.Signed" Version="0.34.0" />
<!-- Including MessagePack to force version, since it's used by StreamJsonRpc but contains vulnerabilities. After StreamJsonRpc updates the version of MessagePack, we can upgrade StreamJsonRpc instead. -->
<PackageVersion Include="MessagePack" Version="2.5.187" />
Expand Down
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ EXHIBIT A -Mozilla Public License.
- hyjiacan.pinyin4net 4.1.1
- Interop.Microsoft.Office.Interop.OneNote 1.1.0.2
- LazyCache 2.4.0
- Mages 2.0.2
- Mages 3.0.0
- Markdig.Signed 0.34.0
- MessagePack 2.5.187
- Microsoft.Bcl.AsyncInterfaces 9.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ public void Interpret_DifferentCulture_WhenCalled(string input, decimal expected
[DataRow("cos", false)]
[DataRow("abs", false)]
[DataRow("1+1.1e3", true)]
[DataRow("randi(8)", true)]
[DataRow("randi()", false)]
[DataRow("randi(0.5)", true)]
[DataRow("rand()", true)]
[DataRow("rand(0.5)", false)]
public void InputValid_TestValid_WhenCalled(string input, bool valid)
{
// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class CalculateHelper
@"^(" +
@"%|" +
@"ceil\s*\(|floor\s*\(|exp\s*\(|max\s*\(|min\s*\(|abs\s*\(|log(?:2|10)?\s*\(|ln\s*\(|sqrt\s*\(|pow\s*\(|" +
@"factorial\s*\(|sign\s*\(|round\s*\(|rand\s*\(|" +
@"factorial\s*\(|sign\s*\(|round\s*\(|rand\s*\(\)|randi\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|" +
Expand Down

0 comments on commit 94d7121

Please sign in to comment.