mirror of https://github.com/getdnsapi/getdns.git
alter address_sync -> address
This commit is contained in:
parent
2151f55013
commit
61ce95cc7a
|
@ -13,7 +13,7 @@
|
||||||
#include "check_getdns_context_create.h"
|
#include "check_getdns_context_create.h"
|
||||||
#include "check_getdns_context_destroy.h"
|
#include "check_getdns_context_destroy.h"
|
||||||
#include "check_getdns_cancel_callback.h"
|
#include "check_getdns_cancel_callback.h"
|
||||||
#include "check_getdns_address_sync.h"
|
#include "check_getdns_address.h"
|
||||||
#include "check_getdns_list_get_length.h"
|
#include "check_getdns_list_get_length.h"
|
||||||
#include "check_getdns_list_get_data_type.h"
|
#include "check_getdns_list_get_data_type.h"
|
||||||
#include "check_getdns_list_get_dict.h"
|
#include "check_getdns_list_get_dict.h"
|
||||||
|
@ -34,6 +34,8 @@
|
||||||
#include "check_getdns_convert_ulabel_to_alabel.h"
|
#include "check_getdns_convert_ulabel_to_alabel.h"
|
||||||
#include "check_getdns_convert_alabel_to_ulabel.h"
|
#include "check_getdns_convert_alabel_to_ulabel.h"
|
||||||
#include "check_getdns_pretty_print_dict.h"
|
#include "check_getdns_pretty_print_dict.h"
|
||||||
|
#include "check_getdns_display_ip_address.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
|
@ -68,6 +70,7 @@ main (void)
|
||||||
Suite *getdns_convert_ulabel_to_alabel_suite(void);
|
Suite *getdns_convert_ulabel_to_alabel_suite(void);
|
||||||
Suite *getdns_convert_alabel_to_ulabel_suite(void);
|
Suite *getdns_convert_alabel_to_ulabel_suite(void);
|
||||||
Suite *getdns_pretty_print_dict_suite(void);
|
Suite *getdns_pretty_print_dict_suite(void);
|
||||||
|
Suite *getdns_display_ip_address_suite(void);
|
||||||
|
|
||||||
sr = srunner_create(getdns_general_suite());
|
sr = srunner_create(getdns_general_suite());
|
||||||
srunner_add_suite(sr, getdns_general_sync_suite());
|
srunner_add_suite(sr, getdns_general_sync_suite());
|
||||||
|
@ -95,6 +98,7 @@ main (void)
|
||||||
srunner_add_suite(sr, getdns_convert_ulabel_to_alabel_suite());
|
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_convert_alabel_to_ulabel_suite());
|
||||||
srunner_add_suite(sr, getdns_pretty_print_dict_suite());
|
srunner_add_suite(sr, getdns_pretty_print_dict_suite());
|
||||||
|
srunner_add_suite(sr, getdns_display_ip_address_suite());
|
||||||
|
|
||||||
srunner_set_log(sr, "check_getdns.log");
|
srunner_set_log(sr, "check_getdns.log");
|
||||||
srunner_run_all(sr, CK_NORMAL);
|
srunner_run_all(sr, CK_NORMAL);
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
#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 *
|
* T E S T S F O R G E T D N S _ A D D R E S S *
|
||||||
* *
|
* *
|
||||||
**************************************************************************
|
***************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_1)
|
START_TEST (getdns_address_1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* context = NULL
|
* context = NULL
|
||||||
|
@ -18,12 +18,12 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *response = NULL;
|
struct getdns_dict *response = NULL;
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
ASSERT_RC(getdns_address(context, "google.com", NULL, &response),
|
||||||
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_address()");
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_2)
|
START_TEST (getdns_address_2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = NULL
|
* name = NULL
|
||||||
|
@ -34,14 +34,34 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, NULL, NULL, &response),
|
ASSERT_RC(getdns_address(context, NULL, NULL, &response),
|
||||||
GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_address()");
|
||||||
|
|
||||||
CONTEXT_DESTROY;
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (getdns_address_3)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* name = invalid domain (too many octets)
|
||||||
|
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||||
|
*/
|
||||||
|
struct getdns_context *context = 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";
|
||||||
|
|
||||||
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
|
ASSERT_RC(getdns_address(context, name, NULL, &response),
|
||||||
|
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_address()");
|
||||||
|
|
||||||
|
CONTEXT_DESTROY;
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_3)
|
START_TEST (getdns_address_4)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = invalid domain (label too long)
|
* name = invalid domain (label too long)
|
||||||
|
@ -53,14 +73,14 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
ASSERT_RC(getdns_address(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()");
|
||||||
|
|
||||||
CONTEXT_DESTROY;
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_4)
|
START_TEST (getdns_address_5)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* response = NULL
|
* response = NULL
|
||||||
|
@ -70,14 +90,14 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, NULL),
|
ASSERT_RC(getdns_address(context, "google.com", NULL, NULL),
|
||||||
GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_address()");
|
||||||
|
|
||||||
CONTEXT_DESTROY;
|
CONTEXT_DESTROY;
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_5)
|
START_TEST (getdns_address_6)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "google.com"
|
* name = "google.com"
|
||||||
|
@ -92,8 +112,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
ASSERT_RC(getdns_address(context, "google.com", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -103,7 +123,7 @@
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_6)
|
START_TEST (getdns_address_7)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "localhost"
|
* name = "localhost"
|
||||||
|
@ -119,8 +139,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "localhost", NULL, &response),
|
ASSERT_RC(getdns_address(context, "localhost", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -130,7 +150,7 @@
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_7)
|
START_TEST (getdns_address_8)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "google.joe"
|
* name = "google.joe"
|
||||||
|
@ -147,8 +167,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.joe", NULL, &response),
|
ASSERT_RC(getdns_address(context, "google.joe", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -160,7 +180,7 @@
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_8)
|
START_TEST (getdns_address_9)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "hampster.com" need to replace this with domain from unbound zone
|
* name = "hampster.com" need to replace this with domain from unbound zone
|
||||||
|
@ -174,8 +194,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "hampster.com", NULL, &response),
|
ASSERT_RC(getdns_address(context, "hampster.com", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -185,7 +205,7 @@
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_9)
|
START_TEST (getdns_address_10)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "google.com" need to swap this out for max domain name length with max lable length`
|
* name = "google.com" need to swap this out for max domain name length with max lable length`
|
||||||
|
@ -199,8 +219,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
ASSERT_RC(getdns_address(context, "google.com", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -211,7 +231,7 @@
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_10)
|
START_TEST (getdns_address_11)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "75.101.146.66" need to change this to local unbound data
|
* name = "75.101.146.66" need to change this to local unbound data
|
||||||
|
@ -226,8 +246,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "75.101.146.66", NULL, &response),
|
ASSERT_RC(getdns_address(context, "75.101.146.66", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -239,7 +259,7 @@
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (getdns_address_sync_11)
|
START_TEST (getdns_address_12)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* name = "2607:f8b0:4006:802::1007" need to change this to local unbound data
|
* name = "2607:f8b0:4006:802::1007" need to change this to local unbound data
|
||||||
|
@ -254,8 +274,8 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "2607:f8b0:4006:802::1007", NULL, &response),
|
ASSERT_RC(getdns_address(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()");
|
||||||
|
|
||||||
EXTRACT_RESPONSE;
|
EXTRACT_RESPONSE;
|
||||||
|
|
||||||
|
@ -268,27 +288,28 @@
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
Suite *
|
Suite *
|
||||||
getdns_address_sync_suite (void)
|
getdns_address_suite (void)
|
||||||
{
|
{
|
||||||
Suite *s = suite_create ("getdns_address_sync()");
|
Suite *s = suite_create ("getdns_address()");
|
||||||
|
|
||||||
/* Negative test caseis */
|
/* Negative test caseis */
|
||||||
TCase *tc_neg = tcase_create("Negative");
|
TCase *tc_neg = tcase_create("Negative");
|
||||||
tcase_add_test(tc_neg, getdns_address_sync_1);
|
tcase_add_test(tc_neg, getdns_address_1);
|
||||||
tcase_add_test(tc_neg, getdns_address_sync_2);
|
tcase_add_test(tc_neg, getdns_address_2);
|
||||||
tcase_add_test(tc_neg, getdns_address_sync_3);
|
tcase_add_test(tc_neg, getdns_address_3);
|
||||||
tcase_add_test(tc_neg, getdns_address_sync_4);
|
tcase_add_test(tc_neg, getdns_address_4);
|
||||||
tcase_add_test(tc_neg, getdns_address_sync_5);
|
tcase_add_test(tc_neg, getdns_address_5);
|
||||||
|
tcase_add_test(tc_neg, getdns_address_6);
|
||||||
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_address_sync_6);
|
tcase_add_test(tc_pos, getdns_address_7);
|
||||||
tcase_add_test(tc_pos, getdns_address_sync_7);
|
tcase_add_test(tc_pos, getdns_address_8);
|
||||||
tcase_add_test(tc_pos, getdns_address_sync_8);
|
tcase_add_test(tc_pos, getdns_address_9);
|
||||||
tcase_add_test(tc_pos, getdns_address_sync_9);
|
tcase_add_test(tc_pos, getdns_address_10);
|
||||||
tcase_add_test(tc_pos, getdns_address_sync_10);
|
tcase_add_test(tc_pos, getdns_address_11);
|
||||||
tcase_add_test(tc_pos, getdns_address_sync_11);
|
tcase_add_test(tc_pos, getdns_address_12);
|
||||||
suite_add_tcase(s, tc_pos);
|
suite_add_tcase(s, tc_pos);
|
||||||
|
|
||||||
return s;
|
return s;
|
Loading…
Reference in New Issue