diff options
author | David Robillard <d@drobilla.net> | 2012-02-01 01:40:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-02-01 01:40:05 +0000 |
commit | 5d071ef1c9ea2d39c03ca64b6a0c3bb9c67bd8cf (patch) | |
tree | 6b2d088aef4ed5099fbbc140c594a0ee1b7e67fa /test/sorted_array_test.c | |
parent | dc7628a8eec281add045eb123ae06dbc94c1b950 (diff) | |
download | zix-5d071ef1c9ea2d39c03ca64b6a0c3bb9c67bd8cf.tar.gz zix-5d071ef1c9ea2d39c03ca64b6a0c3bb9c67bd8cf.tar.bz2 zix-5d071ef1c9ea2d39c03ca64b6a0c3bb9c67bd8cf.zip |
Windows portability fixes.
git-svn-id: http://svn.drobilla.net/zix/trunk@58 df6676b4-ccc9-40e5-b5d6-7c4628a128e3
Diffstat (limited to 'test/sorted_array_test.c')
-rw-r--r-- | test/sorted_array_test.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/test/sorted_array_test.c b/test/sorted_array_test.c index d33151a..3b0a090 100644 --- a/test/sorted_array_test.c +++ b/test/sorted_array_test.c @@ -14,14 +14,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <limits.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <limits.h> +#include <time.h> -#include <sys/time.h> - -#ifndef _MSC_VER +#ifdef _MSC_VER +# define PRIdPTR "Id" +#else # include <inttypes.h> #endif @@ -77,8 +78,7 @@ stress(int test_num, unsigned n_elems) return test_fail(); } if (*(intptr_t*)zix_sorted_array_get_data(ti) != r) { - fprintf(stderr, "Data corrupt (saw %" PRIdPTR - ", expected %" PRIdPTR ")\n", + fprintf(stderr, "Data corrupt (%" PRIdPTR " != %" PRIdPTR ")\n", *(intptr_t*)zix_sorted_array_get_data(ti), r); return test_fail(); } @@ -94,8 +94,7 @@ stress(int test_num, unsigned n_elems) return test_fail(); } if (*(intptr_t*)zix_sorted_array_get_data(ti) != r) { - fprintf(stderr, "Data corrupt (saw %" PRIdPTR - ", expected %" PRIdPTR ")\n", + fprintf(stderr, "Data corrupt (%" PRIdPTR " != %" PRIdPTR ")\n", *(intptr_t*)zix_sorted_array_get_data(ti), r); return test_fail(); } @@ -150,9 +149,6 @@ main(int argc, char** argv) const unsigned n_tests = 3; unsigned n_elems = 0; - struct timeval time; - gettimeofday(&time, NULL); - if (argc == 1) { n_elems = 4096; } else { @@ -160,7 +156,7 @@ main(int argc, char** argv) if (argc > 2) { seed = atol(argv[2]); } else { - seed = time.tv_sec + time.tv_usec; + seed = time(NULL); } } |