aboutsummaryrefslogtreecommitdiff
blob: c782704ab46c22e0f42eff5151d1552a17def76e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "tests.h"

#ifndef CONFIG
# define CONFIG 1
#endif

int main(int argc, char *argv[])
{
#if CONFIG
	int i, test_ret;

	if ((argc - 1) % (ARG_CNT + 1) || argc == 1) {
		printf(
			"usage: " SFUNC " <tests>\n"
			"test: < <ret> " ARG_USE " >\n"
		);
		exit(1);
	}

	test_ret = 0;
	i = 1;
	while (i < argc) {
		char *s;

		s = argv[i++];
		int ret = atoi(s);

		process_args();

		int actual_ret = (int)FUNC(FUNC_IMP);
		printf("%s: " SFUNC "(" FUNC_STR ") = %i (wanted %i)\n",
			(actual_ret == ret) ? "PASS" : "FAIL",
			FUNC_IMP, actual_ret, ret);
		if (actual_ret != ret) ++test_ret;
	}

	return test_ret;
#else
	puts("not implemented");
	return 0;
#endif
}