blob: 80846302f0f6ed07357135255e826cb45ae0a8bd [file]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* mingw-w64 headers */
#include "libtest.h"
#if __STDC_VERSION__ >= 201112L
#define __threadlocal__ _Thread_local
#else
#define __threadlocal__ __thread
#endif
__threadlocal__ int tvar = 0;
int main (void)
{
/**
* Random number to increment `tvar` by.
*/
int x;
mingw_test_init ();
srand (time (NULL));
x = rand ();
tvar += x;
if (tvar != x) {
fprintf (stderr, "tvar has value %d when expected %d\n", tvar, x);
_exit (EXIT_FAILURE);
}
return 0;
}