From c736df8a896d6028aff5495a7c4217449b5e268c Mon Sep 17 00:00:00 2001 From: "Craig E. Despeaux" Date: Mon, 6 Jan 2014 12:59:43 -0500 Subject: [PATCH] Added globals to support getdns_cancel_callback() tests. Fixed macro evaluation problem in ASSERT_RC. --- src/test/check_getdns_common.c | 2 ++ src/test/check_getdns_common.h | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/test/check_getdns_common.c b/src/test/check_getdns_common.c index 5d1bcb87..5e5e6281 100644 --- a/src/test/check_getdns_common.c +++ b/src/test/check_getdns_common.c @@ -8,6 +8,8 @@ #include "check_getdns_common.h" int callback_called = 0; +int callback_completed = 0; +int callback_canceled = 0; /* * extract_response extracts all of the various information diff --git a/src/test/check_getdns_common.h b/src/test/check_getdns_common.h index 619082d8..5b64d223 100644 --- a/src/test/check_getdns_common.h +++ b/src/test/check_getdns_common.h @@ -6,6 +6,8 @@ #define MAXLEN 200 extern int callback_called; + extern int callback_completed; + extern int callback_canceled; struct extracted_response { uint32_t top_answer_type; @@ -29,14 +31,15 @@ * whether the return code from the last * getdns API call is what was expected. */ - #define ASSERT_RC(rc, expected_rc, prefix) \ - { \ - size_t buflen = MAXLEN; \ - char error_string[MAXLEN]; \ - getdns_strerror(rc, error_string, buflen); \ - ck_assert_msg(rc == expected_rc, \ - "%s: expecting %s: %d, but received: %d: %s", \ - prefix, #expected_rc, expected_rc, rc, error_string); \ + #define ASSERT_RC(rc, expected_rc, prefix) \ + { \ + size_t buflen = MAXLEN; \ + char error_string[MAXLEN]; \ + getdns_return_t evaluated_rc = rc; \ + getdns_strerror(evaluated_rc, error_string, buflen); \ + ck_assert_msg(evaluated_rc == expected_rc, \ + "%s: expecting %s: %d, but received: %d: %s", \ + prefix, #expected_rc, expected_rc, evaluated_rc, error_string); \ } /*