It covers:
fs_stream_default_cfg()fs_stream_default_env()fs_stream_create_stream()fs_stream_create_desc()stream_adapter_desc_t::ctorSee fs_stream_default_cfg() specifications
| WHEN | EXPECT |
|---|---|
fs_stream_default_cfg() is called | returns a value-initialized fs_stream_cfg_t;ret.reserved == 0 |
fs_stream adapter.See fs_stream_default_env() specifications
env.file_env == *file_env.env.file_ops == file_ops.env.port_env == *port_env.osal_file_env_tosal_file_ops_t *stream_env_t| WHEN | EXPECT |
|---|---|
fs_stream_default_env(file_env, file_ops, port_env) is called with valid inputs | returns an fs_stream_env_t such that env.file_env == *file_env, env.file_ops == file_ops, and env.port_env == *port_env |
See fs_stream_create_stream() specifications
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.STREAM_STATUS_OK.*out.stream_destroy().STREAM_STATUS_INVALID for invalid argumentsSTREAM_STATUS_OOM on allocation failureSTREAM_STATUS_IO_ERROR when OSAL file operations fail*out unchanged if out is not NULL.fake_memoryfake_file| WHEN | EXPECT |
|---|---|
fs_stream_create_stream(out, args, cfg, env) is called with valid arguments and OSAL file opening succeeds | returns STREAM_STATUS_OK;stores a non- NULL stream handle in *out;the produced stream is ready for normal runtime use |
out == NULL | returns STREAM_STATUS_INVALID;no stream handle is produced |
args == NULL and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
cfg == NULL and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
env == NULL and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
args != NULL but args->path == NULL and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
args != NULL but args->path is an empty string and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
args != NULL but args->flags == 0 and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
allocation required by fs_stream_create_stream() fails | returns STREAM_STATUS_OOM;leaves *out unchanged |
fs_stream_create_stream(out, args, cfg, env) is called with valid arguments but OSAL file opening fails | returns STREAM_STATUS_IO_ERROR;leaves *out unchanged |
stream API:stream_write() writes the expected payload,stream_flush() succeeds.fake_memory.fake_file.See fs_stream_create_desc() specifications
out, key, cfg, env, mem must not be NULL.key must not be an empty string.env->file_env.mem and env->file_ops must not be NULL.STREAM_STATUS_OK.*out.out->ud_dtor().STREAM_STATUS_INVALID for invalid argumentsSTREAM_STATUS_OOM on allocation failureout is not NULL, resets *out to an empty descriptor.fake_memory| WHEN | EXPECT |
|---|---|
fs_stream_create_desc(out, key, cfg, env, mem) is called with valid arguments | returns STREAM_STATUS_OK;stores a valid adapter descriptor in *out;the produced descriptor is eligible for later destruction via out->ud_dtor() |
out == NULL | returns STREAM_STATUS_INVALID;no descriptor is produced |
key == NULL and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
key is an empty string and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
cfg == NULL and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
env == NULL and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
mem == NULL and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
env != NULL but env->file_env.mem == NULL and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
env != NULL but env->file_ops == NULL and out != NULL | returns STREAM_STATUS_INVALID;resets *out to an empty descriptor |
allocation required by fs_stream_create_desc() fails | returns STREAM_STATUS_OOM;resets *out to an empty descriptor |
NULL key, ctor, ud, and ud_dtor fields.See fs_stream_create_desc() specifications
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.STREAM_STATUS_OK.*out.stream_destroy().STREAM_STATUS_INVALID for invalid argumentsSTREAM_STATUS_OOM on allocation failureSTREAM_STATUS_IO_ERROR when OSAL file operations fail*out unchanged if out is not NULL.fake_memoryfake_file| WHEN | EXPECT |
|---|---|
desc.ctor(ud, args, out) is called with valid arguments and OSAL file opening succeeds | returns STREAM_STATUS_OK;stores a non- NULL stream handle in *out;the produced stream is ready for normal runtime use |
args == NULL and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
out == NULL | returns STREAM_STATUS_INVALID;no stream handle is produced |
args != NULL but args->path == NULL and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
args != NULL but args->path is an empty string and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
args != NULL but args->flags == 0 and out != NULL | returns STREAM_STATUS_INVALID;leaves *out unchanged |
allocation required by desc.ctor() fails | returns STREAM_STATUS_OOM;leaves *out unchanged |
desc.ctor(ud, args, out) is called with valid arguments but OSAL file opening fails | returns STREAM_STATUS_IO_ERROR;leaves *out unchanged |
fs_stream_create_desc().stream API:stream_write() writes the expected payload,stream_flush() succeeds.fake_memory.fake_file.