From 37f5b198008bbcb2a49de827977c1b063874b395 Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Mon, 25 Mar 2024 23:56:15 +0000 Subject: [PATCH 1/2] Fix flog_config_new assertion tests --- test/test_config.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_config.c b/test/test_config.c index 7a7a7a4..dcb1d65 100644 --- a/test/test_config.c +++ b/test/test_config.c @@ -75,7 +75,7 @@ void flog_version() {} static void flog_config_new_with_zero_arg_count_fails(void **state) { FlogError error; // should pass non-null assertion (&error) - int mock_argc = 0; // should fail >0 assertion + int mock_argc = 2; // should fail >1 assertion char *mock_argv[] = {}; // should pass non-null assertion expect_assert_failure(flog_config_new(mock_argc, mock_argv, &error)); @@ -84,14 +84,14 @@ flog_config_new_with_zero_arg_count_fails(void **state) { static void flog_config_new_with_null_arg_values_fails(void **state) { FlogError error; // should pass non-null assertion (&error) - int mock_argc = 1; // should pass >0 assertion + int mock_argc = 2; // should pass >1 assertion char **mock_argv = NULL; // should fail non-null assertion expect_assert_failure(flog_config_new(mock_argc, mock_argv, &error)); } static void test_new_config_with_no_error_ptr_calls_assert(void **state) { - int mock_argc = 1; // should pass >0 assertion + int mock_argc = 2; // should pass >1 assertion char *mock_argv[] = {}; // should pass non-null assertion expect_assert_failure(flog_config_new(mock_argc, mock_argv, NULL)); From 332b556552d4feb091f82821104bf717a6b1f70a Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Tue, 26 Mar 2024 19:12:36 +0000 Subject: [PATCH 2/2] Fix mock argc value in unit test --- test/test_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_config.c b/test/test_config.c index dcb1d65..9f51e32 100644 --- a/test/test_config.c +++ b/test/test_config.c @@ -75,7 +75,7 @@ void flog_version() {} static void flog_config_new_with_zero_arg_count_fails(void **state) { FlogError error; // should pass non-null assertion (&error) - int mock_argc = 2; // should fail >1 assertion + int mock_argc = 0; // should fail >1 assertion char *mock_argv[] = {}; // should pass non-null assertion expect_assert_failure(flog_config_new(mock_argc, mock_argv, &error));