aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/assert.h17
-rw-r--r--include/testing.h10
-rw-r--r--include/types.h4
3 files changed, 21 insertions, 10 deletions
diff --git a/include/assert.h b/include/assert.h
index ad9c2fd..aa62bd1 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -3,12 +3,13 @@
#include <stdio.h>
#include <stdlib.h>
-#define assert(condition, ...) \
- do { \
- if (!(condition)) { \
- fprintf(stderr, "Assertion failed: %s:%d in %s(): ", __FILE__, __LINE__, __func__); \
- fprintf(stderr, __VA_ARGS__); \
- fprintf(stderr, "\n"); \
- abort(); \
- } \
+#define assert(condition, ...) \
+ do { \
+ if (!(condition)) { \
+ fprintf(stderr, "Assertion failed: %s:%d in %s(): ", __FILE__, \
+ __LINE__, __func__); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ abort(); \
+ } \
} while (0)
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 <stdio.h>
+#include <string.h>
#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; \
+ }
diff --git a/include/types.h b/include/types.h
index da3a093..6df9510 100644
--- a/include/types.h
+++ b/include/types.h
@@ -1,7 +1,7 @@
+#include <immintrin.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#include <immintrin.h>
typedef ptrdiff_t size;
typedef char byte;
@@ -9,7 +9,7 @@ typedef uintptr_t uptr;
typedef int32_t i32;
typedef uint64_t u64;
typedef float f32;
-typedef __m256i byte_32;
+typedef __m256i bytex32;
#define sizeof(x) (size)sizeof(x)
#define countof(a) (sizeof(a) / sizeof(*(a)))