From 5704de985cff1d40359ecd15211cece0fbe79067 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 15 Nov 2024 15:12:08 -0700 Subject: Add tests to libmisc --- libmisc/tests/test.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 libmisc/tests/test.h (limited to 'libmisc/tests/test.h') diff --git a/libmisc/tests/test.h b/libmisc/tests/test.h new file mode 100644 index 0000000..ea13d3c --- /dev/null +++ b/libmisc/tests/test.h @@ -0,0 +1,21 @@ +/* libmisc/tests/test.h - Common test utilities + * + * Copyright (C) 2024 Luke T. Shumaker + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +#ifndef _LIBMISC_TESTS_TEST_H_ +#define _LIBMISC_TESTS_TEST_H_ + +#include +#include /* for exit() */ + +#define test_assert(expr) do { \ + if (!(expr)) { \ + printf("test failure: %s:%d:%s: %s\n", \ + __FILE__, __LINE__, __func__, #expr); \ + exit(1); \ + } \ + } while (0) + +#endif /* _LIBMISC_TESTS_TEST_H_ */ -- cgit v1.2.3-2-g168b