writeonce/runtime/test/t.h
shoney.arickathil 631d277e0c feat(runtime): wovm VM core (Iteration 2)
- 16 tasks complete: arena, object model, borrow word, containers,
  RC + budgeted cycle collector, wob_build, validating loader,
  interpreter core (dual dispatch), object opcodes, drop-map unwinding,
  builtins + DB_STUB + TRAP, ICALL, wovm CLI + just recipes
- 13 test suites × 2 dispatch flavors (ASan+UBSan) + CLI smoke, all green
- .wob v1 format pinned in src/wob.h + docs/plan/oop-vm/00-wob-format.md
- wo-rt.c reference event-loop preserved for sub-project 2

This is Iteration 2 of the OOP milestone; compiler front (Iteration 3)
is in progress on this branch. They meet at Iteration 4 (emitter+e2e).
2026-08-10 09:35:55 +02:00

50 lines
2.6 KiB
C

/* t.h — tiny assert harness. No framework, per doctrine: counters + report. */
#ifndef WO_T_H
#define WO_T_H
#include <stdio.h>
#include <string.h>
static int t_pass, t_fail;
#define T_CHECK(cond) \
do { \
if (cond) { \
t_pass++; \
} else { \
t_fail++; \
fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); \
} \
} while (0)
#define T_EQ(got, want) \
do { \
long long g_ = (long long)(got), w_ = (long long)(want); \
if (g_ == w_) { \
t_pass++; \
} else { \
t_fail++; \
fprintf(stderr, "FAIL %s:%d: %s == %lld, want %lld\n", __FILE__, \
__LINE__, #got, g_, w_); \
} \
} while (0)
#define T_STREQ(got, want) \
do { \
const char *g_ = (got), *w_ = (want); \
if (g_ && w_ && strcmp(g_, w_) == 0) { \
t_pass++; \
} else { \
t_fail++; \
fprintf(stderr, "FAIL %s:%d: %s == \"%s\", want \"%s\"\n", \
__FILE__, __LINE__, #got, g_ ? g_ : "(null)", \
w_ ? w_ : "(null)"); \
} \
} while (0)
static int t_report(const char *name) {
fprintf(stderr, "%s: %d pass, %d fail\n", name, t_pass, t_fail);
return t_fail ? 1 : 0;
}
#endif /* WO_T_H */