-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiunit.h
More file actions
34 lines (27 loc) · 715 Bytes
/
miniunit.h
File metadata and controls
34 lines (27 loc) · 715 Bytes
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
#ifndef __MINIUNIT_H__
#define __MINIUNIT_H__
#include <stdbool.h>
#include <string.h>
#include "clog.h"
#include <unistd.h>
#include <stdio.h>
#define mu_start() int __mu_line_num_ff = 0
#define mu_check(condition) \
do{\
if(((condition) == false) && ((__mu_line_num_ff) == false)) {\
__mu_line_num_ff = __LINE__;\
}\
}while(false)
#define mu_run(function) \
do{\
int muzzi = function();\
if(muzzi == 0) {\
logf_green("Test passed: %s\n", (#function));\
}\
else{ \
logf_red("Test failed : %s at line %d\n", (#function),(muzzi));\
}\
}while(false)
#define mu_end() return __mu_line_num_ff
#define mu_check_strings_equal(argu1,argu2) mu_check(0==strcmp(argu1, argu2))
#endif