فهرست منبع

Fix signed/unsigned mix in unit tests

bel 10 سال پیش
والد
کامیت
8bc9bedd58
2فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 3 3
      test/private.c
  2. 3 3
      test/public.c

+ 3 - 3
test/private.c

@@ -427,14 +427,14 @@ START_TEST(test_encode_decode)
 	ck_assert_str_eq(buf, nonalpha_url);
 
 	memset(buf, 77, sizeof(buf));
-	ret = mg_url_decode(alpha, strlen(alpha), buf, sizeof(buf), 0);
+	ret = mg_url_decode(alpha, (int)strlen(alpha), buf, sizeof(buf), 0);
 	ck_assert_int_eq(ret, strlen(buf));
 	ck_assert_int_eq(ret, strlen(alpha));
 	ck_assert_str_eq(buf, alpha);
 
 	memset(buf, 77, sizeof(buf));
-	ret =
-	    mg_url_decode(nonalpha_url, strlen(nonalpha_url), buf, sizeof(buf), 0);
+	ret = mg_url_decode(
+	    nonalpha_url, (int)strlen(nonalpha_url), buf, sizeof(buf), 0);
 	ck_assert_int_eq(ret, strlen(buf));
 	ck_assert_int_eq(ret, strlen(nonalpha));
 	ck_assert_str_eq(buf, nonalpha);

+ 3 - 3
test/public.c

@@ -328,7 +328,7 @@ static int request_test_handler(struct mg_connection *conn, void *cbdata)
 	int i;
 	char chunk_data[32];
 
-	ASSERT(cbdata == (void *)7);
+	ck_assert(cbdata == (void *)7);
 	strcpy(chunk_data, "123456789A123456789B123456789C");
 
 	mg_printf(conn,
@@ -337,8 +337,8 @@ static int request_test_handler(struct mg_connection *conn, void *cbdata)
 	          "Content-Type: text/plain\r\n\r\n");
 
 	for (i = 0; i < 20; i++) {
-		mg_printf(conn, "%s\r\n", i);
-		mg_write(conn, chunk_data, i);
+		mg_printf(conn, "%u\r\n", i);
+		mg_write(conn, chunk_data, (unsigned)i);
 		mg_printf(conn, "\r\n");
 	}