mirror of https://github.com/getdnsapi/getdns.git
Merge pull request #80 from verisign/feature/test_ipaddress
added test for display ip addresses and context_set_context_update
This commit is contained in:
commit
53742767b5
|
@ -35,6 +35,8 @@
|
|||
#include "check_getdns_convert_ulabel_to_alabel.h"
|
||||
#include "check_getdns_convert_alabel_to_ulabel.h"
|
||||
#include "check_getdns_pretty_print_dict.h"
|
||||
#include "check_getdns_display_ip_address.h"
|
||||
#include "check_getdns_context_set_context_update_callback.h"
|
||||
|
||||
|
||||
int
|
||||
|
@ -71,6 +73,8 @@ main (void)
|
|||
Suite *getdns_convert_ulabel_to_alabel_suite(void);
|
||||
Suite *getdns_convert_alabel_to_ulabel_suite(void);
|
||||
Suite *getdns_pretty_print_dict_suite(void);
|
||||
Suite *getdns_display_ip_address_suite(void);
|
||||
Suite *getdns_context_set_context_update_callback_suite(void);
|
||||
|
||||
sr = srunner_create(getdns_general_suite());
|
||||
srunner_add_suite(sr, getdns_general_sync_suite());
|
||||
|
@ -99,6 +103,8 @@ main (void)
|
|||
srunner_add_suite(sr, getdns_convert_ulabel_to_alabel_suite());
|
||||
srunner_add_suite(sr, getdns_convert_alabel_to_ulabel_suite());
|
||||
srunner_add_suite(sr, getdns_pretty_print_dict_suite());
|
||||
srunner_add_suite(sr,getdns_display_ip_address_suite());
|
||||
srunner_add_suite(sr,getdns_context_set_context_update_callback_suite());
|
||||
|
||||
srunner_set_log(sr, "check_getdns.log");
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
int callback_called = 0;
|
||||
int callback_completed = 0;
|
||||
int callback_canceled = 0;
|
||||
uint16_t expected_changed_item = 0;
|
||||
|
||||
/*
|
||||
* extract_response extracts all of the various information
|
||||
|
@ -270,3 +271,22 @@ void callbackfn(struct getdns_context *context,
|
|||
fn(&ex_response);
|
||||
|
||||
}
|
||||
|
||||
//refactor later
|
||||
/*
|
||||
* callbackfn is the callback function given to all
|
||||
* asynchronous query tests. It is expected to only
|
||||
* be called for positive tests and will verify the
|
||||
* response that is returned.
|
||||
*/
|
||||
void update_callbackfn(struct getdns_context *context,
|
||||
uint16_t changed_item)
|
||||
{
|
||||
|
||||
ck_assert_msg(changed_item == expected_changed_item,
|
||||
"Expected changed_item == %d, got %d",
|
||||
changed_item, expected_changed_item);
|
||||
printf("changed_item:%d\n",changed_item);
|
||||
printf("expected_changed_item:%d\n",expected_changed_item);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
extern int callback_called;
|
||||
extern int callback_completed;
|
||||
extern int callback_canceled;
|
||||
extern uint16_t expected_changed_item;
|
||||
|
||||
struct extracted_response {
|
||||
uint32_t top_answer_type;
|
||||
|
@ -174,4 +175,11 @@
|
|||
void *userarg,
|
||||
getdns_transaction_t transaction_id);
|
||||
|
||||
/*
|
||||
* update_callbackfn is the callback function given to
|
||||
* getdns_context_set_context_update_callback tests.
|
||||
*/
|
||||
void update_callbackfn(struct getdns_context *context,
|
||||
uint16_t changed_item);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,337 @@
|
|||
#ifndef _check_getdns_context_set_context_update_callback_h_
|
||||
#define _check_getdns_context_set_context_update_callback_h_
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
* *
|
||||
* T E S T S F O R G E T D N S _ C O N T E X T _ S E T _ C O N T E X T _ U P D A T E _ C A L L B A C K *
|
||||
* *
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_1)
|
||||
{
|
||||
/*
|
||||
* context is NULL
|
||||
* expect: GETDNS_RETURN_BAD_CONTEXT
|
||||
*/
|
||||
|
||||
struct getdns_context *context = NULL;
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_2)
|
||||
{
|
||||
/*
|
||||
* value is NULL
|
||||
* expect: GETDNS_RETURN_INVALID_PARAMETER
|
||||
*/
|
||||
|
||||
struct getdns_context *context = NULL;
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, NULL),
|
||||
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_5)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* getdns_context_set_resolution_type() to GETDNS_CONTEXT_STUB
|
||||
* expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_RESOLUTION_TYPE;
|
||||
|
||||
ASSERT_RC(getdns_context_set_resolution_type(context, GETDNS_CONTEXT_STUB),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_6)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_namespaces() to change the order and/or number of namespaces to be queried
|
||||
* expect: GETDNS_CONTEXT_CODE_NAMESPACES
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
uint16_t namespace_arr[2] = {GETDNS_CONTEXT_NAMESPACE_DNS, GETDNS_CONTEXT_NAMESPACE_LOCALNAMES};
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_NAMESPACES;
|
||||
|
||||
ASSERT_RC(getdns_context_set_namespaces(context, 2,namespace_arr),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_namespaces()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_7)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_dns_transport() to GETDNS_CONTEXT_UDP_ONLY
|
||||
* expect: GETDNS_CONTEXT_CODE_DNS_TRANSPORT
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_DNS_TRANSPORT;
|
||||
|
||||
ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_CONTEXT_UDP_ONLY),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_8)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_limit_outstanding_queries() and set limit to 10
|
||||
* expect: GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES;
|
||||
|
||||
ASSERT_RC(getdns_context_set_limit_outstanding_queries(context, 10),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_limit_outstanding_queries()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_10)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_follow_redirects() to GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS
|
||||
* expect: GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS;
|
||||
|
||||
ASSERT_RC(getdns_context_set_follow_redirects(context, GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_follow_redirects()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_15)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_stub_resolution() providing where the API should send queries to
|
||||
* expect: GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_list *upstream_list = NULL;
|
||||
struct getdns_dict *dict = NULL;
|
||||
size_t index = 0;
|
||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||
struct getdns_bindata address_data = { 4, (void *)"\x0A\x58\x1E\x52" };
|
||||
|
||||
|
||||
|
||||
CONTEXT_CREATE(TRUE);
|
||||
LIST_CREATE(upstream_list);
|
||||
DICT_CREATE(dict);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS;
|
||||
|
||||
ASSERT_RC(getdns_dict_set_bindata(dict, "address_type", &address_type),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata()");
|
||||
|
||||
ASSERT_RC(getdns_dict_set_bindata(dict, "address_data", &address_data),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata()");
|
||||
|
||||
ASSERT_RC(getdns_list_set_dict(upstream_list, index, dict), GETDNS_RETURN_GOOD,
|
||||
"Return code from getdns_list_set_dict()");
|
||||
|
||||
|
||||
|
||||
ASSERT_RC(getdns_context_set_upstream_recursive_servers(context, upstream_list),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_upstream_recursive_servers()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
LIST_DESTROY(upstream_list);
|
||||
DICT_DESTROY(dict);
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_16)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_edns_maximum_udp_payload_size() setting max UDP payload to 512
|
||||
* expect: GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE;
|
||||
|
||||
ASSERT_RC(getdns_context_set_edns_maximum_udp_payload_size(context, 512),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_maximum_udp_payload_size()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_17)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_edns_extended_rcode() setting extended rcode to 1
|
||||
* expect: GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE;
|
||||
|
||||
ASSERT_RC(getdns_context_set_edns_extended_rcode(context, 1),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_extended_rcode()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_18)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_edns_version() setting edns version to 1
|
||||
* expect: GETDNS_CONTEXT_CODE_EDNS_VERSION
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_EDNS_VERSION;
|
||||
|
||||
ASSERT_RC(getdns_context_set_edns_version(context, 1),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_version()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_context_update_callback_19)
|
||||
{
|
||||
/*
|
||||
* Create a context by calling getdns_context_create()
|
||||
* Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes
|
||||
* Call getdns_context_set_edns_do_bit() setting edns do bit to 1
|
||||
* expect: GETDNS_CONTEXT_CODE_EDNS_DO_BIT
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
|
||||
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()");
|
||||
|
||||
expected_changed_item = GETDNS_CONTEXT_CODE_EDNS_DO_BIT;
|
||||
|
||||
ASSERT_RC(getdns_context_set_edns_do_bit(context, 1),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_do_bit()");
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
||||
|
||||
Suite *
|
||||
getdns_context_set_context_update_callback_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("getdns_context_set_context_update_callback()");
|
||||
|
||||
/* Negative test caseis */
|
||||
TCase *tc_neg = tcase_create("Negative");
|
||||
tcase_add_test(tc_neg, getdns_context_set_context_update_callback_1);
|
||||
tcase_add_test(tc_neg, getdns_context_set_context_update_callback_2);
|
||||
suite_add_tcase(s, tc_neg);
|
||||
|
||||
/* Positive test cases */
|
||||
TCase *tc_pos = tcase_create("Positive");
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_5);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_6);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_7);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_8);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_10);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_15);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_16);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_17);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_18);
|
||||
tcase_add_test(tc_pos, getdns_context_set_context_update_callback_19);
|
||||
suite_add_tcase(s, tc_pos);
|
||||
|
||||
return s;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
#ifndef _check_getdns_display_ip_address_h_
|
||||
#define _check_getdns_display_ip_address_h_
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
* *
|
||||
* T E S T S F O R G E T D N S _ D I S P L A Y _ I P _ A D D R E S S *
|
||||
* *
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
START_TEST (getdns_display_ip_address_1)
|
||||
{
|
||||
/*
|
||||
* bindata_of_ipv4_or_ipv6_address = NULL
|
||||
* expect: NULL
|
||||
*/
|
||||
|
||||
//struct getdns_bindata bindata_of_ipv4_or_ipv6_address = NULL;
|
||||
char *ptr = NULL;
|
||||
|
||||
ptr = getdns_display_ip_address(NULL);
|
||||
ck_assert_msg(ptr == NULL, "Expected retrieved bindata == NULL, got: %p",
|
||||
ptr);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_display_ip_address_2)
|
||||
{
|
||||
/*
|
||||
* bindata_of_ipv4_or_ipv6_address is getdns_bindata but not ip addresses
|
||||
* expect: Unknown
|
||||
*/
|
||||
|
||||
char *ptr = NULL;
|
||||
struct getdns_bindata bindata_of_ipv4_or_ipv6_address = { 8, (void *)"bindata" };
|
||||
|
||||
ptr = getdns_display_ip_address(&bindata_of_ipv4_or_ipv6_address);
|
||||
|
||||
ck_assert_msg(ptr == NULL, "Expected pointer == NULL, got: %p",
|
||||
ptr);
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_display_ip_address_3)
|
||||
{
|
||||
/*
|
||||
* Create bindata containing “10.88.30.82"
|
||||
* Call getdns_display_ip_address() passing bindata
|
||||
* expect: 10.88.30.82
|
||||
*/
|
||||
|
||||
char *ptr = NULL;
|
||||
struct getdns_bindata bindata_of_ipv4_or_ipv6_address = { 4, (void *)"\x0A\x58\x1E\x52" };
|
||||
|
||||
ptr = getdns_display_ip_address(&bindata_of_ipv4_or_ipv6_address);
|
||||
|
||||
ck_assert_msg(strcmp(ptr, "10.88.30.82") == 0, "Expected pointer == “10.88.30.82”, got: %s",
|
||||
ptr);
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_display_ip_address_4)
|
||||
{
|
||||
/*
|
||||
* Create bindata containing 2607:f8b0:4006:802::1004
|
||||
* Call getdns_display_ip_address() passing bindata
|
||||
* expect: 2607:f8b0:4006:802::1004
|
||||
*/
|
||||
|
||||
char *ptr = NULL;
|
||||
struct getdns_bindata bindata_of_ipv4_or_ipv6_address = { 16, (void *)"\x26\x07\xf8\xb0\x40\x06\x08\x02\x00\x00\x00\x00\x00\x00\x10\x04" };
|
||||
|
||||
ptr = getdns_display_ip_address(&bindata_of_ipv4_or_ipv6_address);
|
||||
|
||||
|
||||
ck_assert_msg(strcmp(ptr, "2607:f8b0:4006:802::1004") == 0, "Expected pointer == “2607:f8b0:4006:802::1004”, got: %s",
|
||||
ptr);
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
||||
Suite *
|
||||
getdns_display_ip_address_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("getdns_display_ip_address()");
|
||||
|
||||
/* Negative test caseis */
|
||||
TCase *tc_neg = tcase_create("Negative");
|
||||
tcase_add_test(tc_neg, getdns_display_ip_address_1);
|
||||
tcase_add_test(tc_neg, getdns_display_ip_address_2);
|
||||
suite_add_tcase(s, tc_neg);
|
||||
|
||||
/* Positive test cases */
|
||||
TCase *tc_pos = tcase_create("Positive");
|
||||
tcase_add_test(tc_pos, getdns_display_ip_address_3);
|
||||
tcase_add_test(tc_pos, getdns_display_ip_address_4);
|
||||
suite_add_tcase(s, tc_pos);
|
||||
|
||||
return s;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue