Skip to content

Commit

Permalink
Merge branch 'feature/net9.0' into release/4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Nov 13, 2024
2 parents 15ade9b + 8e6e167 commit ce18f6a
Show file tree
Hide file tree
Showing 47 changed files with 498 additions and 335 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ jobs:
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- name: Add NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
Expand All @@ -37,6 +38,9 @@ jobs:
- name: Test .NET 8
run: dotnet test --no-build --verbosity normal --configuration Release --framework net8.0 --collect:"XPlat Code Coverage" --results-directory test-results/net8.0

- name: Test .NET 9
run: dotnet test --no-build --verbosity normal --configuration Release --framework net9.0 --collect:"XPlat Code Coverage" --results-directory test-results/net9.0

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/source_validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 4.0.0 - [Unreleased]
## 4.0.1 - [Unreleased]

### Removed

- X10D: Removed `Span<T>.Split` for .NET 9.0 target due to conflicts with
[`System.MemoryExtensions.Split`](https://learn.microsoft.com/en-us/dotnet/api/system.memoryextensions.split?view=net-8.0).

## [4.0.0] - 2024-06-12

### Added

Expand Down Expand Up @@ -642,7 +649,8 @@ please [open an issue](https://github.com/oliverbooth/X10D/issues)!

Earlier versions of this package are undocumented and unlisted from package results.

[unreleased]: https://github.com/oliverbooth/X10D/compare/v3.3.1...main
[unreleased]: https://github.com/oliverbooth/X10D/compare/v4.0.0...main
[4.0.0]: https://github.com/oliverbooth/X10D/releases/tag/v4.0.0
[3.3.1]: https://github.com/oliverbooth/X10D/releases/tag/v3.3.1
[3.3.0]: https://github.com/oliverbooth/X10D/releases/tag/v3.3.0
[3.2.2]: https://github.com/oliverbooth/X10D/releases/tag/v3.2.2
Expand Down
2 changes: 1 addition & 1 deletion X10D.Hosting/X10D.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions X10D.Tests/X10D.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<CoverletOutputFormat>xml,cobertura</CoverletOutputFormat>
Expand All @@ -14,14 +14,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="NSubstitute" Version="5.1.0"/>
<PackageReference Include="NUnit" Version="3.14.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"/>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
<PackageReference Include="System.Reactive" Version="6.0.0"/>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
<PackageReference Include="NSubstitute" Version="5.3.0"/>
<PackageReference Include="NUnit" Version="4.2.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.3.0"/>
<PackageReference Include="System.Reactive" Version="6.0.1"/>
</ItemGroup>

<ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions X10D.Tests/src/Collections/EnumerableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ public void For_ShouldTransform_GivenTransformationDelegate()

IEnumerable<DummyClass> source = oneToTen.Select(i => new DummyClass {Value = i}).ToArray();
IEnumerable<int> values = source.Select(o => o.Value);
CollectionAssert.AreEqual(oneToTen, values.ToArray());
Assert.That(values.ToArray(), Is.EqualTo(oneToTen).AsCollection);

source.For((i, o) => o.Value *= i);
values = source.Select(o => o.Value);
CollectionAssert.AreEqual(multipliedByIndex, values.ToArray());
Assert.That(values.ToArray(), Is.EqualTo(multipliedByIndex).AsCollection);
}

[Test]
Expand All @@ -146,11 +146,11 @@ public void ForEach_ShouldTransform_GivenTransformationDelegate()

IEnumerable<DummyClass> source = oneToTen.Select(i => new DummyClass {Value = i}).ToArray();
IEnumerable<int> values = source.Select(o => o.Value);
CollectionAssert.AreEqual(oneToTen, values.ToArray());
Assert.That(values.ToArray(), Is.EqualTo(oneToTen).AsCollection);

source.ForEach(o => o.Value *= 2);
values = source.Select(o => o.Value);
CollectionAssert.AreEqual(oneToTenDoubled, values.ToArray());
Assert.That(values.ToArray(), Is.EqualTo(oneToTenDoubled).AsCollection);
}

[Test]
Expand Down Expand Up @@ -245,18 +245,18 @@ public void Shuffled_ShouldReorder_GivenNotNull()
int[] array = Enumerable.Range(1, 52).ToArray(); // 52! chance of being shuffled to the same order
int[] shuffled = array[..];

CollectionAssert.AreEqual(array, shuffled);
Assert.That(shuffled, Is.EqualTo(array).AsCollection);

shuffled = array.Shuffled().ToArray();
CollectionAssert.AreNotEqual(array, shuffled);
Assert.That(shuffled, Is.Not.EqualTo(array).AsCollection);
}

[Test]
public void WhereNot_ShouldReturnCorrectElements_GivenSequence()
{
var enumerable = new[] {2, 4, 6, 7, 8, 9, 10};
IEnumerable<int> result = enumerable.WhereNot(x => x % 2 == 0);
CollectionAssert.AreEqual(new[] {7, 9}, result.ToArray());
Assert.That(result.ToArray(), Is.EqualTo(new[] { 7, 9 }).AsCollection);
}

