diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2025-02-12 17:04:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-12 17:04:01 -0500 |
commit | 09de456a667a771348c3f1c9b0bd56afe4b8d3bd (patch) | |
tree | aedfcbb0b2876e3d7aad28a7cc09354a611c156e /tests/include/testing.h | |
parent | 2bd06b22e455fa154e7db27677421c8b53cbf43c (diff) | |
parent | 4e22506e086e02ffe3056c6fd39ccb201fd358c8 (diff) | |
download | stasis-09de456a667a771348c3f1c9b0bd56afe4b8d3bd.tar.gz |
Merge pull request #89 from jhunkeler/huge-changeset
Huge changeset
Diffstat (limited to 'tests/include/testing.h')
-rw-r--r-- | tests/include/testing.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/include/testing.h b/tests/include/testing.h index 4c97bf2..ab24115 100644 --- a/tests/include/testing.h +++ b/tests/include/testing.h @@ -92,9 +92,10 @@ inline char *stasis_testing_read_ascii(const char *filename) { return NULL; } - char *result; + char *result = NULL; result = calloc(st.st_size + 1, sizeof(*result)); if (fread(result, sizeof(*result), st.st_size, fp) < 1) { + guard_free(result); perror(filename); fclose(fp); return NULL; @@ -211,7 +212,7 @@ inline void stasis_testing_teardown_workspace() { .lineno = __LINE__, \ .status = (COND), \ .msg_assertion = "ASSERT(" #COND ")", \ - .msg_reason = REASON } ); \ + .msg_reason = (REASON) } ); \ } while (0) #define STASIS_ASSERT_FATAL(COND, REASON) do { \ @@ -221,7 +222,7 @@ inline void stasis_testing_teardown_workspace() { .lineno = __LINE__, \ .status = (COND), \ .msg_assertion = "ASSERT FATAL (" #COND ")", \ - .msg_reason = REASON } \ + .msg_reason = (REASON) } \ ); \ if (stasis_test_results[stasis_test_results_i ? stasis_test_results_i - 1 : stasis_test_results_i].status == false) {\ exit(STASIS_TEST_SUITE_FATAL); \ @@ -236,7 +237,7 @@ inline void stasis_testing_teardown_workspace() { .status = true, \ .skip = (COND), \ .msg_assertion = "SKIP (" #COND ")", \ - .msg_reason = REASON } \ + .msg_reason = (REASON) } \ ); \ if (stasis_test_results[stasis_test_results_i ? stasis_test_results_i - 1 : stasis_test_results_i].skip == true) {\ return; \ @@ -244,9 +245,9 @@ inline void stasis_testing_teardown_workspace() { } while (0) #define STASIS_TEST_RUN(X) do { \ - for (size_t i = 0; i < sizeof(X) / sizeof(*X); i++) { \ - if (X[i]) { \ - X[i](); \ + for (size_t i = 0; i < sizeof(X) / sizeof(*(X)); i++) { \ + if ((X)[i]) { \ + (X)[i](); \ } \ } \ } while (0) |