Files
moloapp/tests/src/observability/test_helper.h
T
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

30 lines
1.1 KiB
C++

#pragma once
// Minimal test helper. Tests print FAIL lines per broken check and a PASS
// line with counts, and return nonzero when any check fails.
#include <cstdio>
struct TestCtx {
int checks = 0;
int failures = 0;
};
#define CHECK(ctx, cond) \
do { \
++(ctx).checks; \
if (!(cond)) { \
++(ctx).failures; \
std::printf("FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); \
} \
} while (0)
inline int test_summary(TestCtx& ctx, const char* name) {
if (ctx.failures == 0) {
std::printf("PASS %s (%d checks)\n", name, ctx.checks);
return 0;
}
std::printf("FAIL %s (%d of %d checks failed)\n", name, ctx.failures, ctx.checks);
return 1;
}