From 1df3833c51eb91e3ba715241d69ad1a3b601f7e1 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 22 Jan 2025 23:36:01 -0600 Subject: [PATCH] Feature: Add F_maximum and F_minimum 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 | 8 ++++++++ level_1/fl_status_string/c/status_string.c | 24 ++++++++++++++++++++++ .../tests/unit/c/test-status_string-from.c | 10 ++++++++- 6 files changed, 81 insertions(+), 1 deletion(-) diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index e8a37c4..bee0fa9 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -374,6 +374,8 @@ extern "C" { F_lock_write_not, F_loop, F_loop_not, + F_maximum, + F_maximum_not, F_maybe, F_maybe_not, F_memory, @@ -382,6 +384,8 @@ extern "C" { F_message_not, F_middle, F_middle_not, + F_minimum, + F_minimum_not, F_minor, F_minor_not, F_moderate, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index b69b100..7e670b2 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -242,6 +242,8 @@ extern "C" { const f_string_static_t f_status_lock_write_not_s = macro_f_string_static_t_initialize_1(F_status_lock_write_not_s, 0, F_status_lock_write_not_s_length); const f_string_static_t f_status_loop_s = macro_f_string_static_t_initialize_1(F_status_loop_s, 0, F_status_loop_s_length); const f_string_static_t f_status_loop_not_s = macro_f_string_static_t_initialize_1(F_status_loop_not_s, 0, F_status_loop_not_s_length); + const f_string_static_t f_status_maximum_s = macro_f_string_static_t_initialize_1(F_status_maximum_s, 0, F_status_maximum_s_length); + const f_string_static_t f_status_maximum_not_s = macro_f_string_static_t_initialize_1(F_status_maximum_not_s, 0, F_status_maximum_not_s_length); const f_string_static_t f_status_maybe_s = macro_f_string_static_t_initialize_1(F_status_maybe_s, 0, F_status_maybe_s_length); const f_string_static_t f_status_maybe_not_s = macro_f_string_static_t_initialize_1(F_status_maybe_not_s, 0, F_status_maybe_not_s_length); const f_string_static_t f_status_memory_s = macro_f_string_static_t_initialize_1(F_status_memory_s, 0, F_status_memory_s_length); @@ -250,6 +252,8 @@ extern "C" { const f_string_static_t f_status_message_not_s = macro_f_string_static_t_initialize_1(F_status_message_not_s, 0, F_status_message_not_s_length); const f_string_static_t f_status_middle_s = macro_f_string_static_t_initialize_1(F_status_middle_s, 0, F_status_middle_s_length); const f_string_static_t f_status_middle_not_s = macro_f_string_static_t_initialize_1(F_status_middle_not_s, 0, F_status_middle_not_s_length); + const f_string_static_t f_status_minimum_s = macro_f_string_static_t_initialize_1(F_status_minimum_s, 0, F_status_minimum_s_length); + const f_string_static_t f_status_minimum_not_s = macro_f_string_static_t_initialize_1(F_status_minimum_not_s, 0, F_status_minimum_not_s_length); const f_string_static_t f_status_minor_s = macro_f_string_static_t_initialize_1(F_status_minor_s, 0, F_status_minor_s_length); const f_string_static_t f_status_minor_not_s = macro_f_string_static_t_initialize_1(F_status_minor_not_s, 0, F_status_minor_not_s_length); const f_string_static_t f_status_moderate_s = macro_f_string_static_t_initialize_1(F_status_moderate_s, 0, F_status_moderate_s_length); @@ -1881,6 +1885,16 @@ extern "C" { break; + case F_maximum: + *name = f_status_maximum_s; + + break; + + case F_maximum_not: + *name = f_status_maximum_not_s; + + break; + case F_maybe: *name = f_status_maybe_s; @@ -1921,6 +1935,16 @@ extern "C" { break; + case F_minimum: + *name = f_status_minimum_s; + + break; + + case F_minimum_not: + *name = f_status_minimum_not_s; + + break; + case F_minor: *name = f_status_minor_s; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index 9dbf5b8..d724c7e 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -402,6 +402,8 @@ extern "C" { #define F_status_lock_write_not_s "F_lock_write_not" #define F_status_loop_s "F_loop" #define F_status_loop_not_s "F_loop_not" + #define F_status_maximum_s "F_maximum" + #define F_status_maximum_not_s "F_maximum_not" #define F_status_maybe_s "F_maybe" #define F_status_maybe_not_s "F_maybe_not" #define F_status_memory_s "F_memory" @@ -410,6 +412,8 @@ extern "C" { #define F_status_message_not_s "F_message_not" #define F_status_middle_s "F_middle" #define F_status_middle_not_s "F_middle_not" + #define F_status_minimum_s "F_minimum" + #define F_status_minimum_not_s "F_minimum_not" #define F_status_minor_s "F_minor" #define F_status_minor_not_s "F_minor_not" #define F_status_moderate_s "F_moderate" @@ -746,6 +750,8 @@ extern "C" { #define F_status_lock_write_not_s_length 16 #define F_status_loop_s_length 6 #define F_status_loop_not_s_length 10 + #define F_status_maximum_s_length 9 + #define F_status_maximum_not_s_length 13 #define F_status_maybe_s_length 7 #define F_status_maybe_not_s_length 11 #define F_status_memory_s_length 8 @@ -754,6 +760,8 @@ extern "C" { #define F_status_message_not_s_length 13 #define F_status_middle_s_length 8 #define F_status_middle_not_s_length 12 + #define F_status_minimum_s_length 9 + #define F_status_minimum_not_s_length 13 #define F_status_minor_s_length 7 #define F_status_minor_not_s_length 11 #define F_status_moderate_s_length 10 @@ -1092,6 +1100,8 @@ extern "C" { extern const f_string_static_t f_status_lock_write_not_s; extern const f_string_static_t f_status_loop_s; extern const f_string_static_t f_status_loop_not_s; + extern const f_string_static_t f_status_maximum_s; + extern const f_string_static_t f_status_maximum_not_s; extern const f_string_static_t f_status_maybe_s; extern const f_string_static_t f_status_maybe_not_s; extern const f_string_static_t f_status_memory_s; @@ -1100,6 +1110,8 @@ extern "C" { extern const f_string_static_t f_status_message_not_s; extern const f_string_static_t f_status_middle_s; extern const f_string_static_t f_status_middle_not_s; + extern const f_string_static_t f_status_minimum_s; + extern const f_string_static_t f_status_minimum_not_s; extern const f_string_static_t f_status_minor_s; extern const f_string_static_t f_status_minor_not_s; extern const f_string_static_t f_status_moderate_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 194b0f4..dd6ba41 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 @@ -268,6 +268,8 @@ void test__f_status_string_to__works(void **state) { F_lock_write_not, F_loop, F_loop_not, + F_maximum, + F_maximum_not, F_maybe, F_maybe_not, F_memory, @@ -276,6 +278,8 @@ void test__f_status_string_to__works(void **state) { F_message_not, F_middle, F_middle_not, + F_minimum, + F_minimum_not, F_minor, F_minor_not, F_moderate, @@ -917,6 +921,8 @@ void test__f_status_string_to__works(void **state) { f_status_lock_write_not_s, f_status_loop_s, f_status_loop_not_s, + f_status_maximum_s, + f_status_maximum_not_s, f_status_maybe_s, f_status_maybe_not_s, f_status_memory_s, @@ -925,6 +931,8 @@ void test__f_status_string_to__works(void **state) { f_status_message_not_s, f_status_middle_s, f_status_middle_not_s, + f_status_minimum_s, + f_status_minimum_not_s, f_status_minor_s, f_status_minor_not_s, f_status_moderate_s, diff --git a/level_1/fl_status_string/c/status_string.c b/level_1/fl_status_string/c/status_string.c index 4756c2b..77acceb 100644 --- a/level_1/fl_status_string/c/status_string.c +++ b/level_1/fl_status_string/c/status_string.c @@ -1449,6 +1449,18 @@ extern "C" { return F_okay; } + if (f_compare_dynamic(name, f_status_maximum_s) == F_equal_to) { + *code = F_maximum; + + return F_okay; + } + + if (f_compare_dynamic(name, f_status_maximum_not_s) == F_equal_to) { + *code = F_maximum_not; + + return F_okay; + } + if (f_compare_dynamic(name, f_status_maybe_s) == F_equal_to) { *code = F_maybe; @@ -1497,6 +1509,18 @@ extern "C" { return F_okay; } + if (f_compare_dynamic(name, f_status_minimum_s) == F_equal_to) { + *code = F_minimum; + + return F_okay; + } + + if (f_compare_dynamic(name, f_status_minimum_not_s) == F_equal_to) { + *code = F_minimum_not; + + return F_okay; + } + if (f_compare_dynamic(name, f_status_minor_s) == F_equal_to) { *code = F_minor; 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 ad0cd40..b9ed9d9 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 @@ -284,6 +284,8 @@ void test__fl_status_string_from__works(void **state) { F_lock_write_not, F_loop, F_loop_not, + F_maximum, + F_maximum_not, F_maybe, F_maybe_not, F_memory, @@ -292,6 +294,8 @@ void test__fl_status_string_from__works(void **state) { F_message_not, F_middle, F_middle_not, + F_minimum, + F_minimum_not, F_minor, F_minor_not, F_moderate, @@ -933,6 +937,8 @@ void test__fl_status_string_from__works(void **state) { f_status_lock_write_not_s, f_status_loop_s, f_status_loop_not_s, + f_status_maximum_s, + f_status_maximum_not_s, f_status_maybe_s, f_status_maybe_not_s, f_status_memory_s, @@ -941,6 +947,8 @@ void test__fl_status_string_from__works(void **state) { f_status_message_not_s, f_status_middle_s, f_status_middle_not_s, + f_status_minimum_s, + f_status_minimum_not_s, f_status_minor_s, f_status_minor_not_s, f_status_moderate_s, @@ -1343,7 +1351,7 @@ void test__fl_status_string_from__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 642; ++i) { + for (uint16_t i = 0; i < 646; ++i) { f_status_t result = F_okay; -- 1.8.3.1