Skip to content

Commit 6af66c3

Browse files
[libc] Fix sprintf FixedConv test
Similar to #98195. This patch enlarges the number to ensure that a 64-bit number is being read.
1 parent a1d73ac commit 6af66c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libc/test/src/stdio/sprintf_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,7 +3351,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
33513351
LIBC_NAMESPACE::sprintf(buff, "%hR", 0xff); // unsigned short fract max
33523352
ASSERT_STREQ_LEN(written, buff, "0.996094");
33533353

3354-
written = LIBC_NAMESPACE::sprintf(buff, "%lk", 0x0); // 0.0
3354+
written = LIBC_NAMESPACE::sprintf(buff, "%lk", 0x0ll); // 0.0
33553355
ASSERT_STREQ_LEN(written, buff, "0.000000");
33563356

33573357
written = LIBC_NAMESPACE::sprintf(buff, "%lk",
@@ -3365,7 +3365,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
33653365
0xffffffff); //-long fract max
33663366
ASSERT_STREQ_LEN(written, buff, "-1.000000");
33673367

3368-
written = LIBC_NAMESPACE::sprintf(buff, "%lK", 0x0); // 0.0
3368+
written = LIBC_NAMESPACE::sprintf(buff, "%lK", 0x0ll); // 0.0
33693369
ASSERT_STREQ_LEN(written, buff, "0.000000");
33703370

33713371
written =
@@ -3493,7 +3493,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
34933493
ASSERT_STREQ_LEN(written, buff, " 0.100 256.000 ");
34943494

34953495
written =
3496-
LIBC_NAMESPACE::sprintf(buff, "%+-#12.3lk % 012.3k", 0x000000001013a92a,
3496+
LIBC_NAMESPACE::sprintf(buff, "%+-#12.3lk % 012.3k", 0x000000001013a92all,
34973497
0x02740000); // 0.126, 1256.0
34983498
ASSERT_STREQ_LEN(written, buff, "+0.126 0001256.000");
34993499
}

0 commit comments

Comments
 (0)