#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <zap/mem.h>
#include <zap/mth.h>
#define zaptest_log(_expr,_typ,_fmtspec) (fprintf(stderr,"(" #_expr "): " _fmtspec "\n\n",(_typ)(_expr)));
#define zaptest_chk(_lexpr,_rexpr,_typ,_fmtspec) { \
fprintf(stderr,"(" #_lexpr "): " _fmtspec "\n",(_typ)(_lexpr)); \
fprintf(stderr,"(" #_rexpr "): " _fmtspec "\n\n",(_typ)(_rexpr)); \
if ((_typ)(_lexpr) != (_typ)(_rexpr)) { \
fprintf(stderr,"Mismatch!\n"); \
return true; \
} \
}
typedef bool (* zaptest_testtyp)(void);
#include "test/abs.i"
#include "test/bool.i"
#include "test/cmp.i"
#include "test/memcnt.i"
#include "test/memcp.i"
#include "test/memeq.i"
#include "test/memfill.i"
#include "test/memfnd.i"
#include "test/memfor.i"
#include "test/memgen.i"
#include "test/nullptr.i"
#include "test/strcp.i"
#include "test/streq.i"
#include "test/strfill.i"
#include "test/strfnd.i"
#include "test/strlen.i"
#include "test/utf20len.i"
#include "test/utf8dec.i"
#include "test/utf8enc.i"
#include "test/win1252dec.i"
#include "test/win1252enc.i"
static zaptest_testtyp zaptest_tests[] = {
zaptest_test_abs,
zaptest_test_bool,
zaptest_test_cmp,
zaptest_test_memcnt,
zaptest_test_memcp,
zaptest_test_memeq,
zaptest_test_memfill,
zaptest_test_memfnd,
zaptest_test_memfor,
zaptest_test_memgen,
zaptest_test_nullptr,
zaptest_test_strcp,
zaptest_test_streq,
zaptest_test_strfill,
zaptest_test_strfnd,
zaptest_test_strlen,
zaptest_test_utf20len,
zaptest_test_utf8dec,
zaptest_test_utf8enc,
zaptest_test_win1252dec,
zaptest_test_win1252enc,
};
static char const * zaptest_testnms[] = {
"abs",
"add",
"bool",
"cmp",
"memcnt",
"memcp",
"memeq",
"memfill",
"memfnd",
"memfor",
"memgen",
"nullptr",
"strcp",
"streq",
"strfill",
"strfnd",
"strlen",
"utf20len",
"utf8dec",
"utf8enc",
"win1252dec",
"win1252enc",
};
static void zaptest_dotest(zap_sz const _n) {
fprintf(stderr,":: \x1B[94mTesting\x1B[0m %s...\n\n",zaptest_testnms[_n]);
if (zaptest_tests[_n]()) {
fprintf(stderr,":: \x1B[91mError\x1B[0m in %s! Aborting...\n\n",zaptest_testnms[_n]);
exit(EXIT_FAILURE);
}
fprintf(stderr,":: \x1B[92mSuccess\x1B[0m with %s!\n\n",zaptest_testnms[_n]);
}
int main(void) {
fprintf(stderr,"Zap Test\n\n");
fprintf(stderr,"Version: %lX\n",zap_ver);
fprintf(stderr,"\n");
zaptest_log(zap_nopos,zap_sz,"%zX")
zaptest_log((void *)zap_nullptr,uintptr_t,"%" PRIXPTR)
for (zap_sz n = 0x0u;n < sizeof (zaptest_tests) / sizeof (zaptest_tests[0x0u]);++n) {zaptest_dotest(n);}
}