add coverage ws.c (#2050)

Co-authored-by: Jean-Francois Simon <jfsimon@startmail.com>
This commit is contained in:
Jean-François Simon 2023-02-10 15:51:44 +01:00 committed by GitHub
parent fbaaf89a21
commit b513d40bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2308,6 +2308,7 @@ static void w3(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
char buf[8192];
memset(buf, 'A', sizeof(buf));
mg_ws_send(c, "hi there!", 9, WEBSOCKET_OP_TEXT);
mg_ws_printf(c, WEBSOCKET_OP_TEXT, "%s", "hi there2!");
mg_printf(c, "%s", "boo");
mg_ws_wrap(c, 3, WEBSOCKET_OP_TEXT);
mg_ws_send(c, buf, sizeof(buf), WEBSOCKET_OP_TEXT);
@ -2347,6 +2348,8 @@ static void w2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
// mg_hexdump(wm->data.ptr, wm->data.len);
if (wm->data.len == 9) {
ASSERT(mg_strcmp(wm->data, mg_str("hi there!")) == 0);
} else if (wm->data.len == 10) {
ASSERT(mg_strcmp(wm->data, mg_str("hi there2!")) == 0);
} else if (wm->data.len == 3) {
ASSERT(mg_strcmp(wm->data, mg_str("boo")) == 0);
} else {