13 #include "gtest/gtest.h" 20 class FormatArgImplTest :
public ::testing::Test {
22 enum Color { kRed, kGreen, kBlue };
24 static const char *hi() {
return "hi"; }
27 TEST_F(FormatArgImplTest, ToInt) {
37 FormatArgImpl(static_cast<unsigned long long>(123456)), &out));
38 EXPECT_EQ(123456, out);
40 FormatArgImpl(static_cast<unsigned long long>(
41 std::numeric_limits<int>::max()) +
44 EXPECT_EQ(std::numeric_limits<int>::max(), out);
46 FormatArgImpl(static_cast<long long>(
47 std::numeric_limits<int>::min()) -
50 EXPECT_EQ(std::numeric_limits<int>::min(), out);
58 FormatArgImpl(static_cast<int *>(
nullptr)), &out));
65 extern const char kMyArray[];
67 TEST_F(FormatArgImplTest, CharArraysDecayToCharPtr) {
79 TEST_F(FormatArgImplTest, OtherPtrDecayToVoidPtr) {
81 FormatArgImpl(static_cast<void *>(
nullptr)));
83 FormatArgImpl(static_cast<int *>(
nullptr))),
86 FormatArgImpl(static_cast<volatile int *>(
nullptr))),
89 auto p =
static_cast<void (*)()
>([] {});
94 TEST_F(FormatArgImplTest, WorksWithCharArraysOfUnknownSize) {
96 FormatSinkImpl sink(&s);
99 conv.set_flags(Flags());
101 conv.set_precision(-1);
105 EXPECT_EQ(
"ABCDE", s);
107 const char kMyArray[] =
"ABCDE";
TEST_F(GraphCyclesTest, NoCycle)