assorted: move getbytes to parseutil and add tests (#14076)

This commit is contained in:
Bogdan
2023-02-25 01:22:13 +02:00
committed by GitHub
parent 37455119e1
commit 7e52ea52e1
42 changed files with 96 additions and 81 deletions

View File

@@ -39,6 +39,19 @@ namespace Jackett.Test.Common.Utils
description.Value.Should().Contain("Know Your Role and Shut Your Mouth!");
}
[TestCase("1023.4 KB", 1047961)]
[TestCase("1023.4 MB", 1073112704)]
[TestCase("1,023.4 MB", 1073112704)]
[TestCase("1.023,4 MB", 1073112704)]
[TestCase("1 023,4 MB", 1073112704)]
[TestCase("1.023.4 MB", 1073112704)]
[TestCase("1023.4 GB", 1098867408896)]
[TestCase("1023.4 TB", 1125240226709504)]
public void should_parse_size(string stringSize, long size)
{
ParseUtil.GetBytes(stringSize).Should().Be(size);
}
[TestCase(" some string ", "some string")]
public void should_normalize_multiple_spaces(string original, string newString)
{