upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/unit/test_framework.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-17 04:50:07 +0530
committerYour Name <you@example.com>2026-05-17 04:50:07 +0530
commitedd125d0e3fe5fe7c0edf30c429723f3b0120c68 (patch)
tree5b1134ad7a6cfce7adeb46f5069e33b509ce9751 /tests/unit/test_framework.h
parentcb4bd7d7c10cadcb43f82c09b13ffed744e541f7 (diff)
feat(phase6): bytes-based billing - dual metric support
- session_create_bytes() + session_add_bytes() for bytes-metric sessions - session_is_expired() dispatches on config metric (bytes vs milliseconds) - cashu_calculate_allotment() unified dispatcher for both metrics - tollgate_api discovery/usage/session_event use configured metric - config: metric field defaults to 'bytes', step_size_bytes=22020096 (21MB) - 14 new unit tests (148 total passing) - ASSERT_EQ_UINT64 macro added to test framework
Diffstat (limited to 'tests/unit/test_framework.h')
-rw-r--r--tests/unit/test_framework.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_framework.h b/tests/unit/test_framework.h
index 6eb3a10..bdf93a3 100644
--- a/tests/unit/test_framework.h
+++ b/tests/unit/test_framework.h
@@ -29,6 +29,17 @@ static int g_tests_failed = 0;
29 } \ 29 } \
30} while(0) 30} while(0)
31 31
32#define ASSERT_EQ_UINT64(expected, actual, msg) do { \
33 unsigned long long _e = (unsigned long long)(expected), _a = (unsigned long long)(actual); \
34 if (_e == _a) { \
35 printf(" PASS: %s (got %llu)\n", msg, _a); \
36 g_tests_passed++; \
37 } else { \
38 printf(" FAIL: %s (expected %llu, got %llu) at %s:%d\n", msg, _e, _a, __FILE__, __LINE__); \
39 g_tests_failed++; \
40 } \
41} while(0)
42
32#define ASSERT_EQ_STR(expected, actual, msg) do { \ 43#define ASSERT_EQ_STR(expected, actual, msg) do { \
33 const char *_e = (expected), *_a = (actual); \ 44 const char *_e = (expected), *_a = (actual); \
34 if (_e && _a && strcmp(_e, _a) == 0) { \ 45 if (_e && _a && strcmp(_e, _a) == 0) { \