kolibrios-fun/programs/develop/ktcc/trunk/libctest/test.h

38 lines
830 B
C
Raw Normal View History

#include <stddef.h>
#include <stdlib.h>
#ifdef __GNUC__
#include <stdint.h>
#include <errno.h>
#include <limits.h>
#include <unistd.h>
#endif
/* TODO: not thread-safe nor fork-safe */
extern volatile int t_status;
#define T_LOC2(l) __FILE__ ":" #l
#define T_LOC1(l) T_LOC2(l)
#define t_error(...) t_printf(T_LOC1(__LINE__) ": " __VA_ARGS__)
int t_printf(const char *s, ...);
int t_vmfill(void **, size_t *, int);
int t_memfill(void);
void t_fdfill(void);
void t_randseed(uint64_t s);
uint64_t t_randn(uint64_t n);
uint64_t t_randint(uint64_t a, uint64_t b);
void t_shuffle(uint64_t *p, size_t n);
void t_randrange(uint64_t *p, size_t n);
int t_choose(uint64_t n, size_t k, uint64_t *p);
char *t_pathrel(char *buf, size_t n, char *argv0, char *p);
int t_setrlim(int r, long lim);
#include "print.inc"
#include "rand.inc"