Test ownership also for BinaryWriter class

experiment/srcref_basic_cfg
Martchus 6 years ago
parent 1d4a4bd2be
commit f2b8ee4184

@ -223,6 +223,15 @@ void IoTests::testBinaryWriter()
for (char c : testData) {
CPPUNIT_ASSERT(c == static_cast<char>(testFile.get()));
}
// test ownership
writer.setStream(nullptr, true);
writer.setStream(new fstream(), true);
BinaryWriter writer2(writer);
CPPUNIT_ASSERT(writer2.stream() == writer.stream());
CPPUNIT_ASSERT(!writer2.hasOwnership());
writer.setStream(&testFile, false);
writer.setStream(new fstream(), true);
}
/*!

Loading…
Cancel
Save