-
Notifications
You must be signed in to change notification settings - Fork 4
/
describe.h
51 lines (38 loc) · 1.04 KB
/
describe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// describe.h
//
// Copyright (c) 2013 Stephen Mathieson
// Copyright (c) 2015 Michael Phan-Ba
// MIT licensed
//
#ifndef DESCRIBE_H
#define DESCRIBE_H 1
#include <stdio.h>
#include "assertion-macros/assertion-macros.h"
/**
* Before specification.
*/
int
__before_specification(int current);
/**
* After specification.
*/
void
__after_specification(int before, int current, const char *specification);
/**
* Describe the following `suite` with the given `title`.
*/
#define describe(title) for ( \
int __run = 0; \
__run++ == 0 && printf("\n %s\n", title); \
printf("\n") \
)
/**
* Describe the following `fn` with given `specification`.
*/
#define it(specification) for ( \
int __run = 0, __before = __before_specification(assert_failures()); \
__run++ == 0; \
__after_specification(__before, assert_failures(), specification) \
)
#endif