summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-02-19 16:05:59 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-02-19 16:06:34 +0100
commitc58cc09cf50a18058efb59e1b4fb73ab1e3a45a2 (patch)
tree7674e6939fc30eb3b052686ea2ee95bde3580bca /include
parentd2556ebc3fbc59736863e53f5b2c35e72eb09ae8 (diff)
downloadouroboros-0.21.1.tar.gz
ouroboros-0.21.1.zip
lib: Fix CRC32 hashing0.21.1
I assumed that all hashes were stored in Big Endian, but apparently the CRC32 was still in machine endianness when calculated by the rhash implementation. Fixed and updated hash tests a bit. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/test.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/include/ouroboros/test.h b/include/ouroboros/test.h
index a88b5548..096e145c 100644
--- a/include/ouroboros/test.h
+++ b/include/ouroboros/test.h
@@ -29,22 +29,25 @@
#include <unistd.h>
#include <sys/wait.h>
-#define TEST_START() \
- do { \
- printf("%s started.\n", __func__); \
- fflush(stdout); \
- } while(0)
-#define TEST_SUCCESS() \
- do { \
- printf("%s succeeded.\n", __func__); \
- fflush(stdout); \
- } while(0)
+#define TEST_START() \
+ do { \
+ printf("%s started.\n", __func__); \
+ fflush(stdout); \
+ } while (0)
+#define TEST_SUCCESS() \
+ do { \
+ printf("%s succeeded.\n", __func__); \
+ fflush(stdout); \
+ } while (0)
-#define TEST_FAIL() \
- do { \
- printf("%s failed.\n", __func__); \
- fflush(stdout); \
- } while(0)
+#define TEST_FAIL() \
+ do { \
+ printf("%s failed.\n", __func__); \
+ fflush(stdout); \
+ } while (0)
+
+#define TEST_END(result) \
+ do { if (result == 0) TEST_SUCCESS(); else TEST_FAIL(); } while (0)
static int __attribute__((unused)) test_assert_fail(int(* testfunc)(void))
{