| 413 | } |
| 414 | |
| 415 | void 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 | |
| 463 | void concurrencpp::tests::test_task_clear() { |
| 464 | // empty function |
nothing calls this directly
no test coverage detected