MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / TEST

Function TEST

tests/src/Base/Stream.cpp:178–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176using BufferStreambuf = Base::BufferStreambuf;
177
178TEST(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
209TEST(BufferStreambuf, emptyBufferOut)
210{

Callers

nothing calls this directly

Calls 8

getMethod · 0.45
eofMethod · 0.45
failMethod · 0.45
clearMethod · 0.45
putMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected