Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
[Tests/UnitTests/Common/LimitTermination.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[Tests/UnitTests/Common/IntegrationDecline.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[Tests/UnitTests/Common/ExponentialOfALogarithmTest.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void TheRemainderMayBeOutOfReach(string integrand)
{
var watch = System.Diagnostics.Stopwatch.StartNew();
var integral = integrand.ToEntity().Integrate("x");
Assert.True(watch.Elapsed < TimeSpan.FromSeconds(20), $"took {watch.Elapsed}");
Assert.True(watch.Elapsed < IntegrationDecline.Guard, $"took {watch.Elapsed}");
if (!integral.Stringize().Contains("integral("))
DifferentiatesBack(integrand);
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Tests/UnitTests/Calculus/EulerSubstitutionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void DeclinedRatherThanWrongOrSlow(string integrand)
{
var watch = System.Diagnostics.Stopwatch.StartNew();
var integral = integrand.ToEntity().Integrate("x");
Assert.True(watch.Elapsed < TimeSpan.FromSeconds(20), $"took {watch.Elapsed}");
Assert.True(watch.Elapsed < IntegrationDecline.Guard, $"took {watch.Elapsed}");
Assert.DoesNotContain("NaN", integral.Stringize());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ private static void DifferentiatesBack(string integrand)
/// <summary>
/// <c>arctan(x)^2/x^2</c> leaves <c>arctan(x)/(x (1 + x^2))</c>, which has no elementary
/// antiderivative, and the descent has to stop there rather than search: bounded by the
/// clock, since the measure is what keeps a decline quick.
/// clock, since the measure is what keeps a decline quick -- 3.4 seconds here against
/// the runaway it was written against, with <see cref="IntegrationDecline.Guard"/> as
/// the bound so that a loaded runner does not fail it.
/// </summary>
[Fact]
public void ANonElementaryRemainderIsDeclinedQuickly()
{
var watch = System.Diagnostics.Stopwatch.StartNew();
var integral = "atan(x)^2/x^2".ToEntity().Integrate("x");
Assert.Contains("integral(", integral.Stringize());
Assert.True(watch.Elapsed < TimeSpan.FromSeconds(20), $"declined in {watch.Elapsed}");
Assert.True(watch.Elapsed < IntegrationDecline.Guard, $"declined in {watch.Elapsed}");
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Tests/UnitTests/Calculus/RepeatedByPartsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void AnUnanswerableIntegralDoesNotPayForTheRecursion()
watch.Stop();

Assert.Contains("integral(", answer.Stringize());
Assert.True(watch.Elapsed < TimeSpan.FromSeconds(30),
Assert.True(watch.Elapsed < IntegrationDecline.Guard,
$"took {watch.Elapsed.TotalSeconds:F1}s; without the decrease measure on the "
+ "remaining integrand it was 83s");
}
Expand Down
34 changes: 34 additions & 0 deletions Sources/Tests/UnitTests/Common/IntegrationDecline.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Copyright (c) 2019-2026 Angouri.
// AngouriMath is licensed under MIT.
// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
// Website: https://am.angouri.org.
//

using System;

namespace AngouriMath.Tests
{
/// <summary>
/// How long a test allows an integral that is declined, or answered after a search that once
/// ran away, before it calls the decline slow.
/// </summary>
/// <remarks>
/// The four tests that use it each pin a decline that used to take thirty seconds or more
/// and takes a few now -- <c>atan(x)^2/x^2</c> is 3.4 seconds on a developer machine. Their
/// bound was 20 seconds, and on 2026-09-17 the same test failed twice on an Ubuntu runner at
/// 20.7 and 25.7 seconds, in suites that took 13 and 12 minutes where the Windows leg beside
/// them took 4 and 6: the same binary, seven times slower, which makes it the runner and not
/// the code. A bound that fails on a busy runner blocks every merge that lands on one.
///
/// Sixty seconds is past the slowest honest decline by a wide margin and still well short of
/// the runaway each test was written against, so a regression to that still fails; what it
/// no longer does is fail a loaded runner. As <see cref="LimitTermination"/>: the bound is
/// there to catch a search that does not stop, not to measure the machine.
/// </remarks>
internal static class IntegrationDecline
{
/// <summary>The wall clock an integral is given before a test calls its decline slow.</summary>
internal static readonly TimeSpan Guard = TimeSpan.FromSeconds(60);
}
}
Loading