[Test]
Expand Down Expand Up @@ -285,7 +285,7 @@ public void WhereNotNull_ShouldContainNoNullElements()

foreach (object o in array.WhereNotNull())
{
Assert.IsNotNull(o);
Assert.That(o, Is.Not.Null);
actualCount++;
}

Expand Down
64 changes: 32 additions & 32 deletions X10D.Tests/src/Collections/ListTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace X10D.Tests.Collections;
[TestFixture]
internal class ListTests
{
[Test]
[Test]
[TestCase(1)]
[TestCase(1, 2, 3)]
[TestCase(1, 2, 3, 4, 5)]
Expand All @@ -15,17 +15,17 @@ public void Fill_ShouldGiveHomogenousList_GivenValue(params int[] args)
int[] all42 = Enumerable.Repeat(42, args.Length).ToArray();
var list = new List<int>(args);

CollectionAssert.AreEqual(args, list);
Assert.That(list, Is.EqualTo(args).AsCollection);

args.Fill(42);
list.Fill(42);

CollectionAssert.AreEqual(args, list);
CollectionAssert.AreEqual(all42, args);
CollectionAssert.AreEqual(all42, list);
Assert.That(list, Is.EqualTo(args).AsCollection);
Assert.That(args, Is.EqualTo(all42).AsCollection);
Assert.That(list, Is.EqualTo(all42).AsCollection);
}

[Test]
[Test]
[TestCase(1)]
[TestCase(1, 2, 3)]
[TestCase(1, 2, 3, 4, 5)]
Expand All @@ -36,7 +36,7 @@ public void SlicedFill_ShouldLeaveFirstElement_GivenStartIndex1(params int[] arg

int[] comparison = Enumerable.Repeat(1, args.Length - 1).ToArray();
Assert.That(args[0], Is.EqualTo(first));
CollectionAssert.AreEqual(comparison, args[1..]);
Assert.That(args[1..], Is.EqualTo(comparison).AsCollection);
}

