[libc-commits] [libc] 9e0347d - [libc] Fix sprintf FixedConv test (#98204)
via libc-commits
libc-commits at lists.llvm.org
Tue Jul 9 13:21:36 PDT 2024
Author: Mikhail R. Gadelha
Date: 2024-07-09T17:21:31-03:00
New Revision: 9e0347d7054223f9735819557a16215c3205e216
URL: https://github.com/llvm/llvm-project/commit/9e0347d7054223f9735819557a16215c3205e216
DIFF: https://github.com/llvm/llvm-project/commit/9e0347d7054223f9735819557a16215c3205e216.diff
LOG: [libc] Fix sprintf FixedConv test (#98204)
This patch enlarges the number to ensure that a 64-bit number is being read.
Added:
Modified:
libc/test/src/stdio/sprintf_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index 7ccc0a2652e2b..1ca22f71f0f2f 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -3351,7 +3351,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
LIBC_NAMESPACE::sprintf(buff, "%hR", 0xff); // unsigned short fract max
ASSERT_STREQ_LEN(written, buff, "0.996094");
- written = LIBC_NAMESPACE::sprintf(buff, "%lk", 0x0); // 0.0
+ written = LIBC_NAMESPACE::sprintf(buff, "%lk", 0x0ll); // 0.0
ASSERT_STREQ_LEN(written, buff, "0.000000");
written = LIBC_NAMESPACE::sprintf(buff, "%lk",
@@ -3365,7 +3365,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
0xffffffff); //-long fract max
ASSERT_STREQ_LEN(written, buff, "-1.000000");
- written = LIBC_NAMESPACE::sprintf(buff, "%lK", 0x0); // 0.0
+ written = LIBC_NAMESPACE::sprintf(buff, "%lK", 0x0ll); // 0.0
ASSERT_STREQ_LEN(written, buff, "0.000000");
written =
@@ -3493,7 +3493,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
ASSERT_STREQ_LEN(written, buff, " 0.100 256.000 ");
written =
- LIBC_NAMESPACE::sprintf(buff, "%+-#12.3lk % 012.3k", 0x000000001013a92a,
+ LIBC_NAMESPACE::sprintf(buff, "%+-#12.3lk % 012.3k", 0x000000001013a92all,
0x02740000); // 0.126, 1256.0
ASSERT_STREQ_LEN(written, buff, "+0.126 0001256.000");
}
More information about the libc-commits
mailing list