add tests for printf %f precision, fix spacing on %.f precision fix

This commit is contained in:
Arthur Danskin 2017-04-03 18:43:14 -04:00
parent e787f6b74b
commit 7c62a60fc7
2 changed files with 4 additions and 1 deletions

View File

@ -440,7 +440,7 @@ void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str) {
++s;
spec.precision_ = internal::PrecisionHandler().visit(get_arg(s));
} else {
spec.precision_ = 0;
spec.precision_ = 0;
}
}

View File

@ -401,6 +401,9 @@ TEST(PrintfTest, LongLong) {
TEST(PrintfTest, Float) {
EXPECT_PRINTF("392.650000", "%f", 392.65);
EXPECT_PRINTF("392.65", "%.2f", 392.65);
EXPECT_PRINTF("392.6", "%.1f", 392.65);
EXPECT_PRINTF("392", "%.f", 392.65);
EXPECT_PRINTF("392.650000", "%F", 392.65);
EXPECT_PRINTF("392.65", "%s", 392.65);
char buffer[BUFFER_SIZE];