Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
parameterized.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright © 2015-2016 Franklin "Snaipe" Mathieu <http://snai.pe/>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24/**
25 * @file
26 * @brief Parameterized tests
27 *****************************************************************************/
28#ifndef CRITERION_PARAMETERIZED_H_
29#define CRITERION_PARAMETERIZED_H_
30
31#include "alloc.h"
32#include "assert.h"
33
34/**
35 * @defgroup ParameterizedBase Parameterized test & generator macros
36 * @{
37 */
38
39/**
40 * ParameterizedTest(Type *param, Suite, Name, [Options...]) { Function Body }
41 *
42 * Defines a new parameterized test.
43 *
44 * A parameterized test only takes one parameter -- to pass multiple parameters,
45 * use a structure type.
46 *
47 * @param Type The type of the parameter.
48 * @param Suite The name of the test suite containing this test.
49 * @param Name The name of the test.
50 * @param ... An optional sequence of designated initializer key/value
51 * pairs as described in the `criterion_test_extra_data` structure
52 * (see criterion/types.h).
53 * Example: `.exit_code = 1`
54 */
55#define ParameterizedTest(Type, Suite, Name, ...) internal
56
57/**
58 * Defines the parameter generator prototype for the associated parameterized
59 * test.
60 *
61 * @param Suite The name of the test suite containing the test.
62 * @param Test The name of the test.
63 * @returns A constructed instance of criterion::parameters, or the result of
64 * the cr_make_param_array macro.
65 */
66#define ParameterizedTestParameters(Suite, Name) internal
67
68/**
69 * Constructs a parameter list used as a return value for a parameter generator.
70 *
71 * This is only recommended for C sources. For C++, use `criterion::parameters`
72 * or `criterion_test_params`.
73 *
74 * @param Type The type of the array subscript.
75 * @param Array The array of parameters.
76 * @param Len The length of the array.
77 * @param Cleanup The optional cleanup function for the array.
78 * @returns The parameter list.
79 */
80#define cr_make_param_array(Type, Array, Len, Cleanup) internal
81
82/** @} */
83
84#ifdef __cplusplus
85# include <vector>
86
87namespace criterion
88{
89/**
90 * Represents a C++ dynamic parameter list for a parameter generator.
91 *
92 * @ingroup ParameterizedBase
93 *
94 * @param T The type of the parameter.
95 */
96template <typename T>
97using parameters = std::vector<T, criterion::allocator<T> >;
98}
99#endif
100
102
103#endif /* !CRITERION_PARAMETERIZED_H_ */
Test intern memory managment.
Assertion API.