mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Add some more test to str_comp_filenames and restore old behavior
This commit is contained in:
parent
5282c8e2e5
commit
8b3dfaf2d0
|
@ -2834,8 +2834,10 @@ int str_comp_filenames(const char *a, const char *b)
|
|||
{
|
||||
if(*a >= '0' && *a <= '9' && *b >= '0' && *b <= '9')
|
||||
{
|
||||
result = 0;
|
||||
do
|
||||
{
|
||||
if(!result)
|
||||
result = *a - *b;
|
||||
++a;
|
||||
++b;
|
||||
|
|
|
@ -827,6 +827,12 @@ TEST(Str, CompFilename)
|
|||
EXPECT_GT(str_comp_filenames("1b", "1a"), 0);
|
||||
EXPECT_GT(str_comp_filenames("12a", "1B"), 0);
|
||||
EXPECT_LT(str_comp_filenames("1B", "12a"), 0);
|
||||
EXPECT_GT(str_comp_filenames("10a", "1B"), 0);
|
||||
EXPECT_LT(str_comp_filenames("1B", "10a"), 0);
|
||||
EXPECT_GT(str_comp_filenames("10a", "00B"), 0);
|
||||
EXPECT_LT(str_comp_filenames("00B", "10a"), 0);
|
||||
EXPECT_GT(str_comp_filenames("10a", "09B"), 0);
|
||||
EXPECT_LT(str_comp_filenames("09B", "10a"), 0);
|
||||
EXPECT_LT(str_comp_filenames("abc", "abcd"), 0);
|
||||
EXPECT_GT(str_comp_filenames("abcd", "abc"), 0);
|
||||
EXPECT_LT(str_comp_filenames("abc2", "abcd1"), 0);
|
||||
|
@ -840,6 +846,10 @@ TEST(Str, CompFilename)
|
|||
EXPECT_GT(str_comp_filenames("file09", "file1"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file1", "file009"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file009", "file1"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file10", "file00"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file00", "file10"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file10", "file09"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file09", "file10"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file13", "file37"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file37", "file13"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file1.ext", "file09.ext"), 0);
|
||||
|
@ -851,6 +861,10 @@ TEST(Str, CompFilename)
|
|||
EXPECT_GT(str_comp_filenames("file37.ext", "file13.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("FILE13.EXT", "file37.ext"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file37.ext", "FILE13.EXT"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file10.ext", "file00.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file00.ext", "file10.ext"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file10.ext", "file09.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file09.ext", "file10.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file42", "file1337"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file1337", "file42"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file42.ext", "file1337.ext"), 0);
|
||||
|
|
Loading…
Reference in a new issue