Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
munit.h File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
Include dependency graph for munit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MunitParameterEnum
struct  MunitParameter
struct  MunitTest
struct  MunitSuite_
struct  MunitArgument_

Macros

#define MUNIT_VERSION(major, minor, revision)
#define MUNIT_CURRENT_VERSION   MUNIT_VERSION(0, 4, 1)
#define munit_int8_t   int8_t
#define munit_uint8_t   uint8_t
#define munit_int16_t   int16_t
#define munit_uint16_t   uint16_t
#define munit_int32_t   int32_t
#define munit_uint32_t   uint32_t
#define munit_int64_t   int64_t
#define munit_uint64_t   uint64_t
#define munit_bool   int
#define MUNIT_LIKELY(expr)
#define MUNIT_UNLIKELY(expr)
#define MUNIT_UNUSED
#define MUNIT_ARRAY_PARAM(name)
#define MUNIT_SIZE_MODIFIER   "z"
#define MUNIT_CHAR_MODIFIER   "hh"
#define MUNIT_SHORT_MODIFIER   "h"
#define MUNIT_NO_RETURN
#define MUNIT_PUSH_DISABLE_MSVC_C4127_
#define MUNIT_POP_DISABLE_MSVC_C4127_
#define MUNIT_PRINTF(string_index, first_to_check)
#define munit_logf(level, format, ...)
#define munit_log(level, msg)
#define munit_errorf(format, ...)
#define munit_error(msg)
#define munit_assert(expr)
#define munit_assert_true(expr)
#define munit_assert_false(expr)
#define munit_assert_type_full(prefix, suffix, T, fmt, a, op, b)
#define munit_assert_type(T, fmt, a, op, b)
#define munit_assert_char(a, op, b)
#define munit_assert_uchar(a, op, b)
#define munit_assert_short(a, op, b)
#define munit_assert_ushort(a, op, b)
#define munit_assert_int(a, op, b)
#define munit_assert_uint(a, op, b)
#define munit_assert_long(a, op, b)
#define munit_assert_ulong(a, op, b)
#define munit_assert_llong(a, op, b)
#define munit_assert_ullong(a, op, b)
#define munit_assert_size(a, op, b)
#define munit_assert_float(a, op, b)
#define munit_assert_double(a, op, b)
#define munit_assert_ptr(a, op, b)
#define munit_assert_int8(a, op, b)
#define munit_assert_uint8(a, op, b)
#define munit_assert_int16(a, op, b)
#define munit_assert_uint16(a, op, b)
#define munit_assert_int32(a, op, b)
#define munit_assert_uint32(a, op, b)
#define munit_assert_int64(a, op, b)
#define munit_assert_uint64(a, op, b)
#define munit_assert_double_equal(a, b, precision)
#define munit_assert_string_equal(a, b)
#define munit_assert_string_not_equal(a, b)
#define munit_assert_memory_equal(size, a, b)
#define munit_assert_memory_not_equal(size, a, b)
#define munit_assert_ptr_equal(a, b)
#define munit_assert_ptr_not_equal(a, b)
#define munit_assert_null(ptr)
#define munit_assert_not_null(ptr)
#define munit_assert_ptr_null(ptr)
#define munit_assert_ptr_not_null(ptr)
#define munit_malloc(size)
#define munit_new(type)
#define munit_calloc(nmemb, size)
#define munit_newa(type, nmemb)

Typedefs

typedef MunitResult(* MunitTestFunc) (const MunitParameter params[], void *user_data_or_fixture)
typedef void *(* MunitTestSetup) (const MunitParameter params[], void *user_data)
typedef void(* MunitTestTearDown) (void *fixture)
typedef struct MunitSuite_ MunitSuite
typedef struct MunitArgument_ MunitArgument

Enumerations

enum  MunitLogLevel { MUNIT_LOG_DEBUG , MUNIT_LOG_INFO , MUNIT_LOG_WARNING , MUNIT_LOG_ERROR }
enum  MunitResult { MUNIT_OK , MUNIT_FAIL , MUNIT_SKIP , MUNIT_ERROR }
enum  MunitTestOptions { MUNIT_TEST_OPTION_NONE = 0 , MUNIT_TEST_OPTION_SINGLE_ITERATION = 1 << 0 , MUNIT_TEST_OPTION_TODO = 1 << 1 }
enum  MunitSuiteOptions { MUNIT_SUITE_OPTION_NONE = 0 }

Functions

void munit_logf_ex (MunitLogLevel level, const char *filename, int line, const char *format,...)
MUNIT_NO_RETURN void munit_errorf_ex (const char *filename, int line, const char *format,...)
void * munit_malloc_ex (const char *filename, int line, size_t size)
void munit_rand_seed (munit_uint32_t seed)
munit_uint32_t munit_rand_uint32 (void)
int munit_rand_int_range (int min, int max)
double munit_rand_double (void)
void munit_rand_memory (size_t size, munit_uint8_t buffer[MUNIT_ARRAY_PARAM(size)])
const char * munit_parameters_get (const MunitParameter params[], const char *key)
int munit_suite_main (const MunitSuite *suite, void *user_data, int argc, char *const argv[MUNIT_ARRAY_PARAM(argc+1)])
int munit_suite_main_custom (const MunitSuite *suite, void *user_data, int argc, char *const argv[MUNIT_ARRAY_PARAM(argc+1)], const MunitArgument arguments[])

Macro Definition Documentation

◆ MUNIT_ARRAY_PARAM

#define MUNIT_ARRAY_PARAM ( name)

Definition at line 142 of file munit.h.

◆ munit_assert

#define munit_assert ( expr)
Value:
do { \
if (!MUNIT_LIKELY(expr)) { \
munit_error("assertion failed: " #expr); \
} \
} while (0) \
#define MUNIT_LIKELY(expr)
Definition munit.h:134
#define MUNIT_PUSH_DISABLE_MSVC_C4127_
Definition munit.h:173
#define MUNIT_POP_DISABLE_MSVC_C4127_
Definition munit.h:174

Definition at line 209 of file munit.h.

209#define munit_assert(expr) \
210 do { \
211 if (!MUNIT_LIKELY(expr)) { \
212 munit_error("assertion failed: " #expr); \
213 } \
214 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
215 } while (0) \
216 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_char

#define munit_assert_char ( a,
op,
b )
Value:
munit_assert_type_full("'\\x", "'", char, "02" MUNIT_CHAR_MODIFIER "x", a, op, b)
#define MUNIT_CHAR_MODIFIER
Definition munit.h:147
#define munit_assert_type_full(prefix, suffix, T, fmt, a, op, b)
Definition munit.h:236
f a
Definition to_model.m:12

Definition at line 251 of file munit.h.

251#define munit_assert_char(a, op, b) \
252 munit_assert_type_full("'\\x", "'", char, "02" MUNIT_CHAR_MODIFIER "x", a, op, b)

◆ munit_assert_double

#define munit_assert_double ( a,
op,
b )
Value:
munit_assert_type(double, "g", a, op, b)
#define munit_assert_type(T, fmt, a, op, b)
Definition munit.h:248

