Apache2
httpdunit.h
Go to the documentation of this file.
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
2
* contributor license agreements. See the NOTICE file distributed with
3
* this work for additional information regarding copyright ownership.
4
* The ASF licenses this file to You under the Apache License, Version 2.0
5
* (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
/*
18
* httpdunit.h: a collection of test helper macros designed to reduce test
19
* boilerplate and help the build system autogenerate test case definitions.
20
*
21
* Here's how the magic works:
22
*
23
* Every test case under test/unit declares test functions using Check's
24
* START_TEST or the HTTPD_START_LOOP_TEST macro. The build system searches each
25
* source file for those macros and generates an appropriate stub, called
26
* test/unit/<filename>.tests, that will add each test function to the test
27
* case. This stub is then pulled in by three lines of boilerplate at the end of
28
* every test case's source file (see the HTTPD_BEGIN_TEST_CASE documentation,
29
* below).
30
*
31
* The build system uses that same three-line boilerplate to determine the names
32
* of all the test cases, and adds them automatically to the main test suite
33
* using a similar generate-stub-and-include process.
34
*/
35
36
#include "
apr.h
"
/* for pid_t on Windows, needed by Check */
37
38
#if defined(__GNUC__)
39
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
40
#pragma GCC diagnostic push
41
#endif
42
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
43
#elif defined(__clang__)
44
#pragma clang diagnostic push
45
#pragma clang diagnostic ignored "-Wstrict-prototypes"
46
#endif
47
48
#include "check.h"
49
50
#if defined(__GNUC__)
51
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
52
#pragma GCC diagnostic pop
53
#endif
54
#elif defined(__clang__)
55
#pragma clang diagnostic pop
56
#endif
57
58
/*
59
* Boilerplate Macros
60
*/
61
77
#define HTTPD_BEGIN_TEST_CASE(NAME) \
78
TCase * NAME##_test_case(void); \
79
TCase * NAME##_test_case(void) \
80
{ \
81
TCase *testcase = tcase_create(#NAME);
82
96
#define HTTPD_BEGIN_TEST_CASE_WITH_FIXTURE(NAME, SETUP, TEARDOWN) \
97
HTTPD_BEGIN_TEST_CASE(NAME) \
98
tcase_add_checked_fixture(testcase, (SETUP), (TEARDOWN));
99
104
#define HTTPD_END_TEST_CASE \
105
return testcase; \
106
}
107
108
/*
109
* Test Declaration Macros
110
*/
111
120
#define HTTPD_START_LOOP_TEST(NAME, NUM_ITERATIONS) START_TEST(NAME)
apr.h
APR Platform Definitions.
test
httpdunit.h
Generated by
1.9.1