mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Added some test cases that were failing under new version
This commit is contained in:
parent
ed58668931
commit
2847d0f6d0
|
@ -2831,7 +2831,6 @@ int str_comp_filenames(const char *a, const char *b)
|
|||
{
|
||||
if(*a >= '0' && *a <= '9' && *b >= '0' && *b <= '9')
|
||||
{
|
||||
result = 0;
|
||||
do
|
||||
{
|
||||
result = *a - *b;
|
||||
|
@ -2843,7 +2842,7 @@ int str_comp_filenames(const char *a, const char *b)
|
|||
return 1;
|
||||
else if(*b >= '0' && *b <= '9')
|
||||
return -1;
|
||||
else
|
||||
else if(!(!result && *a && *b))
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -820,6 +820,13 @@ TEST(Str, CompFilename)
|
|||
EXPECT_GT(str_comp_filenames("b", "A"), 0);
|
||||
EXPECT_LT(str_comp_filenames("a", "B"), 0);
|
||||
EXPECT_GT(str_comp_filenames("B", "a"), 0);
|
||||
EXPECT_EQ(str_comp_filenames("1A", "1a"), 0);
|
||||
EXPECT_LT(str_comp_filenames("1a", "1B"), 0);
|
||||
EXPECT_GT(str_comp_filenames("1B", "1a"), 0);
|
||||
EXPECT_LT(str_comp_filenames("1a", "1b"), 0);
|
||||
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_LT(str_comp_filenames("abc", "abcd"), 0);
|
||||
EXPECT_GT(str_comp_filenames("abcd", "abc"), 0);
|
||||
EXPECT_LT(str_comp_filenames("abc2", "abcd1"), 0);
|
||||
|
@ -829,8 +836,17 @@ TEST(Str, CompFilename)
|
|||
EXPECT_EQ(str_comp_filenames("file0", "file0"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file0", "file1"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file1", "file0"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file1", "file09"), 0);
|
||||
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_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);
|
||||
EXPECT_GT(str_comp_filenames("file09.ext", "file1.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file1.ext", "file009.ext"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file009.ext", "file1.ext"), 0);
|
||||
EXPECT_EQ(str_comp_filenames("file0.ext", "file0.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("file13.ext", "file37.ext"), 0);
|
||||
EXPECT_GT(str_comp_filenames("file37.ext", "file13.ext"), 0);
|
||||
EXPECT_LT(str_comp_filenames("FILE13.EXT", "file37.ext"), 0);
|
||||
|
|
Loading…
Reference in a new issue