Reset residue toggle after default-limit residue test
This commit is contained in:
1 parent
5420523a0a
commit
662cfa8cc7
3 files changed
+98
-10
No files matched your search
@@ -21,9 +21,57 @@ public class MersenneNumberResidueGpuTesterTests
|
||||
RunCase(tester, 29UL, 37UL, expectedPrime: false);
|
||||
RunCase(tester, 31UL, 1_000UL, expectedPrime: true);
|
||||
RunCase(tester, 89UL, 1_001UL, expectedPrime: true);
|
||||
RunCase(tester, 107UL, 1_001UL, expectedPrime: true);
|
||||
RunCase(tester, 127UL, 1_001UL, expectedPrime: true);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
[Trait("Category", "Fast")]
|
||||
public void Scan_handles_multiple_sets_without_false_positives(bool useGpuOrder)
|
||||
{
|
||||
var tester = new MersenneNumberResidueGpuTester(useGpuOrder);
|
||||
|
||||
bool isPrime = true;
|
||||
bool exhausted = false;
|
||||
UInt128 perSetLimit = 1_666_667UL;
|
||||
UInt128 setCount = 3UL;
|
||||
UInt128 overallLimit = 5_000_000UL;
|
||||
|
||||
tester.Scan(
|
||||
127UL,
|
||||
(UInt128)127UL << 1,
|
||||
LastDigitIsSeven(127UL),
|
||||
perSetLimit,
|
||||
setCount,
|
||||
overallLimit,
|
||||
ref isPrime,
|
||||
ref exhausted);
|
||||
|
||||
isPrime.Should().BeTrue();
|
||||
exhausted.Should().BeTrue();
|
||||
|
||||
isPrime = true;
|
||||
exhausted = false;
|
||||
perSetLimit = 20_000_000UL;
|
||||
setCount = 5UL;
|
||||
overallLimit = 100_000_000UL;
|
||||
|
||||
tester.Scan(
|
||||
107UL,
|
||||
(UInt128)107UL << 1,
|
||||
LastDigitIsSeven(107UL),
|
||||
perSetLimit,
|
||||
setCount,
|
||||
overallLimit,
|
||||
ref isPrime,
|
||||
ref exhausted);
|
||||
|
||||
isPrime.Should().BeTrue();
|
||||
exhausted.Should().BeTrue();
|
||||
}
|
||||
|
||||
private static void RunCase(MersenneNumberResidueGpuTester tester, ulong exponent, ulong maxK, bool expectedPrime)
|
||||
{
|
||||
bool isPrime = true;
|
||||
|
||||
Reference in new issue
Block a user