|
28 | 28 | #include <cppunit/extensions/HelperMacros.h> |
29 | 29 | #include <cppunit/extensions/TestFactoryRegistry.h> |
30 | 30 |
|
| 31 | +#include <memory> |
31 | 32 | #include <sstream> |
32 | 33 | #include <string> |
33 | 34 |
|
@@ -163,6 +164,8 @@ class DMRTest : public TestFixture { |
163 | 164 | CPPUNIT_TEST(test_copy_ctor_group_d4dim_complex); |
164 | 165 | CPPUNIT_TEST(test_copy_ctor_group_d4dim_complex_2); |
165 | 166 | CPPUNIT_TEST(test_copy_ctor_group_d4dim_complex_3); |
| 167 | + CPPUNIT_TEST(test_copy_ctor_flags); |
| 168 | + CPPUNIT_TEST(test_assignment_flags); |
166 | 169 |
|
167 | 170 | CPPUNIT_TEST_SUITE_END(); |
168 | 171 |
|
@@ -241,6 +244,31 @@ class DMRTest : public TestFixture { |
241 | 244 | DBG(cerr << __func__ << "() - END" << endl); |
242 | 245 | } |
243 | 246 |
|
| 247 | + // m_duplicate() must copy the direct-IO and UTF-8 encoding flags. |
| 248 | + void test_copy_ctor_flags() { |
| 249 | + unique_ptr<DMR> dmr(build_dmr("test.1", "test.1.das")); |
| 250 | + dmr->set_global_dio_flag(true); |
| 251 | + dmr->set_utf8_xml_encoding(true); |
| 252 | + |
| 253 | + DMR dmr_2(*dmr); |
| 254 | + CPPUNIT_ASSERT(dmr_2.get_global_dio_flag()); |
| 255 | + CPPUNIT_ASSERT(dmr_2.get_utf8_xml_encoding()); |
| 256 | + } |
| 257 | + |
| 258 | + void test_assignment_flags() { |
| 259 | + unique_ptr<DMR> dmr(build_dmr("test.1", "test.1.das")); |
| 260 | + dmr->set_global_dio_flag(true); |
| 261 | + dmr->set_utf8_xml_encoding(true); |
| 262 | + |
| 263 | + D4BaseTypeFactory factory; |
| 264 | + DMR dmr_2(&factory, "dest"); |
| 265 | + CPPUNIT_ASSERT(!dmr_2.get_global_dio_flag()); |
| 266 | + CPPUNIT_ASSERT(!dmr_2.get_utf8_xml_encoding()); |
| 267 | + dmr_2 = *dmr; |
| 268 | + CPPUNIT_ASSERT(dmr_2.get_global_dio_flag()); |
| 269 | + CPPUNIT_ASSERT(dmr_2.get_utf8_xml_encoding()); |
| 270 | + } |
| 271 | + |
244 | 272 | // This tests if using the copy still works after the original is deleted |
245 | 273 | void test_copy_ctor_2() { |
246 | 274 | DBG(cerr << endl << __func__ << "() - BEGIN" << endl); |
|
0 commit comments