Definition at line 277 of file munit.h.

277#define munit_assert_double(a, op, b) \
278 munit_assert_type(double, "g", a, op, b)

◆ munit_assert_double_equal

#define munit_assert_double_equal ( a,
b,
precision )
Value:
do { \
const double munit_tmp_a_ = (a); \
const double munit_tmp_b_ = (b); \
const double munit_tmp_diff_ = ((munit_tmp_a_ - munit_tmp_b_) < 0) ? \
-(munit_tmp_a_ - munit_tmp_b_) : \
(munit_tmp_a_ - munit_tmp_b_); \
if (MUNIT_UNLIKELY(munit_tmp_diff_ > 1e-##precision)) { \
munit_errorf("assertion failed: %s == %s (%0." #precision "g == %0." #precision "g)", \
#a, #b, munit_tmp_a_, munit_tmp_b_); \
} \
} while (0) \
#define MUNIT_UNLIKELY(expr)
Definition munit.h:135

Definition at line 299 of file munit.h.

299#define munit_assert_double_equal(a, b, precision) \
300 do { \
301 const double munit_tmp_a_ = (a); \
302 const double munit_tmp_b_ = (b); \
303 const double munit_tmp_diff_ = ((munit_tmp_a_ - munit_tmp_b_) < 0) ? \
304 -(munit_tmp_a_ - munit_tmp_b_) : \
305 (munit_tmp_a_ - munit_tmp_b_); \
306 if (MUNIT_UNLIKELY(munit_tmp_diff_ > 1e-##precision)) { \
307 munit_errorf("assertion failed: %s == %s (%0." #precision "g == %0." #precision "g)", \
308 #a, #b, munit_tmp_a_, munit_tmp_b_); \
309 } \
310 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
311 } while (0) \
312 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_false

#define munit_assert_false ( expr)
Value:
do { \
if (!MUNIT_LIKELY(!(expr))) { \
munit_error("assertion failed: " #expr " is not false"); \
} \
} while (0) \

Definition at line 227 of file munit.h.

227#define munit_assert_false(expr) \
228 do { \
229 if (!MUNIT_LIKELY(!(expr))) { \
230 munit_error("assertion failed: " #expr " is not false"); \
231 } \
232 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
233 } while (0) \
234 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_float

#define munit_assert_float ( a,
op,
b )
Value:
munit_assert_type(float, "f", a, op, b)

Definition at line 275 of file munit.h.

275#define munit_assert_float(a, op, b) \
276 munit_assert_type(float, "f", a, op, b)

◆ munit_assert_int

#define munit_assert_int ( a,
op,
b )
Value:
munit_assert_type(int, "d", a, op, b)

Definition at line 259 of file munit.h.

259#define munit_assert_int(a, op, b) \
260 munit_assert_type(int, "d", a, op, b)

◆ munit_assert_int16

#define munit_assert_int16 ( a,
op,
b )
Value:
#define munit_int16_t
Definition munit.h:52

Definition at line 286 of file munit.h.

286#define munit_assert_int16(a, op, b) \
287 munit_assert_type(munit_int16_t, PRIi16, a, op, b)

◆ munit_assert_int32

#define munit_assert_int32 ( a,
op,
b )
Value:
#define munit_int32_t
Definition munit.h:54

Definition at line 290 of file munit.h.

290#define munit_assert_int32(a, op, b) \
291 munit_assert_type(munit_int32_t, PRIi32, a, op, b)

◆ munit_assert_int64

#define munit_assert_int64 ( a,
op,
b )
Value:
#define munit_int64_t
Definition munit.h:56

Definition at line 294 of file munit.h.

294#define munit_assert_int64(a, op, b) \
295 munit_assert_type(munit_int64_t, PRIi64, a, op, b)

◆ munit_assert_int8

#define munit_assert_int8 ( a,
op,
b )
Value:
#define munit_int8_t
Definition munit.h:50

Definition at line 282 of file munit.h.

282#define munit_assert_int8(a, op, b) \
283 munit_assert_type(munit_int8_t, PRIi8, a, op, b)

◆ munit_assert_llong

#define munit_assert_llong ( a,
op,
b )
Value:
munit_assert_type(long long int, "lld", a, op, b)

Definition at line 267 of file munit.h.

267#define munit_assert_llong(a, op, b) \
268 munit_assert_type(long long int, "lld", a, op, b)

◆ munit_assert_long

#define munit_assert_long ( a,
op,
b )
Value:
munit_assert_type(long int, "ld", a, op, b)

Definition at line 263 of file munit.h.

263#define munit_assert_long(a, op, b) \
264 munit_assert_type(long int, "ld", a, op, b)

◆ munit_assert_memory_equal

#define munit_assert_memory_equal ( size,
a,
b )
Value:
do { \
const unsigned char* munit_tmp_a_ = (const unsigned char*) (a); \
const unsigned char* munit_tmp_b_ = (const unsigned char*) (b); \
const size_t munit_tmp_size_ = (size); \
if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) != 0) { \
size_t munit_tmp_pos_; \
for (munit_tmp_pos_ = 0 ; munit_tmp_pos_ < munit_tmp_size_ ; munit_tmp_pos_++) { \
if (munit_tmp_a_[munit_tmp_pos_] != munit_tmp_b_[munit_tmp_pos_]) { \
munit_errorf("assertion failed: memory %s == %s, at offset %" MUNIT_SIZE_MODIFIER "u", \
#a, #b, munit_tmp_pos_); \
break; \
} \
} \
} \
} while (0) \
#define MUNIT_SIZE_MODIFIER
Definition munit.h:146

Definition at line 340 of file munit.h.

