[libc-commits] [PATCH] D156257: [libc][NFC] fix sprintf test on 32 bit systems
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Jul 26 11:34:04 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG91eb99b84173: [libc][NFC] fix sprintf test on 32 bit systems (authored by michaelrj).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156257/new/
https://reviews.llvm.org/D156257
Files:
libc/test/src/stdio/sprintf_test.cpp
Index: libc/test/src/stdio/sprintf_test.cpp
===================================================================
--- libc/test/src/stdio/sprintf_test.cpp
+++ libc/test/src/stdio/sprintf_test.cpp
@@ -122,13 +122,19 @@
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "18446744073709551615"); // ull max
+ written = __llvm_libc::sprintf(buff, "%u", ~0);
+ if (sizeof(int) == 4) {
+ EXPECT_EQ(written, 10);
+ ASSERT_STREQ(buff, "4294967295");
+ }
+
written = __llvm_libc::sprintf(buff, "%tu", ~ptrdiff_t(0));
if (sizeof(ptrdiff_t) == 8) {
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "18446744073709551615");
} else if (sizeof(ptrdiff_t) == 4) {
EXPECT_EQ(written, 10);
- ASSERT_STREQ(buff, "4294967296");
+ ASSERT_STREQ(buff, "4294967295");
}
written = __llvm_libc::sprintf(buff, "%lld", -9223372036854775807ll - 1ll);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156257.544458.patch
Type: text/x-patch
Size: 863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230726/b703e4ae/attachment.bin>
More information about the libc-commits
mailing list