6 Commits
1.5.1 ... 1.5.2

Author SHA1 Message Date
Matt Nadareski
93847420a5 Bump version 2025-05-12 08:11:12 -04:00
Matt Nadareski
76e13a47ec Fix length-based comparison issue 2025-05-12 08:09:59 -04:00
Matt Nadareski
4f56d716d4 Update copyright 2024-12-30 21:20:49 -05:00
Matt Nadareski
cd7e89f869 Remove unnecessary action step 2024-12-30 21:20:32 -05:00
Matt Nadareski
0810b4b083 Ensure .NET versions are installed for testing 2024-12-19 10:51:23 -05:00
Matt Nadareski
ba0b126714 Ensure .NET versions are installed for testing 2024-12-19 10:49:39 -05:00
5 changed files with 42 additions and 14 deletions

View File

@@ -16,7 +16,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Run tests
run: dotnet test
@@ -24,12 +27,6 @@ jobs:
- name: Run publish script
run: ./publish-nix.sh
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: "*.nupkg,*.snupkg"
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:

View File

@@ -11,7 +11,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Build
run: dotnet build

View File

@@ -8,7 +8,7 @@ namespace SabreTools.Matching.Test.Compare
public class NaturalComparerTests
{
[Fact]
public void NaturalComparer_ListSortTest()
public void NaturalComparer_ListSort_Numeric()
{
// Setup arrays
string[] sortable = ["0", "100", "5", "2", "1000"];
@@ -22,7 +22,21 @@ namespace SabreTools.Matching.Test.Compare
}
[Fact]
public void NaturalReversedComparer_ListSortTest()
public void NaturalComparer_ListSort_Mixed()
{
// Setup arrays
string[] sortable = ["b3b", "c", "b", "a", "a1"];
string[] expected = ["a", "a1", "b", "b3b", "c"];
// Run sorting on array
Array.Sort(sortable, new NaturalComparer());
// Check the output
Assert.True(sortable.SequenceEqual(expected));
}
[Fact]
public void NaturalReversedComparer_ListSort_Numeric()
{
// Setup arrays
string[] sortable = ["0", "100", "5", "2", "1000"];
@@ -34,5 +48,19 @@ namespace SabreTools.Matching.Test.Compare
// Check the output
Assert.True(sortable.SequenceEqual(expected));
}
[Fact]
public void NaturalReversedComparer_ListSort_Mixed()
{
// Setup arrays
string[] sortable = ["b3b", "c", "b", "a", "a1"];
string[] expected = ["c", "b3b", "b", "a1", "a"];
// Run sorting on array
Array.Sort(sortable, new NaturalReversedComparer());
// Check the output
Assert.True(sortable.SequenceEqual(expected));
}
}
}

View File

@@ -66,9 +66,9 @@ namespace SabreTools.Matching.Compare
return PartCompare(x1[i], y1[i]);
}
if (y1.Length > x1.Length)
if (x1.Length > y1.Length)
return 1;
else if (x1.Length > y1.Length)
else if (y1.Length > x1.Length)
return -1;
else
return x.CompareTo(y);

View File

@@ -9,12 +9,12 @@
<Nullable>enable</Nullable>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.5.1</Version>
<Version>1.5.2</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
<Description>Byte array and stream matching library</Description>
<Copyright>Copyright (c) Matt Nadareski 2018-2024</Copyright>
<Copyright>Copyright (c) Matt Nadareski 2018-2025</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/SabreTools/SabreTools.Matching</RepositoryUrl>