From: Bastian Dehn Date: Tue, 7 Oct 2025 09:48:52 +0000 (+0200) Subject: change image converter test single file X-Git-Tag: v1.1.9^2~2^2~6 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=c8afe339d503bd2a81536b5574769a59ca258c17;p=sane-kds-s2000w-net.git change image converter test single file --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 135c2ed..8df3949 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,12 +40,11 @@ TARGET_LINK_LIBRARIES("kds_s2000w_read_config_tests_run" ${CMOCKA_LIBRARY} sane-kds_s2000w_net-static) -ADD_EXECUTABLE("kds_s2000w_image_converter_tests_run" - "kds_s2000w_image_converter_tests_run.c" +ADD_EXECUTABLE("kds_s2000w_image_converter_tests" "kds_s2000w_image_converter_tests.c" "kds_s2000w_client_mock.c") -ADD_DEPENDENCIES("kds_s2000w_image_converter_tests_run" sane-kds_s2000w_net-static) -TARGET_LINK_LIBRARIES("kds_s2000w_image_converter_tests_run" +ADD_DEPENDENCIES("kds_s2000w_image_converter_tests" sane-kds_s2000w_net-static) +TARGET_LINK_LIBRARIES("kds_s2000w_image_converter_tests" ${CMOCKA_LIBRARY} sane-kds_s2000w_net-static) @@ -73,7 +72,7 @@ ADD_CUSTOM_TARGET("runningtests" COMMAND ./kds_s2000w_net_tests_run COMMAND ./kds_s2000w_net_read_tests_run COMMAND ./kds_s2000w_image_type_check_tests_run - COMMAND ./kds_s2000w_image_converter_tests_run + COMMAND ./kds_s2000w_image_converter_tests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS "kds_s2000w_read_config_tests_run" "kds_s2000w_option_descriptor_tests_run" @@ -81,7 +80,7 @@ ADD_CUSTOM_TARGET("runningtests" "kds_s2000w_net_tests_run" "kds_s2000w_net_read_tests_run" "kds_s2000w_image_type_check_tests_run" - "kds_s2000w_image_converter_tests_run") + "kds_s2000w_image_converter_tests") ADD_CUSTOM_TARGET("generate_gcov_coverage" ALL gcov ${CMAKE_BINARY_DIR}/src/CMakeFiles/sane-kds_s2000w_net-static.dir/*.c.o diff --git a/tests/kds_s2000w_image_converter_tests.c b/tests/kds_s2000w_image_converter_tests.c index d0c73d6..ff0ffd3 100644 --- a/tests/kds_s2000w_image_converter_tests.c +++ b/tests/kds_s2000w_image_converter_tests.c @@ -1,5 +1,11 @@ +#include +#include +#include +#include +#include #include -#include "kds_s2000w_image_converter_tests.h" +#include +#include "kds_s2000w_client_mock.h" #include "../src/kds_s2000w_image_converter.h" void get_metadata_from_image_test() @@ -39,4 +45,13 @@ void get_metadata_from_image_test() image = NULL; free(mdata); mdata = NULL; +} + +int main() +{ + const struct CMUnitTest converter_tests[] = { + cmocka_unit_test(get_metadata_from_image_test) + }; + + return cmocka_run_group_tests(converter_tests, NULL, NULL); } \ No newline at end of file diff --git a/tests/kds_s2000w_image_converter_tests.h b/tests/kds_s2000w_image_converter_tests.h deleted file mode 100644 index 6522e3d..0000000 --- a/tests/kds_s2000w_image_converter_tests.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef KDS_S2000W_IMAGE_CONVERTER_TESTS_H -#define KDS_S2000W_IMAGE_CONVERTER_TESTS_H -#include -#include -#include -#include -#include - -void get_metadata_from_image_test(); - -#endif \ No newline at end of file diff --git a/tests/kds_s2000w_image_converter_tests_run.c b/tests/kds_s2000w_image_converter_tests_run.c deleted file mode 100644 index 048b343..0000000 --- a/tests/kds_s2000w_image_converter_tests_run.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include "kds_s2000w_client_mock.h" -#include "kds_s2000w_image_converter_tests.h" - -int main() -{ - const struct CMUnitTest converter_tests[] = { - cmocka_unit_test(get_metadata_from_image_test) - }; - - return cmocka_run_group_tests(converter_tests, NULL, NULL); -} \ No newline at end of file