You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.4 KiB
30 lines
1.4 KiB
5 years ago
|
using System;
|
||
|
using System.Linq;
|
||
|
using Xunit;
|
||
|
|
||
4 years ago
|
namespace Jellyfin.Extensions.Tests
|
||
5 years ago
|
{
|
||
4 years ago
|
public class AlphanumericComparatorTests
|
||
5 years ago
|
{
|
||
5 years ago
|
// InlineData is pre-sorted
|
||
5 years ago
|
[Theory]
|
||
|
[InlineData(null, "", "1", "9", "10", "a", "z")]
|
||
|
[InlineData("50F", "100F", "SR9", "SR100")]
|
||
|
[InlineData("image-1.jpg", "image-02.jpg", "image-4.jpg", "image-9.jpg", "image-10.jpg", "image-11.jpg", "image-22.jpg")]
|
||
|
[InlineData("Hard drive 2GB", "Hard drive 20GB")]
|
||
|
[InlineData("b", "e", "è", "ě", "f", "g", "k")]
|
||
|
[InlineData("123456789", "123456789a", "abc", "abcd")]
|
||
|
[InlineData("12345678912345678912345678913234567891", "123456789123456789123456789132345678912")]
|
||
|
[InlineData("12345678912345678912345678913234567891", "12345678912345678912345678913234567891")]
|
||
|
[InlineData("12345678912345678912345678913234567891", "12345678912345678912345678913234567892")]
|
||
|
[InlineData("12345678912345678912345678913234567891a", "12345678912345678912345678913234567891a")]
|
||
|
[InlineData("12345678912345678912345678913234567891a", "12345678912345678912345678913234567891b")]
|
||
4 years ago
|
public void AlphanumericComparatorTest(params string?[] strings)
|
||
5 years ago
|
{
|
||
4 years ago
|
var copy = strings.Reverse().ToArray();
|
||
4 years ago
|
Array.Sort(copy, new AlphanumericComparator());
|
||
5 years ago
|
Assert.True(strings.SequenceEqual(copy));
|
||
|
}
|
||
|
}
|
||
|
}
|