mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibC: Set PRI[xX]8/PRI[xX]16 macros to x
and X
Described in:
<https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/
inttypes.h.html>
The macros were first added in a7a456002e
,
but it is not clear why the PRIx16/32 macros were defined as 'b' & 'w'.
PrintfImplementation was never able to parse these values.
This commit is contained in:
parent
97cfb9934b
commit
6c06b70911
2 changed files with 14 additions and 4 deletions
|
@ -10,6 +10,8 @@
|
|||
#include <AK/Random.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
@ -263,3 +265,11 @@ TEST_CASE(hexadecimal_values)
|
|||
EXPECT(test_single<int>({ LITERAL("xxx\0"), "|%x|", 0, 3, LITERAL("|0|\0") }));
|
||||
EXPECT(test_single<int>({ LITERAL("xxx\0"), "|%#x|", 0, 3, LITERAL("|0|\0") }));
|
||||
}
|
||||
|
||||
TEST_CASE(inttypes_macros)
|
||||
{
|
||||
EXPECT(test_single<uint8_t>({ LITERAL("xxxxx"), "|%" PRIx8 "|", 0xAB, 4, LITERAL("|ab|\0") }));
|
||||
EXPECT(test_single<uint8_t>({ LITERAL("xxxxx"), "|%" PRIX8 "|", 0xAB, 4, LITERAL("|AB|\0") }));
|
||||
EXPECT(test_single<uint16_t>({ LITERAL("xxxxxxx"), "|%" PRIx16 "|", 0xC0DE, 6, LITERAL("|c0de|\0") }));
|
||||
EXPECT(test_single<uint16_t>({ LITERAL("xxxxxxx"), "|%" PRIX16 "|", 0xC0DE, 6, LITERAL("|C0DE|\0") }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue