network

low level network subjects
Log | Files | Refs | Submodules | README | git clone https://git.ne02ptzero.me/git/network

commit 50f518a0f19d52e44865de7785ced391d5a1777b
parent f00dd588606c4d7a329c3106168f2aa8af863e8b
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Sun, 26 Mar 2017 21:44:58 +0200

Fix(client_test): Wrong column name and error report

Diffstat:
Minc/package.h | 16++++++++--------
Msrc/client_test.c | 4++--
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/inc/package.h b/inc/package.h @@ -86,10 +86,10 @@ typedef struct error_pkg_s { /* Error possible types */ typedef enum error_type_e { - ERR_SERVER_FAULT = 1, - ERR_MALFORMED_PACKET, - ERR_RES_NOT_FOUND, - ERR_END + ERR_SERVER_FAULT = 0x1, + ERR_MALFORMED_PACKET = 0x2, + ERR_RES_NOT_FOUND = 0x3, + ERR_END = 0x4 } SF_PACKED error_type_t; typedef struct req_get_pkg_s { @@ -110,10 +110,10 @@ typedef struct req_get_pkg_s { /* Stability of packages */ typedef enum prot_package_state_e { - PKG_STABLE = 1, - PKG_UNSTABLE, - PKG_DEV, - PKG_END + PKG_STABLE = 0x1, + PKG_UNSTABLE = 0x2, + PKG_DEV = 0x3, + PKG_END = 0x4 } prot_package_state_t; typedef struct req_get_file_s { diff --git a/src/client_test.c b/src/client_test.c @@ -31,7 +31,7 @@ SQL_CALLBACK_DEF(pkg_cb) { pkg->dependencies = strdup(col_txt[i]); else if (strcmp(col_name[i], "archiveSize") == 0) pkg->arch_size = strtoull(col_txt[i], (char **)NULL, 10); - else if (strcmp(col_name[i], "InstalledSize") == 0) + else if (strcmp(col_name[i], "installedSize") == 0) pkg->inst_size = strtoull(col_txt[i], (char **)NULL, 10); else if (strcmp(col_name[i], "archiveHash") == 0) pkg->arch_hash = strdup(col_txt[i]); @@ -164,7 +164,7 @@ TEST(pkg_req_get_pkg_1_read) { size_t r_n = 0, size; TEST_ASSERT(sockfd, "Server is not responding"); - expect = pkg_build_error(&size, ERR_RES_NOT_FOUND, "Package not found"); + expect = pkg_build_error(&size, ERR_MALFORMED_PACKET, "A packet send by the client is wrong"); ret = malloc(2048); READ_TIMEOUT(sockfd, ret, 2048, 1, r_n);