[Test]
Expand Down Expand Up @@ -80,7 +80,7 @@ public void Fill_ShouldThrow_GivenNull()
[Test]
public void IndexOf_ShouldReturnCorrectValue_FromStartOfList()
{
int[] array = {0, 1, 2, 3, 4};
int[] array = { 0, 1, 2, 3, 4 };
Assert.Multiple(() =>
{
Assert.That(array.IndexOf(2), Is.EqualTo(2));
Expand All @@ -92,7 +92,7 @@ public void IndexOf_ShouldReturnCorrectValue_FromStartOfList()
[Test]
public void IndexOf_ShouldReturnCorrectValue_GivenSubRange()
{
int[] array = {0, 1, 2, 3, 4, 0};
int[] array = { 0, 1, 2, 3, 4, 0 };
Assert.Multiple(() =>
{
Assert.That(array.IndexOf(0), Is.Zero);
Expand Down Expand Up @@ -149,7 +149,7 @@ public void IndexOf_ShouldThrowArgumentOutOfRangeException_GivenNegativeStartInd
[Test]
public void IndexOf_ShouldThrowArgumentOutOfRangeException_GivenInvalidStartIndexCountPair()
{
int[] array = {0, 1, 2};
int[] array = { 0, 1, 2 };
Assert.Throws<ArgumentOutOfRangeException>(() => array.IndexOf(0, 2, 4));
}

Expand Down Expand Up @@ -184,7 +184,7 @@ public void RemoveRange_ShouldThrowArgumentOutOfRangeException_GivenEndIndexLess
public void RemoveRange_ShouldThrowArgumentOutOfRangeException_GivenEndIndexGreaterThanOrEqualToCount()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new List<int>().RemoveRange(..0));
Assert.Throws<ArgumentOutOfRangeException>(() => new List<int> {1}.RemoveRange(..2));
Assert.Throws<ArgumentOutOfRangeException>(() => new List<int> { 1 }.RemoveRange(..2));
}

[Test]
Expand All @@ -208,7 +208,7 @@ public void RemoveRange_ShouldRemoveElements_GivenList()
list.RemoveRange(2..5);

Assert.That(list, Has.Count.EqualTo(6));
CollectionAssert.AreEqual(new[] {1, 2, 7, 8, 9, 10}, list);
Assert.That(list, Is.EqualTo(new[] { 1, 2, 7, 8, 9, 10 }).AsCollection);
}

[Test]
Expand All @@ -217,11 +217,11 @@ public void Shuffle_ShouldReorder_GivenNotNull()
var list = new List<int>(Enumerable.Range(1, 52)); // 52! chance of being shuffled to the same order
var shuffled = new List<int>(list);

CollectionAssert.AreEqual(list, shuffled);
Assert.That(shuffled, Is.EqualTo(list).AsCollection);

shuffled.Shuffle();

CollectionAssert.AreNotEqual(list, shuffled);
Assert.That(shuffled, Is.Not.EqualTo(list).AsCollection);
}

[Test]
Expand All @@ -233,23 +233,23 @@ public void Shuffle_ShouldThrow_GivenNull()
[Test]
public void Slice_ShouldReturnCorrectValue_GivenStartIndex()
{
int[] array = {0, 1, 2, 3, 4, 5};
CollectionAssert.AreEqual(new[] {2, 3, 4, 5}, array.Slice(2).ToArray());
int[] array = { 0, 1, 2, 3, 4, 5 };
Assert.That(array.Slice(2).ToArray(), Is.EqualTo(new[] { 2, 3, 4, 5 }).AsCollection);
}

[Test]
public void Slice_ShouldReturnCorrectValue_GivenStartIndexAndLength()
{
int[] array = {0, 1, 2, 3, 4, 5};
CollectionAssert.AreEqual(new[] {2, 3, 4}, array.Slice(2, 3).ToArray());
int[] array = { 0, 1, 2, 3, 4, 5 };
Assert.That(array.Slice(2, 3).ToArray(), Is.EqualTo(new[] { 2, 3, 4 }).AsCollection);
}

[Test]
public void Slice_ShouldReturnEmptyList_ForEmptyList()
{
int[] array = Array.Empty<int>();
CollectionAssert.AreEqual(Array.Empty<int>(), array.Slice(0).ToArray());
CollectionAssert.AreEqual(Array.Empty<int>(), array.Slice(0, 0).ToArray());
Assert.That(array.Slice(0).ToArray(), Is.EqualTo(Array.Empty<int>()).AsCollection);
Assert.That(array.Slice(0, 0).ToArray(), Is.EqualTo(Array.Empty<int>()).AsCollection);
}

[Test]
Expand Down Expand Up @@ -278,7 +278,7 @@ public void Slice_ShouldThrowArgumentOutOfRangeException_GivenNegativeStartIndex
[Test]
public void Slice_ShouldThrowArgumentOutOfRangeException_GivenInvalidStartIndexCountPair()
{
int[] array = {0, 1, 2};
int[] array = { 0, 1, 2 };
Assert.Throws<ArgumentOutOfRangeException>(() => array.Slice(2, 4));
}

Expand All @@ -297,18 +297,18 @@ public void Swap_ShouldThrowArgumentNullException_GivenNullTarget()
[Test]
public void Swap_ShouldSwapElements_GivenMatchingElementCount()
{
var first = new List<int> {1, 2, 3};
var second = new List<int> {4, 5, 6};
var first = new List<int> { 1, 2, 3 };
var second = new List<int> { 4, 5, 6 };

first.Swap(second);

CollectionAssert.AreEqual(new[] {4, 5, 6}, first, string.Join(' ', first));
CollectionAssert.AreEqual(new[] {1, 2, 3}, second, string.Join(' ', second));
Assert.That(first, Is.EqualTo(new[] { 4, 5, 6 }).AsCollection, string.Join(' ', first));
Assert.That(second, Is.EqualTo(new[] { 1, 2, 3 }).AsCollection, string.Join(' ', second));

first.Swap(second);

CollectionAssert.AreEqual(new[] {1, 2, 3}, first, string.Join(' ', first));
CollectionAssert.AreEqual(new[] {4, 5, 6}, second, string.Join(' ', second));
Assert.That(first, Is.EqualTo(new[] { 1, 2, 3 }).AsCollection, string.Join(' ', first));
Assert.That(second, Is.EqualTo(new[] { 4, 5, 6 }).AsCollection, string.Join(' ', second));
}

[Test]
Expand All @@ -322,16 +322,16 @@ public void Swap_ShouldSwapElements_GivenDifferentElementCount()
4,
5
};
var second = new List<int> {6, 7};
var second = new List<int> { 6, 7 };

first.Swap(second);

CollectionAssert.AreEqual(new[] {6, 7}, first, string.Join(' ', first));
CollectionAssert.AreEqual(new[] {1, 2, 3, 4, 5}, second, string.Join(' ', second));
Assert.That(first, Is.EqualTo(new[] { 6, 7 }).AsCollection, string.Join(' ', first));
Assert.That(second, Is.EqualTo(new[] { 1, 2, 3, 4, 5 }).AsCollection, string.Join(' ', second));

first.Swap(second);

CollectionAssert.AreEqual(new[] {1, 2, 3, 4, 5}, first, string.Join(' ', first));
CollectionAssert.AreEqual(new[] {6, 7}, second, string.Join(' ', second));
Assert.That(first, Is.EqualTo(new[] { 1, 2, 3, 4, 5 }).AsCollection, string.Join(' ', first));
Assert.That(second, Is.EqualTo(new[] { 6, 7 }).AsCollection, string.Join(' ', second));
}
}
Loading

0 comments on commit ce18f6a

Please sign in to comment.