Browse code

Update greatest to 1.2.2

John Hawthorn authored on 27/04/2017 01:11:34
Showing 1 changed files

... ...
@@ -21,10 +21,10 @@
21 21
 extern "C" {
22 22
 #endif
23 23
 
24
-/* 1.2.1 */
24
+/* 1.2.2 */
25 25
 #define GREATEST_VERSION_MAJOR 1
26 26
 #define GREATEST_VERSION_MINOR 2
27
-#define GREATEST_VERSION_PATCH 1
27
+#define GREATEST_VERSION_PATCH 2
28 28
 
29 29
 /* A unit testing system for C, contained in 1 file.
30 30
  * It doesn't use dynamic allocation or depend on anything
... ...
@@ -205,20 +205,23 @@ typedef enum {
205 205
 typedef struct greatest_run_info {
206 206
     unsigned char flags;
207 207
     unsigned char verbosity;
208
+    unsigned char pad_0[2];
209
+
208 210
     unsigned int tests_run;     /* total test count */
209 211
 
212
+    /* currently running test suite */
213
+    greatest_suite_info suite;
214
+
210 215
     /* overall pass/fail/skip counts */
211 216
     unsigned int passed;
212 217
     unsigned int failed;
213 218
     unsigned int skipped;
214 219
     unsigned int assertions;
215 220
 
216
-    /* currently running test suite */
217
-    greatest_suite_info suite;
218
-
219 221
     /* info to print about the most recent failure */
220
-    const char *fail_file;
221 222
     unsigned int fail_line;
223
+    unsigned int pad_1;
224
+    const char *fail_file;
222 225
     const char *msg;
223 226
 
224 227
     /* current setup/teardown hooks and userdata */
... ...
@@ -242,6 +245,7 @@ typedef struct greatest_run_info {
242 245
 #endif
243 246
 
244 247
 #if GREATEST_USE_LONGJMP
248
+    int pad_jmp_buf;
245 249
     jmp_buf jump_dest;
246 250
 #endif
247 251
 } greatest_run_info;
... ...
@@ -432,16 +436,16 @@ typedef enum greatest_test_res {
432 436
     } while (0)
433 437
 
434 438
 /* Fail if EXP != GOT (equality comparison by ==).
435
- * Warning: EXP and GOT will be evaluated more than once on failure. */
439
+ * Warning: FMT, EXP, and GOT will be evaluated more
440
+ * than once on failure. */
436 441
 #define GREATEST_ASSERT_EQ_FMTm(MSG, EXP, GOT, FMT)                     \
437 442
     do {                                                                \
438
-        const char *greatest_FMT = ( FMT );                             \
439 443
         greatest_info.assertions++;                                     \
440 444
         if ((EXP) != (GOT)) {                                           \
441 445
             fprintf(GREATEST_STDOUT, "\nExpected: ");                   \
442
-            fprintf(GREATEST_STDOUT, greatest_FMT, EXP);                \
446
+            fprintf(GREATEST_STDOUT, FMT, EXP);                         \
443 447
             fprintf(GREATEST_STDOUT, "\n     Got: ");                   \
444
-            fprintf(GREATEST_STDOUT, greatest_FMT, GOT);                \
448
+            fprintf(GREATEST_STDOUT, FMT, GOT);                         \
445 449
             fprintf(GREATEST_STDOUT, "\n");                             \
446 450
             GREATEST_FAILm(MSG);                                        \
447 451
         }                                                               \
... ...
@@ -658,7 +662,7 @@ void greatest_post_test(const char *name, int res) {                    \
658 662
         fprintf(GREATEST_STDOUT, "\n");                                 \
659 663
         greatest_info.col = 0;                                          \
660 664
     }                                                                   \
661
-    if (GREATEST_STDOUT == stdout) fflush(stdout);                      \
665
+    fflush(GREATEST_STDOUT);                                            \
662 666
 }                                                                       \
663 667
                                                                         \
664 668
 static void report_suite(void) {                                        \
... ...
@@ -890,7 +894,8 @@ static int greatest_memory_equal_cb(const void *exp, const void *got,   \
890 894
                                                                         \
891 895
 static int greatest_memory_printf_cb(const void *t, void *udata) {      \
892 896
     greatest_memory_cmp_env *env = (greatest_memory_cmp_env *)udata;    \
893
-    unsigned char *buf = (unsigned char *)t, diff_mark = ' ';           \
897
+    const unsigned char *buf = (const unsigned char *)t;                \
898
+    unsigned char diff_mark = ' ';                                      \
894 899
     FILE *out = GREATEST_STDOUT;                                        \
895 900
     size_t i, line_i, line_len = 0;                                     \
896 901
     int len = 0;   /* format hexdump with differences highlighted */    \