| 4 | #include <cstring> |
| 5 | |
| 6 | struct ComplexValue |
| 7 | { |
| 8 | ComplexValue(const ComplexValue& other) |
| 9 | : isMoved(other.isMoved) |
| 10 | , isDeleted(other.isDeleted) |
| 11 | { |
| 12 | EXPECT_FALSE(other.isMoved); |
| 13 | EXPECT_FALSE(other.isDeleted); |
| 14 | } |
| 15 | |
| 16 | ComplexValue& operator=(const ComplexValue& other) noexcept |
| 17 | { |
| 18 | EXPECT_FALSE(other.isMoved); |
| 19 | EXPECT_FALSE(other.isDeleted); |
| 20 | isMoved = other.isMoved; |
| 21 | isDeleted = other.isDeleted; |
| 22 | return *this; |
| 23 | } |
| 24 | |
| 25 | ComplexValue() noexcept |
| 26 | : isMoved(false) |
| 27 | , isDeleted(false) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | ComplexValue(ComplexValue&& other) noexcept |
| 32 | : isMoved(other.isMoved) |
| 33 | , isDeleted(other.isDeleted) |
| 34 | { |
| 35 | EXPECT_FALSE(other.isDeleted); |
| 36 | other.isMoved = true; |
| 37 | } |
| 38 | |
| 39 | ~ComplexValue() noexcept { isDeleted = true; } |
| 40 | |
| 41 | ComplexValue& operator=(ComplexValue&& other) noexcept |
| 42 | { |
| 43 | isDeleted = other.isDeleted; |
| 44 | isMoved = other.isMoved; |
| 45 | other.isMoved = true; |
| 46 | return *this; |
| 47 | } |
| 48 | |
| 49 | bool isMoved; |
| 50 | bool isDeleted; |
| 51 | }; |
| 52 | |
| 53 | TEST(SmFlatHashMap, InsertFromItselfWhileGrow) |
| 54 | { |
nothing calls this directly
no outgoing calls
no test coverage detected