Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SwapTest() {
- bool is_deleted = false;
- bool is_deleted2 = false;
- int copy_count_ = 0;
- int copy_count_2 = 0;
- auto *ptr = new Spy(is_deleted, copy_count_);
- auto *ptr2 = new Spy(is_deleted2, copy_count_2);
- UniquePtr<Spy> uptr(ptr);
- UniquePtr<Spy> uptr2(ptr2);
- uptr.Swap(uptr2);
- ASSERT_EQUAL(uptr.Get(), ptr2);
- ASSERT_EQUAL(uptr2.Get(), ptr);
- ASSERT_EQUAL(copy_count_, 0)
- ASSERT_EQUAL(copy_count_2, 0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement