From 1e5f3a58935e13846f87a14368719df0caaec4e0 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 18 Feb 2025 20:38:08 -0600 Subject: [PATCH] Feature: Add F_add and F_remove status codes. --- level_0/f_status/c/status.h | 4 ++++ level_0/f_status_string/c/status_string.c | 24 ++++++++++++++++++++++ level_0/f_status_string/c/status_string.h | 12 +++++++++++ .../tests/unit/c/test-status_string-to.c | 10 ++++++++- level_1/fl_status_string/c/status_string.c | 24 ++++++++++++++++++++++ .../tests/unit/c/test-status_string-from.c | 10 ++++++++- 6 files changed, 82 insertions(+), 2 deletions(-) diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index bee0fa9..e129cb8 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -215,6 +215,8 @@ extern "C" { F_abort_not, F_absolute, F_absolute_not, + F_add, + F_add_not, F_address, F_address_not, F_again, @@ -465,6 +467,8 @@ extern "C" { F_relative_not, F_remote, F_remote_not, + F_remove, + F_remove_not, F_repeat, F_repeat_not, F_require, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index 7e670b2..a0955ed 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -83,6 +83,8 @@ extern "C" { const f_string_static_t f_status_abort_not_s = macro_f_string_static_t_initialize_1(F_status_abort_not_s, 0, F_status_abort_not_s_length); const f_string_static_t f_status_absolute_s = macro_f_string_static_t_initialize_1(F_status_absolute_s, 0, F_status_absolute_s_length); const f_string_static_t f_status_absolute_not_s = macro_f_string_static_t_initialize_1(F_status_absolute_not_s, 0, F_status_absolute_not_s_length); + const f_string_static_t f_status_add_s = macro_f_string_static_t_initialize_1(F_status_add_s, 0, F_status_add_s_length); + const f_string_static_t f_status_add_not_s = macro_f_string_static_t_initialize_1(F_status_add_not_s, 0, F_status_add_not_s_length); const f_string_static_t f_status_address_s = macro_f_string_static_t_initialize_1(F_status_address_s, 0, F_status_address_s_length); const f_string_static_t f_status_address_not_s = macro_f_string_static_t_initialize_1(F_status_address_not_s, 0, F_status_address_not_s_length); const f_string_static_t f_status_again_s = macro_f_string_static_t_initialize_1(F_status_again_s, 0, F_status_again_s_length); @@ -333,6 +335,8 @@ extern "C" { const f_string_static_t f_status_relative_not_s = macro_f_string_static_t_initialize_1(F_status_relative_not_s, 0, F_status_relative_not_s_length); const f_string_static_t f_status_remote_s = macro_f_string_static_t_initialize_1(F_status_remote_s, 0, F_status_remote_s_length); const f_string_static_t f_status_remote_not_s = macro_f_string_static_t_initialize_1(F_status_remote_not_s, 0, F_status_remote_not_s_length); + const f_string_static_t f_status_remove_s = macro_f_string_static_t_initialize_1(F_status_remove_s, 0, F_status_remove_s_length); + const f_string_static_t f_status_remove_not_s = macro_f_string_static_t_initialize_1(F_status_remove_not_s, 0, F_status_remove_not_s_length); const f_string_static_t f_status_repeat_s = macro_f_string_static_t_initialize_1(F_status_repeat_s, 0, F_status_repeat_s_length); const f_string_static_t f_status_repeat_not_s = macro_f_string_static_t_initialize_1(F_status_repeat_not_s, 0, F_status_repeat_not_s_length); const f_string_static_t f_status_require_s = macro_f_string_static_t_initialize_1(F_status_require_s, 0, F_status_require_s_length); @@ -1100,6 +1104,16 @@ extern "C" { break; + case F_add: + *name = f_status_add_s; + + break; + + case F_add_not: + *name = f_status_add_not_s; + + break; + case F_address: *name = f_status_address_s; @@ -2340,6 +2354,16 @@ extern "C" { break; + case F_remove: + *name = f_status_remove_s; + + break; + + case F_remove_not: + *name = f_status_remove_not_s; + + break; + case F_repeat: *name = f_status_repeat_s; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index d724c7e..90c3db9 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -243,6 +243,8 @@ extern "C" { #define F_status_abort_not_s "F_abort_not" #define F_status_absolute_s "F_absolute" #define F_status_absolute_not_s "F_absolute_not" + #define F_status_add_s "F_add" + #define F_status_add_not_s "F_add_not" #define F_status_address_s "F_address" #define F_status_address_not_s "F_address_not" #define F_status_again_s "F_again" @@ -493,6 +495,8 @@ extern "C" { #define F_status_relative_not_s "F_relative_not" #define F_status_remote_s "F_remote" #define F_status_remote_not_s "F_remote_not" + #define F_status_remove_s "F_remove" + #define F_status_remove_not_s "F_remove_not" #define F_status_repeat_s "F_repeat" #define F_status_repeat_not_s "F_repeat_not" #define F_status_require_s "F_require" @@ -591,6 +595,8 @@ extern "C" { #define F_status_abort_not_s_length 11 #define F_status_absolute_s_length 10 #define F_status_absolute_not_s_length 14 + #define F_status_add_s_length 5 + #define F_status_add_not_s_length 9 #define F_status_address_s_length 9 #define F_status_address_not_s_length 13 #define F_status_again_s_length 7 @@ -841,6 +847,8 @@ extern "C" { #define F_status_relative_not_s_length 14 #define F_status_remote_s_length 8 #define F_status_remote_not_s_length 12 + #define F_status_remove_s_length 8 + #define F_status_remove_not_s_length 12 #define F_status_repeat_s_length 8 #define F_status_repeat_not_s_length 12 #define F_status_require_s_length 9 @@ -939,6 +947,8 @@ extern "C" { extern const f_string_static_t f_status_abort_not_s; extern const f_string_static_t f_status_absolute_s; extern const f_string_static_t f_status_absolute_not_s; + extern const f_string_static_t f_status_add_s; + extern const f_string_static_t f_status_add_not_s; extern const f_string_static_t f_status_address_s; extern const f_string_static_t f_status_address_not_s; extern const f_string_static_t f_status_again_s; @@ -1191,6 +1201,8 @@ extern "C" { extern const f_string_static_t f_status_relative_not_s; extern const f_string_static_t f_status_remote_s; extern const f_string_static_t f_status_remote_not_s; + extern const f_string_static_t f_status_remove_s; + extern const f_string_static_t f_status_remove_not_s; extern const f_string_static_t f_status_repeat_s; extern const f_string_static_t f_status_repeat_not_s; extern const f_string_static_t f_status_require_s; diff --git a/level_0/f_status_string/tests/unit/c/test-status_string-to.c b/level_0/f_status_string/tests/unit/c/test-status_string-to.c index dd6ba41..95a7081 100644 --- a/level_0/f_status_string/tests/unit/c/test-status_string-to.c +++ b/level_0/f_status_string/tests/unit/c/test-status_string-to.c @@ -109,6 +109,8 @@ void test__f_status_string_to__works(void **state) { F_abort_not, F_absolute, F_absolute_not, + F_add, + F_add_not, F_address, F_address_not, F_again, @@ -359,6 +361,8 @@ void test__f_status_string_to__works(void **state) { F_relative_not, F_remote, F_remote_not, + F_remove, + F_remove_not, F_repeat, F_repeat_not, F_require, @@ -762,6 +766,8 @@ void test__f_status_string_to__works(void **state) { f_status_abort_not_s, f_status_absolute_s, f_status_absolute_not_s, + f_status_add_s, + f_status_add_not_s, f_status_address_s, f_status_address_not_s, f_status_again_s, @@ -1012,6 +1018,8 @@ void test__f_status_string_to__works(void **state) { f_status_relative_not_s, f_status_remote_s, f_status_remote_not_s, + f_status_remove_s, + f_status_remove_not_s, f_status_repeat_s, f_status_repeat_not_s, f_status_require_s, @@ -1335,7 +1343,7 @@ void test__f_status_string_to__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 646; ++i) { + for (uint16_t i = 0; i < 650; ++i) { f_string_static_t result = f_string_static_t_initialize; diff --git a/level_1/fl_status_string/c/status_string.c b/level_1/fl_status_string/c/status_string.c index 77acceb..cdc8b65 100644 --- a/level_1/fl_status_string/c/status_string.c +++ b/level_1/fl_status_string/c/status_string.c @@ -495,6 +495,18 @@ extern "C" { return F_okay; } + if (f_compare_dynamic(name, f_status_add_s) == F_equal_to) { + *code = F_add; + + return F_okay; + } + + if (f_compare_dynamic(name, f_status_add_not_s) == F_equal_to) { + *code = F_add_not; + + return F_okay; + } + if (f_compare_dynamic(name, f_status_address_s) == F_equal_to) { *code = F_address; @@ -1995,6 +2007,18 @@ extern "C" { return F_okay; } + if (f_compare_dynamic(name, f_status_remove_s) == F_equal_to) { + *code = F_remove; + + return F_okay; + } + + if (f_compare_dynamic(name, f_status_remove_not_s) == F_equal_to) { + *code = F_remove_not; + + return F_okay; + } + if (f_compare_dynamic(name, f_status_repeat_s) == F_equal_to) { *code = F_repeat; diff --git a/level_1/fl_status_string/tests/unit/c/test-status_string-from.c b/level_1/fl_status_string/tests/unit/c/test-status_string-from.c index b9ed9d9..dc81326 100644 --- a/level_1/fl_status_string/tests/unit/c/test-status_string-from.c +++ b/level_1/fl_status_string/tests/unit/c/test-status_string-from.c @@ -125,6 +125,8 @@ void test__fl_status_string_from__works(void **state) { F_abort_not, F_absolute, F_absolute_not, + F_add, + F_add_not, F_address, F_address_not, F_again, @@ -375,6 +377,8 @@ void test__fl_status_string_from__works(void **state) { F_relative_not, F_remote, F_remote_not, + F_remove, + F_remove_not, F_repeat, F_repeat_not, F_require, @@ -778,6 +782,8 @@ void test__fl_status_string_from__works(void **state) { f_status_abort_not_s, f_status_absolute_s, f_status_absolute_not_s, + f_status_add_s, + f_status_add_not_s, f_status_address_s, f_status_address_not_s, f_status_again_s, @@ -1028,6 +1034,8 @@ void test__fl_status_string_from__works(void **state) { f_status_relative_not_s, f_status_remote_s, f_status_remote_not_s, + f_status_remove_s, + f_status_remove_not_s, f_status_repeat_s, f_status_repeat_not_s, f_status_require_s, @@ -1351,7 +1359,7 @@ void test__fl_status_string_from__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 646; ++i) { + for (uint16_t i = 0; i < 650; ++i) { f_status_t result = F_okay; -- 1.8.3.1