mirror of https://github.com/getdnsapi/getdns.git
Implemented most of Neel's review feedback.
This commit is contained in:
parent
d9c3df6ce8
commit
c1f7ced032
|
@ -1,6 +1,13 @@
|
||||||
|
|
||||||
#ifndef _check_getdns_address_h_
|
#ifndef _check_getdns_address_h_
|
||||||
#define _check_getdns_address_h_
|
#define _check_getdns_address_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
**************************************************************************
|
||||||
|
* *
|
||||||
|
* T E S T S F O R G E T D N S _ A D D R E S S _ S Y N C *
|
||||||
|
* *
|
||||||
|
**************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_1)
|
START_TEST (getdns_address_sync_1)
|
||||||
{
|
{
|
||||||
|
@ -25,10 +32,12 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, NULL, NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, NULL, NULL, &response),
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -42,10 +51,12 @@
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
||||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_address_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -59,10 +70,12 @@
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
||||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_address_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -74,10 +87,12 @@
|
||||||
*/
|
*/
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, NULL),
|
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, NULL),
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -94,7 +109,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -102,6 +117,8 @@
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -119,7 +136,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "localhost", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "localhost", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -127,6 +144,8 @@
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -145,7 +164,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.joe", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "google.joe", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -155,6 +174,8 @@
|
||||||
assert_nxdomain(&ex_response);
|
assert_nxdomain(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
assert_soa_in_authority(&ex_response);
|
assert_soa_in_authority(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -170,7 +191,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "hampster.com", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "hampster.com", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -178,6 +199,8 @@
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -193,7 +216,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -202,6 +225,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_address_in_answer(&ex_response, TRUE, FALSE);
|
assert_address_in_answer(&ex_response, TRUE, FALSE);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -218,7 +243,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "75.101.146.66", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "75.101.146.66", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -228,6 +253,8 @@
|
||||||
assert_nxdomain(&ex_response);
|
assert_nxdomain(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
assert_soa_in_authority(&ex_response);
|
assert_soa_in_authority(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -244,7 +271,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "2607:f8b0:4006:802::1007", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "2607:f8b0:4006:802::1007", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
@ -254,6 +281,8 @@
|
||||||
assert_nxdomain(&ex_response);
|
assert_nxdomain(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
assert_soa_in_authority(&ex_response);
|
assert_soa_in_authority(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,11 @@ void assert_ptr_in_answer(struct extracted_response *ex_response)
|
||||||
ck_assert_msg(ptr_records == 1, "Expected to find one PTR record in answer section, got %d", ptr_records);
|
ck_assert_msg(ptr_records == 1, "Expected to find one PTR record in answer section, got %d", ptr_records);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* negative_callbackfn is the callback function given
|
||||||
|
* to negative asynchronous query tests when no response
|
||||||
|
* is expected.
|
||||||
|
*/
|
||||||
void negative_callbackfn(struct getdns_context *context,
|
void negative_callbackfn(struct getdns_context *context,
|
||||||
uint16_t callback_type,
|
uint16_t callback_type,
|
||||||
struct getdns_dict *response,
|
struct getdns_dict *response,
|
||||||
|
@ -231,6 +236,11 @@ void negative_callbackfn(struct getdns_context *context,
|
||||||
ck_abort_msg("Callback should never occur for negative test cases");
|
ck_abort_msg("Callback should never occur for negative test cases");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* positive_callbackfn is the callback function given
|
||||||
|
* to positive asynchronous query tests and will validate
|
||||||
|
* the response that is returned.
|
||||||
|
*/
|
||||||
void positive_callbackfn(struct getdns_context *context,
|
void positive_callbackfn(struct getdns_context *context,
|
||||||
uint16_t callback_type,
|
uint16_t callback_type,
|
||||||
struct getdns_dict *response,
|
struct getdns_dict *response,
|
||||||
|
|
|
@ -42,11 +42,17 @@
|
||||||
* create a context and assert the proper
|
* create a context and assert the proper
|
||||||
* return code is returned.
|
* return code is returned.
|
||||||
*/
|
*/
|
||||||
#define CONTEXT_CREATE \
|
#define CONTEXT_CREATE(set_from_os) \
|
||||||
ASSERT_RC(getdns_context_create(&context, TRUE), \
|
ASSERT_RC(getdns_context_create(&context, set_from_os), \
|
||||||
GETDNS_RETURN_GOOD, \
|
GETDNS_RETURN_GOOD, \
|
||||||
"Return code from getdns_context_create()");
|
"Return code from getdns_context_create()");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The CONTEXT_FREE macro is used to
|
||||||
|
* destroy the current context.
|
||||||
|
*/
|
||||||
|
#define CONTEXT_DESTROY getdns_context_destroy(context);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The EVENT_BASE_CREATE macro is used to
|
* The EVENT_BASE_CREATE macro is used to
|
||||||
* create an event base and put it in the
|
* create an event base and put it in the
|
||||||
|
@ -74,6 +80,11 @@
|
||||||
ck_assert_msg(list != NULL, \
|
ck_assert_msg(list != NULL, \
|
||||||
"NULL pointer returned by getdns_list_create()");
|
"NULL pointer returned by getdns_list_create()");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The LIST_DESTROY macro destroys a list.
|
||||||
|
*/
|
||||||
|
#define LIST_DESTROY(list) getdns_list_destroy(list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The DICT_CREATE macro simply creates a
|
* The DICT_CREATE macro simply creates a
|
||||||
* dict and verifies the returned pointer
|
* dict and verifies the returned pointer
|
||||||
|
@ -83,6 +94,11 @@
|
||||||
dict = getdns_dict_create(); \
|
dict = getdns_dict_create(); \
|
||||||
ck_assert_msg(dict != NULL, \
|
ck_assert_msg(dict != NULL, \
|
||||||
"NULL pointer returned by getdns_dict_create()");
|
"NULL pointer returned by getdns_dict_create()");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The DICT_DESTROY macro destroys a dict.
|
||||||
|
*/
|
||||||
|
#define DICT_DESTROY(dict) getdns_dict_destroy(dict);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The process_response macro declares the
|
* The process_response macro declares the
|
||||||
|
@ -92,14 +108,60 @@
|
||||||
#define EXTRACT_RESPONSE \
|
#define EXTRACT_RESPONSE \
|
||||||
struct extracted_response ex_response; \
|
struct extracted_response ex_response; \
|
||||||
extract_response(response, &ex_response);
|
extract_response(response, &ex_response);
|
||||||
|
|
||||||
|
//
|
||||||
|
// FUNCTION DECLARATIONS
|
||||||
|
//
|
||||||
|
|
||||||
|
/*
|
||||||
|
* extract_response extracts all of the various information
|
||||||
|
* a test may want to look at from the response.
|
||||||
|
*/
|
||||||
void extract_response(struct getdns_dict *response, struct extracted_response *ex_response);
|
void extract_response(struct getdns_dict *response, struct extracted_response *ex_response);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* assert_noerror asserts that the rcode is 0.
|
||||||
|
*/
|
||||||
void assert_noerror(struct extracted_response *ex_response);
|
void assert_noerror(struct extracted_response *ex_response);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* assert_nodata asserts that ancount in the header and the
|
||||||
|
* of the answer section (list) are both zero.
|
||||||
|
*/
|
||||||
void assert_nodata(struct extracted_response *ex_response);
|
void assert_nodata(struct extracted_response *ex_response);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* assert_address_records_in_answer asserts that ancount in
|
||||||
|
* the header * is >= 1, ancount is equal to the length
|
||||||
|
* of "answer", and that all of * the records in the
|
||||||
|
* answer section are A and/or AAAA resource records based
|
||||||
|
* on the value of the a/aaaa arguments.
|
||||||
|
*/
|
||||||
void assert_address_in_answer(struct extracted_response *ex_response, int a, int aaaa);
|
void assert_address_in_answer(struct extracted_response *ex_response, int a, int aaaa);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* assert_nxdomain asserts that an NXDOMAIN response was
|
||||||
|
* was returned for the DNS query meaning rcode == 3.
|
||||||
|
*/
|
||||||
void assert_nxdomain(struct extracted_response *ex_response);
|
void assert_nxdomain(struct extracted_response *ex_response);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* assert_soa_in_authority asserts that a SOA record was
|
||||||
|
* returned in the authority sections.
|
||||||
|
*/
|
||||||
void assert_soa_in_authority(struct extracted_response *ex_response);
|
void assert_soa_in_authority(struct extracted_response *ex_response);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* assert_ptr_in_answer asserts that a PTR record was
|
||||||
|
* returned in the answer sections.
|
||||||
|
*/
|
||||||
void assert_ptr_in_answer(struct extracted_response *ex_response);
|
void assert_ptr_in_answer(struct extracted_response *ex_response);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* negative_callbackfn is the callback function given
|
||||||
|
* to negative asynchronous query tests when no response
|
||||||
|
* is expected.
|
||||||
|
*/
|
||||||
void negative_callbackfn(
|
void negative_callbackfn(
|
||||||
struct getdns_context *context,
|
struct getdns_context *context,
|
||||||
uint16_t callback_type,
|
uint16_t callback_type,
|
||||||
|
@ -107,6 +169,12 @@
|
||||||
void *userarg,
|
void *userarg,
|
||||||
getdns_transaction_t transaction_id
|
getdns_transaction_t transaction_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* positive_callbackfn is the callback function given
|
||||||
|
* to positive asynchronous query tests and will validate
|
||||||
|
* the response that is returned.
|
||||||
|
*/
|
||||||
void positive_callbackfn(
|
void positive_callbackfn(
|
||||||
struct getdns_context *context,
|
struct getdns_context *context,
|
||||||
uint16_t callback_type,
|
uint16_t callback_type,
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
#ifndef _check_getdns_general_h_
|
#ifndef _check_getdns_general_h_
|
||||||
#define _check_getdns_general_h_
|
#define _check_getdns_general_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
**************************************************************************
|
||||||
|
* *
|
||||||
|
* T E S T S F O R G E T D N S _ G E M E R A L *
|
||||||
|
* *
|
||||||
|
**************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
START_TEST (getdns_general_1)
|
START_TEST (getdns_general_1)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +34,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, NULL, GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, NULL, GETDNS_RRTYPE_A, NULL,
|
||||||
|
@ -34,6 +42,7 @@
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -48,7 +57,7 @@
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_A, NULL,
|
||||||
|
@ -56,6 +65,7 @@
|
||||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general()");
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -70,7 +80,7 @@
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_A, NULL,
|
||||||
|
@ -78,6 +88,7 @@
|
||||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general()");
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -91,7 +102,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
|
@ -99,6 +110,7 @@
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -116,7 +128,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", 0, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", 0, NULL,
|
||||||
|
@ -124,6 +136,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -141,7 +154,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", 65279, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", 65279, NULL,
|
||||||
|
@ -149,6 +162,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -167,7 +181,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
|
@ -175,6 +189,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -193,7 +208,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_AAAA, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_AAAA, NULL,
|
||||||
|
@ -201,6 +216,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -221,7 +237,7 @@
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
const char *name = "thisdomainsurelydoesntexist.com";
|
const char *name = "thisdomainsurelydoesntexist.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_TXT, NULL,
|
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_TXT, NULL,
|
||||||
|
@ -229,6 +245,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -246,7 +263,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "hampster.com", GETDNS_RRTYPE_MX, NULL,
|
ASSERT_RC(getdns_general(context, "hampster.com", GETDNS_RRTYPE_MX, NULL,
|
||||||
|
@ -254,6 +271,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -272,7 +290,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
|
@ -280,6 +298,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -298,7 +317,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "75.101.146.66", GETDNS_RRTYPE_PTR, NULL,
|
ASSERT_RC(getdns_general(context, "75.101.146.66", GETDNS_RRTYPE_PTR, NULL,
|
||||||
|
@ -306,6 +325,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -324,7 +344,7 @@
|
||||||
struct event_base *event_base = NULL; \
|
struct event_base *event_base = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "2607:f8b0:4006:802::1007", GETDNS_RRTYPE_PTR, NULL,
|
ASSERT_RC(getdns_general(context, "2607:f8b0:4006:802::1007", GETDNS_RRTYPE_PTR, NULL,
|
||||||
|
@ -332,6 +352,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
#ifndef _check_getdns_general_sync_h_
|
#ifndef _check_getdns_general_sync_h_
|
||||||
#define _check_getdns_general_sync_h_
|
#define _check_getdns_general_sync_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
**************************************************************************
|
||||||
|
* *
|
||||||
|
* T E S T S F O R G E T D N S _ G E N E R A L _ S Y N C *
|
||||||
|
* *
|
||||||
|
**************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
START_TEST (getdns_general_sync_1)
|
START_TEST (getdns_general_sync_1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -24,10 +32,12 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, NULL, GETDNS_RRTYPE_A, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, NULL, GETDNS_RRTYPE_A, NULL, &response),
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -41,10 +51,12 @@
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_A, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_A, NULL, &response),
|
||||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -58,10 +70,12 @@
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_A, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_A, NULL, &response),
|
||||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -73,10 +87,12 @@
|
||||||
*/
|
*/
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, NULL),
|
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, NULL),
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -93,7 +109,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "google.com", 0, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "google.com", 0, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -102,6 +118,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -118,7 +136,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "google.com", 65279, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "google.com", 65279, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -127,6 +145,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -144,7 +164,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -153,6 +173,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_address_in_answer(&ex_response, TRUE, FALSE);
|
assert_address_in_answer(&ex_response, TRUE, FALSE);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -170,7 +192,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_AAAA, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_AAAA, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -179,6 +201,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_address_in_answer(&ex_response, FALSE, TRUE);
|
assert_address_in_answer(&ex_response, FALSE, TRUE);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -198,7 +222,7 @@
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
const char *name = "thisdomainsurelydoesntexist.com";
|
const char *name = "thisdomainsurelydoesntexist.com";
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_TXT, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_TXT, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -208,6 +232,8 @@
|
||||||
assert_nxdomain(&ex_response);
|
assert_nxdomain(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
assert_soa_in_authority(&ex_response);
|
assert_soa_in_authority(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -224,7 +250,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "hampster.com", GETDNS_RRTYPE_MX, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "hampster.com", GETDNS_RRTYPE_MX, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -233,6 +259,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_nodata(&ex_response);
|
assert_nodata(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -250,7 +278,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -259,6 +287,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_address_in_answer(&ex_response, TRUE, FALSE);
|
assert_address_in_answer(&ex_response, TRUE, FALSE);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -276,7 +306,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "75.101.146.66", GETDNS_RRTYPE_PTR, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "75.101.146.66", GETDNS_RRTYPE_PTR, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -285,6 +315,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_ptr_in_answer(&ex_response);
|
assert_ptr_in_answer(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -302,7 +334,7 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
CONTEXT_CREATE;
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_general_sync(context, "2607:f8b0:4006:802::1007", GETDNS_RRTYPE_PTR, NULL, &response),
|
ASSERT_RC(getdns_general_sync(context, "2607:f8b0:4006:802::1007", GETDNS_RRTYPE_PTR, NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||||
|
@ -311,6 +343,8 @@
|
||||||
|
|
||||||
assert_noerror(&ex_response);
|
assert_noerror(&ex_response);
|
||||||
assert_ptr_in_answer(&ex_response);
|
assert_ptr_in_answer(&ex_response);
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -328,8 +362,8 @@
|
||||||
tcase_add_test(tc_neg, getdns_general_sync_5);
|
tcase_add_test(tc_neg, getdns_general_sync_5);
|
||||||
suite_add_tcase(s, tc_neg);
|
suite_add_tcase(s, tc_neg);
|
||||||
/* Positive test cases */
|
/* Positive test cases */
|
||||||
|
|
||||||
TCase *tc_pos = tcase_create("Positive");
|
TCase *tc_pos = tcase_create("Positive");
|
||||||
|
|
||||||
tcase_add_test(tc_pos, getdns_general_sync_6);
|
tcase_add_test(tc_pos, getdns_general_sync_6);
|
||||||
tcase_add_test(tc_pos, getdns_general_sync_7);
|
tcase_add_test(tc_pos, getdns_general_sync_7);
|
||||||
tcase_add_test(tc_pos, getdns_general_sync_8);
|
tcase_add_test(tc_pos, getdns_general_sync_8);
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
#ifndef _check_getdns_list_get_data_type_h_
|
#ifndef _check_getdns_list_get_data_type_h_
|
||||||
#define _check_getdns_list_get_data_type_h_
|
#define _check_getdns_list_get_data_type_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
**************************************************************************
|
||||||
|
* *
|
||||||
|
* T E S T S F O R G E T D N S _ L I S T _ G E T _ D A T A _ T Y P E *
|
||||||
|
* *
|
||||||
|
**************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
START_TEST (getdns_list_get_data_type_1)
|
START_TEST (getdns_list_get_data_type_1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -28,6 +36,8 @@
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
getdns_data_type answer;
|
getdns_data_type answer;
|
||||||
|
|
||||||
|
LIST_CREATE(list);
|
||||||
|
|
||||||
ASSERT_RC(getdns_list_set_int(list, index, 1), GETDNS_RETURN_GOOD,
|
ASSERT_RC(getdns_list_set_int(list, index, 1), GETDNS_RETURN_GOOD,
|
||||||
"Return code from getdns_list_set_int()");
|
"Return code from getdns_list_set_int()");
|
||||||
|
|
||||||
|
@ -35,6 +45,7 @@
|
||||||
ASSERT_RC(getdns_list_get_data_type(list, index, &answer),
|
ASSERT_RC(getdns_list_get_data_type(list, index, &answer),
|
||||||
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_data_type()");
|
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_data_type()");
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -55,6 +66,7 @@
|
||||||
ASSERT_RC(getdns_list_get_data_type(list, index, NULL),
|
ASSERT_RC(getdns_list_get_data_type(list, index, NULL),
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_list_get_data_type()");
|
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_list_get_data_type()");
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -74,6 +86,7 @@
|
||||||
ASSERT_RC(getdns_list_get_data_type(list, index, &answer),
|
ASSERT_RC(getdns_list_get_data_type(list, index, &answer),
|
||||||
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_data_type()");
|
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_data_type()");
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -103,6 +116,8 @@
|
||||||
ck_assert_msg(answer == t_dict,
|
ck_assert_msg(answer == t_dict,
|
||||||
"Wrong data type, expected t_dict: %d, got %d", t_dict, answer);
|
"Wrong data type, expected t_dict: %d, got %d", t_dict, answer);
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
|
DICT_DESTROY(dict);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -132,6 +147,8 @@
|
||||||
ck_assert_msg(answer == t_list,
|
ck_assert_msg(answer == t_list,
|
||||||
"Wrong data type, expected t_list: %d, got %d", t_list, answer);
|
"Wrong data type, expected t_list: %d, got %d", t_list, answer);
|
||||||
|
|
||||||
|
LIST_DESTROY(list1);
|
||||||
|
LIST_DESTROY(list2);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -160,6 +177,7 @@
|
||||||
ck_assert_msg(answer == t_bindata,
|
ck_assert_msg(answer == t_bindata,
|
||||||
"Wrong data type, expected t_bindata: %d, got %d", t_bindata, answer);
|
"Wrong data type, expected t_bindata: %d, got %d", t_bindata, answer);
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -186,6 +204,7 @@
|
||||||
ck_assert_msg(answer == t_int,
|
ck_assert_msg(answer == t_int,
|
||||||
"Wrong data type, expected t_int: %d, got %d", t_int, answer);
|
"Wrong data type, expected t_int: %d, got %d", t_int, answer);
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
#ifndef _check_getdns_list_get_length_h_
|
#ifndef _check_getdns_list_get_length_h_
|
||||||
#define _check_getdns_list_get_length_h_
|
#define _check_getdns_list_get_length_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
**************************************************************************
|
||||||
|
* *
|
||||||
|
* T E S T S F O R G E T D N S _ L I S T _ G E T _ L E N G T H *
|
||||||
|
* *
|
||||||
|
**************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
START_TEST (getdns_list_get_length_1)
|
START_TEST (getdns_list_get_length_1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -29,6 +37,7 @@
|
||||||
ASSERT_RC(getdns_list_get_length(list, NULL),
|
ASSERT_RC(getdns_list_get_length(list, NULL),
|
||||||
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_length()");
|
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_length()");
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -56,6 +65,7 @@
|
||||||
|
|
||||||
ck_assert_msg(length == 3, "Expected length == 3, got %d", length);
|
ck_assert_msg(length == 3, "Expected length == 3, got %d", length);
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -75,7 +85,8 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_list_get_length()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_list_get_length()");
|
||||||
|
|
||||||
ck_assert_msg(length == 0, "Expected length == 3, got %d", length);
|
ck_assert_msg(length == 0, "Expected length == 3, got %d", length);
|
||||||
|
|
||||||
|
LIST_DESTROY(list);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue