#include "../src/kds_s2000w_net.h"
 #include "../src/kds_s2000w_handler.h"
 
-int kds_s2000w_client_get_option(int64_t sessionid, response* response)
+int __wrap_kds_s2000w_client_get_option(int64_t sessionid, response* response)
 {
        response->data = realloc(response->data, 918);
        const char* responsedata = "{ \
        response->code = 200;
        response->size = sizeof(response->data);
 
-       return 0;
+       return mock_type(int);
 }
 
 int kds_s2000w_client_stop_scan(int64_t sessionid, response* response)
        assert_int_equal(result, SANE_STATUS_UNSUPPORTED);
 }
 
-START_TEST(sane_kds_s2000w_net_control_get_option_zero)
+void sane_kds_s2000w_net_control_get_option_zero()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int value = 0;
 
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(value, 24);
+       assert_int_equal(value, 24);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_two)
+void sane_kds_s2000w_net_control_get_option_two()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 2, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "DocumentFeeder");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "DocumentFeeder");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_three)
+void sane_kds_s2000w_net_control_get_option_three()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 3, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "Color");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "Color");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_four)
+void sane_kds_s2000w_net_control_get_option_four()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = 0;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 4, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 200);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 200);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_five)
+void sane_kds_s2000w_net_control_get_option_five()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 5, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "Duplex");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "Duplex");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_six)
+void sane_kds_s2000w_net_control_get_option_six()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = 0;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 6, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 8);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 8);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_eight)
+void sane_kds_s2000w_net_control_get_option_eight()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 8, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_nine)
+void sane_kds_s2000w_net_control_get_option_nine()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 9, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "None");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "None");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_ten)
+void sane_kds_s2000w_net_control_get_option_ten()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 10, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_eleven)
+void sane_kds_s2000w_net_control_get_option_eleven()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 11, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "Automatic");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "Automatic");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_twelve)
+void sane_kds_s2000w_net_control_get_option_twelve()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 12, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "Automatic");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "Automatic");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_thirteen)
+void sane_kds_s2000w_net_control_get_option_thirteen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 13, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_fourteen)
+void sane_kds_s2000w_net_control_get_option_fourteen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 14, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_fifteen)
+void sane_kds_s2000w_net_control_get_option_fifteen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 15, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_sixteen)
+void sane_kds_s2000w_net_control_get_option_sixteen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 16, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_seventeen)
+void sane_kds_s2000w_net_control_get_option_seventeen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 17, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "None");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "None");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_eightteen)
+void sane_kds_s2000w_net_control_get_option_eightteen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 18, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_nineteen)
+void sane_kds_s2000w_net_control_get_option_nineteen()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        char value[50] = {0};
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 19, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_str_eq(value, "None");
+       assert_int_equal(option_num, 24);
+       assert_string_equal(value, "None");
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_twenty)
+void sane_kds_s2000w_net_control_get_option_twenty()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 20, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_twentyone)
+void sane_kds_s2000w_net_control_get_option_twentyone()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 21, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 0);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 0);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
-START_TEST(sane_kds_s2000w_net_control_get_option_twentytwo)
+void sane_kds_s2000w_net_control_get_option_twentytwo()
 {
+       will_return(__wrap_kds_s2000w_client_get_option, 0);
        handler* h = init_handler();
        int option_num = 0;
        int value = -1;
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &option_num, NULL);
        _sane_kds_s2000w_net_control_option(h, 22, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       ck_assert_int_eq(option_num, 24);
-       ck_assert_int_eq(value, 140);
+       assert_int_equal(option_num, 24);
+       assert_int_equal(value, 140);
        free_handler(h);
        h = NULL;
 }
-END_TEST
 
 START_TEST(sane_kds_s2000w_net_start_cancel)
 {
        Suite* net_tests_suite = suite_create("kds_s2000w_net");
 
        TCase* net_tests = tcase_create("kds_s2000w_net_tests");
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_zero);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_two);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_three);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_four);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_five);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_six);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_eight);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_nine);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_ten);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_eleven);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_twelve);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_thirteen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_fourteen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_fifteen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_sixteen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_seventeen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_eightteen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_nineteen);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_twenty);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_twentyone);
-       tcase_add_test(net_tests, sane_kds_s2000w_net_control_get_option_twentytwo);
        tcase_add_test(net_tests, sane_kds_s2000w_net_get_parameter_cancel);
        tcase_add_test(net_tests, sane_kds_s2000w_net_start_cancel);
        tcase_add_test(net_tests, sane_kds_s2000w_net_cancel);