Added a sorting mechanism to emulate how windows sorts files. Refactored cache to support chapter folders as well.

This commit is contained in:
Joseph Milazzo 2021-01-10 12:47:34 -06:00
parent 6020697d7d
commit f737f662df
11 changed files with 237 additions and 32 deletions

View file

@ -48,6 +48,7 @@ namespace API.Tests
[InlineData("Dance in the Vampire Bund v16-17 (Digital) (NiceDragon)", "")]
[InlineData("c001", "1")]
[InlineData("[Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.12.zip", "12")]
[InlineData("Adding volume 1 with File: Ana Satsujin Vol. 1 Ch. 5 - Manga Box (gb).cbz", "5")]
public void ParseChaptersTest(string filename, string expected)
{
var result = ParseChapter(filename);

View file

@ -0,0 +1,28 @@
using System;
using API.Comparators;
using Xunit;
namespace API.Tests.Services
{
public class StringLogicalComparerTest
{
[Theory]
[InlineData(
new[] {"x1.jpg", "x10.jpg", "x3.jpg", "x4.jpg", "x11.jpg"},
new[] {"x1.jpg", "x3.jpg", "x4.jpg", "x10.jpg", "x11.jpg"}
)]
public void TestLogicalComparer(string[] input, string[] expected)
{
NumericComparer nc = new NumericComparer();
Array.Sort(input, nc);
var i = 0;
foreach (var s in input)
{
Assert.Equal(s, expected[i]);
i++;
}
}
}
}