340#define munit_assert_memory_equal(size, a, b) \
341 do { \
342 const unsigned char* munit_tmp_a_ = (const unsigned char*) (a); \
343 const unsigned char* munit_tmp_b_ = (const unsigned char*) (b); \
344 const size_t munit_tmp_size_ = (size); \
345 if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) != 0) { \
346 size_t munit_tmp_pos_; \
347 for (munit_tmp_pos_ = 0 ; munit_tmp_pos_ < munit_tmp_size_ ; munit_tmp_pos_++) { \
348 if (munit_tmp_a_[munit_tmp_pos_] != munit_tmp_b_[munit_tmp_pos_]) { \
349 munit_errorf("assertion failed: memory %s == %s, at offset %" MUNIT_SIZE_MODIFIER "u", \
350 #a, #b, munit_tmp_pos_); \
351 break; \
352 } \
353 } \
354 } \
355 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
356 } while (0) \
357 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_memory_not_equal

#define munit_assert_memory_not_equal ( size,
a,
b )
Value:
do { \
const unsigned char* munit_tmp_a_ = (const unsigned char*) (a); \
const unsigned char* munit_tmp_b_ = (const unsigned char*) (b); \
const size_t munit_tmp_size_ = (size); \
if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) == 0) { \
munit_errorf("assertion failed: memory %s != %s (%zu bytes)", \
#a, #b, munit_tmp_size_); \
} \
} while (0) \

Definition at line 359 of file munit.h.

359#define munit_assert_memory_not_equal(size, a, b) \
360 do { \
361 const unsigned char* munit_tmp_a_ = (const unsigned char*) (a); \
362 const unsigned char* munit_tmp_b_ = (const unsigned char*) (b); \
363 const size_t munit_tmp_size_ = (size); \
364 if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) == 0) { \
365 munit_errorf("assertion failed: memory %s != %s (%zu bytes)", \
366 #a, #b, munit_tmp_size_); \
367 } \
368 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
369 } while (0) \
370 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_not_null

#define munit_assert_not_null ( ptr)
Value:
munit_assert_ptr(ptr, !=, NULL)
#define munit_assert_ptr(a, op, b)
Definition munit.h:279

Definition at line 378 of file munit.h.

378#define munit_assert_not_null(ptr) \
379 munit_assert_ptr(ptr, !=, NULL)

◆ munit_assert_null

#define munit_assert_null ( ptr)
Value:
munit_assert_ptr(ptr, ==, NULL)

Definition at line 376 of file munit.h.

376#define munit_assert_null(ptr) \
377 munit_assert_ptr(ptr, ==, NULL)

◆ munit_assert_ptr

#define munit_assert_ptr ( a,
op,
b )
Value:
munit_assert_type(const void*, "p", a, op, b)

Definition at line 279 of file munit.h.

279#define munit_assert_ptr(a, op, b) \
280 munit_assert_type(const void*, "p", a, op, b)

◆ munit_assert_ptr_equal

#define munit_assert_ptr_equal ( a,
b )
Value:

Definition at line 372 of file munit.h.

372#define munit_assert_ptr_equal(a, b) \
373 munit_assert_ptr(a, ==, b)

◆ munit_assert_ptr_not_equal

#define munit_assert_ptr_not_equal ( a,
b )
Value:

Definition at line 374 of file munit.h.

374#define munit_assert_ptr_not_equal(a, b) \
375 munit_assert_ptr(a, !=, b)

◆ munit_assert_ptr_not_null

#define munit_assert_ptr_not_null ( ptr)
Value:
munit_assert_ptr(ptr, !=, NULL)

Definition at line 382 of file munit.h.

382#define munit_assert_ptr_not_null(ptr) \
383 munit_assert_ptr(ptr, !=, NULL)

◆ munit_assert_ptr_null

#define munit_assert_ptr_null ( ptr)
Value:
munit_assert_ptr(ptr, ==, NULL)

Definition at line 380 of file munit.h.

380#define munit_assert_ptr_null(ptr) \
381 munit_assert_ptr(ptr, ==, NULL)

◆ munit_assert_short

#define munit_assert_short ( a,
op,
b )
Value:
#define MUNIT_SHORT_MODIFIER
Definition munit.h:148

Definition at line 255 of file munit.h.

255#define munit_assert_short(a, op, b) \
256 munit_assert_type(short, MUNIT_SHORT_MODIFIER "d", a, op, b)

◆ munit_assert_size

#define munit_assert_size ( a,
op,
b )
Value:

Definition at line 272 of file munit.h.

272#define munit_assert_size(a, op, b) \
273 munit_assert_type(size_t, MUNIT_SIZE_MODIFIER "u", a, op, b)

◆ munit_assert_string_equal

#define munit_assert_string_equal ( a,
b )
Value:
do { \
const char* munit_tmp_a_ = a; \
const char* munit_tmp_b_ = b; \
if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) != 0)) { \
munit_errorf("assertion failed: string %s == %s (\"%s\" == \"%s\")", \
#a, #b, munit_tmp_a_, munit_tmp_b_); \
} \
} while (0) \

Definition at line 316 of file munit.h.

316#define munit_assert_string_equal(a, b) \
317 do { \
318 const char* munit_tmp_a_ = a; \
319 const char* munit_tmp_b_ = b; \
320 if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) != 0)) { \
321 munit_errorf("assertion failed: string %s == %s (\"%s\" == \"%s\")", \
322 #a, #b, munit_tmp_a_, munit_tmp_b_); \
323 } \
324 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
325 } while (0) \
326 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_string_not_equal

#define munit_assert_string_not_equal ( a,
b )
Value:
do { \
const char* munit_tmp_a_ = a; \
const char* munit_tmp_b_ = b; \
if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) == 0)) { \
munit_errorf("assertion failed: string %s != %s (\"%s\" == \"%s\")", \
#a, #b, munit_tmp_a_, munit_tmp_b_); \
} \
} while (0) \

Definition at line 328 of file munit.h.

328#define munit_assert_string_not_equal(a, b) \
329 do { \
330 const char* munit_tmp_a_ = a; \
331 const char* munit_tmp_b_ = b; \
332 if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) == 0)) { \
333 munit_errorf("assertion failed: string %s != %s (\"%s\" == \"%s\")", \
334 #a, #b, munit_tmp_a_, munit_tmp_b_); \
335 } \
336 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
337 } while (0) \
338 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_true

#define munit_assert_true ( expr)
Value:
do { \
if (!MUNIT_LIKELY(expr)) { \
munit_error("assertion failed: " #expr " is not true"); \
} \
} while (0) \

Definition at line 218 of file munit.h.

218#define munit_assert_true(expr) \
219 do { \
220 if (!MUNIT_LIKELY(expr)) { \
221 munit_error("assertion failed: " #expr " is not true"); \
222 } \
223 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
224 } while (0) \
225 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_type

#define munit_assert_type ( T,
fmt,
a,
op,
b )
Value:
munit_assert_type_full("", "", T, fmt, a, op, b)

Definition at line 248 of file munit.h.

248#define munit_assert_type(T, fmt, a, op, b) \
249 munit_assert_type_full("", "", T, fmt, a, op, b)

◆ munit_assert_type_full

#define munit_assert_type_full ( prefix,
suffix,
T,
fmt,
a,
op,
b )
Value:
do { \
T munit_tmp_a_ = (a); \
T munit_tmp_b_ = (b); \
if (!(munit_tmp_a_ op munit_tmp_b_)) { \
munit_errorf("assertion failed: %s %s %s (" prefix "%" fmt suffix " %s " prefix "%" fmt suffix ")", \
#a, #op, #b, munit_tmp_a_, #op, munit_tmp_b_); \
} \
} while (0) \

Definition at line 236 of file munit.h.

236#define munit_assert_type_full(prefix, suffix, T, fmt, a, op, b) \
237 do { \
238 T munit_tmp_a_ = (a); \
239 T munit_tmp_b_ = (b); \
240 if (!(munit_tmp_a_ op munit_tmp_b_)) { \
241 munit_errorf("assertion failed: %s %s %s (" prefix "%" fmt suffix " %s " prefix "%" fmt suffix ")", \
242 #a, #op, #b, munit_tmp_a_, #op, munit_tmp_b_); \
243 } \
244 MUNIT_PUSH_DISABLE_MSVC_C4127_ \
245 } while (0) \
246 MUNIT_POP_DISABLE_MSVC_C4127_

◆ munit_assert_uchar

#define munit_assert_uchar ( a,
op,
b )
Value:
munit_assert_type_full("'\\x", "'", unsigned char, "02" MUNIT_CHAR_MODIFIER "x", a, op, b)

Definition at line 253 of file munit.h.

253#define munit_assert_uchar(a, op, b) \
254 munit_assert_type_full("'\\x", "'", unsigned char, "02" MUNIT_CHAR_MODIFIER "x", a, op, b)

◆ munit_assert_uint

#define munit_assert_uint ( a,
op,
b )
Value:
munit_assert_type(unsigned int, "u", a, op, b)

Definition at line 261 of file munit.h.

261#define munit_assert_uint(a, op, b) \
262 munit_assert_type(unsigned int, "u", a, op, b)

◆ munit_assert_uint16

#define munit_assert_uint16 ( a,
op,
b )
Value:
#define munit_uint16_t
Definition munit.h:53

Definition at line 288 of file munit.h.

288#define munit_assert_uint16(a, op, b) \
289 munit_assert_type(munit_uint16_t, PRIu16, a, op, b)

◆ munit_assert_uint32

#define munit_assert_uint32 ( a,
op,
b )
Value:
#define munit_uint32_t
Definition munit.h:55

Definition at line 292 of file munit.h.

292#define munit_assert_uint32(a, op, b) \
293 munit_assert_type(munit_uint32_t, PRIu32, a, op, b)

◆ munit_assert_uint64

#define munit_assert_uint64 ( a,
op,
b )
Value:
#define munit_uint64_t
Definition munit.h:57

Definition at line 296 of file munit.h.

296#define munit_assert_uint64(a, op, b) \
297 munit_assert_type(munit_uint64_t, PRIu64, a, op, b)

◆ munit_assert_uint8

#define munit_assert_uint8 ( a,
op,
b )
Value:
#define munit_uint8_t
Definition munit.h:51

Definition at line 284 of file munit.h.

284#define munit_assert_uint8(a, op, b) \
285 munit_assert_type(munit_uint8_t, PRIu8, a, op, b)

◆ munit_assert_ullong

#define munit_assert_ullong ( a,
op,
b )
Value:
munit_assert_type(unsigned long long int, "llu", a, op, b)

Definition at line 269 of file munit.h.

269#define munit_assert_ullong(a, op, b) \
270 munit_assert_type(unsigned long long int, "llu", a, op, b)

◆ munit_assert_ulong

#define munit_assert_ulong ( a,
op,
b )
Value:
munit_assert_type(unsigned long int, "lu", a, op, b)

Definition at line 265 of file munit.h.

265#define munit_assert_ulong(a, op, b) \
266 munit_assert_type(unsigned long int, "lu", a, op, b)

◆ munit_assert_ushort

#define munit_assert_ushort ( a,
op,
b )
Value:
munit_assert_type(unsigned short, MUNIT_SHORT_MODIFIER "u", a, op, b)

Definition at line 257 of file munit.h.

257#define munit_assert_ushort(a, op, b) \
258 munit_assert_type(unsigned short, MUNIT_SHORT_MODIFIER "u", a, op, b)

◆ munit_bool

#define munit_bool   int

Definition at line 121 of file munit.h.

◆ munit_calloc

#define munit_calloc ( nmemb,
size )
Value:
munit_malloc((nmemb) * (size))
#define munit_malloc(size)
Definition munit.h:389

Definition at line 395 of file munit.h.

395#define munit_calloc(nmemb, size) \
396 munit_malloc((nmemb) * (size))

◆ MUNIT_CHAR_MODIFIER

#define MUNIT_CHAR_MODIFIER   "hh"

Definition at line 147 of file munit.h.

◆ MUNIT_CURRENT_VERSION

#define MUNIT_CURRENT_VERSION   MUNIT_VERSION(0, 4, 1)

Definition at line 35 of file munit.h.

◆ munit_error

#define munit_error ( msg)
Value:
munit_errorf("%s", msg)
#define munit_errorf(format,...)
Definition munit.h:203

Definition at line 206 of file munit.h.

206#define munit_error(msg) \
207 munit_errorf("%s", msg)

◆ munit_errorf

#define munit_errorf ( format,
... )
Value:
munit_errorf_ex(__FILE__, __LINE__, format, __VA_ARGS__)
void munit_errorf_ex(const char *filename, int line, const char *format,...)
Definition munit.c:238

Definition at line 203 of file munit.h.

