Add FormatInt::size, and support for long and long long.

This commit is contained in:
Victor Zverovich
2014-02-13 09:59:49 -08:00
parent 2a3e010340
commit d473a79581
2 changed files with 15 additions and 6 deletions
+6
View File
@@ -1410,7 +1410,13 @@ TEST(FormatterTest, Examples) {
TEST(FormatIntTest, FormatInt) {
EXPECT_EQ("42", fmt::FormatInt(42).str());
EXPECT_EQ(2, fmt::FormatInt(42).size());
EXPECT_EQ("-42", fmt::FormatInt(-42).str());
EXPECT_EQ(3, fmt::FormatInt(-42).size());
EXPECT_EQ("42", fmt::FormatInt(42ul).str());
EXPECT_EQ("-42", fmt::FormatInt(-42l).str());
EXPECT_EQ("42", fmt::FormatInt(42ull).str());
EXPECT_EQ("-42", fmt::FormatInt(-42ll).str());
std::ostringstream os;
os << std::numeric_limits<int64_t>::max();
EXPECT_EQ(os.str(), fmt::FormatInt(std::numeric_limits<int64_t>::max()).str());