Lumiera
0.pre.03
»edit your freedom«
test.h
Go to the documentation of this file.
1
/*
2
TEST.h - support macros for plain-C tests
3
4
Copyright (C)
5
2008, 2010 Christian Thaeter <ct@pipapo.org>
6
7
**Lumiera** is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by the
9
Free Software Foundation; either version 2 of the License, or (at your
10
option) any later version. See the file COPYING for further details.
11
12
*/
13
24
#ifndef LIB_TEST_TEST_H
25
#define LIB_TEST_TEST_H
26
27
#include <stdio.h>
28
#include <stdlib.h>
29
#include <string.h>
30
#include <nobug.h>
31
32
33
34
#define TESTS_BEGIN \
35
int \
36
main (int argc, const char** argv) \
37
{ \
38
NOBUG_INIT; \
39
unsigned testcnt=0; \
40
int ret = 0; \
41
\
42
if (argc == 1) \
43
fprintf (stderr, "supported tests:\n");
44
45
#define TEST(name) \
46
if (argc == 1) \
47
fprintf (stderr, " "#name"\n"); \
48
else if (!strcmp(argv[1], #name) && ++testcnt)
49
50
#define PLANNED_TEST(name) \
51
if (argc == 1) \
52
fprintf (stderr, " "#name" (planned)\n"); \
53
else if (!++testcnt)
54
55
#define TESTS_END \
56
if (!testcnt && argc !=1) \
57
fprintf (stderr,"no such test: %s\n", argv[1]); \
58
return ret; \
59
}
60
61
62
#endif
63
64
/*
65
// Local Variables:
66
// mode: C
67
// c-file-style: "gnu"
68
// indent-tabs-mode: nil
69
// End:
70
*/
lib
test
test.h
Generated on Fri Dec 13 2024 05:05:35 for Lumiera by
1.8.13