{"utc_capi_base_utils_i18n_ubrk_get_rule_status_vec_n", utc_capi_base_utils_i18n_ubrk_get_rule_status_vec_n, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_p", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_p, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
+ {"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p", utc_capi_base_utils_i18n_uchar_get_int_property_value_p, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p2", utc_capi_base_utils_i18n_uchar_get_int_property_value_p2, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p3", utc_capi_base_utils_i18n_uchar_get_int_property_value_p3, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_rule_status_vec_n", utc_capi_base_utils_i18n_ubrk_get_rule_status_vec_n, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_p", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_p, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
+ {"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p", utc_capi_base_utils_i18n_uchar_get_int_property_value_p, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p2", utc_capi_base_utils_i18n_uchar_get_int_property_value_p2, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p3", utc_capi_base_utils_i18n_uchar_get_int_property_value_p3, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_rule_status_vec_n", utc_capi_base_utils_i18n_ubrk_get_rule_status_vec_n, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_p", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_p, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
+ {"utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2", utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2, utc_capi_base_utils_ubrk_startup, utc_capi_base_utils_ubrk_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p", utc_capi_base_utils_i18n_uchar_get_int_property_value_p, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p2", utc_capi_base_utils_i18n_uchar_get_int_property_value_p2, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
{"utc_capi_base_utils_i18n_uchar_get_int_property_value_p3", utc_capi_base_utils_i18n_uchar_get_int_property_value_p3, utc_capi_base_utils_uchar_startup, utc_capi_base_utils_uchar_cleanup},
*/
void utc_capi_base_utils_ubrk_startup(void)
{
- _text = (i18n_uchar*)calloc(strlen(text) + 1, sizeof(i18n_uchar));
+ _text = (i18n_uchar *)calloc(strlen(text) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_text, text);
ret = i18n_ubrk_create(I18N_UBRK_WORD, locale, _text, -1, &ubrk);
*/
void utc_capi_base_utils_ubrk_cleanup(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
*/
int utc_capi_base_utils_i18n_ubrk_create_p2(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
*/
int utc_capi_base_utils_i18n_ubrk_create_p3(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
*/
int utc_capi_base_utils_i18n_ubrk_create_p4(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
*/
int utc_capi_base_utils_i18n_ubrk_create_rules_p(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
"[0-5]{500}; \n"
"!.*;\n";
- i18n_uchar *_rules = (i18n_uchar*)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
+ i18n_uchar *_rules = (i18n_uchar *)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_rules, rules);
i18n_uparse_error_s parse_err;
*/
int utc_capi_base_utils_i18n_ubrk_create_rules_n2(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
"[0-5]{500}; \n"
"!.*;\n";
- i18n_uchar *_rules = (i18n_uchar*)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
+ i18n_uchar *_rules = (i18n_uchar *)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_rules, rules);
i18n_uparse_error_s parse_err;
*/
int utc_capi_base_utils_i18n_ubrk_create_rules_n3(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
"[0-5]{500}; \n"
"!.*;\n";
- i18n_uchar *_rules = (i18n_uchar*)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
+ i18n_uchar *_rules = (i18n_uchar *)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_rules, rules);
i18n_uparse_error_s parse_err;
*/
int utc_capi_base_utils_i18n_ubrk_create_rules_n4(void)
{
- if(NULL != ubrk) {
+ if (NULL != ubrk)
+ {
i18n_ubrk_destroy(ubrk);
ubrk = NULL;
}
"[0-5]{500}; \n"
"!.*;\n";
- i18n_uchar *_rules = (i18n_uchar*)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
+ i18n_uchar *_rules = (i18n_uchar *)calloc(strlen(rules) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_rules, rules);
i18n_uparse_error_s parse_err;
"[\\p{L}]{300}; \n"
"[\\p{N}]{400}; \n"
"[0-5]{500}; \n"
- "!.*;\n", rule_string_length);
+ "!.*;\n",
+ rule_string_length);
const int32_t test_string_length = 25;
i18n_uchar testString[test_string_length];
i18n_uchar rules[rule_string_length];
i18n_ustring_copy_ua_n(rules, "[A-N]{100}; \n"
- "[a-w]{200}; \n"
- "[\\p{L}]{300}; \n"
- "[\\p{N}]{400}; \n"
- "[0-5]{500}; \n"
- "!.*;\n", rule_string_length);
+ "[a-w]{200}; \n"
+ "[\\p{L}]{300}; \n"
+ "[\\p{N}]{400}; \n"
+ "[0-5]{500}; \n"
+ "!.*;\n",
+ rule_string_length);
const int32_t test_string_length = 25;
i18n_uchar testString[test_string_length];
*/
static int _loccmp(const char *string, const char *prefix)
{
- if(NULL == string || NULL == prefix) {
+ if (NULL == string || NULL == prefix)
+ {
return -3;
}
/* 'root' is less than everything */
- if(strcmp(prefix, "root") == 0) {
+ if (strcmp(prefix, "root") == 0)
+ {
return (strcmp(string, "root") == 0) ? 0 : 1;
}
int32_t prefix_len = (int32_t)strlen(prefix);
int32_t compare = strncmp(string, prefix, prefix_len);
- if(compare)
+ if (compare)
return -1;
- if(string_len == prefix_len)
+ if (string_len == prefix_len)
return 0;
- if(string[prefix_len] == '_')
+ if (string[prefix_len] == '_')
return 1;
return -2; // false match, e.g. "en_USX" compared with "en_US"
}
return 0;
}
+
+/**
+ * @testcase utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2
+ * @since_tizen 2.3
+ * @description Gets locale of specified type from invalid locale data type.
+ * @scenario Pass NULL as the break iterator and expects fail.
+ */
+int utc_capi_base_utils_i18n_ubrk_get_locale_by_type_n2(void)
+{
+ assert_eq(ret, I18N_ERROR_NONE);
+ assert_neq(ubrk, NULL);
+
+ const char *locale = "ar_KW_ABDALI";
+ ret = i18n_ubrk_create(I18N_UBRK_WORD, locale, _text, strlen(text), &ubrk);
+ assert_eq(ret, I18N_ERROR_NONE);
+ assert_neq(ubrk, NULL);
+
+ const char *actual = i18n_ubrk_get_locale_by_type(ubrk, I18N_ULOCALE_DATA_LOCALE_TYPE_LIMIT + 1);
+ ret = get_last_result();
+ assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
\ No newline at end of file