浏览代码

Fix some issues in new unit tests

bel 9 年之前
父节点
当前提交
3fcfbd7d8b
共有 2 个文件被更改,包括 8 次插入4 次删除
  1. 2 1
      test/private.c
  2. 6 3
      test/public_func.c

+ 2 - 1
test/private.c

@@ -620,7 +620,8 @@ START_TEST(test_parse_date_string)
 	gmt_time_string(date, 1, NULL);
 	ck_assert_str_eq(date, "");
 	gmt_time_string(date, 6, NULL);
-	ck_assert_str_eq(date, "Tue, ");
+	ck_assert_str_eq(date,
+	                 "Thu, "); /* part of "Thu, 01 Jan 1970 00:00:00 GMT" */
 	gmt_time_string(date, sizeof(date), NULL);
 	ck_assert_str_eq(date, "Thu, 01 Jan 1970 00:00:00 GMT");
 

+ 6 - 3
test/public_func.c

@@ -434,7 +434,8 @@ END_TEST
 
 START_TEST(test_mg_get_response_code_text)
 {
-	size_t i, j, len;
+	int i;
+	size_t j, len;
 	const char *resp;
 
 	for (i = 100; i < 600; i++) {
@@ -444,8 +445,10 @@ START_TEST(test_mg_get_response_code_text)
 		ck_assert_uint_gt(len, 1);
 		ck_assert_uint_lt(len, 32);
 		for (j = 0; j < len; j++) {
-			ck_assert(resp[j] == ' ' || (resp[j] >= 'A' && resp[j] <= 'Z')
-			          || (resp[j] >= 'a' && resp[j] <= 'z'));
+			if (!(resp[j] != ' ' || (resp[j] >= 'A' && resp[j] <= 'Z')
+			      || (resp[j] >= 'a' && resp[j] <= 'z'))) {
+				ck_abort_msg("Found letter %c in %s", resp[j], resp);
+			}
 		}
 	}
 }