#include <string.h>
#include <unistd.h>
#include <math.h>
-#include <sane/sane.h>
#include "config.h"
+#include "kds_s2000w_net.h"
#include "kds_s2000w_option_descriptors.h"
#include "kds_s2000w_handler.h"
#include "kds_s2000w_debug.h"
--- /dev/null
+#ifndef KDS_S2000W_NET_H
+#define KDS_S2000W_NET_H
+#include <sane/sane.h>
+
+SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize);
+void _sane_kds_s2000w_net_exit(void);
+SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list, SANE_Bool local_only);
+SANE_Status _sane_kds_s2000w_net_open(SANE_String_Const devicename, SANE_Handle* handle);
+void _sane_kds_s2000w_net_close(SANE_Handle handle);
+const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(SANE_Handle handle, SANE_Int option);
+void _sane_kds_s2000w_net_cancel(SANE_Handle handle);
+SANE_Status _sane_kds_s2000w_net_get_parameters(SANE_Handle handle, SANE_Parameters* params);
+SANE_Status _sane_kds_s2000w_net_start(SANE_Handle handle);
+SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, SANE_Int max_length, SANE_Int* length);
+SANE_Status _sane_kds_s2000w_net_set_io_mode(SANE_Handle handle, SANE_Bool non_blocking);
+SANE_Status _sane_kds_s2000w_net_get_select_fd(SANE_Handle handle, SANE_Int* fd);
+
+#endif
\ No newline at end of file
find_library(SUBUNIT NAMES subunit REQUIRED)
find_library(MATH NAMES m REQUIRED)
-add_executable("runtests" "runtests.c")
+add_executable("runtests"
+ "kds_s2000w_net_read_tests.c"
+ "kds_s2000w_net_tests.c"
+ "kds_s2000w_read_config_tests.c"
+ "runtests.c")
add_dependencies("runtests" sane-kds_s2000w_net)
target_link_libraries("runtests" check subunit sane-kds_s2000w_net)
-#include <check.h>
#include <stdlib.h>
#include <sane/sane.h>
-#include "../src/kds_s2000w_net.c"
-
-START_TEST(sane_kds_s2000w_net_find_first_data_byte_test)
-{
- char data[] = {
- 0x50, 0x36, 0x0a, 0x31,
- 0x31, 0x35, 0x39, 0x20,
- 0x38, 0x32, 0x39, 0x0a,
- 0x32, 0x35, 0x35, 0x0a
- };
-
- int header_bytes = _sane_kds_s2000w_net_find_first_data_byte(data);
-
- ck_assert_int_eq(header_bytes, 16);
-}
-END_TEST
+#include "kds_s2000w_net_read_tests.h"
+#include "../src/kds_s2000w_handler.h"
+#include "../src/kds_s2000w_net.h"
START_TEST(sane_kds_s2000w_net_read_cancel_test)
{
Suite* read = suite_create("kds_s2000w_net_read");
TCase* net_read = tcase_create("read");
- tcase_add_test(net_read, sane_kds_s2000w_net_find_first_data_byte_test);
tcase_add_test(net_read, sane_kds_s2000w_net_read_cancel_test);
tcase_add_test(net_read, sane_kds_s2000w_net_read_without_data);
tcase_add_test(net_read, sane_kds_s2000w_net_read_empty_image);
--- /dev/null
+#ifndef KDS_S2000W_NET_READ_TESTS_H
+#define KDS_S2000W_NET_READ_TESTS_H
+#include <check.h>
+
+Suite* net_read();
+
+#endif
\ No newline at end of file
-#include <check.h>
#include <stdlib.h>
#include <sane/sane.h>
+#include "kds_s2000w_net_tests.h"
+#include "../src/kds_s2000w_net.h"
#include "../src/kds_s2000w_handler.h"
START_TEST(kds_s2000w_net_get_parameters_with_image_data)
--- /dev/null
+#ifndef KDS_S2000W_NET_TESTS_H
+#define KDS_S2000W_NET_TESTS_H
+#include <check.h>
+
+Suite* net_tests();
+
+#endif
\ No newline at end of file
-#include <check.h>
+#include <stdlib.h>
+#include "kds_s2000w_read_config_tests.h"
#include "../src/kds_s2000w_config.h"
START_TEST(kds_s2000w_config_read_parameter)
--- /dev/null
+#ifndef KDS_S2000W_READ_CONFIG_TESTS_H
+#define KDS_S2000W_READ_CONFIG_TESTS_H
+#include <check.h>
+
+Suite* config_read();
+
+#endif
\ No newline at end of file
#include <check.h>
#include <unistd.h>
-#include "kds_s2000w_net_read_tests.c"
-#include "kds_s2000w_net_tests.c"
-#include "kds_s2000w_read_config_tests.c"
+#include "kds_s2000w_net_read_tests.h"
+#include "kds_s2000w_net_tests.h"
+#include "kds_s2000w_read_config_tests.h"
int main()
{