mirror of
https://github.com/samsonjs/lake.git
synced 2026-03-25 08:55:49 +00:00
33 lines
No EOL
1.2 KiB
C
33 lines
No EOL
1.2 KiB
C
/**
|
|
* laketest.h
|
|
* Lake Scheme
|
|
*
|
|
* Copyright 2011 Sami Samhuri
|
|
* MIT License
|
|
*
|
|
* Based on MinUnit: http://www.jera.com/techinfo/jtns/jtn002.html
|
|
*
|
|
*/
|
|
|
|
#include "lake.h"
|
|
#include <stdio.h>
|
|
|
|
void restore_output(void);
|
|
|
|
#define lt_assert(message, test) \
|
|
do \
|
|
{ \
|
|
if (!(test)) \
|
|
{ \
|
|
restore_output(); \
|
|
fprintf(stderr, "%s:%d assertion failed: " #test "\n", __FILE__, \
|
|
__LINE__); \
|
|
return message; \
|
|
} \
|
|
} while (0)
|
|
|
|
typedef char *(*test_fn)(void);
|
|
|
|
/* Returns non-zero if all passed, or zero if any failed */
|
|
int lt_run_tests(char *title, test_fn *tests);
|
|
LakeVal *lt_eval(LakeCtx *lake, char *s); |