It covers:
See logger_default_env() specifications
env.mem == mem_ops.osal_mem_ops_t| WHEN | EXPECT |
|---|---|
logger_default_env(mem_ops) is called with a valid mem_ops pointer | returns a logger_env_t such that env.mem == mem_ops |
See:
out, vtbl, env must not be NULL.backend must not be NULL.vtbl->log, vtbl->destroy must not be NULL.env->mem must not be NULL.LOGGER_STATUS_OK.*out.logger_destroy().LOGGER_STATUS_INVALID for invalid argumentsLOGGER_STATUS_OOM on allocation failure*out unchanged if out is not NULL.logger_destroy() does nothing if l == NULL or *l == NULL.*l to NULL.fake_memory| WHEN | EXPECT |
|---|---|
logger_create(out, vtbl, backend, env) is called with valid arguments | returns LOGGER_STATUS_OK;stores a non- NULL logger handle in *out;the produced handle is eligible for destruction by logger_destroy() |
out == NULL | returns LOGGER_STATUS_INVALID;no logger handle is produced |
vtbl == NULL and out != NULL | returns LOGGER_STATUS_INVALID;leaves *out unchanged |
vtbl != NULL but vtbl->destroy == NULL and out != NULL | returns LOGGER_STATUS_INVALID;leaves *out unchanged |
backend == NULL and out != NULL | returns LOGGER_STATUS_INVALID;leaves *out unchanged |
env == NULL and out != NULL | returns LOGGER_STATUS_INVALID;leaves *out unchanged |
env != NULL but env->mem == NULL and out != NULL | returns LOGGER_STATUS_INVALID;leaves *out unchanged |
| allocation of the logger handle fails | returns LOGGER_STATUS_OOM;leaves *out unchanged |
logger_create() succeeds and logger_destroy() is called twice | first logger_destroy(&l) releases the handle and sets l to NULL;second logger_destroy(&l) is a no-op and keeps l as NULL |
logger port.logger_destroy() when called on an already-destroyed handle.See:
l != NULL, l has been created by logger_create() with fake_logger_vtbl and fake_logger_backend_t.l must not be NULL.message must not be NULL.log callback stored in the logger handle.log callback.l == NULL, returns LOGGER_STATUS_INVALID.message == NULL, returns LOGGER_STATUS_INVALID.fake_logger_backend_tfake_logger_vtbl| WHEN | EXPECT |
|---|---|
l == NULL and message != NULL | returns LOGGER_STATUS_INVALID |
l != NULL and message == NULL | returns LOGGER_STATUS_INVALID |
l != NULL and message != NULL and fake_logger_backend.log_ret == LOGGER_STATUS_IO_ERROR | calls fake_logger_vtbl.log(fake_logger_backend, message) exactly once;does not call fake_logger_vtbl.destroy;returns LOGGER_STATUS_IO_ERROR |
logger port.logger_log() delegates to the bound adapter callback and propagates its returned status unchanged.