Port tests to windows and add to cmake build.

This commit is contained in:
Richard Newton
2013-08-17 13:43:45 +01:00
parent e16a6af0c7
commit 7f74fc7c99
38 changed files with 171 additions and 108 deletions

View File

@@ -18,15 +18,15 @@
*/
#include "../include/zmq.h"
#include <sys/time.h>
#include "../include/zmq_utils.h"
#include <stdio.h>
#include <string.h>
#undef NDEBUG
#include <assert.h>
#include "testutil.hpp"
int main (void)
{
setup_test_environment();
void *ctx = zmq_ctx_new ();
assert (ctx);
@@ -46,17 +46,11 @@ int main (void)
rc = zmq_setsockopt (frontend, ZMQ_RCVTIMEO, &timeout, sizeof (int));
assert (rc == 0);
struct timeval before, after;
gettimeofday (&before, NULL);
void* stopwatch = zmq_stopwatch_start();
rc = zmq_recv (frontend, buffer, 32, 0);
assert (rc == -1);
assert (zmq_errno () == EAGAIN);
gettimeofday (&after, NULL);
long elapsed = (long)
((after.tv_sec * 1000 + after.tv_usec / 1000)
- (before.tv_sec * 1000 + before.tv_usec / 1000));
unsigned int elapsed = zmq_stopwatch_stop(stopwatch) / 1000;
assert (elapsed > 200 && elapsed < 300);
// Check that normal message flow works as expected