203#define munit_errorf(format, ...) \
204 munit_errorf_ex(__FILE__, __LINE__, format, __VA_ARGS__)

◆ munit_int16_t

#define munit_int16_t   int16_t

Definition at line 52 of file munit.h.

◆ munit_int32_t

#define munit_int32_t   int32_t

Definition at line 54 of file munit.h.

◆ munit_int64_t

#define munit_int64_t   int64_t

Definition at line 56 of file munit.h.

◆ munit_int8_t

#define munit_int8_t   int8_t

Definition at line 50 of file munit.h.

◆ MUNIT_LIKELY

#define MUNIT_LIKELY ( expr)
Value:
(expr)

Definition at line 134 of file munit.h.

◆ munit_log

#define munit_log ( level,
msg )
Value:
munit_logf(level, "%s", msg)
#define munit_logf(level, format,...)
Definition munit.h:193

Definition at line 196 of file munit.h.

196#define munit_log(level, msg) \
197 munit_logf(level, "%s", msg)

◆ munit_logf

#define munit_logf ( level,
format,
... )
Value:
munit_logf_ex(level, __FILE__, __LINE__, format, __VA_ARGS__)
void munit_logf_ex(MunitLogLevel level, const char *filename, int line, const char *format,...)
Definition munit.c:221

Definition at line 193 of file munit.h.

193#define munit_logf(level, format, ...) \
194 munit_logf_ex(level, __FILE__, __LINE__, format, __VA_ARGS__)

◆ munit_malloc

#define munit_malloc ( size)
Value:
munit_malloc_ex(__FILE__, __LINE__, (size))
void * munit_malloc_ex(const char *filename, int line, size_t size)
Definition munit.c:281

Definition at line 389 of file munit.h.

389#define munit_malloc(size) \
390 munit_malloc_ex(__FILE__, __LINE__, (size))

◆ munit_new

#define munit_new ( type)
Value:
((type*) munit_malloc(sizeof(type)))

Definition at line 392 of file munit.h.

392#define munit_new(type) \
393 ((type*) munit_malloc(sizeof(type)))

◆ munit_newa

#define munit_newa ( type,
nmemb )
Value:
((type*) munit_calloc((nmemb), sizeof(type)))
#define munit_calloc(nmemb, size)
Definition munit.h:395

Definition at line 398 of file munit.h.

398#define munit_newa(type, nmemb) \
399 ((type*) munit_calloc((nmemb), sizeof(type)))

◆ MUNIT_NO_RETURN

#define MUNIT_NO_RETURN

Definition at line 166 of file munit.h.

◆ MUNIT_POP_DISABLE_MSVC_C4127_

#define MUNIT_POP_DISABLE_MSVC_C4127_

Definition at line 174 of file munit.h.

◆ MUNIT_PRINTF

#define MUNIT_PRINTF ( string_index,
first_to_check )

Definition at line 187 of file munit.h.

◆ MUNIT_PUSH_DISABLE_MSVC_C4127_

#define MUNIT_PUSH_DISABLE_MSVC_C4127_

Definition at line 173 of file munit.h.

◆ MUNIT_SHORT_MODIFIER

#define MUNIT_SHORT_MODIFIER   "h"

Definition at line 148 of file munit.h.

◆ MUNIT_SIZE_MODIFIER

#define MUNIT_SIZE_MODIFIER   "z"

Definition at line 146 of file munit.h.

Referenced by munit_malloc_ex().

◆ munit_uint16_t

#define munit_uint16_t   uint16_t

Definition at line 53 of file munit.h.

◆ munit_uint32_t

#define munit_uint32_t   uint32_t

◆ munit_uint64_t

#define munit_uint64_t   uint64_t

Definition at line 57 of file munit.h.

Referenced by munit_rand_int_range().

◆ munit_uint8_t

#define munit_uint8_t   uint8_t

Definition at line 51 of file munit.h.

Referenced by munit_rand_memory().

◆ MUNIT_UNLIKELY

#define MUNIT_UNLIKELY ( expr)
Value:
(expr)

Definition at line 135 of file munit.h.

Referenced by munit_malloc_ex().

◆ MUNIT_UNUSED

#define MUNIT_UNUSED

Definition at line 136 of file munit.h.

◆ MUNIT_VERSION

#define MUNIT_VERSION ( major,
minor,
revision )
Value:
(((major) << 16) | ((minor) << 8) | (revision))

Definition at line 32 of file munit.h.

32#define MUNIT_VERSION(major, minor, revision) \
33 (((major) << 16) | ((minor) << 8) | (revision))

Typedef Documentation

◆ MunitArgument

typedef struct MunitArgument_ MunitArgument

Definition at line 480 of file munit.h.

◆ MunitSuite

typedef struct MunitSuite_ MunitSuite

Definition at line 465 of file munit.h.

◆ MunitTestFunc

typedef MunitResult(* MunitTestFunc) (const MunitParameter params[], void *user_data_or_fixture)

Definition at line 446 of file munit.h.

◆ MunitTestSetup

typedef void *(* MunitTestSetup) (const MunitParameter params[], void *user_data)

Definition at line 448 of file munit.h.

◆ MunitTestTearDown

typedef void(* MunitTestTearDown) (void *fixture)

Definition at line 450 of file munit.h.

Enumeration Type Documentation

◆ MunitLogLevel

Enumerator
MUNIT_LOG_DEBUG 
MUNIT_LOG_INFO 
MUNIT_LOG_WARNING 
MUNIT_LOG_ERROR 

Definition at line 177 of file munit.h.

