/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to tests/test_macros.h

  • Committer: Gustav Hartvigsson
  • Date: 2015-04-10 21:36:10 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150410213610-r1q96ym4nmulpax9
* Added a few skeletal functions to Callback.h
* Re-wrote parts of SDynamicArray to be more sane.
  * removed s_dynamic_array_len() and s_dynamic_array_add()
  * added s_dynamic_array_set() and s_dynamic_array_last_item()
  * use calloc instead of malloc.
* added unsubscribe function to SGlobalNotify.
* Added decumentation in Interface.h
* Made s_dbg_print() more helpful.

-- Testing --
* Made test_case() macro more useful.
* added tests for the dynamic array.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
#define end_unit()    \
67
67
  return unit_retval;
68
68
 
69
 
#define test_fail(p, ...)\
70
 
  fprintf (stderr, RED "[FAILED][%s:%d, %s] " p " \n" RESET,   \
71
 
  __FILE__, __LINE__, __func__ , ##__VA_ARGS__)
72
 
 
73
 
#define test_pass(p, ...)                            \
74
 
   fprintf (stdout, GREEN "[PASS] " p " \n" RESET,   \
75
 
   ##__VA_ARGS__)
76
 
 
77
 
#define test_case(cond, p)          \
78
 
    if (cond) {                     \
79
 
      test_pass(p);                 \
80
 
    } else {                        \
81
 
      test_fail(p);                 \
82
 
      unit_retval++;                \
 
69
#define test_case(cond, p, ...)                                     \
 
70
    if (cond) {                                                     \
 
71
      fprintf (stdout, GREEN "[PASS] " p " \n" RESET,               \
 
72
               ##__VA_ARGS__);                                      \
 
73
    } else {                                                        \
 
74
      fprintf (stderr, RED "[FAILED][%s:%d, %s] " p " \n" RESET,    \
 
75
      __FILE__, __LINE__, __func__ , ##__VA_ARGS__);                \
 
76
      unit_retval++;                                                \
83
77
    }
84
78
 
85
79