| 136 | |
| 137 | |
| 138 | def test_unique_ptr_roundtrip(): |
| 139 | # Multiple roundtrips to stress-test instance registration/deregistration. |
| 140 | num_round_trips = 1000 |
| 141 | recycled = m.atyp("passenger") |
| 142 | for _ in range(num_round_trips): |
| 143 | id_orig = id(recycled) |
| 144 | recycled = m.unique_ptr_roundtrip(recycled) |
| 145 | assert re.match("passenger(_MvCtor)*_MvCtor", m.get_mtxt(recycled)) |
| 146 | id_rtrn = id(recycled) |
| 147 | # Ensure the returned object is a different Python instance. |
| 148 | assert id_rtrn != id_orig |
| 149 | id_orig = id_rtrn |
| 150 | |
| 151 | |
| 152 | def test_pass_unique_ptr_cref(): |