[llvm] [ADT] Add `isPunct` to StringExtras (PR #105461)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 20:29:43 PDT 2024
================
@@ -380,3 +382,14 @@ TEST(StringExtrasTest, arrayToStringRef) {
roundTripTestString("\0\n");
roundTripTestString("\xFF\xFE");
}
+
+TEST(StringExtrasTest, isPunct) {
+ // Loop over all valid char values and verify that llvm::isPunct matched
+ // std::ispunct(). Limit to first 256 characters in case CHAR_BIT > 8.
+ int Count = 0;
+ for (char C = std::numeric_limits<char>::min(); Count < 256; ++C) {
+ EXPECT_EQ(static_cast<bool>(std::ispunct(C)), isPunct(C));
----------------
s-barannikov wrote:
`std::ispunct` result is locale-dependent and should not be used as a reference.
https://github.com/llvm/llvm-project/pull/105461
More information about the llvm-commits
mailing list