| 176 | using BufferStreambuf = Base::BufferStreambuf; |
| 177 | |
| 178 | TEST(BufferStreambuf, emptyBufferIn) |
| 179 | { |
| 180 | std::array<char, 0> array; |
| 181 | BufferStreambuf streambuf(array, std::ios::in); |
| 182 | std::istream stream(&streambuf); |
| 183 | |
| 184 | // Read a byte with get() |
| 185 | EXPECT_TRUE(stream.good()); |
| 186 | EXPECT_EQ(stream.get(), std::istream::traits_type::eof()); |
| 187 | EXPECT_TRUE(stream.eof()); |
| 188 | EXPECT_TRUE(stream.fail()); |
| 189 | |
| 190 | // Peek a byte |
| 191 | stream.seekg(0, std::ios::beg); |
| 192 | stream.clear(); |
| 193 | EXPECT_TRUE(stream.good()); |
| 194 | EXPECT_EQ(stream.peek(), std::istream::traits_type::eof()); |
| 195 | EXPECT_TRUE(stream.eof()); |
| 196 | EXPECT_FALSE(stream.fail()); |
| 197 | |
| 198 | // Read a char with formatted input |
| 199 | stream.seekg(0, std::ios::beg); |
| 200 | stream.clear(); |
| 201 | EXPECT_TRUE(stream.good()); |
| 202 | char c = 123; |
| 203 | stream >> c; |
| 204 | EXPECT_EQ(c, 123); |
| 205 | EXPECT_TRUE(stream.eof()); |
| 206 | EXPECT_TRUE(stream.fail()); |
| 207 | } |
| 208 | |
| 209 | TEST(BufferStreambuf, emptyBufferOut) |
| 210 | { |