summaryrefslogtreecommitdiff
path: root/libcr_ipc/tests/test.h
blob: 4928d8d02e284b17e22f782aff4bdd9bcc0316fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* libcr_ipc/tests/test.h - Common test utilities
 *
 * Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#ifndef _LIBCR_IPC_TESTS_TEST_H_
#define _LIBCR_IPC_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 /* _LIBCR_IPC_TESTS_TEST_H_ */