MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / token_move

Method token_move

tests/unittests/unittests.cpp:1207–1242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1205 }
1206
1207 bool token_move()
1208 {
1209 typedef TestTraits<16> Traits;
1210 Traits::reset();
1211
1212 {
1213 ConcurrentQueue<int, Traits> q;
1214 ProducerToken t0(q);
1215
1216 ASSERT_OR_FAIL(t0.valid());
1217
1218 ProducerToken t1(std::move(t0));
1219 ASSERT_OR_FAIL(t1.valid());
1220 ASSERT_OR_FAIL(!t0.valid());
1221
1222 t1 = std::move(t1);
1223 ASSERT_OR_FAIL(t1.valid());
1224 ASSERT_OR_FAIL(!t0.valid());
1225
1226 ProducerToken t2(q);
1227 t2 = std::move(t1);
1228 ASSERT_OR_FAIL(t2.valid());
1229 ASSERT_OR_FAIL(t1.valid());
1230 ASSERT_OR_FAIL(!t0.valid());
1231
1232 t0 = std::move(t1);
1233 ASSERT_OR_FAIL(t2.valid());
1234 ASSERT_OR_FAIL(!t1.valid());
1235 ASSERT_OR_FAIL(t0.valid());
1236 }
1237
1238 ASSERT_OR_FAIL(Traits::malloc_count() == 5); // 2 for each producer + 1 for initial block pool
1239 ASSERT_OR_FAIL(Traits::free_count() == Traits::malloc_count());
1240
1241 return true;
1242 }
1243
1244 bool multi_producers()
1245 {

Callers

nothing calls this directly

Calls 2

moveFunction · 0.85
validMethod · 0.80

Tested by

no test coverage detected