summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/linger.cpp2
-rw-r--r--tests/polltimeo.cpp12
-rw-r--r--tests/timeo.cpp12
3 files changed, 18 insertions, 8 deletions
diff --git a/tests/linger.cpp b/tests/linger.cpp
index 8300394..42dfda0 100644
--- a/tests/linger.cpp
+++ b/tests/linger.cpp
@@ -52,7 +52,9 @@ int XS_TEST_MAIN ()
rc = xs_term (ctx);
assert (rc == 0);
int ms = (int) xs_stopwatch_stop (watch) / 1000;
+#if !defined _WIN32 || !defined _DEBUG
assert (ms > 50 && ms < 150);
+#endif
return 0;
}
diff --git a/tests/polltimeo.cpp b/tests/polltimeo.cpp
index 087d125..73d7f53 100644
--- a/tests/polltimeo.cpp
+++ b/tests/polltimeo.cpp
@@ -57,8 +57,10 @@ int XS_TEST_MAIN ()
void *watch = xs_stopwatch_start ();
rc = xs_poll (&pi, 1, 500);
assert (rc == 0);
- unsigned long elapsed = xs_stopwatch_stop (watch);
- assert (elapsed > 440000 && elapsed < 550000);
+ unsigned long elapsed = xs_stopwatch_stop (watch) / 1000;
+#if !defined _WIN32 || !defined _DEBUG
+ assert (elapsed > 440 && elapsed < 550);
+#endif
// Check whether connection during the wait doesn't distort the timeout.
void *thread = thread_create (polltimeo_worker, ctx);
@@ -66,8 +68,10 @@ int XS_TEST_MAIN ()
watch = xs_stopwatch_start ();
rc = xs_poll (&pi, 1, 2000);
assert (rc == 0);
- elapsed = xs_stopwatch_stop (watch);
- assert (elapsed > 1900000 && elapsed < 2100000);
+ elapsed = xs_stopwatch_stop (watch) / 1000;
+#if !defined _WIN32 || !defined _DEBUG
+ assert (elapsed > 1900 && elapsed < 2100);
+#endif
thread_join (thread);
// Clean-up.
diff --git a/tests/timeo.cpp b/tests/timeo.cpp
index e2dcbb8..92c578b 100644
--- a/tests/timeo.cpp
+++ b/tests/timeo.cpp
@@ -65,8 +65,10 @@ int XS_TEST_MAIN ()
rc = xs_recv (sb, buf, 32, 0);
assert (rc == -1);
assert (xs_errno () == EAGAIN);
- unsigned long elapsed = xs_stopwatch_stop (watch);
- assert (elapsed > 440000 && elapsed < 550000);
+ unsigned long elapsed = xs_stopwatch_stop (watch) / 1000;
+#if !defined _WIN32 || !defined _DEBUG
+ assert (elapsed > 440 && elapsed < 550);
+#endif
// Check whether connection during the wait doesn't distort the timeout.
timeout = 2000;
@@ -78,8 +80,10 @@ int XS_TEST_MAIN ()
rc = xs_recv (sb, buf, 32, 0);
assert (rc == -1);
assert (xs_errno () == EAGAIN);
- elapsed = xs_stopwatch_stop (watch);
- assert (elapsed > 1900000 && elapsed < 2100000);
+ elapsed = xs_stopwatch_stop (watch) / 1000;
+#if !defined _WIN32 || !defined _DEBUG
+ assert (elapsed > 1900 && elapsed < 2100);
+#endif
thread_join (thread);
// Check that timeouts don't break normal message transfer.