Upgraded AngouriMath to v2.8.0 (#1235)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-25 18:45:24 +01:00
1 parent fae3ceb840
commit 506c06fbfc
24 files changed
+974 -105

No files matched your search

@@ -1,6 +1,9 @@
using System.Reflection;
using AIStudio.Tools.Mathematics;
using AngouriMath;
using AngouriMath.Core.Exceptions;
using Microsoft.Extensions.Logging.Abstractions;
@@ -104,6 +107,15 @@ public sealed class MathComputationServiceTests
Assert.That(() => service.ComputeAsync(SpinUntilCanceled, request.Token), Throws.InstanceOf<OperationCanceledException>());
}
[Test]
public async Task ABugOfAngouriMathBecomesAMessageWithoutTheLibrary()
{
var service = CreateService();
var bug = (Exception)Activator.CreateInstance(typeof(AngouriBugException), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, ["please report about it to the official repository of AngouriMath"], null)!;
var exception = (await Assert.ThrowsAsync<MathComputationException>(() => service.ComputeAsync<int>(_ => throw bug)))!;
Assert.That(exception.Message, Is.EqualTo("The tool ran into an error of its own with this expression and could not compute it."));
}
[Test]
public async Task AnExceptionOfAngouriMathBecomesAMessageAndFreesTheSlot()
{
@@ -112,7 +124,7 @@ public sealed class MathComputationServiceTests
using (Assert.EnterMultipleScope())
{
Assert.That(exception.Message, Does.StartWith("The tool could not compute this:`x + 1` evaluates to `x + 1`"));
Assert.That(exception.Message, Does.StartWith("The tool could not compute this: `x + 1` evaluates to `x + 1`"));
Assert.That(await service.ComputeAsync(_ => 4), Is.EqualTo(4));
}
}