6 /* TODO: not thread-safe nor fork-safe */
7 static volatile int t_status;
9 #define T_LOC2(l) __FILE__ ":" #l
10 #define T_LOC1(l) T_LOC2(l)
11 #define t_error(...) t_printf("ERROR " T_LOC1(__LINE__) ": " __VA_ARGS__)
13 static int t_printf(const char *s, ...)
21 n = vsnprintf(buf, sizeof buf, s, ap);
25 else if (n >= sizeof buf) {
32 return write(1, buf, n);
35 int t_vmfill(void **, size_t *, int);
39 void t_randseed(uint64_t s);
40 uint64_t t_randn(uint64_t n);
41 uint64_t t_randint(uint64_t a, uint64_t b);
42 void t_shuffle(uint64_t *p, size_t n);
43 void t_randrange(uint64_t *p, size_t n);
44 int t_choose(uint64_t n, size_t k, uint64_t *p);
46 char *t_pathrel(char *buf, size_t n, char *argv0, char *p);