aboutsummaryrefslogtreecommitdiff
path: root/tests/test.h
blob: c5e2e738089c0f1f317458ebd0db1c4166f6b62f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include <stdio.h>

struct TestContext
{
	int checks;
	int failures;
};

#define check(context, condition) \
	do \
	{ \
		(context)->checks += 1; \
		if (!(condition)) \
		{ \
			(context)->failures += 1; \
			printf("  FAIL %s:%d: %s\n", __FILE__, __LINE__, #condition); \
		} \
	} \
	while (0)