]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add first init test for read config
authorBastian Dehn <hhaalo@arcor.de>
Sat, 2 Mar 2024 13:02:47 +0000 (14:02 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 2 Mar 2024 13:03:00 +0000 (14:03 +0100)
src/kds_s2000w_config.c
src/kds_s2000w_config.h
tests/kds_s2000w_read_config_tests.c [new file with mode: 0644]
tests/runtests.c
tools/read_config.c

index d464f016d26f4ff2d7484d742a691cd26c241d1e..acf244244b84acb0521bb3fd3daa2a770383eac8 100644 (file)
@@ -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
index ddbb5afef5f943a68ed8ff917517590c090a6211..2e42a38d77758fe17490ad0255313f917461078d 100644 (file)
@@ -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 (file)
index 0000000..893d536
--- /dev/null
@@ -0,0 +1,8 @@
+#include <check.h>
+#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
index f7e80659aa28dd1fdf6b09693c0b4ae103f52a61..dd11d83b61c2947bde965ef3189dcbac9f4da472 100644 (file)
@@ -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);
index 15e7feed8565f28d06afbc58b2cae0b69d52ff7e..7946eb01a3e10dc4289164c9b5e3e46933085370 100644 (file)
@@ -1,7 +1,9 @@
 #include <stdio.h>
+#include <stdlib.h>
+#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