/* libmisc/tests/test.h - Common test utilities
 *
 * Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#ifndef _LIBMISC_TESTS_TEST_H_
#define _LIBMISC_TESTS_TEST_H_

#include <stdio.h>
#include <stdlib.h> /* 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_ */