summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-18 10:06:59 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-18 10:06:59 -0800
commitc44386d110f5f335a34cc964768ab14d36b6dd36 (patch)
tree76e56433e337d70a1058d94db546586508bdc85b /tests
parent7e844cf618d67675928fb4c6fadc6cc16db19d19 (diff)
downloadnng-c44386d110f5f335a34cc964768ab14d36b6dd36.tar.gz
nng-c44386d110f5f335a34cc964768ab14d36b6dd36.tar.bz2
nng-c44386d110f5f335a34cc964768ab14d36b6dd36.zip
Windows compilation fixes.
Diffstat (limited to 'tests')
-rw-r--r--tests/idhash.c2
-rw-r--r--tests/inproc.c1
-rw-r--r--tests/sock.c13
-rw-r--r--tests/stubs.h11
4 files changed, 13 insertions, 14 deletions
diff --git a/tests/idhash.c b/tests/idhash.c
index 0609248b..600b17ae 100644
--- a/tests/idhash.c
+++ b/tests/idhash.c
@@ -8,7 +8,7 @@
//
#include "convey.h"
-#include "stubs.h"
+#include "core/nng_impl.h"
#include "core/idhash.c"
Main({
diff --git a/tests/inproc.c b/tests/inproc.c
index 89b43ced..cfbf3153 100644
--- a/tests/inproc.c
+++ b/tests/inproc.c
@@ -9,6 +9,7 @@
#include "convey.h"
#include "trantest.h"
+#include "core/nng_impl.h"
// Inproc tests.
diff --git a/tests/sock.c b/tests/sock.c
index 6a122cdf..123354ac 100644
--- a/tests/sock.c
+++ b/tests/sock.c
@@ -8,7 +8,6 @@
//
#include "convey.h"
-#include "stubs.h"
#include "nng.h"
#include "core/nng_impl.h"
@@ -47,7 +46,7 @@ Main({
int64_t when = 500000;
uint64_t now;
- now = getms();
+ now = nni_clock();
rv = nng_setopt(sock, NNG_OPT_RCVTIMEO, &when,
sizeof (when));
@@ -55,8 +54,8 @@ Main({
rv = nng_recvmsg(sock, &msg, 0);
So(rv == NNG_ETIMEDOUT);
So(msg == NULL);
- So(getms() >= (now + (when/1000)));
- So(getms() < (now + ((when/1000) * 2)));
+ So(nni_clock() >= (now + when));
+ So(nni_clock() < (now + (when * 2)));
})
Convey("Recv nonblock with no pipes gives EAGAIN", {
@@ -74,15 +73,15 @@ Main({
// We cheat to get access to the core's clock.
So(nng_msg_alloc(&msg, 0) == 0);
So(msg != NULL);
- now = getms();
+ now = nni_clock();
rv = nng_setopt(sock, NNG_OPT_SNDTIMEO, &when,
sizeof (when));
So(rv == 0);
rv = nng_sendmsg(sock, msg, 0);
So(rv == NNG_ETIMEDOUT);
- So(getms() >= (now + (when/1000)));
- So(getms() < (now + ((when/1000) * 2)));
+ So(nni_clock() >= (now + when));
+ So(nni_clock() < (now + (when * 2)));
nng_msg_free(msg);
})
diff --git a/tests/stubs.h b/tests/stubs.h
index 967074c4..c77b8db6 100644
--- a/tests/stubs.h
+++ b/tests/stubs.h
@@ -7,13 +7,10 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "convey.h"
-#include "nng.h"
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
+#ifndef STUBS_H
+#define STUBS_H
+#include <stdint.h>
#ifdef _WIN32
#include <windows.h>
#else
@@ -46,3 +43,5 @@ getms(void)
return (((uint64_t)(tv.tv_sec ) * 1000) + (tv.tv_usec / 1000));
#endif
}
+
+#endif // STUBS_H \ No newline at end of file