#include <utils_i18n.h>
#include <string.h>
-#define I18N_UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+#define I18N_UPRV_LENGTHOF(array) (int32_t)(sizeof(array) / sizeof((array)[0]))
static int ret = I18N_ERROR_NONE;
static i18n_uidna_h uidna;
/**
-* @function utc_capi_base_utils_uidna_startup
-* @description Called before each test
-* @parameter NA
-* @return NA
-*/
+ * @function utc_capi_base_utils_uidna_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
void utc_capi_base_utils_uidna_startup(void)
{
+ uidna = NULL;
+ ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
}
/**
-* @function utc_capi_base_utils_uidna_cleanup
-* @description Called after each test
-* @parameter NA
-* @return NA
-*/
+ * @function utc_capi_base_utils_uidna_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
void utc_capi_base_utils_uidna_cleanup(void)
{
- if (!uidna)
+ if (uidna != NULL)
+ {
i18n_uidna_destroy(uidna);
+ uidna = NULL;
+ }
}
/**
*/
int utc_capi_base_utils_i18n_uidna_label_to_ascii_p(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_ascii(uidna, fA_sharps16, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_label_to_ascii_n(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_ascii(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_label_to_unicode_p(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_unicode(uidna, fA_sharps16, i18n_ustring_get_length(fA_sharps16), dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_label_to_unicode_n(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_unicode(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_name_to_ascii_p(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_ascii(uidna, fA_sharps16, i18n_ustring_get_length(fA_sharps16), dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_name_to_ascii_n(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_ascii(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_name_to_unicode_p(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode(uidna, fA_sharps16, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_name_to_unicode_n(void)
{
- static const i18n_uchar fA_sharps16[] = { 0x66, 0x41, 0xdf, 0 };
+ static const i18n_uchar fA_sharps16[] = {0x66, 0x41, 0xdf, 0};
i18n_uchar dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_label_to_ascii_UTF8_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_ascii_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_label_to_ascii_UTF8_n(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_ascii_UTF8(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_label_to_unicode_UTF8_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_unicode_UTF8(uidna, fA_sharps8, (int32_t)strlen(fA_sharps8), dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_label_to_unicode_UTF8_n(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_label_to_unicode_UTF8(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_name_to_ascii_UTF8_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_ascii_UTF8(uidna, fA_sharps8, (int32_t)strlen(fA_sharps8), dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_name_to_ascii_UTF8_n(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_ascii_UTF8(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_name_to_unicode_UTF8_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
assert_eq(length, 4);
*/
int utc_capi_base_utils_i18n_uidna_name_to_unicode_UTF8_n(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, NULL, -3, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_uidna_info_get_is_trans_different_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
*/
int utc_capi_base_utils_i18n_uidna_info_get_is_trans_different_n(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
*/
int utc_capi_base_utils_i18n_uidna_info_get_errors_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
*/
int utc_capi_base_utils_i18n_uidna_info_get_errors_n(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
*/
int utc_capi_base_utils_i18n_uidna_info_destroy_p(void)
{
- static const char fA_sharps8[] = { 0x66, 0x41, (char)0xc3, (char)0x9f, 0 };
+ static const char fA_sharps8[] = {0x66, 0x41, (char)0xc3, (char)0x9f, 0};
char dest[10];
i18n_uidna_info_h info;
int32_t length;
- ret = i18n_uidna_create(I18N_UIDNA_DEFAULT, &uidna);
- assert_eq(ret, I18N_ERROR_NONE);
-
ret = i18n_uidna_name_to_unicode_UTF8(uidna, fA_sharps8, -1, dest, I18N_UPRV_LENGTHOF(dest), &info, &length);
assert_eq(ret, I18N_ERROR_NONE);
return 0;
}
-