소스 검색

Fix sleep function in public test

bel 10 년 전
부모
커밋
d3d94716ce
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      test/public.c

+ 4 - 3
test/public.c

@@ -20,16 +20,17 @@
  */
  */
 
 
 #include <stdlib.h>
 #include <stdlib.h>
+#include <time.h>
 
 
 #include "public.h"
 #include "public.h"
 #include <civetweb.h>
 #include <civetweb.h>
 
 
 #if defined(_WIN32)
 #if defined(_WIN32)
 #include <Windows.h>
 #include <Windows.h>
-#define mg_sleep(x) (Sleep(x))
+#define mg_Sleep(x) (Sleep(x*1000))
 #else
 #else
 #include <unistd.h>
 #include <unistd.h>
-#define mg_sleep(x) (usleep((x)*1000))
+#define mg_Sleep(x) (sleep(x))
 #endif
 #endif
 
 
 /* This unit test file uses the excellent Check unit testing library.
 /* This unit test file uses the excellent Check unit testing library.
@@ -67,7 +68,7 @@ START_TEST (test_mg_start_stop_server)
 
 
   ctx = mg_start(NULL, NULL, OPTIONS);
   ctx = mg_start(NULL, NULL, OPTIONS);
   ck_assert(ctx != NULL);
   ck_assert(ctx != NULL);
-  mg_sleep(1000);
+  mg_Sleep(2);
   mg_stop(ctx);
   mg_stop(ctx);
 }
 }
 END_TEST
 END_TEST