diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2012-03-24 11:24:16 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2012-03-24 11:24:16 -0700 |
commit | 86bad61b76a260ffc442acffbe58feee67df45e5 (patch) | |
tree | e375e62ff6d7fea9fb810830e66118e67b4ec2c8 /tests/upb_test.h | |
parent | db59a5198f890ecdcac1227b0bb998160acac5c6 (diff) |
Sync from internal Google development.
Many improvements, too many to mention. One significant
perf regression warrants investigation:
omitfp.parsetoproto2_googlemessage1.upb_jit: 343 -> 252 (-26.53)
plain.parsetoproto2_googlemessage1.upb_jit: 334 -> 251 (-24.85)
25% regression for this benchmark is bad, but since I don't think
there's any fundamental design issue that caused it I'm going to
go ahead with the commit anyway. Can investigate and fix later.
Other benchmarks were neutral or showed slight improvement.
Diffstat (limited to 'tests/upb_test.h')
-rw-r--r-- | tests/upb_test.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/upb_test.h b/tests/upb_test.h index 2bd340e..652977b 100644 --- a/tests/upb_test.h +++ b/tests/upb_test.h @@ -7,6 +7,7 @@ #ifndef UPB_TEST_H_ #define UPB_TEST_H_ +#include <stdio.h> #include <stdlib.h> #ifdef __cplusplus @@ -18,9 +19,28 @@ int num_assertions = 0; ++num_assertions; \ if (!(expr)) { \ fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, "expr: %s\n", #expr); \ abort(); \ } \ -} while(0) +} while (0) + +#define ASSERT_NOCOUNT(expr) do { \ + if (!(expr)) { \ + fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, "expr: %s\n", #expr); \ + abort(); \ + } \ +} while (0) + +#define ASSERT_STATUS(expr, status) do { \ + ++num_assertions; \ + if (!(expr)) { \ + fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, "expr: %s\n", #expr); \ + fprintf(stderr, "failed status: %s\n", upb_status_getstr(status)); \ + abort(); \ + } \ +} while (0) #ifdef __cplusplus } /* extern "C" */ |