MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / test_task_destructor

Method test_task_destructor

test/source/tests/task_tests.cpp:415–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void concurrencpp::tests::test_task_destructor() {
416 // empty task
417 { task empty; }
418
419 // small functor
420 {
421 object_observer observer;
422
423 { task task(observer.get_testing_stub()); }
424
425 assert_equal(observer.get_destruction_count(), 1);
426 }
427
428 // big functor
429 {
430 struct functor {
431 testing_stub stub;
432 char padding[1024] = {};
433
434 functor(testing_stub stub) noexcept : stub(std::move(stub)) {}
435
436 void operator()() {}
437 };
438
439 object_observer observer;
440
441 { task t(functor {observer.get_testing_stub()}); }
442
443 assert_equal(observer.get_destruction_count(), 1);
444 }
445
446 // coroutine
447 {
448 object_observer observer;
449 const auto handle = coro_function({}, observer.get_testing_stub());
450
451 { task t(handle); }
452
453 assert_equal(observer.get_destruction_count(), 1);
454 }
455
456 // trivially destructible (does nothing)
457 {
458 trivially_copiable_destructable tcd;
459 task task(tcd);
460 }
461}
462
463void concurrencpp::tests::test_task_clear() {
464 // empty function

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.85
coro_functionFunction · 0.85
get_testing_stubMethod · 0.80
get_destruction_countMethod · 0.45

Tested by

no test coverage detected