1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2011 Tomas Gavenciak <gavento@ucw.cz> *
21 *****************************************************************************/
24 * Wrappers around check.h unit-test library
26 * Create a .test.c file with (example):
28 * GP_SUITE(suite_name)
32 * fail_unless(1 == 1);
33 * fail_if(1 < 0, "Impossible!");
35 * if (1 + 1 == i) fail("Arrgh, 1 + 1 is %d", i);
39 * The tests are collected automatically by find_tests.py.
40 * See below for more options.
44 #include "GP_TestingRandom.h"
47 * Helper macro to allow auto-generation of test-cases and suites.
48 * Searched for by find_tests.py.
50 * Use alone on a line as
53 * GP_TEST(testname, "foo=1, bar='baz'")
54 * The optional string is passed as parameters to Python dict() as parameters
55 * for the testcase-generator.
56 * Currently, the following parameters are recognized:
57 * suite -- name of the suite
58 * loop_start -- test will be repeated as with:
59 * loop_end for (int _i = loop_start; _i < loop_end; i++) { ... }
60 * expect_exit -- expect the function to exit with given exitcode
61 * expect_signal -- expect the function to exit with given exitcode
63 * Parameters name, fname, line are used internally, do not use them
66 #define GP_TEST(name, ...) static void name(int); void GP_TEST_##name(int i) {\
67 GP_InitTestingRandom( #name, i); name(i); } \
70 #define GP_ENDTEST END_TEST
73 * Helper macro to allow auto-generation of suites.
74 * Defines suite from this point until EOF or redefinition.
75 * Searched for by find_tests.py
77 * Use alone on a line as
81 #define GP_SUITE(name, ...)