mirror of https://github.com/getdnsapi/getdns.git
update convert_alabel_to_ulabel convert_alabel_to_ulabel
This commit is contained in:
parent
fd4ca9d919
commit
e854db5a94
|
@ -27,6 +27,8 @@
|
|||
#include "check_getdns_dict_set_list.h"
|
||||
#include "check_getdns_dict_set_bindata.h"
|
||||
#include "check_getdns_dict_set_int.h"
|
||||
#include "check_getdns_convert_ulabel_to_alabel.h"
|
||||
//#include "check_getdns_convert_alabel_to_ulabel.h"
|
||||
|
||||
int
|
||||
main (void)
|
||||
|
@ -53,6 +55,8 @@ main (void)
|
|||
Suite *getdns_dict_set_list_suite(void);
|
||||
Suite *getdns_dict_set_bindata_suite(void);
|
||||
Suite *getdns_dict_set_int_suite(void);
|
||||
Suite *getdns_convert_ulabel_to_alabel_suite(void);
|
||||
//Suite *getdns_convert_alabel_to_ulabel_suite(void);
|
||||
|
||||
sr = srunner_create(getdns_general_suite());
|
||||
srunner_add_suite(sr, getdns_general_sync_suite());
|
||||
|
@ -73,6 +77,8 @@ main (void)
|
|||
srunner_add_suite(sr, getdns_dict_set_list_suite());
|
||||
srunner_add_suite(sr, getdns_dict_set_bindata_suite());
|
||||
srunner_add_suite(sr, getdns_dict_set_int_suite());
|
||||
srunner_add_suite(sr, getdns_convert_ulabel_to_alabel_suite());
|
||||
//srunner_add_suite(sr, getdns_convert_alabel_to_ulabel_suite());
|
||||
|
||||
srunner_set_log(sr, "check_getdns.log");
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
|
|
|
@ -15,13 +15,38 @@
|
|||
* ulabel = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
ulabel = null;
|
||||
char alabel = NULL;
|
||||
|
||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *ulabel ),
|
||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *alabel ),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_alabel_to_ulabel()");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_convert_alabel_to_ulabel_2)
|
||||
{
|
||||
/*
|
||||
* alabel = invalid characters
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
char alabel = "#$%_";
|
||||
|
||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *alabel ),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_alabel_to_ulabel()");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_convert_alabel_to_ulabel_3)
|
||||
{
|
||||
/*
|
||||
* alabel = valid characters (ace must begin with prefix "xn--" and be followed by a valid puny algorithm output; length limited to 59 chars)
|
||||
* expect: GETDNS_RETURN_GOOD
|
||||
*/
|
||||
char alabel = "xn--caf-dma";
|
||||
|
||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *alabel ),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_convert_alabel_to_ulabel()");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
Suite *
|
||||
getdns_convert_alabel_to_ulabel_suite (void)
|
||||
|
|
|
@ -1,42 +1,67 @@
|
|||
#ifndef _check_getdns_convert_alabel_to_ulabel_h_
|
||||
#define _check_getdns_convert_alabel_to_ulabel_h_
|
||||
#ifndef _check_getdns_convert_ulabel_to_alabel_h_
|
||||
#define _check_getdns_convert_ulabel_to_alabel_h_
|
||||
|
||||
/*
|
||||
*************************************************************************************
|
||||
* *
|
||||
* T E S T S F O R G E T D N S _ C O N V E R T _ A L A B E L _ T O _ U L A B E L *
|
||||
* T E S T S F O R G E T D N S _ C O N V E R T _ U L A B E L _ T O _ A L A B E L *
|
||||
* *
|
||||
*************************************************************************************
|
||||
*/
|
||||
|
||||
START_TEST (getdns_convert_alabel_to_ulabel_1)
|
||||
START_TEST (getdns_convert_ulabel_to_alabel_1)
|
||||
{
|
||||
/*
|
||||
* ulabel = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
ulabel = null;
|
||||
char ulabel = NULL;
|
||||
|
||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *ulabel ),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_alabel_to_ulabel()");
|
||||
ASSERT_RC(getdns_convert_ulabel_to_alabel( *ulabel ),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_ulabel_to_alabel()");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_convert_ulabel_to_alabel_2)
|
||||
{
|
||||
/*
|
||||
* ulabel = invalid characters
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
char ulabel = "#$%_";
|
||||
|
||||
ASSERT_RC(getdns_convert_ulabel_to_alabel( *ulabel ),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_ulabel_to_alabel()");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_convert_ulabel_to_alabel_3)
|
||||
{
|
||||
/*
|
||||
* ulabel = valid characters ( _abc, -abc, -abc-, abc- and limited to 63 octets )
|
||||
* expect: GETDNS_RETURN_GOOD
|
||||
*/
|
||||
char ulabel = "café";
|
||||
|
||||
ASSERT_RC(getdns_convert_ulabel_to_alabel( *ulabel ),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_convert_ulabel_to_alabel()");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
Suite *
|
||||
getdns_convert_alabel_to_ulabel_suite (void)
|
||||
getdns_convert_ulabel_to_alabel_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("getdns_convert_alabel_to_ulabel()");
|
||||
Suite *s = suite_create ("getdns_convert_ulabel_to_alabel()");
|
||||
|
||||
/* Negative test caseis */
|
||||
TCase *tc_neg = tcase_create("Negative");
|
||||
tcase_add_test(tc_neg, getdns_convert_alabel_to_ulabel_1);
|
||||
tcase_add_test(tc_neg, getdns_convert_alabel_to_ulabel_2);
|
||||
tcase_add_test(tc_neg, getdns_convert_ulabel_to_alabel_1);
|
||||
tcase_add_test(tc_neg, getdns_convert_ulabel_to_alabel_2);
|
||||
suite_add_tcase(s, tc_neg);
|
||||
|
||||
/* Positive test cases */
|
||||
TCase *tc_pos = tcase_create("Positive");
|
||||
tcase_add_test(tc_pos, getdns_convert_alabel_to_ulabel_3);
|
||||
tcase_add_test(tc_pos, getdns_convert_ulabel_to_alabel_3);
|
||||
suite_add_tcase(s, tc_pos);
|
||||
|
||||
return s;
|
||||
|
|
Loading…
Reference in New Issue