test/psock/test_psock_create_from_buffer.cpp
TEST(create)
{
    allocator* alloc = nullptr;
    psock* s = nullptr;
    const char* buffer = "this is a test.";
    size_t buffer_size = strlen(buffer);

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

    /* we should be able to create a psock from the buffer. */
    TEST_ASSERT(
        STATUS_SUCCESS ==
            psock_create_from_buffer(
                &s, alloc, buffer, buffer_size));

    /* we should be able to release the socket, which in turn will close the lhs
     * descriptor. */
    TEST_ASSERT(
        STATUS_SUCCESS ==
            resource_release(psock_resource_handle(s)));

    /* clean up. */
    TEST_ASSERT(
        STATUS_SUCCESS == resource_release(allocator_resource_handle(alloc)));
}
/**
 * Verify that we can create and release a psock instance created from a
 * buffer.
 */
Verify that we can create and release a psock instance created from a
buffer.
Verify that we can create and release a psock instance created from a buffer .
TEST(create)
{
    allocator* alloc = nullptr;
    psock* s = nullptr;
    const char* buffer = "this is a test.";
    size_t buffer_size = strlen(buffer);
    TEST_ASSERT(
        STATUS_SUCCESS == malloc_allocator_create(&alloc));
    TEST_ASSERT(
        STATUS_SUCCESS ==
            psock_create_from_buffer(
                &s, alloc, buffer, buffer_size));
    TEST_ASSERT(
        STATUS_SUCCESS ==
            resource_release(psock_resource_handle(s)));
    TEST_ASSERT(
        STATUS_SUCCESS == resource_release(allocator_resource_handle(alloc)));
}
TEST ( create ) { allocator * alloc = nullptr ; psock * s = nullptr ; const char * buffer = " " ; size_t buffer_size = strlen ( buffer ) ; TEST_ASSERT ( STATUS_SUCCESS == malloc_allocator_create ( & alloc ) ) ; TEST_ASSERT ( STATUS_SUCCESS == psock_create_from_buffer ( & s , alloc , buffer , buffer_size ) ) ; TEST_ASSERT ( STATUS_SUCCESS == resource_release ( psock_resource_handle ( s ) ) ) ; TEST_ASSERT ( STATUS_SUCCESS == resource_release ( allocator_resource_handle ( alloc ) ) ) ; }
Verify that we can create and release a psock instance created from a
 buffer.
Verify that we can create and release a psock instance created from a buffer .
/* we should be able to create a malloc allocator. */ /* we should be able to create a psock from the buffer. */ /* we should be able to release the socket, which in turn will close the lhs
     * descriptor. */ /* clean up. */