From d144022e473f079922e7becce667a0c9171a50b4 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 2 Mar 2024 14:02:47 +0100 Subject: [PATCH] add first init test for read config --- src/kds_s2000w_config.c | 7 ++++++- src/kds_s2000w_config.h | 5 +++++ tests/kds_s2000w_read_config_tests.c | 8 ++++++++ tests/runtests.c | 13 +++++++++++++ tools/read_config.c | 4 +++- 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 tests/kds_s2000w_read_config_tests.c diff --git a/src/kds_s2000w_config.c b/src/kds_s2000w_config.c index d464f01..acf2442 100644 --- a/src/kds_s2000w_config.c +++ b/src/kds_s2000w_config.c @@ -1 +1,6 @@ -#include "kds_s2000w_config.h" \ No newline at end of file +#include "kds_s2000w_config.h" + +void loadConfig(program_config* config) +{ + return; +} \ No newline at end of file diff --git a/src/kds_s2000w_config.h b/src/kds_s2000w_config.h index ddbb5af..2e42a38 100644 --- a/src/kds_s2000w_config.h +++ b/src/kds_s2000w_config.h @@ -1,4 +1,9 @@ #ifndef KDS_S2000W_CONFIG_H #define KDS_S2000W_CONFIG_H +typedef struct { + const char* scanner_url; +} program_config; + +void loadConfig(program_config* config); #endif \ No newline at end of file diff --git a/tests/kds_s2000w_read_config_tests.c b/tests/kds_s2000w_read_config_tests.c new file mode 100644 index 0000000..893d536 --- /dev/null +++ b/tests/kds_s2000w_read_config_tests.c @@ -0,0 +1,8 @@ +#include +#include "../src/kds_s2000w_config.h" + +START_TEST(kds_s2000w_config_read_parameter) +{ + ck_assert_int_eq(1, 2); +} +END_TEST \ No newline at end of file diff --git a/tests/runtests.c b/tests/runtests.c index f7e8065..dd11d83 100644 --- a/tests/runtests.c +++ b/tests/runtests.c @@ -17,6 +17,7 @@ void void_mock() {} #undef sleep #include "kds_s2000w_net_read_tests.c" #include "kds_s2000w_net_get_params_tests.c" +#include "kds_s2000w_read_config_tests.c" Suite* net_read() { @@ -45,6 +46,17 @@ Suite* get_params() return get_params; } +Suite* config_read() +{ + Suite* read_config = suite_create("kds_s2000w_net_read_config"); + + TCase* net_config_read = tcase_create("read config"); + tcase_add_test(net_config_read, kds_s2000w_config_read_parameter); + suite_add_tcase(read_config, net_config_read); + + return read_config; +} + int main() { int failed = 0; @@ -52,6 +64,7 @@ int main() SRunner* runner = srunner_create(kds_s2000w_net); srunner_add_suite(runner, net_read()); srunner_add_suite(runner, get_params()); + srunner_add_suite(runner, config_read()); srunner_run_all(runner, CK_NORMAL); failed = srunner_ntests_failed(runner); diff --git a/tools/read_config.c b/tools/read_config.c index 15e7fee..7946eb0 100644 --- a/tools/read_config.c +++ b/tools/read_config.c @@ -1,7 +1,9 @@ #include +#include +#include "../src/kds_s2000w_config.h" int main() { - printf("Hello read config\n"); + program_config* config = malloc(sizeof(program_config)); return 0; } \ No newline at end of file -- 2.39.5