From edd125d0e3fe5fe7c0edf30c429723f3b0120c68 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 17 May 2026 04:50:07 +0530 Subject: 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 --- tests/unit/test_framework.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/unit/test_framework.h') 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; } \ } while(0) +#define ASSERT_EQ_UINT64(expected, actual, msg) do { \ + unsigned long long _e = (unsigned long long)(expected), _a = (unsigned long long)(actual); \ + if (_e == _a) { \ + printf(" PASS: %s (got %llu)\n", msg, _a); \ + g_tests_passed++; \ + } else { \ + printf(" FAIL: %s (expected %llu, got %llu) at %s:%d\n", msg, _e, _a, __FILE__, __LINE__); \ + g_tests_failed++; \ + } \ +} while(0) + #define ASSERT_EQ_STR(expected, actual, msg) do { \ const char *_e = (expected), *_a = (actual); \ if (_e && _a && strcmp(_e, _a) == 0) { \ -- cgit v1.2.3