static int ret = I18N_ERROR_NONE;
static i18n_unumber_format_h num_format = NULL;
-static i18n_uchar test_variable[] = { '1', ',', '9', '9', '4', 0x00 };
-static i18n_uchar test_variable2[] = { '-', '1', ',', '9', '9', '4', 0x00 };
-static i18n_uchar test_variable3[] = { '-', '6', '4', '3', 0x00 };
-static i18n_uchar test_variable4[] = { '2', ',', '0', '1', '4', 0x00 };
-static i18n_uchar test_variable5[] = { '-', '2', ',', '0', '1', '4', 0x00 };
+static i18n_uchar test_variable[] = {'1', ',', '9', '9', '4', 0x00};
+static i18n_uchar test_variable2[] = {'-', '1', ',', '9', '9', '4', 0x00};
+static i18n_uchar test_variable3[] = {'-', '6', '4', '3', 0x00};
+static i18n_uchar test_variable4[] = {'2', ',', '0', '1', '4', 0x00};
+static i18n_uchar test_variable5[] = {'-', '2', ',', '0', '1', '4', 0x00};
/**
* @function utc_capi_base_utils_unumber_startup
*/
void utc_capi_base_utils_unumber_cleanup(void)
{
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
}
*/
int utc_capi_base_utils_i18n_unumber_create_p(void)
{
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
i18n_unumber_format_style_e style = I18N_UNUMBER_PATTERN_DECIMAL;
- i18n_uchar pattern[5] = { '#', ',', '#', '#', 0 };
+ i18n_uchar pattern[5] = {'#', ',', '#', '#', 0};
- for(; style <= I18N_UNUMBER_PATTERN_RULEBASED; style++) {
+ for (; style <= I18N_UNUMBER_PATTERN_RULEBASED; style++)
+ {
ret = i18n_unumber_create(style, pattern, -1, NULL, NULL, &num_format);
assert_eq(ret, I18N_ERROR_NONE);
}
i18n_uchar buffer[BUF_SIZE];
int len_symbol = 0;
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
- for(; style <= I18N_UNUMBER_SCIENTIFIC; style++) {
+ for (; style <= I18N_UNUMBER_SCIENTIFIC; style++)
+ {
ret = i18n_unumber_create(style, NULL, -1, I18N_ULOCALE_US, NULL, &num_format);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
i18n_unumber_format_symbol_e symbol = I18N_UNUMBER_DECIMAL_SEPARATOR_SYMBOL;
- for(; symbol < I18N_UNUMBER_FORMAT_SYMBOL_COUNT; symbol++) {
+ for (; symbol < I18N_UNUMBER_FORMAT_SYMBOL_COUNT; symbol++)
+ {
ret = i18n_unumber_get_symbol(num_format, symbol, buffer, BUF_SIZE, &len_symbol);
assert_eq(ret, I18N_ERROR_NONE);
assert_geq(len_symbol, 0);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_error_code_e status = I18N_ERROR_NONE;
i18n_unumber_format(num_format, 1994, result, BUF_SIZE, NULL, &status);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_error_code_e status = I18N_ERROR_NONE;
i18n_unumber_format(num_format, -643, result, BUF_SIZE, NULL, &status);
*/
int utc_capi_base_i18n_unumber_format_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_error_code_e status = I18N_ERROR_NONE;
i18n_unumber_format(NULL, 1994, result, BUF_SIZE, NULL, &status);
*/
int utc_capi_base_i18n_unumber_format_n3(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_error_code_e status = I18N_ERROR_NONE;
i18n_unumber_format(num_format, 1994, result, -1, NULL, &status);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_int64(num_format, 1994, result, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_int64(num_format, -1994, result, BUF_SIZE, NULL);
*/
int utc_capi_base_utils_i18n_unumber_format_int64_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_int64(NULL, 1994, result, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_int64(num_format, 1994, result, -1, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_double(num_format, 2014.0, result, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_double(num_format, -2014.0, result, BUF_SIZE, NULL);
*/
int utc_capi_base_utils_i18n_unumber_format_double_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_double(NULL, 2014.0, result, BUF_SIZE, NULL);
ret = get_last_result();
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_double(num_format, 2014.0, result, -1, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_decimal(num_format, "2014.0", 6, result, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_decimal(num_format, "-2014.0", 7, result, BUF_SIZE, NULL);
*/
int utc_capi_base_utils_i18n_unumber_format_decimal_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_decimal(NULL, "2014.0", 6, result, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_decimal(num_format, NULL, 6, result, BUF_SIZE, NULL);
*/
int utc_capi_base_utils_i18n_unumber_format_decimal_n4(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_decimal(num_format, "2014.0", 6, result, -1, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
const char *currency = "USD";
i18n_uchar *_currency = NULL;
- _currency = (i18n_uchar*)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
+ _currency = (i18n_uchar *)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_currency, currency);
i18n_unumber_format_double_currency(num_format, 2014.0, _currency, result, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
const char *currency = "USD";
i18n_uchar *_currency = NULL;
- _currency = (i18n_uchar*)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
+ _currency = (i18n_uchar *)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_currency, currency);
i18n_unumber_format_double_currency(num_format, 2014.0, _currency, result, BUF_SIZE, NULL);
*/
int utc_capi_base_utils_i18n_unumber_format_double_currency_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
const char *currency = "USD";
i18n_uchar *_currency = NULL;
- _currency = (i18n_uchar*)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
+ _currency = (i18n_uchar *)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_currency, currency);
i18n_unumber_format_double_currency(NULL, 2014.0, _currency, result, BUF_SIZE, NULL);
const char *currency = "USD";
i18n_uchar *_currency = NULL;
- _currency = (i18n_uchar*)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
+ _currency = (i18n_uchar *)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_currency, currency);
i18n_unumber_format_double_currency(num_format, 2014.0, _currency, NULL, BUF_SIZE, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
const char *currency = "USD";
i18n_uchar *_currency = NULL;
- _currency = (i18n_uchar*)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
+ _currency = (i18n_uchar *)calloc(strlen(currency) + 1, sizeof(i18n_uchar));
i18n_ustring_copy_ua(_currency, currency);
i18n_unumber_format_double_currency(num_format, 2014.0, _currency, result, -1, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- const i18n_uchar text[] = { '2', '3', '2', '3', '1', '0', 0x00 };
+ const i18n_uchar text[] = {'2', '3', '2', '3', '1', '0', 0x00};
int32_t value = i18n_unumber_parse(num_format, text, i18n_ustring_get_length(text), NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- const i18n_uchar text[] = { '-', '2', '3', '2', '3', '1', '0', 0x00 };
+ const i18n_uchar text[] = {'-', '2', '3', '2', '3', '1', '0', 0x00};
int32_t value = i18n_unumber_parse(num_format, text, i18n_ustring_get_length(text), NULL);
*/
int utc_capi_base_utils_i18n_unumber_parse_n(void)
{
- const i18n_uchar text[] = { '2', '3', '2', '3', '1', '0', 0x00 };
+ const i18n_uchar text[] = {'2', '3', '2', '3', '1', '0', 0x00};
i18n_unumber_parse(NULL, text, i18n_ustring_get_length(text), NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- const i18n_uchar text[] = { '2', '3', '2', '3', '1', '0', 0x00 };
+ const i18n_uchar text[] = {'2', '3', '2', '3', '1', '0', 0x00};
i18n_unumber_parse(num_format, NULL, i18n_ustring_get_length(text), NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- const i18n_uchar text[] = { '2', '3', '2', '3', '1', '0', 0x00 };
+ const i18n_uchar text[] = {'2', '3', '2', '3', '1', '0', 0x00};
i18n_unumber_parse(num_format, text, -2, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar parse_double[] = { '1', '2', '2', '3', '.', '1', '1', 0 };
+ i18n_uchar parse_double[] = {'1', '2', '2', '3', '.', '1', '1', 0};
int32_t len = i18n_ustring_get_length(parse_double);
double value = i18n_unumber_parse_double(num_format, parse_double, len, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar parse_double[] = { '-', '1', '2', '2', '3', '.', '1', '1', 0 };
+ i18n_uchar parse_double[] = {'-', '1', '2', '2', '3', '.', '1', '1', 0};
int32_t len = i18n_ustring_get_length(parse_double);
double value = i18n_unumber_parse_double(num_format, parse_double, len, NULL);
*/
int utc_capi_base_utils_i18n_unumber_parse_double_n(void)
{
- i18n_uchar parse_double[] = { '1', '2', '2', '3', '.', '1', '1', 0 };
+ i18n_uchar parse_double[] = {'1', '2', '2', '3', '.', '1', '1', 0};
int32_t len = i18n_ustring_get_length(parse_double);
i18n_unumber_parse_double(NULL, parse_double, len, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar parse_double[] = { '1', '2', '2', '3', '.', '1', '1', 0 };
+ i18n_uchar parse_double[] = {'1', '2', '2', '3', '.', '1', '1', 0};
i18n_unumber_parse_double(num_format, parse_double, -2, NULL);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- char result[BUF_SIZE] = { 0, };
+ char result[BUF_SIZE] = {
+ 0,
+ };
i18n_uchar *_text = NULL;
char *text = "12,345.678";
- _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);
int32_t _text_length = i18n_ustring_get_length(_text);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- char result[BUF_SIZE] = { 0, };
+ char result[BUF_SIZE] = {
+ 0,
+ };
i18n_uchar *_text = NULL;
char *text = ".1234";
- _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);
int32_t _text_length = i18n_ustring_get_length(_text);
*/
int utc_capi_base_utils_i18n_unumber_parse_decimal_n(void)
{
- char result[BUF_SIZE] = { 0, };
+ char result[BUF_SIZE] = {
+ 0,
+ };
i18n_uchar *_text = NULL;
char *text = "12,345,678.1234";
- _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);
int32_t _text_length = i18n_ustring_get_length(_text);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- char result[BUF_SIZE] = { 0, };
+ char result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_parse_decimal(num_format, NULL, 16, NULL, result, BUF_SIZE);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- char result[BUF_SIZE] = { 0, };
+ char result[BUF_SIZE] = {
+ 0,
+ };
i18n_uchar *_text = NULL;
char *text = "12,345,678.1234";
- _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);
i18n_unumber_parse_decimal(num_format, _text, -2, NULL, result, BUF_SIZE);
i18n_uchar *_text = NULL;
char *text = "12,345,678.1234";
- _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);
int32_t _text_length = i18n_ustring_get_length(_text);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- char result[BUF_SIZE] = { 0, };
+ char result[BUF_SIZE] = {
+ 0,
+ };
i18n_uchar *_text = NULL;
char *text = "12,345,678.1234";
- _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);
int32_t _text_length = i18n_ustring_get_length(_text);
int utc_capi_base_utils_i18n_unumber_parse_double_currency_p(void)
{
i18n_uchar *pattern = NULL;
- i18n_uchar currency[BUF_SIZE] = { 0, };
- i18n_uchar _text[] = { 0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0 };
+ i18n_uchar currency[BUF_SIZE] = {
+ 0,
+ };
+ i18n_uchar _text[] = {0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0};
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
int utc_capi_base_utils_i18n_unumber_parse_double_currency_p2(void)
{
i18n_uchar *pattern = NULL;
- i18n_uchar currency[BUF_SIZE] = { 0, };
- i18n_uchar _text[] = { 0x00A3, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0 };
+ i18n_uchar currency[BUF_SIZE] = {
+ 0,
+ };
+ i18n_uchar _text[] = {0x00A3, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0};
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
*/
int utc_capi_base_utils_i18n_unumber_parse_double_currency_n(void)
{
- i18n_uchar currency[BUF_SIZE] = { 0, };
- i18n_uchar _text[] = { 0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0 };
+ i18n_uchar currency[BUF_SIZE] = {
+ 0,
+ };
+ i18n_uchar _text[] = {0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0};
int32_t _text_length = i18n_ustring_get_length(_text);
i18n_unumber_parse_double_currency(NULL, _text, _text_length, NULL, currency);
int utc_capi_base_utils_i18n_unumber_parse_double_currency_n2(void)
{
i18n_uchar *pattern = NULL;
- i18n_uchar currency[BUF_SIZE] = { 0, };
+ i18n_uchar currency[BUF_SIZE] = {
+ 0,
+ };
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
int utc_capi_base_utils_i18n_unumber_parse_double_currency_n3(void)
{
i18n_uchar *pattern = NULL;
- i18n_uchar currency[BUF_SIZE] = { 0, };
- i18n_uchar _text[] = { 0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0 };
+ i18n_uchar currency[BUF_SIZE] = {
+ 0,
+ };
+ i18n_uchar _text[] = {0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0};
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
int utc_capi_base_utils_i18n_unumber_parse_double_currency_n4(void)
{
i18n_uchar *pattern = NULL;
- i18n_uchar _text[] = { 0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0 };
+ i18n_uchar _text[] = {0x0024, 0x0031, 0x0032, 0x002E, 0x0030, 0x0030, 0};
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
int utc_capi_base_utils_i18n_unumber_apply_pattern_p(void)
{
i18n_unumber_format_h num_format;
- i18n_uchar pattern1[4] = { '#', ',', '#', '#' };
+ i18n_uchar pattern1[4] = {'#', ',', '#', '#'};
int length1 = 4;
- i18n_uchar pattern2[8] = { '#', ',', '#', '#', ',', '#', '#', '#' };
+ i18n_uchar pattern2[8] = {'#', ',', '#', '#', ',', '#', '#', '#'};
int length2 = 8;
ret = i18n_unumber_create(I18N_UNUMBER_DECIMAL, pattern1, length1, I18N_ULOCALE_US, NULL, &num_format);
int utc_capi_base_utils_i18n_unumber_apply_pattern_p2(void)
{
i18n_unumber_format_h num_format;
- i18n_uchar pattern1[4] = { '#', ',', '#', '#' };
+ i18n_uchar pattern1[4] = {'#', ',', '#', '#'};
int length1 = 4;
- i18n_uchar pattern2[8] = { '#', ',', '#', '#', ',', '#', '#', '#' };
+ i18n_uchar pattern2[8] = {'#', ',', '#', '#', ',', '#', '#', '#'};
int length2 = 8;
ret = i18n_unumber_create(I18N_UNUMBER_DECIMAL, pattern1, length1, I18N_ULOCALE_US, NULL, &num_format);
int utc_capi_base_utils_i18n_unumber_apply_pattern_n(void)
{
i18n_unumber_format_h num_format;
- i18n_uchar pattern1[4] = { '#', ',', '#', '#' };
+ i18n_uchar pattern1[4] = {'#', ',', '#', '#'};
int length1 = 4;
- i18n_uchar pattern2[8] = { '#', ',', '#', '#', ',', '#', '#', '#' };
+ i18n_uchar pattern2[8] = {'#', ',', '#', '#', ',', '#', '#', '#'};
int length2 = 8;
ret = i18n_unumber_create(I18N_UNUMBER_DECIMAL, pattern1, length1, I18N_ULOCALE_US, NULL, &num_format);
int utc_capi_base_utils_i18n_unumber_apply_pattern_n2(void)
{
i18n_unumber_format_h num_format;
- i18n_uchar pattern1[4] = { '#', ',', '#', '#' };
+ i18n_uchar pattern1[4] = {'#', ',', '#', '#'};
int length1 = 4;
int length2 = 8;
int utc_capi_base_utils_i18n_unumber_apply_pattern_n3(void)
{
i18n_unumber_format_h num_format;
- i18n_uchar pattern1[4] = { '#', ',', '#', '#' };
+ i18n_uchar pattern1[4] = {'#', ',', '#', '#'};
int length1 = 4;
- i18n_uchar pattern2[8] = { '#', ',', '#', '#', ',', '#', '#', '#' };
+ i18n_uchar pattern2[8] = {'#', ',', '#', '#', ',', '#', '#', '#'};
ret = i18n_unumber_create(I18N_UNUMBER_DECIMAL, pattern1, length1, I18N_ULOCALE_US, NULL, &num_format);
assert_eq(ret, I18N_ERROR_NONE);
{
i18n_unumber_format_attribute_e attribute = I18N_UNUMBER_PARSE_INT_ONLY;
- for(; attribute <= I18N_UNUMBER_LENIENT_PARSE; attribute++) {
+ for (; attribute <= I18N_UNUMBER_LENIENT_PARSE; attribute++)
+ {
i18n_unumber_get_attribute(num_format, attribute);
ret = get_last_result();
assert_eq(ret, I18N_ERROR_NONE);
{
i18n_unumber_format_attribute_e attribute = I18N_UNUMBER_PARSE_INT_ONLY;
- for(; attribute <= I18N_UNUMBER_LENIENT_PARSE; attribute++) {
- if(I18N_UNUMBER_ROUNDING_INCREMENT != attribute) {
+ for (; attribute <= I18N_UNUMBER_LENIENT_PARSE; attribute++)
+ {
+ if (I18N_UNUMBER_ROUNDING_INCREMENT != attribute)
+ {
ret = i18n_unumber_set_attribute(num_format, attribute, 0);
assert_eq(ret, I18N_ERROR_NONE);
}
}
/**
+ * @testcase utc_capi_base_utils_i18n_unumber_set_attribute_n3
+ * @since_tizen 2.3.1
+ * @description Sets a numeric attribute associated with a number handle,
+ * passing invalid attribute, so the error is expected.
+ */
+int utc_capi_base_utils_i18n_unumber_set_attribute_n3(void)
+{
+ ret = i18n_unumber_set_attribute(num_format, I18N_UNUMBER_PADDING_POSITION, I18N_UNUMBER_PAD_AFTER_SUFFIX + 1);
+ assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+/**
* @testcase utc_capi_base_utils_i18n_unumber_get_double_attribute_p
* @since_tizen 2.3.1
* @description Gets a numeric attribute associated with a number.
{
assert_eq(ret, I18N_ERROR_NONE);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_text_attribute_e attribute = I18N_UNUMBER_POSITIVE_PREFIX;
- for(; attribute <= I18N_UNUMBER_CURRENCY_CODE; attribute++) {
+ for (; attribute <= I18N_UNUMBER_CURRENCY_CODE; attribute++)
+ {
i18n_unumber_get_text_attribute(num_format, attribute, result, BUF_SIZE);
ret = get_last_result();
assert_eq(ret, I18N_ERROR_NONE);
*/
int utc_capi_base_utils_i18n_unumber_get_text_attribute_p2(void)
{
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
- i18n_uchar pattern[4] = { '#', ',', '#', '#' };
+ i18n_uchar pattern[4] = {'#', ',', '#', '#'};
ret = i18n_unumber_create(I18N_UNUMBER_PATTERN_RULEBASED, pattern, -1, I18N_ULOCALE_US, NULL, &num_format);
assert_eq(ret, I18N_ERROR_NONE);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_get_text_attribute(num_format, I18N_UNUMBER_DEFAULT_RULESET, result, BUF_SIZE);
ret = get_last_result();
*/
int utc_capi_base_utils_i18n_unumber_get_text_attribute_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_get_text_attribute(NULL, I18N_UNUMBER_CURRENCY_CODE, result, BUF_SIZE);
ret = get_last_result();
*/
int utc_capi_base_utils_i18n_unumber_get_text_attribute_n2(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_get_text_attribute(num_format, -1, result, BUF_SIZE);
ret = get_last_result();
*/
int utc_capi_base_utils_i18n_unumber_get_text_attribute_n4(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_get_text_attribute(num_format, I18N_UNUMBER_CURRENCY_CODE, result, -1);
ret = get_last_result();
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar new_value[BUF_SIZE] = { 0, };
+ i18n_uchar new_value[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_text_attribute_e attribute = I18N_UNUMBER_POSITIVE_PREFIX;
- for(; attribute <= I18N_UNUMBER_CURRENCY_CODE; attribute++) {
+ for (; attribute <= I18N_UNUMBER_CURRENCY_CODE; attribute++)
+ {
ret = i18n_unumber_set_text_attribute(num_format, attribute, new_value, 8);
assert_eq(ret, I18N_ERROR_NONE);
}
*/
int utc_capi_base_utils_i18n_unumber_set_text_attribute_p2(void)
{
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
- i18n_uchar pattern[5] = { '#', ',', '#', '#', 0 };
+ i18n_uchar pattern[5] = {'#', ',', '#', '#', 0};
ret = i18n_unumber_create(I18N_UNUMBER_PATTERN_RULEBASED, pattern, -1, I18N_ULOCALE_US, NULL, &num_format);
assert_eq(ret, I18N_ERROR_NONE);
*/
int utc_capi_base_utils_i18n_unumber_set_text_attribute_n(void)
{
- i18n_uchar new_value[BUF_SIZE] = { 0, };
+ i18n_uchar new_value[BUF_SIZE] = {
+ 0,
+ };
ret = i18n_unumber_set_text_attribute(NULL, I18N_UNUMBER_CURRENCY_CODE, new_value, BUF_SIZE);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_unumber_set_text_attribute_n2(void)
{
- i18n_uchar new_value[BUF_SIZE] = { 0, };
+ i18n_uchar new_value[BUF_SIZE] = {
+ 0,
+ };
ret = i18n_unumber_set_text_attribute(num_format, -1, new_value, BUF_SIZE);
assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED);
*/
int utc_capi_base_utils_i18n_unumber_set_text_attribute_n4(void)
{
- i18n_uchar new_value[BUF_SIZE] = { 0, };
+ i18n_uchar new_value[BUF_SIZE] = {
+ 0,
+ };
ret = i18n_unumber_set_text_attribute(num_format, I18N_UNUMBER_CURRENCY_CODE, new_value, -2);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_to_pattern(num_format, 0, result, BUF_SIZE);
ret = get_last_result();
*/
int utc_capi_base_utils_i18n_unumber_to_pattern_p2(void)
{
- if(NULL != num_format) {
+ if (NULL != num_format)
+ {
i18n_unumber_destroy(num_format);
}
- i18n_uchar pattern[9] = { '#', ',', '#', '#', ',', '#', '#', '#', '\n' };
+ i18n_uchar pattern[9] = {'#', ',', '#', '#', ',', '#', '#', '#', '\n'};
ret = i18n_unumber_create(I18N_UNUMBER_DECIMAL, pattern, 0, I18N_ULOCALE_US, NULL, &num_format);
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_to_pattern(num_format, 0, result, BUF_SIZE);
*/
int utc_capi_base_utils_i18n_unumber_to_pattern_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_to_pattern(NULL, 0, result, BUF_SIZE);
ret = get_last_result();
*/
int utc_capi_base_utils_i18n_unumber_to_pattern_n3(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_to_pattern(num_format, 0, result, -1);
ret = get_last_result();
assert_eq(ret, I18N_ERROR_NONE);
assert_neq(num_format, NULL);
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
i18n_unumber_format_symbol_e symbol = I18N_UNUMBER_DECIMAL_SEPARATOR_SYMBOL;
- for(; symbol < I18N_UNUMBER_FORMAT_SYMBOL_COUNT; symbol++) {
+ for (; symbol < I18N_UNUMBER_FORMAT_SYMBOL_COUNT; symbol++)
+ {
ret = i18n_unumber_set_symbol(num_format, symbol, result, BUF_SIZE);
assert_eq(ret, I18N_ERROR_NONE);
}
*/
int utc_capi_base_utils_i18n_unumber_set_symbol_n(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
ret = i18n_unumber_set_symbol(NULL, I18N_UNUMBER_CURRENCY_SYMBOL, result, BUF_SIZE);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_unumber_set_symbol_n2(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
ret = i18n_unumber_set_symbol(num_format, -1, result, BUF_SIZE);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);
*/
int utc_capi_base_utils_i18n_unumber_set_symbol_n4(void)
{
- i18n_uchar result[BUF_SIZE] = { 0, };
+ i18n_uchar result[BUF_SIZE] = {
+ 0,
+ };
ret = i18n_unumber_set_symbol(num_format, I18N_UNUMBER_CURRENCY_SYMBOL, result, -2);
assert_eq(ret, I18N_ERROR_INVALID_PARAMETER);