Replace Criterion by CUnit
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
parent
60752b3fd8
commit
74a48c5731
47 changed files with 4486 additions and 5388 deletions
|
@ -10,8 +10,7 @@
|
|||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
#include "ddsc/dds.h"
|
||||
#include <criterion/criterion.h>
|
||||
#include <criterion/logging.h>
|
||||
#include "CUnit/Test.h"
|
||||
#include "os/os.h"
|
||||
#include "config_env.h"
|
||||
#include "ddsc/ddsc_project.h"
|
||||
|
@ -26,18 +25,18 @@ static void config__check_env(
|
|||
_In_z_ const char * expected_value)
|
||||
{
|
||||
const char * env_uri = os_getenv(env_variable);
|
||||
#if 0
|
||||
const char * const env_not_set = "Environment variable '%s' isn't set. This needs to be set to '%s' for this test to run.";
|
||||
const char * const env_not_as_expected = "Environment variable '%s' has an unexpected value: '%s' (expected: '%s')";
|
||||
#endif
|
||||
|
||||
#ifdef FORCE_ENV
|
||||
{
|
||||
bool env_ok;
|
||||
|
||||
if ( env_uri == NULL ) {
|
||||
cr_log_info(env_not_set, env_variable, expected_value);
|
||||
env_ok = false;
|
||||
} else if ( strncmp(env_uri, expected_value, strlen(expected_value)) != 0 ) {
|
||||
cr_log_info(env_not_as_expected, env_variable, env_uri, expected_value);
|
||||
env_ok = false;
|
||||
} else {
|
||||
env_ok = true;
|
||||
|
@ -51,20 +50,19 @@ static void config__check_env(
|
|||
(void) sprintf(envstr, "%s=%s", env_variable, expected_value);
|
||||
|
||||
r = os_putenv(envstr);
|
||||
cr_assert_eq(r, os_resultSuccess, "Invoking os_putenv(\"%s\") failed", envstr);
|
||||
cr_log_warn("Environment variable '%s' set to expected value '%s'", env_variable, expected_value);
|
||||
CU_ASSERT_EQUAL_FATAL(r, os_resultSuccess);
|
||||
|
||||
os_free(envstr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
cr_assert_not_null(env_uri, env_not_set, env_variable, expected_value);
|
||||
cr_assert_str_eq(env_uri, expected_value, env_not_as_expected, env_variable, env_uri, expected_value);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(env_uri);
|
||||
CU_ASSERT_STRING_EQUAL_FATAL(env_uri, expected_value);
|
||||
#endif /* FORCE_ENV */
|
||||
|
||||
}
|
||||
|
||||
Test(ddsc_config, simple_udp, .init = os_osInit, .fini = os_osExit) {
|
||||
CU_Test(ddsc_config, simple_udp, .init = os_osInit, .fini = os_osExit) {
|
||||
|
||||
dds_entity_t participant;
|
||||
|
||||
|
@ -73,7 +71,7 @@ Test(ddsc_config, simple_udp, .init = os_osInit, .fini = os_osExit) {
|
|||
|
||||
participant = dds_create_participant(DDS_DOMAIN_DEFAULT, NULL, NULL);
|
||||
|
||||
cr_assert_gt(participant, 0, "dds_create_participant");
|
||||
CU_ASSERT_FATAL(participant> 0);
|
||||
|
||||
dds_delete(participant);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue