1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include "omp_testsuite.h"
5 #include "omp_my_sleep.h"
6
7 #define NTIMES 100
8
9 #define ASSERT_CMP(lhs, cmp, rhs) \
10 if (!((lhs)cmp(rhs))) { \
11 printf("Expected: (" #lhs ") " #cmp " (" #rhs "), actual: %e vs. %e", lhs, \
12 rhs); \
13 return EXIT_FAILURE; \
14 }
15
main()16 int main() {
17 int i;
18
19 for (i = 0; i < NTIMES; i++) {
20 double start = omp_get_wtime(), end;
21 ASSERT_CMP(start, >=, 0.0);
22 for (end = omp_get_wtime(); end == start; end = omp_get_wtime()) {
23 ASSERT_CMP(end, >=, 0.0);
24 }
25 ASSERT_CMP(end, >=, 0.0);
26 ASSERT_CMP(end, >, start);
27 }
28
29 return EXIT_SUCCESS;
30 }
31