@@ -33,8 +33,14 @@ namespace rtl_tests
3333 // 'Event' has a unique_ptr<Date> and two 'Event' instances exists, So-
3434 EXPECT_TRUE (date::get_instance_count () == 2 );
3535
36+ // Sets Calender's move operation counter to zero
37+ calender::reset_move_ops_counter ();
38+
3639 // Moving a RObject created via alloc::Stack, invokes Calender's move constructor.
3740 RObject calender1 = std::move (calender0);
41+
42+ // Calender's move-constructor called once.
43+ EXPECT_TRUE (calender::get_move_ops_count () == 1 );
3844
3945 ASSERT_FALSE (calender1.isEmpty ());
4046 EXPECT_TRUE (calender1.isConstCastSafe ());
@@ -91,10 +97,16 @@ namespace rtl_tests
9197 // 'Event' has a unique_ptr<Date> and two 'Event' instances exists, So-
9298 EXPECT_TRUE (date::get_instance_count () == 2 );
9399
100+ // Sets Calender's move operation counter to zero
101+ calender::reset_move_ops_counter ();
102+
94103 // RObject created via alloc::HEAP, contains pointer to reflected type internally, So just the
95104 // address wrapped in std::any inside Robject is moved. Calender's move constructor is not called.
96105 RObject calender1 = std::move (calender0);
97106
107+ // Calender's move constructor isn't called.
108+ EXPECT_TRUE (calender::get_move_ops_count () == 0 );
109+
98110 ASSERT_FALSE (calender1.isEmpty ());
99111 EXPECT_TRUE (calender1.isConstCastSafe ());
100112 EXPECT_TRUE (calender1.isOnHeap ());
@@ -228,9 +240,15 @@ namespace rtl_tests
228240 // 'Event' has a unique_ptr<Date> and two 'Event' instances exists, So-
229241 EXPECT_TRUE (date::get_instance_count () == 2 );
230242
243+ // Sets Calender's move operation counter to zero
244+ calender::reset_move_ops_counter ();
245+
231246 // Moving a RObject created via alloc::Stack, invokes Calender's move constructor.
232247 RObject calender1 = std::move (calender0);
233248
249+ // Calender's move-constructor called once.
250+ EXPECT_TRUE (calender::get_move_ops_count () == 1 );
251+
234252 ASSERT_FALSE (calender1.isEmpty ());
235253 EXPECT_TRUE (calender1.isConstCastSafe ());
236254 EXPECT_FALSE (calender1.isOnHeap ());
0 commit comments