Handle short and float arguments

This commit is contained in:
Victor Zverovich
2013-03-31 07:01:09 -07:00
parent aa9a94c8df
commit d3be932534
2 changed files with 14 additions and 0 deletions
+11
View File
@@ -809,6 +809,13 @@ void CheckUnknownTypes(
}
}
TEST(FormatterTest, FormatShort) {
short s = 42;
EXPECT_EQ("42", str(Format("{0:d}") << s));
unsigned short us = 42;
EXPECT_EQ("42", str(Format("{0:d}") << us));
}
TEST(FormatterTest, FormatInt) {
EXPECT_THROW_MSG(Format("{0:v") << 42,
FormatError, "unmatched '{' in format");
@@ -883,6 +890,10 @@ TEST(FormatterTest, FormatOct) {
EXPECT_EQ(buffer, str(Format("{0:o}") << ULONG_MAX));
}
TEST(FormatterTest, FormatFloat) {
EXPECT_EQ("392.500000", str(Format("{0:f}") << 392.5f));
}
TEST(FormatterTest, FormatDouble) {
CheckUnknownTypes(1.2, "eEfFgG", "double");
EXPECT_EQ("0", str(Format("{0:}") << 0.0));