Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
types.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 Types for tests
27 *****************************************************************************/
28#ifndef CRITERION_TYPES_H_
29#define CRITERION_TYPES_H_
30
31#include "alloc.h"
32#ifdef __cplusplus
33# include <cstddef>
34# include <vector>
35using std::size_t;
36#else
37# include <stdbool.h>
38# include <stddef.h>
39#endif
40#include "internal/common.h"
41
42/**
43 * Enumerates the supported languages for tests
44 */
46 CR_LANG_C, /* !< C */
47 CR_LANG_CXX, /* !< C++ */
48 CR_LANG_OBJC, /* !< Objective-C */
49 CR_LANG_OBJCXX, /* !< Objective-C++ */
50
51 CR_LANG_SIZE_ /* leave this at the end */
52};
53
54/**
55 * Enumerates the supported kinds of tests
56 */
61
68
69/**
70 * Represents a set of parameters for a parameterized test.
71 */
73
74/**
75 * Contains all the options that can be set for a test, through
76 * the Test and TestSuite macros, or other means.
77 */
79 /* / @cond CRITERION_TEST_EXTRA_DATA_PRIVATE_API
80 Start of private API */
81 /*
82 * Warning: the fields below are not meant to be set manually.
83 * Setting them improperly *will* wreck havock in your tests.
84 *
85 * You've been warned.
86 */
87 int sentinel_;
88 enum criterion_compiler compiler_;
89 enum criterion_language lang_;
90 enum criterion_test_kind kind_;
91 struct criterion_test_params (*param_)(void);
92 const char *identifier_;
93 const char *file_;
94 unsigned line_;
95 /* Enf of private API
96 / @endcond */
97
98 /**
99 * The setup test fixture.
100 *
101 * This function, if provided, will be executed during the initialization
102 * of the test.
103 */
104 void (*init)(void);
105
106 /**
107 * The teardown test fixture.
108 *
109 * This function, if provided, will be executed during the finalization
110 * of the test.
111 */
112 void (*fini)(void);
113
114 /**
115 * The expected signal to be raised by the test.
116 *
117 * If the test does not raise the specified signal, then the test is
118 * marked as failed.
119 *
120 * A value of 0 means that is it not expected for the test to raise any
121 * signal.
122 */
124
125 /**
126 * The expected exit status to be returned by the test.
127 *
128 * By default, criterion exits the test process with a value of 0. If it
129 * is expected for the test to exit with a non-zero status, this option
130 * can be used.
131 */
133
134 /**
135 * If `true`, skips the test.
136 *
137 * The test will still appear in the test list, but will be marked as
138 * skipped and will not be executed.
139 */
141
142 /**
143 * The long description of a test.
144 *
145 * If a description is provided, it will be printed in test reports, and
146 * logged if the runner runs in verbose mode.
147 */
148 const char *description;
149
150 /**
151 * The timeout for the test, in seconds.
152 *
153 * If the realtime execution of a test takes longer than the specified
154 * value, then the test is immediately aborted and reported as timing out.
155 *
156 * A value of `0` is equivalent to `+INFINITY` and means that the test
157 * does not timeout.
158 *
159 * It is unspecified behaviour for the value of `timeout` to be negative
160 * or `NaN`.
161 */
162 double timeout;
163
164 /**
165 * Extra user data.
166 *
167 * This field is currently unused.
168 */
169 void *data;
170};
171
172/**
173 * Represents a test
174 */
176 const char *name;
177 const char *category;
178 void (*test)(void);
180};
181
182/**
183 * Represents a test suite
184 */
186 const char *name;
188};
189
191
196
201
202#endif /* !CRITERION_TYPES_H_ */
Test intern memory managment.
static const int sentinel_
decltype(sizeof(void *)) size_t
Definition doctest.h:524
struct criterion_suite suite
Definition types.h:193
struct criterion_ordered_set * tests
Definition types.h:194
struct criterion_test_extra_data * data
Definition types.h:187
const char * name
Definition types.h:186
void(* fini)(void)
Definition types.h:112
const char * description
Definition types.h:148
void(* init)(void)
Definition types.h:104
struct criterion_ordered_set * suites
Definition types.h:198
const char * name
Definition types.h:176
const char * category
Definition types.h:177
void(* test)(void)
Definition types.h:178
struct criterion_test_extra_data * data
Definition types.h:179
criterion_language
Definition types.h:45
@ CR_LANG_C
Definition types.h:46
@ CR_LANG_CXX
Definition types.h:47
@ CR_LANG_OBJC
Definition types.h:48
@ CR_LANG_OBJCXX
Definition types.h:49
@ CR_LANG_SIZE_
Definition types.h:51
criterion_compiler
Definition types.h:62
@ CR_COMP_UNKNOWN
Definition types.h:63
@ CR_COMP_CLANG
Definition types.h:65
@ CR_COMP_MSVC
Definition types.h:66
@ CR_COMP_GCC
Definition types.h:64
criterion_test_kind
Definition types.h:57
@ CR_TEST_NORMAL
Definition types.h:58
@ CR_TEST_PARAMETERIZED
Definition types.h:59