summaryrefslogtreecommitdiff
path: root/src/kernel/tests/base.h
blob: 877b17925143642e53507062215ad8568269dad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#include <kernel/arch/log.h>
#include <kernel/util.h>
#include <stdbool.h>

extern bool _did_tests_fail;

// tests MUST be used
#pragma GCC diagnostic error "-Wunused-function"

#define TEST(name) \
	static void __test_##name()

#define TEST_RUN(name) \
	__test_##name();

#define TEST_IF(cond)                             \
	if (!(cond)) {                                \
		_did_tests_fail = true;                   \
		log_const("TEST_IF failed at "            \
		          __FILE__ ":" NUM2STR(__LINE__)  \
		                                    " "); \
	}