Commit 5f9574c3 authored by Victor Zverovich's avatar Victor Zverovich

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

parent 87545b0a
...@@ -328,6 +328,14 @@ TEST(WriterTest, WriteDoubleAtBufferBoundary) { ...@@ -328,6 +328,14 @@ TEST(WriterTest, WriteDoubleAtBufferBoundary) {
writer << 1.23456789; 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) { TEST(WriterTest, WriteChar) {
CHECK_WRITE('a'); CHECK_WRITE('a');
} }
......
...@@ -93,6 +93,8 @@ FMT_GCC_EXTENSION typedef unsigned long long ULongLong; ...@@ -93,6 +93,8 @@ FMT_GCC_EXTENSION typedef unsigned long long ULongLong;
namespace internal { namespace internal {
enum { INLINE_BUFFER_SIZE = 500 };
#if _SECURE_SCL #if _SECURE_SCL
template <typename T> template <typename T>
inline stdext::checked_array_iterator<T*> CheckPtr(T *ptr, std::size_t size) { inline stdext::checked_array_iterator<T*> CheckPtr(T *ptr, std::size_t size) {
...@@ -648,8 +650,7 @@ class BasicFormatter; ...@@ -648,8 +650,7 @@ class BasicFormatter;
template <typename Char> template <typename Char>
class BasicWriter { class BasicWriter {
private: private:
enum { INLINE_BUFFER_SIZE = 500 }; mutable internal::Array<Char, internal::INLINE_BUFFER_SIZE> buffer_; // Output buffer.
mutable internal::Array<Char, INLINE_BUFFER_SIZE> buffer_; // Output buffer.
friend class BasicFormatter<Char>; friend class BasicFormatter<Char>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment