Skip to content

Commit 19ebaa6

Browse files
Add .NET 9.0 to target frameworks
Updated Open.Numeric.Primes.csproj to include `net9.0` in the <TargetFrameworks> element. This ensures compatibility with .NET 9.0, allowing the project to leverage new features and improvements in this version. The project now supports `netstandard2.0`, `netstandard2.1`, `net7.0`, `net8.0`, and `net9.0`.
1 parent 3130f80 commit 19ebaa6

5 files changed

+30
-5
lines changed

benchmarks/Open.Numeric.Primes.Benchmarks.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<NoWarn>CA1822;</NoWarn>

source/Open.Numeric.Primes.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0;net8.0;net9.0;</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
@@ -20,7 +20,7 @@
2020
<PackageProjectUrl>https://github.com/Open-NET-Libraries/Open.Numeric.Primes/</PackageProjectUrl>
2121
<RepositoryUrl>https://github.com/Open-NET-Libraries/Open.Numeric.Primes/</RepositoryUrl>
2222
<RepositoryType>git</RepositoryType>
23-
<Version>4.0.2</Version>
23+
<Version>4.0.3</Version>
2424
<PackageReleaseNotes></PackageReleaseNotes>
2525
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2626
<PublishRepositoryUrl>true</PublishRepositoryUrl>

speed/Open.Numeric.Primes.Speed.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
</PropertyGroup>
77
<ItemGroup>

tests/Open.Numeric.Primes.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

tests/PrimeTests.cs

+25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using FluentAssertions;
2+
using Open.Numeric.Primes.Extensions;
23
using System;
34
using System.Collections.Generic;
45
using System.Collections.Immutable;
@@ -375,4 +376,28 @@ public static void PrimeFactors_BigInt()
375376
);
376377
}
377378
}
379+
380+
[Theory]
381+
[InlineData(9223372036854775783UL)]
382+
[InlineData(9223372036854775837UL)]
383+
[InlineData(9223372036854775907UL)]
384+
public static void MillerRabinKnownLargeProbablePrimes(ulong number)
385+
=> MillerRabin.IsProbablePrime(number).Should().BeTrue();
386+
387+
[Theory]
388+
[InlineData(9223372036854775783UL)]
389+
[InlineData(9223372036854775837UL)]
390+
[InlineData(9223372036854775907UL)]
391+
public static void KnownLargePrimes(ulong number)
392+
=> number.IsPrime().Should().BeTrue();
393+
394+
[Fact]
395+
public static void MillerRabinTest()
396+
{
397+
foreach (var p in FirstKnownInt32.Select(i => (ulong)i))
398+
MillerRabin.IsPrime(p).Should().BeTrue();
399+
400+
foreach (var p in FirstNotInt32.Select(i => (ulong)i))
401+
MillerRabin.IsPrime(p).Should().BeFalse();
402+
}
378403
}

0 commit comments

Comments
 (0)