test/fiber/test_fiber_scheduler_discipline_find.cpp
TEST(not_found)
{
    allocator* alloc = nullptr;
    fiber_scheduler* sched = nullptr;
    fiber_scheduler_discipline* disc = nullptr;
    rcpr_uuid id = { .data = {
        0x0e, 0x2c, 0xfc, 0x92, 0x89, 0xfa, 0x46, 0x54,
        0xb9, 0x69, 0xd7, 0x1b, 0x18, 0x46, 0x9b, 0x4c } };

    /* we should be able to create a malloc allocator. */
    TEST_ASSERT(
        STATUS_SUCCESS == malloc_allocator_create(&alloc));

    /* we should be able to create a disciplined fiber scheduler. */
    TEST_ASSERT(
        STATUS_SUCCESS ==
            fiber_scheduler_create_with_disciplines(&sched, alloc));

    /*  finding a discipline by id fails because no discipline exists. */
    TEST_ASSERT(
        ERROR_FIBER_SCHEDULER_DISCIPLINE_NOT_FOUND
            == fiber_scheduler_discipline_find(&disc, sched, &id));

    /* clean up. */
    TEST_ASSERT(
        STATUS_SUCCESS ==
            resource_release(fiber_scheduler_resource_handle(sched)));
    TEST_ASSERT(
        STATUS_SUCCESS == resource_release(allocator_resource_handle(alloc)));
}
/**
 * Verify that if a discipline has not been added to the scheduler, it is not
 * found.
 */
Verify that if a discipline has not been added to the scheduler, it is not
found.
Verify that if a discipline has not been added to the scheduler it is not found .
TEST(not_found)
{
    allocator* alloc = nullptr;
    fiber_scheduler* sched = nullptr;
    fiber_scheduler_discipline* disc = nullptr;
    rcpr_uuid id = { .data = {
        0x0e, 0x2c, 0xfc, 0x92, 0x89, 0xfa, 0x46, 0x54,
        0xb9, 0x69, 0xd7, 0x1b, 0x18, 0x46, 0x9b, 0x4c } };
    TEST_ASSERT(
        STATUS_SUCCESS == malloc_allocator_create(&alloc));
    TEST_ASSERT(
        STATUS_SUCCESS ==
            fiber_scheduler_create_with_disciplines(&sched, alloc));
    TEST_ASSERT(
        ERROR_FIBER_SCHEDULER_DISCIPLINE_NOT_FOUND
            == fiber_scheduler_discipline_find(&disc, sched, &id));
    TEST_ASSERT(
        STATUS_SUCCESS ==
            resource_release(fiber_scheduler_resource_handle(sched)));
    TEST_ASSERT(
        STATUS_SUCCESS == resource_release(allocator_resource_handle(alloc)));
}
TEST ( not_found ) { allocator * alloc = nullptr ; fiber_scheduler * sched = nullptr ; fiber_scheduler_discipline * disc = nullptr ; rcpr_uuid id = { . data = { 0x0e , 0x2c , 0xfc , 0x92 , 0x89 , 0xfa , 0x46 , 0x54 , 0xb9 , 0x69 , 0xd7 , 0x1b , 0x18 , 0x46 , 0x9b , 0x4c } } ; TEST_ASSERT ( STATUS_SUCCESS == malloc_allocator_create ( & alloc ) ) ; TEST_ASSERT ( STATUS_SUCCESS == fiber_scheduler_create_with_disciplines ( & sched , alloc ) ) ; TEST_ASSERT ( ERROR_FIBER_SCHEDULER_DISCIPLINE_NOT_FOUND == fiber_scheduler_discipline_find ( & disc , sched , & id ) ) ; TEST_ASSERT ( STATUS_SUCCESS == resource_release ( fiber_scheduler_resource_handle ( sched ) ) ) ; TEST_ASSERT ( STATUS_SUCCESS == resource_release ( allocator_resource_handle ( alloc ) ) ) ; }
Verify that if a discipline has not been added to the scheduler, it is not
 found.
Verify that if a discipline has not been added to the scheduler it is not found .
/* we should be able to create a malloc allocator. */ /* we should be able to create a disciplined fiber scheduler. */ /*  finding a discipline by id fails because no discipline exists. */ /* clean up. */