Cleanup: use doxygen groups for BLI_string_tests

This commit is contained in:
Campbell Barton
2023-05-09 17:02:28 +10:00
parent 5532d05622
commit 7f7804e62d

View File

@@ -20,7 +20,8 @@ using std::string;
using std::vector;
/* -------------------------------------------------------------------- */
/* tests */
/** \name String Partition
* \{ */
/* BLI_str_partition */
TEST(string, StrPartition)
@@ -321,6 +322,12 @@ TEST(string, StrPartitionExUtf8)
}
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Format Integer (Grouped)
* \{ */
/* BLI_str_format_int_grouped */
TEST(string, StrFormatIntGrouped)
{
@@ -381,6 +388,12 @@ TEST(string, StrFormatUint64Grouped)
EXPECT_EQ(sizeof(number_str), strlen(number_str) + 1);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Format Byte Units
* \{ */
/* BLI_str_format_byte_unit */
TEST(string, StrFormatByteUnits)
{
@@ -448,6 +461,12 @@ TEST(string, StrFormatByteUnits)
EXPECT_EQ(sizeof(size_str), strlen(size_str) + 1);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Format Decimal Units
* \{ */
/* BLI_str_format_decimal_unit */
TEST(string, StrFormatDecimalUnits)
{
@@ -640,6 +659,12 @@ TEST(string, StrFormatIntegerUnits)
EXPECT_STREQ("-2B", size_str);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Length (Clamped)
* \{ */
TEST(string, StringNLen)
{
EXPECT_EQ(0, BLI_strnlen("", 0));
@@ -659,6 +684,12 @@ TEST(string, StringNLen)
EXPECT_EQ(47, BLI_strnlen("This string writes about an agent without name.", 100));
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Find Split Words
* \{ */
struct WordInfo {
WordInfo() = default;
WordInfo(int start, int end) : start(start), end(end) {}
@@ -778,6 +809,12 @@ TEST_F(StringFindSplitWords, LimitChars)
testStringFindSplitWords(words, 0, {{-1, -1}});
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Search (Case Insensitive)
* \{ */
/* BLI_strncasestr */
TEST(string, StringStrncasestr)
{
@@ -803,6 +840,12 @@ TEST(string, StringStrncasestr)
EXPECT_EQ(res, (void *)nullptr);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Maximum Word Count
* \{ */
/* BLI_string_max_possible_word_count */
TEST(string, StringMaxPossibleWordCount)
{
@@ -813,6 +856,12 @@ TEST(string, StringMaxPossibleWordCount)
EXPECT_EQ(BLI_string_max_possible_word_count(10), 6);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String is Decimal
* \{ */
/* BLI_string_is_decimal */
TEST(string, StrIsDecimal)
{
@@ -832,6 +881,12 @@ TEST(string, StrIsDecimal)
EXPECT_TRUE(BLI_string_is_decimal("11342908713948713498745980171334059871345098713405981734"));
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Natural Case Insensitive Comparison
* \{ */
/* BLI_strcasecmp_natural */
class StringCasecmpNatural : public testing::Test {
protected:
@@ -876,6 +931,12 @@ class StringCasecmpNatural : public testing::Test {
}
};
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Case Insensitive Comparison
* \{ */
TEST_F(StringCasecmpNatural, Empty)
{
const CompareWordsArray equal{
@@ -1036,7 +1097,13 @@ TEST_F(StringCasecmpNatural, TextAndNumbers)
testReturnsMoreThanZeroForAll(positive);
}
/* BLI_str_escape, BLI_str_unescape */
/** \} */
/* -------------------------------------------------------------------- */
/** \name String Escape/Un-Escape
*
* #BLI_str_escape, #BLI_str_unescape.
* \{ */
class StringEscape : public testing::Test {
protected:
@@ -1119,3 +1186,5 @@ TEST_F(StringEscape, Control)
testEscapeWords(escaped);
}
/** \} */