diff --git a/test/printf-test.cc b/test/printf-test.cc index 297cecdf..6ae3dc4c 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -381,12 +381,40 @@ TEST(PrintfTest, Int) { EXPECT_PRINTF(fmt::format("{:X}", u), "%X", -42); } +TEST(PrintfTest, Float) { + EXPECT_PRINTF("392.650000", "%f", 392.65); + EXPECT_PRINTF("392.650000", "%F", 392.65); + double inf = std::numeric_limits::infinity(); + EXPECT_PRINTF("inf", "%f", inf); + EXPECT_PRINTF("INF", "%F", inf); + char buffer[BUFFER_SIZE]; + safe_sprintf(buffer, "%e", 392.65); + EXPECT_PRINTF(buffer, "%e", 392.65); + safe_sprintf(buffer, "%E", 392.65); + EXPECT_PRINTF(buffer, "%E", 392.65); + EXPECT_PRINTF("392.65", "%g", 392.65); + EXPECT_PRINTF("392.65", "%G", 392.65); + EXPECT_PRINTF("inf", "%g", inf); + EXPECT_PRINTF("INF", "%G", inf); + // TODO: test %a & %A +} + TEST(PrintfTest, Char) { EXPECT_PRINTF("x", "%c", 'x'); int max = std::numeric_limits::max(); EXPECT_PRINTF(fmt::format("{}", static_cast(max)), "%c", max); + //EXPECT_PRINTF("x", "%lc", L'x'); // TODO: test wchar_t } -// TODO: test type specifier -// TODO: test char, string +TEST(PrintfTest, String) { + // TODO +} + +TEST(PrintfTest, Pointer) { + // TODO +} + +TEST(PrintfTest, Location) { + // TODO +}