diff options
Diffstat (limited to 'libwmc/tests')
-rw-r--r-- | libwmc/tests/test-wmc-com.c | 40 | ||||
-rw-r--r-- | libwmc/tests/test-wmc-com.h | 4 | ||||
-rw-r--r-- | libwmc/tests/test-wmc-escaping.c | 14 | ||||
-rw-r--r-- | libwmc/tests/test-wmc-utils.c | 36 |
4 files changed, 48 insertions, 46 deletions
diff --git a/libwmc/tests/test-wmc-com.c b/libwmc/tests/test-wmc-com.c index 3a6b96dc..d42b918a 100644 --- a/libwmc/tests/test-wmc-com.c +++ b/libwmc/tests/test-wmc-com.c @@ -36,12 +36,12 @@ typedef struct { char *port; int fd; struct termios old_t; - gboolean debug; - gboolean uml290; + wmcbool debug; + wmcbool uml290; } TestComData; gpointer -test_com_setup (const char *port, gboolean uml290, gboolean debug) +test_com_setup (const char *port, wmcbool uml290, wmcbool debug) { TestComData *d; int ret; @@ -93,10 +93,10 @@ test_com_teardown (gpointer user_data) } static void -print_buf (const char *detail, const char *buf, gsize len) +print_buf (const char *detail, const char *buf, size_t len) { int i = 0; - gboolean newline = FALSE; + wmcbool newline = FALSE; g_print ("%s (%zu) ", detail, len); for (i = 0; i < len; i++) { @@ -112,15 +112,15 @@ print_buf (const char *detail, const char *buf, gsize len) g_print ("\n"); } -static gboolean +static wmcbool send_command (TestComData *d, char *inbuf, - gsize inbuf_len, - gsize cmd_len) + size_t inbuf_len, + size_t cmd_len) { int status; int eagain_count = 1000; - gsize i = 0, sendlen; + size_t i = 0, sendlen; char sendbuf[600]; /* Encapsulate the data for the device */ @@ -152,8 +152,8 @@ send_command (TestComData *d, return TRUE; } -static gsize -wait_reply (TestComData *d, char *buf, gsize len) +static size_t +wait_reply (TestComData *d, char *buf, size_t len) { fd_set in; int result; @@ -161,7 +161,7 @@ wait_reply (TestComData *d, char *buf, gsize len) char readbuf[1024]; ssize_t bytes_read; int total = 0, retries = 0; - gsize decap_len = 0; + size_t decap_len = 0; FD_ZERO (&in); FD_SET (d->fd, &in); @@ -182,8 +182,8 @@ wait_reply (TestComData *d, char *buf, gsize len) retries++; continue; } else if (bytes_read == 1) { - gboolean more = FALSE, success; - gsize used = 0; + wmcbool more = FALSE, success; + size_t used = 0; total++; decap_len = 0; @@ -229,11 +229,11 @@ void test_com_init (void *f, void *data) { TestComData *d = data; - gboolean success; + wmcbool success; char buf[512]; gint len; WmcResult *result; - gsize reply_len; + size_t reply_len; len = wmc_cmd_init_new (buf, sizeof (buf), d->uml290); g_assert (len == 16); @@ -256,12 +256,12 @@ void test_com_device_info (void *f, void *data) { TestComData *d = data; - gboolean success; + wmcbool success; char buf[1024]; const char *str, *str2; gint len; WmcResult *result; - gsize reply_len; + size_t reply_len; len = wmc_cmd_device_info_new (buf, sizeof (buf)); g_assert (len == 2); @@ -318,13 +318,13 @@ void test_com_status (void *f, void *data) { TestComData *d = data; - gboolean success; + wmcbool success; char buf[1024]; const char *str; u_int8_t dbm; gint len; WmcResult *result; - gsize reply_len; + size_t reply_len; len = wmc_cmd_status_new (buf, sizeof (buf)); g_assert (len == 2); diff --git a/libwmc/tests/test-wmc-com.h b/libwmc/tests/test-wmc-com.h index 6c3d2a07..69d2154e 100644 --- a/libwmc/tests/test-wmc-com.h +++ b/libwmc/tests/test-wmc-com.h @@ -18,7 +18,9 @@ #ifndef TEST_WMC_COM_H #define TEST_WMC_COM_H -gpointer test_com_setup (const char *port, gboolean uml290, gboolean debug); +#include "utils.h" + +gpointer test_com_setup (const char *port, wmcbool uml290, wmcbool debug); void test_com_teardown (gpointer d); void test_com_port_init (void *f, void *data); diff --git a/libwmc/tests/test-wmc-escaping.c b/libwmc/tests/test-wmc-escaping.c index cb268da7..3c4cd21f 100644 --- a/libwmc/tests/test-wmc-escaping.c +++ b/libwmc/tests/test-wmc-escaping.c @@ -76,7 +76,7 @@ void test_escape1 (void *f, void *data) { char escaped[1024]; - gsize len; + size_t len; /* Ensure that escaping in general works */ len = hdlc_escape (data1, sizeof (data1), FALSE, escaped, sizeof (escaped)); @@ -96,7 +96,7 @@ void test_escape2 (void *f, void *data) { char escaped[1024]; - gsize len; + size_t len; /* Ensure that escaping data that doesn't need escaping works */ len = hdlc_escape (data2, sizeof (data2), FALSE, escaped, sizeof (escaped)); @@ -119,7 +119,7 @@ void test_escape_ctrl (void *f, void *data) { char escaped[1024]; - gsize len; + size_t len; len = hdlc_escape (data_ctrl_src, sizeof (data_ctrl_src), TRUE, escaped, sizeof (escaped)); g_assert (len == sizeof (data_ctrl_expected)); @@ -131,8 +131,8 @@ test_escape_unescape (void *f, void *data) { char escaped[512]; char unescaped[512]; - gsize len, unlen; - gboolean escaping = FALSE; + size_t len, unlen; + wmcbool escaping = FALSE; /* Ensure that escaping data that needs escaping, and then unescaping it, * produces the exact same data as was originally escaped. @@ -149,8 +149,8 @@ test_escape_unescape_ctrl (void *f, void *data) { char escaped[512]; char unescaped[512]; - gsize len, unlen; - gboolean escaping = FALSE; + size_t len, unlen; + wmcbool escaping = FALSE; /* Ensure that escaping data that needs escaping, and then unescaping it, * produces the exact same data as was originally escaped. diff --git a/libwmc/tests/test-wmc-utils.c b/libwmc/tests/test-wmc-utils.c index 3a1d76be..49d7351d 100644 --- a/libwmc/tests/test-wmc-utils.c +++ b/libwmc/tests/test-wmc-utils.c @@ -46,11 +46,11 @@ static const char decap_inbuf[] = { void test_utils_decapsulate_basic_buffer (void *f, void *data) { - gboolean success; + wmcbool success; char outbuf[512]; - gsize decap_len = 0; - gsize used = 0; - gboolean more = FALSE; + size_t decap_len = 0; + size_t used = 0; + wmcbool more = FALSE; success = hdlc_decapsulate_buffer (decap_inbuf, sizeof (decap_inbuf), FALSE, 0, outbuf, sizeof (outbuf), @@ -71,7 +71,7 @@ test_utils_encapsulate_basic_buffer (void *f, void *data) { char cmdbuf[10]; char outbuf[512]; - gsize encap_len = 0; + size_t encap_len = 0; cmdbuf[0] = 0x4B; /* DIAG_CMD_SUBSYS */ cmdbuf[1] = 0x05; /* DIAG_SUBSYS_HDR */ @@ -93,11 +93,11 @@ static const char cns_inbuf[] = { void test_utils_decapsulate_sierra_cns (void *f, void *data) { - gboolean success; + wmcbool success; char outbuf[512]; - gsize decap_len = 0; - gsize used = 0; - gboolean more = FALSE; + size_t decap_len = 0; + size_t used = 0; + wmcbool more = FALSE; success = hdlc_decapsulate_buffer (cns_inbuf, sizeof (cns_inbuf), FALSE, 0, outbuf, sizeof (outbuf), @@ -123,7 +123,7 @@ test_utils_encapsulate_uml290_wmc1 (void *f, void *data) { char inbuf[512]; char outbuf[512]; - gsize encap_len = 0; + size_t encap_len = 0; memcpy (inbuf, uml290_encap_src, sizeof (uml290_encap_src)); encap_len = wmc_encapsulate (inbuf, sizeof (uml290_encap_src), @@ -167,11 +167,11 @@ static const char uml290_expected[] = { void test_utils_decapsulate_uml290_wmc1 (void *f, void *data) { - gboolean success; + wmcbool success; char outbuf[512]; - gsize decap_len = 0; - gsize used = 0; - gboolean more = FALSE; + size_t decap_len = 0; + size_t used = 0; + wmcbool more = FALSE; success = hdlc_decapsulate_buffer (uml290_src, sizeof (uml290_src), TRUE, 0x3030, outbuf, sizeof (outbuf), @@ -205,11 +205,11 @@ static const char pc5740_expected[] = { void test_utils_decapsulate_pc5740_wmc1 (void *f, void *data) { - gboolean success; + wmcbool success; char outbuf[512]; - gsize decap_len = 0; - gsize used = 0; - gboolean more = FALSE; + size_t decap_len = 0; + size_t used = 0; + wmcbool more = FALSE; success = hdlc_decapsulate_buffer (pc5740_src, sizeof (pc5740_src), FALSE, 0, outbuf, sizeof (outbuf), |