mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
AK: Print NaN and infinite numbers in PrintfImplementation
This commit is contained in:
parent
feb19646df
commit
34108547b6
2 changed files with 41 additions and 1 deletions
|
@ -273,3 +273,19 @@ TEST_CASE(inttypes_macros)
|
|||
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") }));
|
||||
}
|
||||
|
||||
TEST_CASE(float_values)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
int i;
|
||||
} v;
|
||||
|
||||
v.i = 0x7fc00000;
|
||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", v.f, 6, LITERAL("| nan|\0") }));
|
||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", -v.f, 6, LITERAL("|-nan|\0") }));
|
||||
|
||||
v.i = 0x7f800000;
|
||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", v.f, 6, LITERAL("| inf|\0") }));
|
||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", -v.f, 6, LITERAL("|-inf|\0") }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue