File: tests.cc

package info (click to toggle)
cln 0.98-7.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 12,188 kB
  • ctags: 15,282
  • sloc: cpp: 71,545; ansic: 12,015; asm: 8,431; sh: 3,159; makefile: 886; lisp: 64
file content (35 lines) | stat: -rw-r--r-- 664 bytes parent folder | download
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
#include <stdlib.h>
#include <string.h>
#include <cl_io.h>

extern int test_I (int iterations);
extern int test_MI (int iterations);
extern int test_nt (int iterations);

int test_all (int iterations)
{
	int error = 0;
	error |= test_I(iterations);
	error |= test_MI(iterations);
	error |= test_nt(iterations);
	return error;
}

main (int argc, char* argv[])
{
	int iterations = 10000;
	if ((argc >= 3) && !strcmp(argv[1],"-i")) {
		iterations = atoi(argv[2]);
		argc -= 2; argv += 2;
	}
	if (argc < 1)
		exit(1);

	if (!test_all(iterations)) {
		fprint (cl_stdout, "Tests passed.\n");
		exit(0);
	} else {
		fprint (cl_stdout, "Tests failed.\n");
		exit(1);
	}
}