Unit tests implementation for the fs_stream adapter.
More...
#include "fs_stream/cr/fs_stream_cr_api.h"#include "stream/borrowers/stream.h"#include "stream/lifecycle/stream_lifecycle.h"#include "osal/file/test/osal_file_fake_provider.h"#include "osal/mem/osal_mem.h"#include "osal/mem/test/osal_mem_fake_provider.h"#include "policy/lexleo_cstd_types.h"#include "policy/lexleo_cstd_lib.h"#include "policy/lexleo_cstd_jmp.h"#include "lexleo_cmocka.h"
Go to the source code of this file.
Functions | |
| static void | test_fs_stream_default_cfg (void **state) |
Test fs_stream_default_cfg(). | |
| static void | test_fs_stream_default_env (void **state) |
Test fs_stream_default_env(). | |
This file implements the unit-level validation of the fs_stream adapter contracts.
Covered surfaces:
fs_stream_default_cfg(), fs_stream_default_env()fs_stream_create_stream()fs_stream_create_desc()stream_adapter_desc_t::ctorstream APITest strategy:
fake_memoryfake_filestream borrower API checks on successfully created streamsSee also:
Definition in file unit_test_fs_stream.c.
stream_status_t fs_stream_create_stream( stream_t **out, const fs_stream_args_t *args, const fs_stream_cfg_t *cfg, const fs_stream_env_t *env );
Invalid arguments:
out, args, cfg, env must not be NULL.args->path must not be NULL and must not be an empty string.args->flags must not be zero.Success:
*out.stream_destroy().Failure:
*out unchanged if out is not NULL.Doubles:
See also:
The scenarios below define the test oracle for fs_stream_create_stream().
| Enumerator | |
|---|---|
| FS_CREATE_STREAM_SCENARIO_OK | WHEN
|
| FS_CREATE_STREAM_SCENARIO_OUT_NULL | WHEN
|
| FS_CREATE_STREAM_SCENARIO_ARGS_NULL | WHEN
|
| FS_CREATE_STREAM_SCENARIO_CFG_NULL | WHEN
|
| FS_CREATE_STREAM_SCENARIO_ENV_NULL | WHEN
|
| FS_CREATE_STREAM_SCENARIO_PATH_NULL | WHEN
|
| FS_CREATE_STREAM_SCENARIO_PATH_EMPTY | WHEN
|
| FS_CREATE_STREAM_SCENARIO_FLAGS_ZERO | WHEN
|
| FS_CREATE_STREAM_SCENARIO_OOM | WHEN allocation required by
Notes:
|
| FS_CREATE_STREAM_SCENARIO_OPEN_FAIL | WHEN
Notes:
|
Definition at line 156 of file unit_test_fs_stream.c.
stream_status_t fs_stream_create_desc( stream_adapter_desc_t *out, stream_key_t key, const fs_stream_cfg_t *cfg, const fs_stream_env_t *env, const osal_mem_ops_t *mem );
Invalid arguments:
out, key, cfg, env, mem must not be NULL.key must not be an empty string.Success:
*out.out->ud_dtor().Failure:
out is not NULL, resets *out to an empty descriptor.Doubles:
See also:
The scenarios below define the test oracle for fs_stream_create_desc().
| Enumerator | |
|---|---|
| FS_STREAM_CREATE_DESC_SCENARIO_OK | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_OUT_NULL | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_KEY_NULL | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_KEY_EMPTY | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_CFG_NULL | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_ENV_NULL | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_MEM_NULL | WHEN
|
| FS_STREAM_CREATE_DESC_SCENARIO_OOM | WHEN allocation required by
Notes:
|
Definition at line 627 of file unit_test_fs_stream.c.
stream_status_t desc.ctor( const void *ud, const fs_stream_args_t *args, stream_t **out );
Invalid arguments:
args and out must not be NULL.args->path must not be NULL and must not be an empty string.args->flags must not be zero.Success:
*out.stream_destroy().Failure:
*out unchanged if out is not NULL.Doubles:
See also:
The scenarios below define the test oracle for descriptor constructor usage through fs_stream_create_desc().
Definition at line 1014 of file unit_test_fs_stream.c.
|
static |
fs_stream_cfg_t fs_stream_default_cfg(void);
Success:
fs_stream_cfg_t.ret.reserved == 0.Failure:
See also:
Definition at line 66 of file unit_test_fs_stream.c.
|
static |
fs_stream_env_t fs_stream_default_env( const osal_file_env_t *file_env, const osal_file_ops_t *file_ops, const stream_env_t *port_env );
Success:
ret.file_env == *file_env.ret.file_ops == file_ops.ret.port_env == *port_env.Failure:
Doubles:
osal_file_env_tosal_file_ops_t *stream_env_tSee also:
Definition at line 100 of file unit_test_fs_stream.c.