@@ -69,10 +69,10 @@ TEST(StringUtilsTests, SplitString)
69
69
ASSERT_EQ (parts.size () > 5 ? parts[5 ] : " null" , " " );
70
70
}
71
71
72
- TEST (StringUtilsTests, AreAllCharactersWhitelisted )
72
+ TEST (StringUtilsTests, AreAllCharactersAllowlisted )
73
73
{
74
74
// testing method
75
- // bool AreAllCharactersWhitelisted (const std::string& stringToTest, const std::string& whitelist );
75
+ // bool AreAllCharactersAllowlisted (const std::string& stringToTest, const std::string& allowlist );
76
76
77
77
string allAsciiChars;
78
78
@@ -81,29 +81,29 @@ TEST(StringUtilsTests, AreAllCharactersWhitelisted)
81
81
allAsciiChars += ((char )i);
82
82
}
83
83
84
- // any string is whitelisted against the full list of characters
85
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (allAsciiChars, allAsciiChars));
86
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" " , allAsciiChars));
87
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" a" , allAsciiChars));
88
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" aaaaaaaaaaa" , allAsciiChars));
89
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (string (10000 , ' ' ), allAsciiChars));
90
-
91
- // any non-empty string is NOT whitelisted against an empty list of characters
92
- EXPECT_FALSE (StringUtils::AreAllCharactersWhitelisted (allAsciiChars, " " ));
93
- EXPECT_FALSE (StringUtils::AreAllCharactersWhitelisted (" a" , " " ));
94
- EXPECT_FALSE (StringUtils::AreAllCharactersWhitelisted (" aaaaaaaaaaa" , " " ));
95
- EXPECT_FALSE (StringUtils::AreAllCharactersWhitelisted (string (10000 , ' ' ), " " ));
96
-
97
- // empty string is whitelisted against any whitelist of characters
98
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" " , allAsciiChars));
99
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" " , " " ));
100
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" " , " a" ));
101
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" " , " aaaaaaaaaaa" ));
102
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" " , string (10000 , ' ' )));
84
+ // any string is allowed against the full list of characters
85
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (allAsciiChars, allAsciiChars));
86
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" " , allAsciiChars));
87
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" a" , allAsciiChars));
88
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" aaaaaaaaaaa" , allAsciiChars));
89
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (string (10000 , ' ' ), allAsciiChars));
90
+
91
+ // any non-empty string is NOT allowed against an empty list of characters
92
+ EXPECT_FALSE (StringUtils::AreAllCharactersAllowlisted (allAsciiChars, " " ));
93
+ EXPECT_FALSE (StringUtils::AreAllCharactersAllowlisted (" a" , " " ));
94
+ EXPECT_FALSE (StringUtils::AreAllCharactersAllowlisted (" aaaaaaaaaaa" , " " ));
95
+ EXPECT_FALSE (StringUtils::AreAllCharactersAllowlisted (string (10000 , ' ' ), " " ));
96
+
97
+ // empty string is allowed against any list of characters
98
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" " , allAsciiChars));
99
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" " , " " ));
100
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" " , " a" ));
101
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" " , " aaaaaaaaaaa" ));
102
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" " , string (10000 , ' ' )));
103
103
104
104
// a few more positive and negative tests
105
- EXPECT_TRUE (StringUtils::AreAllCharactersWhitelisted (" abc123" , " abcdef123456" ));
106
- EXPECT_FALSE (StringUtils::AreAllCharactersWhitelisted (" abc123" , " abcdef23456" ));
105
+ EXPECT_TRUE (StringUtils::AreAllCharactersAllowlisted (" abc123" , " abcdef123456" ));
106
+ EXPECT_FALSE (StringUtils::AreAllCharactersAllowlisted (" abc123" , " abcdef23456" ));
107
107
}
108
108
109
109
TEST (StringUtilsTests, ToString)
0 commit comments