From 7bbd74cb1706478b276de29a48ee5fe34d6692cd Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 20 Feb 2023 14:40:47 +0100 Subject: [PATCH] Add common unit test macros --- test/unit/unittest.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/unit/unittest.h diff --git a/test/unit/unittest.h b/test/unit/unittest.h new file mode 100644 index 0000000..165cb64 --- /dev/null +++ b/test/unit/unittest.h @@ -0,0 +1,12 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#ifndef UNITTEST_H +#define UNITTEST_H + +#include "common.h" + +#define OK(x) do { if ((x) != 0) { die(#x " failed"); } } while (0) +#define ERR(x) do { if ((x) == 0) { die(#x " didn't fail"); } } while (0) + +#endif /* UNITTEST_H */