| 648 | |
| 649 | #ifndef TSTRING_IS_STD_STRING |
| 650 | void TestRefCount() { |
| 651 | using TStr = TStringType; |
| 652 | |
| 653 | struct TestStroka: public TStr { |
| 654 | using TStr::TStr; |
| 655 | // un-protect |
| 656 | using TStr::RefCount; |
| 657 | }; |
| 658 | |
| 659 | TestStroka s1(Data.orig()); |
| 660 | UNIT_ASSERT_EQUAL(s1.RefCount() == 1, true); |
| 661 | TestStroka s2(s1); |
| 662 | UNIT_ASSERT_EQUAL(s1.RefCount() == 2, true); |
| 663 | UNIT_ASSERT_EQUAL(s2.RefCount() == 2, true); |
| 664 | UNIT_ASSERT_EQUAL(s1.c_str() == s2.c_str(), true); // the same pointer |
| 665 | char_type* beg = s2.begin(); |
| 666 | UNIT_ASSERT_EQUAL(s1 == beg, true); |
| 667 | UNIT_ASSERT_EQUAL(s1.RefCount() == 1, true); |
| 668 | UNIT_ASSERT_EQUAL(s2.RefCount() == 1, true); |
| 669 | UNIT_ASSERT_EQUAL(s1.c_str() == s2.c_str(), false); |
| 670 | } |
| 671 | #endif |
| 672 | |
| 673 | // Find family |