| 52 | static int assignCallCount = 0; |
| 53 | |
| 54 | struct ComplexVal |
| 55 | { |
| 56 | ComplexVal() = delete; |
| 57 | ComplexVal(const ComplexVal& other) = delete; |
| 58 | ComplexVal& operator=(const ComplexVal& other) noexcept = delete; |
| 59 | |
| 60 | ComplexVal(uint32_t _v) noexcept |
| 61 | : v(_v) |
| 62 | , status(Status::Constructed) |
| 63 | { |
| 64 | ctorCallCount++; |
| 65 | } |
| 66 | |
| 67 | ComplexVal(ComplexVal&& other) noexcept |
| 68 | : v(other.v) |
| 69 | , status(Status::MoveConstructed) |
| 70 | { |
| 71 | EXPECT_NE(other.status, Status::Destructed); |
| 72 | ctorCallCount++; |
| 73 | other.status = Status::Moved; |
| 74 | } |
| 75 | |
| 76 | ~ComplexVal() noexcept |
| 77 | { |
| 78 | EXPECT_NE(status, Status::Destructed); |
| 79 | status = Status::Destructed; |
| 80 | dtorCallCount++; |
| 81 | } |
| 82 | |
| 83 | ComplexVal& operator=(ComplexVal&& other) noexcept |
| 84 | { |
| 85 | status = Status::MoveAssigned; |
| 86 | other.status = Status::Moved; |
| 87 | |
| 88 | v = other.v; |
| 89 | assignCallCount++; |
| 90 | return *this; |
| 91 | } |
| 92 | |
| 93 | uint32_t v; |
| 94 | enum class Status |
| 95 | { |
| 96 | Constructed = 0, |
| 97 | MoveConstructed = 1, |
| 98 | MoveAssigned = 2, |
| 99 | Destructed = 3, |
| 100 | Moved = 4, |
| 101 | }; |
| 102 | Status status; |
| 103 | }; |
| 104 | |
| 105 | template <typename TFrom, typename TTo> void doMoveAssignmentTest(TFrom& hm1, TTo& hm2, size_t numValuesToInsert) |
| 106 | { |
nothing calls this directly
no outgoing calls
no test coverage detected