diff options
| author | Mikhail Romanko <me@blankhex.com> | 2025-11-09 10:58:17 +0300 |
|---|---|---|
| committer | Mikhail Romanko <me@blankhex.com> | 2025-11-09 10:58:17 +0300 |
| commit | 0fc57128fb676598757eff37392da2227991498d (patch) | |
| tree | 975025e67fbaf57ff6540c299ed247ba7e365131 | |
| parent | 6d02598e20a126ea159ef4529340b93e5fa7b5ea (diff) | |
| download | bhlib-0fc57128fb676598757eff37392da2227991498d.tar.gz | |
Evaluate arguments in BH_VERIFY_STR_EQ once
| -rw-r--r-- | test/include/BH/Unit.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/include/BH/Unit.h b/test/include/BH/Unit.h index 9f9b3bb..a831ee3 100644 --- a/test/include/BH/Unit.h +++ b/test/include/BH/Unit.h @@ -40,10 +40,13 @@ typedef int (*BH_UnitCallback)(void); #define BH_VERIFY_STR_EQ(actual, expected) \ do { \ - BH_VERIFY((actual) != NULL && (expected) != NULL); \ - if (strcmp((actual), (expected)) != 0) { \ + const char *a, *b; \ + a = (actual); \ + b = (expected); \ + BH_VERIFY(a != NULL && b != NULL); \ + if (strcmp(a, b) != 0) { \ printf("%s:%d\tExpected '%s', got '%s'\n", \ - __FILE__, __LINE__, (expected), (actual)); \ + __FILE__, __LINE__, a, b); \ return -1; \ } \ } while(0) |
