Unit tests implementation for the logger port. More...
#include "logger/borrowers/logger.h"#include "logger/lifecycle/logger_lifecycle.h"#include "logger/adapters/logger_adapters_api.h"#include "logger/cr/logger_cr_api.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 "lexleo_cmocka.h"
Go to the source code of this file.
Functions | |
| static void | test_logger_default_env (void **state) |
Test logger_default_env(). | |
This file implements the unit-level validation of the logger port contracts.
Covered surfaces:
See also:
Definition in file unit_test_logger.c.
logger_status_t logger_create( logger_t **out, const logger_vtbl_t *vtbl, void *backend, const logger_env_t *env );
void logger_destroy(logger_t **l);
Invalid arguments:
out, vtbl, env must not be NULL.vtbl->log, vtbl->destroy must not be NULL.env->mem must not be NULL.Success:
LOGGER_STATUS_OK.*out.logger_destroy().Failure:
LOGGER_STATUS_INVALID for invalid argumentsLOGGER_STATUS_OOM on allocation failure*out unchanged if out is not NULL.Lifecycle:
logger_destroy() does nothing if l is NULL or *l is NULL.*l to NULL.Doubles:
See also:
The scenarios below define the test oracle for logger_create() and logger_destroy().
| Enumerator | |
|---|---|
| LOGGER_LIFECYCLE_SCENARIO_OK | WHEN
|
| LOGGER_LIFECYCLE_SCENARIO_OUT_NULL | WHEN
|
| LOGGER_LIFECYCLE_SCENARIO_VTBL_NULL | WHEN
|
| LOGGER_LIFECYCLE_SCENARIO_VTBL_LOG_NULL | WHEN
Notes:
|
| LOGGER_LIFECYCLE_SCENARIO_VTBL_DESTROY_NULL | WHEN
Notes:
|
| LOGGER_LIFECYCLE_SCENARIO_BACKEND_NULL | WHEN
|
| LOGGER_LIFECYCLE_SCENARIO_ENV_NULL | WHEN
|
| LOGGER_LIFECYCLE_SCENARIO_ENV_MEM_NULL | WHEN
|
| LOGGER_LIFECYCLE_SCENARIO_OOM | WHEN allocation of the logger handle fails (allocator reports OOM) EXPECT:
Notes:
|
| LOGGER_LIFECYCLE_SCENARIO_DESTROY_IDEMPOTENT | WHEN
Notes:
|
Definition at line 163 of file unit_test_logger.c.
logger_status_t logger_log(logger_t *l, const char *message);
Precondition:
l != NULL, l has been created by logger_create() with fake_logger_vtbl and fake_logger_backend_t.Doubles:
fake_logger_backend_tfake_logger_vtblSee also:
The scenarios below define the test oracle for logger_log().
Definition at line 600 of file unit_test_logger.c.
|
static |
logger_env_t logger_default_env(const osal_mem_ops_t *mem_ops);
Success:
ret.mem == mem_ops.Failure:
Doubles:
osal_mem_ops_tSee also:
Definition at line 111 of file unit_test_logger.c.