177 {
MunitLogLevel
Definition munit.h:177
@ MUNIT_LOG_ERROR
Definition munit.h:181
@ MUNIT_LOG_WARNING
Definition munit.h:180
@ MUNIT_LOG_DEBUG
Definition munit.h:178
@ MUNIT_LOG_INFO
Definition munit.h:179

◆ MunitResult

Enumerator
MUNIT_OK 
MUNIT_FAIL 
MUNIT_SKIP 
MUNIT_ERROR 

Definition at line 415 of file munit.h.

415 {
416 /* Test successful */
417 MUNIT_OK,
418 /* Test failed */
420 /* Test was skipped */
422 /* Test failed due to circumstances not intended to be tested
423 * (things like network errors, invalid parameter value, failure to
424 * allocate memory in the test harness, etc.). */
MunitResult
Definition munit.h:415
@ MUNIT_SKIP
Definition munit.h:421
@ MUNIT_FAIL
Definition munit.h:419
@ MUNIT_OK
Definition munit.h:417
@ MUNIT_ERROR
Definition munit.h:425

◆ MunitSuiteOptions

Enumerator
MUNIT_SUITE_OPTION_NONE 

Definition at line 461 of file munit.h.

461 {
MunitSuiteOptions
Definition munit.h:461
@ MUNIT_SUITE_OPTION_NONE
Definition munit.h:462

◆ MunitTestOptions

Enumerator
MUNIT_TEST_OPTION_NONE 
MUNIT_TEST_OPTION_SINGLE_ITERATION 
MUNIT_TEST_OPTION_TODO 

Definition at line 440 of file munit.h.

440 {
MunitTestOptions
Definition munit.h:440
@ MUNIT_TEST_OPTION_TODO
Definition munit.h:443
@ MUNIT_TEST_OPTION_SINGLE_ITERATION
Definition munit.h:442
@ MUNIT_TEST_OPTION_NONE
Definition munit.h:441

Function Documentation

◆ munit_errorf_ex()

MUNIT_NO_RETURN void munit_errorf_ex ( const char * filename,
int line,
const char * format,
... )

Definition at line 238 of file munit.c.

238 {
239 va_list ap;
240
241 va_start(ap, format);
242 munit_logf_exv(MUNIT_LOG_ERROR, stderr, filename, line, format, ap);
243 va_end(ap);
244
245#if defined(MUNIT_THREAD_LOCAL)
246 if (munit_error_jmp_buf_valid)
247 longjmp(munit_error_jmp_buf, 1);
248#endif
249 abort();
250}

References MUNIT_LOG_ERROR.

◆ munit_logf_ex()

void munit_logf_ex ( MunitLogLevel level,
const char * filename,
int line,
const char * format,
... )

Definition at line 221 of file munit.c.

221 {
222 va_list ap;
223
224 va_start(ap, format);
225 munit_logf_exv(level, stderr, filename, line, format, ap);
226 va_end(ap);
227
228 if (level >= munit_log_level_fatal) {
229#if defined(MUNIT_THREAD_LOCAL)
230 if (munit_error_jmp_buf_valid)
231 longjmp(munit_error_jmp_buf, 1);
232#endif
233 abort();
234 }
235}

Referenced by munit_malloc_ex().

Here is the caller graph for this function:

◆ munit_malloc_ex()

void * munit_malloc_ex ( const char * filename,
int line,
size_t size )

Definition at line 281 of file munit.c.

281 {
282 void *ptr;
283
284 if (size == 0)
285 return NULL;
286
287 ptr = calloc(1, size);
288 if (MUNIT_UNLIKELY(ptr == NULL)) {
289 munit_logf_ex(MUNIT_LOG_ERROR, filename, line, "Failed to allocate %" MUNIT_SIZE_MODIFIER "u bytes.", size);
290 }
291
292 return ptr;
293}

References MUNIT_LOG_ERROR, munit_logf_ex(), MUNIT_SIZE_MODIFIER, and MUNIT_UNLIKELY.

Here is the call graph for this function:

◆ munit_parameters_get()

const char * munit_parameters_get ( const MunitParameter params[],
const char * key )

Definition at line 1075 of file munit.c.

1075 {
1076 const MunitParameter *param;
1077
1078 for (param = params; param != NULL && param->name != NULL; param++)
1079 if (strcmp(param->name, key) == 0)
1080 return param->value;
1081 return NULL;
1082}
char * value
Definition munit.h:435
char * name
Definition munit.h:434

References MunitParameter::name, and MunitParameter::value.

◆ munit_rand_double()

double munit_rand_double ( void )

Definition at line 1028 of file munit.c.

1028 {
1029 munit_uint32_t old, state;
1030 double retval = 0.0;
1031
1032 do {
1033 state = old = munit_atomic_load(&munit_rand_state);
1034
1035 /* See http://mumble.net/~campbell/tmp/random_real.c for how to do
1036 * this right. Patches welcome if you feel that this is too
1037 * biased. */
1038 retval = munit_rand_state_uint32(&state) / ((~((munit_uint32_t) 0U)) + 1.0);
1039 } while (!munit_atomic_cas(&munit_rand_state, &old, state));
1040
1041 return retval;
1042}
#define munit_atomic_load(src)
Definition munit.c:885

References munit_atomic_load, and munit_uint32_t.

◆ munit_rand_int_range()

int munit_rand_int_range ( int min,
int max )

Definition at line 1015 of file munit.c.

1015 {
1016 munit_uint64_t range = (munit_uint64_t) max - (munit_uint64_t) min;
1017
1018 if (min > max)
1019 return munit_rand_int_range(max, min);
1020
1021 if (range > (~((munit_uint32_t) 0U)))
1022 range = (~((munit_uint32_t) 0U));
1023
1024 return min + munit_rand_at_most(0, (munit_uint32_t) range);
1025}
int munit_rand_int_range(int min, int max)
Definition munit.c:1015

References munit_rand_int_range(), munit_uint32_t, and munit_uint64_t.

Referenced by munit_rand_int_range().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ munit_rand_memory()

void munit_rand_memory ( size_t size,
munit_uint8_t buffer[MUNIT_ARRAY_PARAM(size)] )

Definition at line 971 of file munit.c.

971 {
972 munit_uint32_t old, state;
973
974 do {
975 state = old = munit_atomic_load(&munit_rand_state);
976 munit_rand_state_memory(&state, size, data);
977 } while (!munit_atomic_cas(&munit_rand_state, &old, state));
978}

References munit_atomic_load, munit_uint32_t, and munit_uint8_t.

◆ munit_rand_seed()

void munit_rand_seed ( munit_uint32_t seed)

Definition at line 913 of file munit.c.

913 {
914 munit_uint32_t state = munit_rand_next_state(seed + MUNIT_PRNG_INCREMENT);
915 munit_atomic_store(&munit_rand_state, state);
916}
#define MUNIT_PRNG_INCREMENT
Definition munit.c:898
#define munit_atomic_store(dest, value)
Definition munit.c:884

References munit_atomic_store, MUNIT_PRNG_INCREMENT, and munit_uint32_t.

◆ munit_rand_uint32()

munit_uint32_t munit_rand_uint32 ( void )

Definition at line 942 of file munit.c.

942 {
943 munit_uint32_t old, state;
944
945 do {
946 old = munit_atomic_load(&munit_rand_state);
947 state = munit_rand_next_state(old);
948 } while (!munit_atomic_cas(&munit_rand_state, &old, state));
949
950 return munit_rand_from_state(old);
951}

References munit_atomic_load, and munit_uint32_t.

◆ munit_suite_main()

int munit_suite_main ( const MunitSuite * suite,
void * user_data,
int argc,
char *const argv[MUNIT_ARRAY_PARAM(argc+1)] )

Definition at line 2094 of file munit.c.

2095 {
2096 return munit_suite_main_custom(suite, user_data, argc, argv, NULL);
2097}
int munit_suite_main_custom(const MunitSuite *suite, void *user_data, int argc, char *const argv[MUNIT_ARRAY_PARAM(argc+1)], const MunitArgument arguments[])
Definition munit.c:1867

References munit_suite_main_custom().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ munit_suite_main_custom()

int munit_suite_main_custom ( const MunitSuite * suite,
void * user_data,
int argc,
char *const argv[MUNIT_ARRAY_PARAM(argc+1)],
const MunitArgument arguments[] )

Definition at line 1867 of file munit.c.

1869 {
1870 int result = EXIT_FAILURE;
1871 MunitTestRunner runner;
1872 size_t parameters_size = 0;
1873 size_t tests_size = 0;
1874 int arg;
1875
1876 char *envptr;
1877 unsigned long ts;
1878 char *endptr;
1879 unsigned long long iterations;
1880 MunitLogLevel level;
1881 const MunitArgument *argument;
1882 const char **runner_tests;
1883 unsigned int tests_run;
1884 unsigned int tests_total;
1885
1886 runner.prefix = NULL;
1887 runner.suite = NULL;
1888 runner.current_suite = NULL;
1889 runner.tests = NULL;
1890 runner.seed = 0;
1891 runner.iterations = 0;
1892 runner.parameters = NULL;
1893 runner.single_parameter_mode = 0;
1894 runner.user_data = NULL;
1895
1896 runner.report.successful = 0;
1897 runner.report.skipped = 0;
1898 runner.report.failed = 0;
1899 runner.report.errored = 0;
1900#if defined(MUNIT_ENABLE_TIMING)
1901 runner.report.cpu_clock = 0;
1902 runner.report.wall_clock = 0;
1903#endif
1904
1905 runner.colorize = 0;
1906#if !defined(_WIN32)
1907 runner.fork = 1;
1908#else
1909 runner.fork = 0;
1910#endif
1911 runner.show_stderr = 0;
1912 runner.fatal_failures = 0;
1913 runner.suite = suite;
1914 runner.user_data = user_data;
1915 runner.seed = munit_rand_generate_seed();
1916 runner.colorize = munit_stream_supports_ansi(MUNIT_OUTPUT_FILE);
1917
1918 for (arg = 1; arg < argc; arg++) {
1919 if (strncmp("--", argv[arg], 2) == 0) {
1920 if (strcmp("seed", argv[arg] + 2) == 0) {
1921 if (arg + 1 >= argc) {
1922 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "%s requires an argument", argv[arg]);
1923 goto cleanup;
1924 }
1925
1926 envptr = argv[arg + 1];
1927 ts = strtoul(argv[arg + 1], &envptr, 0);
1928 if (*envptr != '\0' || ts > (~((munit_uint32_t) 0U))) {
1929 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "invalid value ('%s') passed to %s", argv[arg + 1],
1930 argv[arg]);
1931 goto cleanup;
1932 }
1933 runner.seed = (munit_uint32_t) ts;
1934
1935 arg++;
1936 } else if (strcmp("iterations", argv[arg] + 2) == 0) {
1937 if (arg + 1 >= argc) {
1938 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "%s requires an argument", argv[arg]);
1939 goto cleanup;
1940 }
1941
1942 endptr = argv[arg + 1];
1943 iterations = strtoul(argv[arg + 1], &endptr, 0);
1944 if (*endptr != '\0' || iterations > UINT_MAX) {
1945 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "invalid value ('%s') passed to %s", argv[arg + 1],
1946 argv[arg]);
1947 goto cleanup;
1948 }
1949
1950 runner.iterations = (unsigned int) iterations;
1951
1952 arg++;
1953 } else if (strcmp("param", argv[arg] + 2) == 0) {
1954 if (arg + 2 >= argc) {
1955 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "%s requires two arguments", argv[arg]);
1956 goto cleanup;
1957 }
1958
1959 runner.parameters = realloc(runner.parameters, sizeof(MunitParameter) * (parameters_size + 2));
1960 if (runner.parameters == NULL) {
1961 munit_log_internal(MUNIT_LOG_ERROR, stderr, "failed to allocate memory");
1962 goto cleanup;
1963 }
1964 runner.parameters[parameters_size].name = (char *) argv[arg + 1];
1965 runner.parameters[parameters_size].value = (char *) argv[arg + 2];
1966 parameters_size++;
1967 runner.parameters[parameters_size].name = NULL;
1968 runner.parameters[parameters_size].value = NULL;
1969 arg += 2;
1970 } else if (strcmp("color", argv[arg] + 2) == 0) {
1971 if (arg + 1 >= argc) {
1972 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "%s requires an argument", argv[arg]);
1973 goto cleanup;
1974 }
1975
1976 if (strcmp(argv[arg + 1], "always") == 0)
1977 runner.colorize = 1;
1978 else if (strcmp(argv[arg + 1], "never") == 0)
1979 runner.colorize = 0;
1980 else if (strcmp(argv[arg + 1], "auto") == 0)
1981 runner.colorize = munit_stream_supports_ansi(MUNIT_OUTPUT_FILE);
1982 else {
1983 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "invalid value ('%s') passed to %s", argv[arg + 1],
1984 argv[arg]);
1985 goto cleanup;
1986 }
1987
1988 arg++;
1989 } else if (strcmp("help", argv[arg] + 2) == 0) {
1990 munit_print_help(argc, argv, user_data, arguments);
1991 result = EXIT_SUCCESS;
1992 goto cleanup;
1993 } else if (strcmp("single", argv[arg] + 2) == 0) {
1994 runner.single_parameter_mode = 1;
1995 } else if (strcmp("show-stderr", argv[arg] + 2) == 0) {
1996 runner.show_stderr = 1;
1997#if !defined(_WIN32)
1998 } else if (strcmp("no-fork", argv[arg] + 2) == 0) {
1999 runner.fork = 0;
2000#endif
2001 } else if (strcmp("fatal-failures", argv[arg] + 2) == 0) {
2002 runner.fatal_failures = 1;
2003 } else if (strcmp("log-visible", argv[arg] + 2) == 0 ||
2004 strcmp("log-fatal", argv[arg] + 2) == 0) {
2005 if (arg + 1 >= argc) {
2006 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "%s requires an argument", argv[arg]);
2007 goto cleanup;
2008 }
2009
2010 if (strcmp(argv[arg + 1], "debug") == 0)
2011 level = MUNIT_LOG_DEBUG;
2012 else if (strcmp(argv[arg + 1], "info") == 0)
2013 level = MUNIT_LOG_INFO;
2014 else if (strcmp(argv[arg + 1], "warning") == 0)
2015 level = MUNIT_LOG_WARNING;
2016 else if (strcmp(argv[arg + 1], "error") == 0)
2017 level = MUNIT_LOG_ERROR;
2018 else {
2019 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "invalid value ('%s') passed to %s", argv[arg + 1],
2020 argv[arg]);
2021 goto cleanup;
2022 }
2023
2024 if (strcmp("log-visible", argv[arg] + 2) == 0)
2025 munit_log_level_visible = level;
2026 else
2027 munit_log_level_fatal = level;
2028
2029 arg++;
2030 } else if (strcmp("list", argv[arg] + 2) == 0) {
2031 munit_suite_list_tests(suite, 0, NULL);
2032 result = EXIT_SUCCESS;
2033 goto cleanup;
2034 } else if (strcmp("list-params", argv[arg] + 2) == 0) {
2035 munit_suite_list_tests(suite, 1, NULL);
2036 result = EXIT_SUCCESS;
2037 goto cleanup;
2038 } else {
2039 argument = munit_arguments_find(arguments, argv[arg] + 2);
2040 if (argument == NULL) {
2041 munit_logf_internal(MUNIT_LOG_ERROR, stderr, "unknown argument ('%s')", argv[arg]);
2042 goto cleanup;
2043 }
2044
2045 if (!argument->parse_argument(suite, user_data, &arg, argc, argv))
2046 goto cleanup;
2047 }
2048 } else {
2049 runner_tests = realloc((void *) runner.tests, sizeof(char *) * (tests_size + 2));
2050 if (runner_tests == NULL) {
2051 munit_log_internal(MUNIT_LOG_ERROR, stderr, "failed to allocate memory");
2052 goto cleanup;
2053 }
2054 runner.tests = runner_tests;
2055 runner.tests[tests_size++] = argv[arg];
2056 runner.tests[tests_size] = NULL;
2057 }
2058 }
2059
2060 fflush(stderr);
2061 fprintf(MUNIT_OUTPUT_FILE, "Running test suite with seed 0x%08" PRIx32 "...\n", runner.seed);
2062
2063 munit_test_runner_run(&runner);
2064
2065 tests_run = runner.report.successful + runner.report.failed + runner.report.errored;
2066 tests_total = tests_run + runner.report.skipped;
2067 if (tests_run == 0) {
2068 fprintf(stderr, "No tests run, %d (100%%) skipped.\n", runner.report.skipped);
2069 } else {
2070 fprintf(MUNIT_OUTPUT_FILE, "%d of %d (%0.0f%%) tests successful, %d (%0.0f%%) test skipped.\n",
2071 runner.report.successful, tests_run,
2072 (((double) runner.report.successful) / ((double) tests_run)) * 100.0,
2073 runner.report.skipped,
2074 (((double) runner.report.skipped) / ((double) tests_total)) * 100.0);
2075 }
2076
2077
2078#if defined(MUNIT_FAIL_NO_TEST_RUN)
2079 if (runner.report.failed == 0 && runner.report.errored == 0 && tests_run > 0) {
2080#else
2081 if (runner.report.failed == 0 && runner.report_simple.errored == 0) {
2082#endif
2083 result = EXIT_SUCCESS;
2084 }
2085
2086 cleanup:
2087 free(runner.parameters);
2088 free((void *) runner.tests);
2089
2090 return result;
2091}
#define MUNIT_OUTPUT_FILE
Definition munit.c:32
struct MunitArgument_ MunitArgument
Definition munit.h:480
munit_bool(* parse_argument)(const MunitSuite *suite, void *user_data, int *arg, int argc, char *const argv[MUNIT_ARRAY_PARAM(argc+1)])
Definition munit.h:485
munit_uint64_t wall_clock
Definition munit.c:1053
unsigned int skipped
Definition munit.c:1048
unsigned int errored
Definition munit.c:1050
unsigned int failed
Definition munit.c:1049
munit_uint64_t cpu_clock
Definition munit.c:1052
unsigned int successful
Definition munit.c:1047
munit_bool show_stderr
Definition munit.c:1070
const char ** tests
Definition munit.c:1061
void * user_data
Definition munit.c:1066
const MunitSuite * current_suite
Definition munit.c:1060
unsigned int iterations
Definition munit.c:1063
munit_bool fork
Definition munit.c:1069
const MunitSuite * suite
Definition munit.c:1059
const char * prefix
Definition munit.c:1058
MunitParameter * parameters
Definition munit.c:1064
munit_uint32_t seed
Definition munit.c:1062
munit_bool single_parameter_mode
Definition munit.c:1065
munit_bool fatal_failures
Definition munit.c:1071
munit_bool colorize
Definition munit.c:1068
MunitReport report
Definition munit.c:1067

References MunitTestRunner::colorize, MunitReport::cpu_clock, MunitTestRunner::current_suite, MunitReport::errored, MunitReport::failed, MunitTestRunner::fatal_failures, MunitTestRunner::fork, MunitTestRunner::iterations, MUNIT_LOG_DEBUG, MUNIT_LOG_ERROR, MUNIT_LOG_INFO, MUNIT_LOG_WARNING, MUNIT_OUTPUT_FILE, munit_uint32_t, MunitParameter::name, MunitTestRunner::parameters, MunitArgument_::parse_argument, MunitTestRunner::prefix, MunitTestRunner::report, MunitTestRunner::seed, MunitTestRunner::show_stderr, MunitTestRunner::single_parameter_mode, MunitReport::skipped, MunitReport::successful, MunitTestRunner::suite, MunitTestRunner::tests, MunitTestRunner::user_data, MunitParameter::value, and MunitReport::wall_clock.

Referenced by munit_suite_main().

Here is the caller graph for this function: