Add a test case for writing a double to a filled buffer.

This commit is contained in:
Victor Zverovich 2014-04-09 08:05:23 -07:00
parent 87545b0af4
commit 5f9574c3c1
2 changed files with 11 additions and 2 deletions

View File

@ -328,6 +328,14 @@ TEST(WriterTest, WriteDoubleAtBufferBoundary) {
writer << 1.23456789;
}
TEST(WriterTest, WriteDoubleWithFilledBuffer) {
fmt::Writer writer;
// Fill the buffer.
for (int i = 0; i < fmt::internal::INLINE_BUFFER_SIZE; ++i)
writer << ' ';
writer << 1.2;
}
TEST(WriterTest, WriteChar) {
CHECK_WRITE('a');
}

View File

@ -93,6 +93,8 @@ FMT_GCC_EXTENSION typedef unsigned long long ULongLong;
namespace internal {
enum { INLINE_BUFFER_SIZE = 500 };
#if _SECURE_SCL
template <typename T>
inline stdext::checked_array_iterator<T*> CheckPtr(T *ptr, std::size_t size) {
@ -648,8 +650,7 @@ class BasicFormatter;
template <typename Char>
class BasicWriter {
private:
enum { INLINE_BUFFER_SIZE = 500 };
mutable internal::Array<Char, INLINE_BUFFER_SIZE> buffer_; // Output buffer.
mutable internal::Array<Char, internal::INLINE_BUFFER_SIZE> buffer_; // Output buffer.
friend class BasicFormatter<Char>;