Test self assignment
This commit is contained in:
parent
8d0243dcde
commit
0de327d442
12
tests.cpp
12
tests.cpp
@ -167,6 +167,17 @@ void test_copy_assignment_decrements_previous_reference()
|
||||
assert(mybase_destruct == destructed_before + 2);
|
||||
}
|
||||
|
||||
void test_self_assignment()
|
||||
{
|
||||
int destructed_before = mybase_destruct;
|
||||
MyB a = MyB::create(1, 2);
|
||||
a = a;
|
||||
assert(a);
|
||||
assert(a->x == 1);
|
||||
assert(a.use_count() == 1);
|
||||
assert(mybase_destruct == destructed_before);
|
||||
}
|
||||
|
||||
void test_move_constructor()
|
||||
{
|
||||
int constructed_before = mybase_construct;
|
||||
@ -415,6 +426,7 @@ int main(int argc, char * argv[])
|
||||
test_multi_construct_from_raw_pointers();
|
||||
test_listener_self_registration();
|
||||
test_copy_assignment_decrements_previous_reference();
|
||||
test_self_assignment();
|
||||
test_cross_type_comparison();
|
||||
test_reset();
|
||||
test_move_constructor();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user