mirror of https://github.com/getdnsapi/getdns.git
final convert_alabel_to_ulabel.h convert_ulabel_to_alabel.h
This commit is contained in:
parent
e854db5a94
commit
8782569d45
|
@ -28,7 +28,7 @@
|
||||||
#include "check_getdns_dict_set_bindata.h"
|
#include "check_getdns_dict_set_bindata.h"
|
||||||
#include "check_getdns_dict_set_int.h"
|
#include "check_getdns_dict_set_int.h"
|
||||||
#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"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
|
@ -56,7 +56,7 @@ main (void)
|
||||||
Suite *getdns_dict_set_bindata_suite(void);
|
Suite *getdns_dict_set_bindata_suite(void);
|
||||||
Suite *getdns_dict_set_int_suite(void);
|
Suite *getdns_dict_set_int_suite(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);
|
||||||
|
|
||||||
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());
|
||||||
|
@ -78,7 +78,7 @@ main (void)
|
||||||
srunner_add_suite(sr, getdns_dict_set_bindata_suite());
|
srunner_add_suite(sr, getdns_dict_set_bindata_suite());
|
||||||
srunner_add_suite(sr, getdns_dict_set_int_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_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_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);
|
||||||
|
|
|
@ -12,13 +12,14 @@
|
||||||
START_TEST (getdns_convert_alabel_to_ulabel_1)
|
START_TEST (getdns_convert_alabel_to_ulabel_1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* ulabel = NULL
|
* alabel = NULL
|
||||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||||
*/
|
*/
|
||||||
char alabel = NULL;
|
char *alabel = NULL;
|
||||||
|
|
||||||
|
ck_assert_msg(strcmp( getdns_convert_alabel_to_ulabel( alabel ), "nil" ) == 0,
|
||||||
|
"Was not expecting %s from getdns_convert_alabel_to_ulabel()", getdns_convert_alabel_to_ulabel( alabel ) );
|
||||||
|
|
||||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *alabel ),
|
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_alabel_to_ulabel()");
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -28,10 +29,12 @@
|
||||||
* alabel = invalid characters
|
* alabel = invalid characters
|
||||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||||
*/
|
*/
|
||||||
char alabel = "#$%_";
|
char *alabel = "#$%_";
|
||||||
|
|
||||||
|
ck_assert_msg(strcmp( getdns_convert_alabel_to_ulabel( alabel ), "#$%_" ) == 0,
|
||||||
|
"Was not expecting %s from getdns_convert_alabel_to_ulabel()", getdns_convert_alabel_to_ulabel( alabel ) );
|
||||||
|
|
||||||
|
|
||||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *alabel ),
|
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_alabel_to_ulabel()");
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -41,10 +44,11 @@
|
||||||
* alabel = valid characters (ace must begin with prefix "xn--" and be followed by a valid puny algorithm output; length limited to 59 chars)
|
* 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
|
* expect: GETDNS_RETURN_GOOD
|
||||||
*/
|
*/
|
||||||
char alabel = "xn--caf-dma";
|
char *alabel = "xn--caf-dma";
|
||||||
|
|
||||||
|
ck_assert_msg(strcmp( getdns_convert_alabel_to_ulabel( alabel ), "café" ) == 0,
|
||||||
|
"Was not expecting %s from getdns_convert_alabel_to_ulabel()", getdns_convert_alabel_to_ulabel( alabel ) );
|
||||||
|
|
||||||
ASSERT_RC(getdns_convert_alabel_to_ulabel( *alabel ),
|
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_convert_alabel_to_ulabel()");
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
* ulabel = NULL
|
* ulabel = NULL
|
||||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||||
*/
|
*/
|
||||||
char ulabel = NULL;
|
char *ulabel = NULL;
|
||||||
|
|
||||||
ASSERT_RC(getdns_convert_ulabel_to_alabel( *ulabel ),
|
ck_assert_msg(strcmp( getdns_convert_ulabel_to_alabel( ulabel ), "nil" ) == 0,
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_ulabel_to_alabel()");
|
"Was not expecting %s from getdns_convert_ulabel_to_alabel()", getdns_convert_ulabel_to_alabel( ulabel ) );
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@
|
||||||
* ulabel = invalid characters
|
* ulabel = invalid characters
|
||||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||||
*/
|
*/
|
||||||
char ulabel = "#$%_";
|
char *ulabel = "#$%_";
|
||||||
|
|
||||||
ASSERT_RC(getdns_convert_ulabel_to_alabel( *ulabel ),
|
ck_assert_msg(strcmp( getdns_convert_ulabel_to_alabel( ulabel ), "#$%_" ) == 0,
|
||||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_convert_ulabel_to_alabel()");
|
"Was not expecting %s from getdns_convert_ulabel_to_alabel()", getdns_convert_ulabel_to_alabel( ulabel ) );
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -41,10 +41,11 @@
|
||||||
* ulabel = valid characters ( _abc, -abc, -abc-, abc- and limited to 63 octets )
|
* ulabel = valid characters ( _abc, -abc, -abc-, abc- and limited to 63 octets )
|
||||||
* expect: GETDNS_RETURN_GOOD
|
* expect: GETDNS_RETURN_GOOD
|
||||||
*/
|
*/
|
||||||
char ulabel = "café";
|
char *ulabel = "café";
|
||||||
|
|
||||||
|
ck_assert_msg(strcmp( getdns_convert_ulabel_to_alabel( ulabel ), "xn--caf-dma" ) == 0,
|
||||||
|
"Was not expecting %s from getdns_convert_ulabel_to_alabel()", getdns_convert_ulabel_to_alabel( ulabel ) );
|
||||||
|
|
||||||
ASSERT_RC(getdns_convert_ulabel_to_alabel( *ulabel ),
|
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_convert_ulabel_to_alabel()");
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue