mirror of https://github.com/getdnsapi/getdns.git
Added globals to support getdns_cancel_callback() tests.
Fixed macro evaluation problem in ASSERT_RC.
This commit is contained in:
parent
c8a7180a3a
commit
c736df8a89
|
@ -8,6 +8,8 @@
|
||||||
#include "check_getdns_common.h"
|
#include "check_getdns_common.h"
|
||||||
|
|
||||||
int callback_called = 0;
|
int callback_called = 0;
|
||||||
|
int callback_completed = 0;
|
||||||
|
int callback_canceled = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extract_response extracts all of the various information
|
* extract_response extracts all of the various information
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#define MAXLEN 200
|
#define MAXLEN 200
|
||||||
|
|
||||||
extern int callback_called;
|
extern int callback_called;
|
||||||
|
extern int callback_completed;
|
||||||
|
extern int callback_canceled;
|
||||||
|
|
||||||
struct extracted_response {
|
struct extracted_response {
|
||||||
uint32_t top_answer_type;
|
uint32_t top_answer_type;
|
||||||
|
@ -29,14 +31,15 @@
|
||||||
* whether the return code from the last
|
* whether the return code from the last
|
||||||
* getdns API call is what was expected.
|
* getdns API call is what was expected.
|
||||||
*/
|
*/
|
||||||
#define ASSERT_RC(rc, expected_rc, prefix) \
|
#define ASSERT_RC(rc, expected_rc, prefix) \
|
||||||
{ \
|
{ \
|
||||||
size_t buflen = MAXLEN; \
|
size_t buflen = MAXLEN; \
|
||||||
char error_string[MAXLEN]; \
|
char error_string[MAXLEN]; \
|
||||||
getdns_strerror(rc, error_string, buflen); \
|
getdns_return_t evaluated_rc = rc; \
|
||||||
ck_assert_msg(rc == expected_rc, \
|
getdns_strerror(evaluated_rc, error_string, buflen); \
|
||||||
"%s: expecting %s: %d, but received: %d: %s", \
|
ck_assert_msg(evaluated_rc == expected_rc, \
|
||||||
prefix, #expected_rc, expected_rc, rc, error_string); \
|
"%s: expecting %s: %d, but received: %d: %s", \
|
||||||
|
prefix, #expected_rc, expected_rc, evaluated_rc, error_string); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue