58 CPPUNIT_ASSERT_EQUAL(std::string(
"7fffffffffffffff"),
toStdString(
asHex(std::numeric_limits<int64_t>::max())));
59 CPPUNIT_ASSERT_EQUAL(std::string(
"ffffffffffffffff"),
toStdString(
asHex(std::numeric_limits<uint64_t>::max())));
66 CPPUNIT_ASSERT_EQUAL(std::string(
"80000000"),
toStdString(
asHex(std::numeric_limits<int32_t>::min())));
76 enum { enumValue = 0xABCD };
78 struct { uint8_t bitField:2; } s;
85 CPPUNIT_ASSERT_EQUAL(std::string(
"001"),
toStdString(
asHex(1).minDigits(3)));
88 CPPUNIT_ASSERT_EQUAL(std::string(
"0000"),
toStdString(
asHex(0).minDigits(4)));
91 CPPUNIT_ASSERT_EQUAL(std::string(
"1"),
toStdString(
asHex(0x1).minDigits(0)));
92 CPPUNIT_ASSERT_EQUAL(std::string(
"12"),
toStdString(
asHex(0x12).minDigits(1)));
93 CPPUNIT_ASSERT_EQUAL(std::string(
"123"),
toStdString(
asHex(0x123).minDigits(2)));
97 CPPUNIT_ASSERT_EQUAL(std::string(
"1A2B"),
toStdString(
asHex(0x1a2b).upperCase(
true)));
99 std::ostringstream ss;
102 ss << std::uppercase <<
asHex(0xABC).upperCase(
false);
103 CPPUNIT_ASSERT_EQUAL(std::string(
"abc"), ss.str());
107 CPPUNIT_ASSERT_EQUAL(std::string(
"01A"),
toStdString(
asHex(0x1A).upperCase().minDigits(3)));
114 CPPUNIT_ASSERT_EQUAL(std::string(
"A0a0"), ss.str());
118 ss << std::showbase <<
asHex(1);
119 CPPUNIT_ASSERT_EQUAL(std::string(
"0x1"), ss.str());
123 ss << std::uppercase << std::hex << 0xA <<
asHex(0xB) << 0xC;
124 CPPUNIT_ASSERT_EQUAL(std::string(
"ABC"), ss.str());
128 ss << std::uppercase << std::hex << 0xA <<
asHex(0xB).upperCase(
false) << 0xC;
129 CPPUNIT_ASSERT_EQUAL(std::string(
"AbC"), ss.str());
133 ss << std::oct << 9 <<
asHex(0xA) << 11;
134 CPPUNIT_ASSERT_EQUAL(std::string(
"11a13"), ss.str());
138 ss << std::setw(4) <<
asHex(0x1);
139 CPPUNIT_ASSERT_EQUAL(std::string(
" 1"), ss.str());
143 ss << std::setw(4) <<
asHex(0x1) << 2;
144 CPPUNIT_ASSERT_EQUAL(std::string(
" 12"), ss.str());
148 ss << std::setfill(
'.') << std::setw(4) <<
asHex(0x2);
149 CPPUNIT_ASSERT_EQUAL(std::string(
"...2"), ss.str());
153 ss << std::setfill(
'.') <<
asHex(0x3).minDigits(2) << std::setw(4) << 4;
154 CPPUNIT_ASSERT_EQUAL(std::string(
"03...4"), ss.str());