1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-16 00:01:05 -08:00
emacs/mps/qa/test/testlib/testlib.h
Richard Tucker 0f52ec25fc New unit
test system hatched

Copied from Perforce
 Change: 18174
 ServerID: perforce.ravenbrook.com
1997-05-15 15:53:53 +01:00

70 lines
1.7 KiB
C

/* test_lib.h
various handy things for reporting errors &c
*/
#ifndef test_lib_h
#define test_lib_h
#include "mps.h"
#include "versind.h"
#include "platform.h"
/* Give textual description of mps error code */
const char *err_text(mps_res_t err);
/* pass, fail: write result=pass/fail to stdout and
exit (0 or 1 as appropriate)
*/
void pass(void);
void fail(void);
/* report: print variable and value to stdout
*/
void report(const char *str, const char *format, ...);
void vreport(const char *str, const char *format, va_list args);
/* adie: print text and err code to stderr by calling error
die: as above, but if err is MPS_RES_OK do nothing
cdie: print text and err code to stderr as comment, or as error
if err isn't MPS_RES_OK
*/
void cdie(mps_res_t err, const char *str);
void die(mps_res_t err, const char *str);
void adie(mps_res_t err, const char *str);
/* Prints text to stderr */
void comment(const char *format, ...);
void vcomment(const char *format, va_list args);
/* Prints text to stderr if cond is true */
void commentif(int cond, const char *format, ...);
/* Prints text to stderr and aborts */
void error(const char *format, ...);
void verror(const char *format, va_list args);
/* If exp is false, prints text to stderr and aborts */
void asserts(int expr, const char *format, ...);
/* Easy way of entering the trampoline, for when you don't
want to pass any information in or out. If you have a
function void foo(void), just go easy_tramp(foo).
*/
void easy_tramp(void (*f)(void));
/* Random number from 0 to x-1
*/
unsigned long ranint(unsigned long limit);
unsigned long ranrange(unsigned long min, unsigned long max);
#endif