/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
32 by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt
1
#ifndef __H_TEST__
2
#define __H_TEST__
3
4
#include <stdio.h>
5
6
#ifndef RESET
33 by Gustav Hartvigsson
* made test_macros.h a lil' bit more portable
7
/* Colour definitions for console prints */
8
#define RESET   "\033[0m"
9
#define BLACK   "\033[30m"      /* Black */
10
#define RED     "\033[31m"      /* Red */
11
#define GREEN   "\033[32m"      /* Green */
12
#define YELLOW  "\033[33m"      /* Yellow */
13
#define BLUE    "\033[34m"      /* Blue */
14
#define MAGENTA "\033[35m"      /* Magenta */
15
#define CYAN    "\033[36m"      /* Cyan */
16
#define WHITE   "\033[37m"      /* White */
17
#define BOLDBLACK   "\033[1m\033[30m"      /* Bold Black */
18
#define BOLDRED     "\033[1m\033[31m"      /* Bold Red */
19
#define BOLDGREEN   "\033[1m\033[32m"      /* Bold Green */
20
#define BOLDYELLOW  "\033[1m\033[33m"      /* Bold Yellow */
21
#define BOLDBLUE    "\033[1m\033[34m"      /* Bold Blue */
22
#define BOLDMAGENTA "\033[1m\033[35m"      /* Bold Magenta */
23
#define BOLDCYAN    "\033[1m\033[36m"      /* Bold Cyan */
24
#define BOLDWHITE   "\033[1m\033[37m"      /* Bold White */
25
#endif
26
27
#define test_fail(p, ...)\
32 by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt
28
  fprintf (stderr, RED "[FAILED][%s:%d, %s] " p " \n" RESET,\
29
  __FILE__, __LINE__, __func__ , ##__VA_ARGS__)
30
31
#define test_pass(p, ...)\
32
   fprintf (stdout, GREEN "[PASS] " p " \n" RESET,\
33
   ##__VA_ARGS__)
34
35
#define test_case(cond, p, ret)     \
36
    if (cond) {                     \
37
      test_pass(p);                 \
38
    } else {                        \
39
      test_fail(p);                 \
40
      ret++;                        \
41
    }
42
43
#endif /* __H_TEST__ */
44