From 37516080db6878bef6fb1e6c5542165f3f982792 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sat, 23 Aug 2025 22:07:34 +0200 Subject: code upgrade --- include/testing.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/testing.h') diff --git a/include/testing.h b/include/testing.h index 9e0c022..dc070d3 100644 --- a/include/testing.h +++ b/include/testing.h @@ -1,4 +1,6 @@ +#pragma once #include +#include #define t_assert(fact) \ if (!(fact)) { \ @@ -22,3 +24,11 @@ #a, b, #b, __FILE__, __LINE__, __func__); \ return 1; \ } + +#define t_assert_strequal(a, b) \ + if ((a.len != b.len) || (a.len && memcmp(a.data, b.data, a.len))) { \ + fprintf(stderr, \ + "Assertion failed: %.*s (%s) != %.*s (%s) at %s:%d in %s()\n", (i32)a.len, a.data, \ + #a, (i32)b.len, b.data, #b, __FILE__, __LINE__, __func__); \ + return 1; \ + } -- cgit v1.3