mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Add tests for str_clean_whitespaces
, fix documentation
This commit is contained in:
parent
6bc633ed35
commit
da57768854
|
@ -1302,7 +1302,7 @@ void str_sanitize_filename(char *str);
|
|||
*
|
||||
* @param str String to clean up
|
||||
*
|
||||
* @remark The strings are treated as zero-termineted strings.
|
||||
* @remark The strings are treated as zero-terminated strings.
|
||||
*/
|
||||
void str_clean_whitespaces(char *str);
|
||||
|
||||
|
|
|
@ -663,6 +663,26 @@ TEST(Str, Sanitize)
|
|||
EXPECT_STREQ(aBuf, " ");
|
||||
}
|
||||
|
||||
TEST(Str, CleanWhitespaces)
|
||||
{
|
||||
char aBuf[64];
|
||||
str_copy(aBuf, "aa bb ccc dddd eeeee");
|
||||
str_clean_whitespaces(aBuf);
|
||||
EXPECT_STREQ(aBuf, "aa bb ccc dddd eeeee");
|
||||
str_copy(aBuf, " ");
|
||||
str_clean_whitespaces(aBuf);
|
||||
EXPECT_STREQ(aBuf, "");
|
||||
str_copy(aBuf, " aa");
|
||||
str_clean_whitespaces(aBuf);
|
||||
EXPECT_STREQ(aBuf, "aa");
|
||||
str_copy(aBuf, "aa ");
|
||||
str_clean_whitespaces(aBuf);
|
||||
EXPECT_STREQ(aBuf, "aa");
|
||||
str_copy(aBuf, " aa bb ccc dddd eeeee ");
|
||||
str_clean_whitespaces(aBuf);
|
||||
EXPECT_STREQ(aBuf, "aa bb ccc dddd eeeee");
|
||||
}
|
||||
|
||||
TEST(Str, CompFilename)
|
||||
{
|
||||
EXPECT_EQ(str_comp_filenames("a", "a"), 0);
|
||||
|
|
Loading…
Reference in a new issue