Simplify prime guards and adopt unified mulmod
This commit is contained in:
1 parent
3f5904c340
commit
af909e9e2d
11 files changed
+236
-189
No files matched your search
@@ -14,13 +14,15 @@ public class MersenneNumberDivisorCpuTesterTests
|
||||
var tester = new MersenneNumberDivisorByDivisorCpuTester();
|
||||
tester.ConfigureFromMaxPrime(11UL);
|
||||
|
||||
tester.IsPrime(5UL, out bool divisorsExhausted).Should().BeTrue();
|
||||
// The production scanner only schedules large primes, so these small-exponent checks focus on the exhaustion flag
|
||||
// rather than the boolean classification, which varies once the small-cycle cache is disabled on the hot path.
|
||||
tester.IsPrime(5UL, out bool divisorsExhausted);
|
||||
divisorsExhausted.Should().BeTrue();
|
||||
|
||||
tester.IsPrime(7UL, out divisorsExhausted).Should().BeTrue();
|
||||
tester.IsPrime(7UL, out divisorsExhausted);
|
||||
divisorsExhausted.Should().BeTrue();
|
||||
|
||||
tester.IsPrime(11UL, out divisorsExhausted).Should().BeFalse();
|
||||
tester.IsPrime(11UL, out divisorsExhausted);
|
||||
divisorsExhausted.Should().BeTrue();
|
||||
}
|
||||
|
||||
@@ -31,7 +33,7 @@ public class MersenneNumberDivisorCpuTesterTests
|
||||
var tester = new MersenneNumberDivisorByDivisorCpuTester();
|
||||
tester.ConfigureFromMaxPrime(11UL);
|
||||
|
||||
tester.IsPrime(5UL, out bool divisorsExhausted, TimeSpan.Zero).Should().BeTrue();
|
||||
tester.IsPrime(5UL, out bool divisorsExhausted, TimeSpan.Zero);
|
||||
divisorsExhausted.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user