-//\r
-// Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-#include "ITs-base-utils-common.h"\r
-\r
-/** @addtogroup itc-base-utils\r
-* @ingroup itc\r
-* @{\r
-*/\r
-/**\r
-* @function ITs_base_utils_ucnv_startup\r
-* @description Called before each test\r
-* @parameter NA\r
-* @return NA\r
-*/\r
-void ITs_base_utils_ucnv_startup(void)\r
-{\r
- struct stat stBuff;\r
- if ( stat(ERR_LOG, &stBuff) == 0 )\r
- {\r
- remove(ERR_LOG);\r
- }\r
-#if DEBUG\r
- FPRINTF("\\n[Line : %d][%s] TEST SUIT start-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE);\r
-#endif\r
- return;\r
-}\r
-/**\r
-* @function ITs_base_utils_ucnv_cleanup\r
-* @description Called after each test\r
-* @parameter NA\r
-* @return NA\r
-*/\r
-void ITs_base_utils_ucnv_cleanup(void)\r
-{\r
-#if DEBUG\r
- FPRINTF("\\n[Line : %d][%s] TEST SUIT clean-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE);\r
-#endif\r
-\r
- return;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_max_bytes_for_string_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_max_bytes_for_string\r
- * @apicovered i18n_ucnv_get_max_bytes_for_string\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_max_bytes_for_string\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_max_bytes_for_string\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_max_bytes_for_string_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int result = -1;\r
- int ExpectedResult = 22;\r
- int nRet = -1;\r
-\r
- //Target API\r
- result = i18n_ucnv_get_max_bytes_for_string(1, 2);\r
- PRINT_RESULT(ExpectedResult, result, "i18n_ucnv_get_max_bytes_for_string", "result and ExpectedResult are not same");\r
-\r
- nRet = get_last_result();\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "get_last_result", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_compare_names_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_compare_names\r
- * @apicovered i18n_ucnv_compare_names\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_compare_names\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_compare_names\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_compare_names_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- static const char *szSrc1[] = { "UTF-8", "utf_8", "u*T@f08", "Utf 8" };\r
- static const char *szSrc2[] = { "utf", "utfa", "utfb", "utfc"};\r
- static const char *szSrc3[] = { "utfc", "utfb", "utfa", "utf"};\r
- int count = 3;\r
- int i;\r
- int nRet = -1;\r
-\r
- for(i = 0; i < count; i++)\r
- {\r
- //Target API\r
- nRet = i18n_ucnv_compare_names(szSrc1[i], szSrc1[i + 1]);\r
- PRINT_RESULT(nRet, 0 , "i18n_ucnv_compare_names", "expected and obtained result are not same");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_compare_names(szSrc2[i], szSrc2[i + 1]);\r
- if(nRet >= 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_compare_names failed ,return value is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
-\r
- //Target API\r
- nRet = i18n_ucnv_compare_names(szSrc3[i], szSrc3[i + 1]);\r
- if(nRet <= 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_compare_names failed ,return value is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_create_destroy_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_create, i18n_ucnv_destroy\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_destroy\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_destroy\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_destroy\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_create_destroy_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-949";\r
-\r
- //Target API\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_create_unicode_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_create_unicode\r
- * @apicovered i18n_ucnv_create_unicode\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_unicode\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_unicode\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_create_unicode_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_uchar szConv[] = {0x0069, 0x0062, 0x006d, 0x002d, 0x0039, 0x0034, 0x0033, 0x0000};\r
-\r
- i18n_ucnv_h hCnv = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_create_unicode(szConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_unicode", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create_unicode");\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- hCnv = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_create_unicode(NULL, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_unicode", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create_unicode");\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- hCnv = NULL;\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_create_ccsid_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_create_ccsid\r
- * @apicovered i18n_ucnv_create_ccsid\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_ccsid\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_ccsid\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_create_ccsid_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- int szCodePointSize = -1;\r
- int i;\r
- int32_t szCodePoints[]={ 37, 850, 943, 949, 950, 1047, 1252, 1392, 33722 };\r
- i18n_ucnv_h hCnv = NULL;\r
-\r
- szCodePointSize = sizeof(szCodePoints)/sizeof(szCodePoints[0]);\r
-\r
- for(i = 0; i < szCodePointSize; i++)\r
- {\r
- //Target API\r
- nRet = i18n_ucnv_create_ccsid(szCodePoints[i], I18N_UCNV_IBM, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_ccsid", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create_ccsid");\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- hCnv = NULL;\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_safe_clone_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_safe_clone\r
- * @apicovered i18n_ucnv_safe_clone\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_safe_clone\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_safe_clone\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_safe_clone_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv1 = NULL;\r
- i18n_ucnv_h hCnv2 = NULL;\r
- const char *pszConv = "iso-8859-3";\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv1);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv1, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_safe_clone(hCnv1, &hCnv2);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_safe_clone", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv1));\r
- CHECK_HANDLE_CLEANUP(hCnv2, "i18n_ucnv_safe_clone", i18n_ucnv_destroy(hCnv1));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv2);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv1);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_set_get_subst_chars_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars, i18n_ucnv_destroy\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_set_get_subst_chars_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- char new_subchars[] = {0x7F};\r
- char get_subchars[10];\r
- int8_t len = sizeof(new_subchars);\r
- i18n_ucnv_h hCnv = NULL;\r
-\r
- nRet = i18n_ucnv_create(NULL, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_set_subst_chars(hCnv, new_subchars, len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_subst_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_subst_chars(hCnv, get_subchars, &len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_subst_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(1, len, "i18n_ucnv_get_subst_chars", "expected and obtained length are not same", i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_set_subst_string_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_set_subst_string\r
- * @apicovered i18n_ucnv_set_subst_string\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_set_subst_string\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_set_subst_string\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_set_subst_string_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ISO-8859-1";\r
- char DestBuffer[16];\r
- int8_t length = -1;\r
- static const i18n_uchar szSrc[] = { 0x61, 0x62, 0x63, 0x64, 0x65 };\r
- int szSrcSize = sizeof(szSrc)/sizeof(szSrc[0]);\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_set_subst_string(hCnv, szSrc, szSrcSize);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_subst_string", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_get_subst_chars(hCnv, DestBuffer, &length);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_subst_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_invalid_chars_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_invalid_chars\r
- * @apicovered i18n_ucnv_get_invalid_chars\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_invalid_chars\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_invalid_chars\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_invalid_chars_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = NULL;\r
- char szInvalidChars[10];\r
- int8_t InvalidLength = 0;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_invalid_chars(hCnv, szInvalidChars, &InvalidLength);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_invalid_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- if(InvalidLength < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_get_invalid_chars failed ,InvalidLength is not correct \n", __LINE__, API_NAMESPACE);\r
- i18n_ucnv_destroy(hCnv);\r
- return 1;\r
- }\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_invalid_uchars_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_invalid_uchars\r
- * @apicovered i18n_ucnv_get_invalid_uchars\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_invalid_uchars\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_invalid_uchars\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_invalid_uchars_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = NULL;\r
- i18n_uchar szInvalidChars[10];\r
- int8_t InvalidLength = 0;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_invalid_uchars(hCnv, szInvalidChars, &InvalidLength);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_invalid_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- if(InvalidLength < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_get_invalid_uchars failed ,InvalidLength is not correct \n", __LINE__, API_NAMESPACE);\r
- i18n_ucnv_destroy(hCnv);\r
- return 1;\r
- }\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_reset_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_reset\r
- * @apicovered i18n_ucnv_reset\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_reset\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_reset\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_reset_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = NULL;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_reset(hCnv);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_reset", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_reset_to_unicode_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_reset_to_unicode\r
- * @apicovered i18n_ucnv_reset_to_unicode\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_reset_to_unicode\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_reset_to_unicode\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_reset_to_unicode_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = NULL;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_reset_to_unicode(hCnv);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_reset_to_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_reset_from_unicode_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_reset_from_unicode\r
- * @apicovered i18n_ucnv_reset_from_unicode\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_reset_from_unicode\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_reset_from_unicode\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_reset_from_unicode_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = NULL;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_reset_from_unicode(hCnv);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_reset_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_max_char_size_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_max_char_size\r
- * @apicovered i18n_ucnv_get_max_char_size\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_max_char_size\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_max_char_size\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_max_char_size_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "UTF-16";\r
- int8_t size = -1;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_max_char_size(hCnv, &size);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_max_char_size", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(size, 2, "i18n_ucnv_get_max_char_size", "obtained and expected size are not same", i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_min_char_size_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_min_char_size\r
- * @apicovered i18n_ucnv_get_min_char_size\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_min_char_size\r
- * @failcase I18N_ERROR_NONE not returned i18n_ucnv_get_min_char_size\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_min_char_size_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-949_P110-1999";\r
- int8_t size = -1;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_min_char_size(hCnv, &size);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_min_char_size", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(size, 1, "i18n_ucnv_get_min_char_size", "obtained and expected size are not same", i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_display_name_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_display_name\r
- * @apicovered i18n_ucnv_get_display_name\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_display_name\r
- * @failcase I18N_ERROR_NONE not returned i18n_ucnv_get_display_name\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_display_name_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-949";\r
- i18n_uchar *pszDisplayName = NULL;\r
- int32_t DisplayCapacity = 0;\r
- int32_t DisplayNameLen = -1;\r
- const char *pszDisplayLocale = "ko_KR";\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- nRet = i18n_ucnv_get_display_name(hCnv, pszDisplayLocale, pszDisplayName, DisplayCapacity, &DisplayNameLen);\r
- if(I18N_ERROR_BUFFER_OVERFLOW == nRet) {\r
- pszDisplayName = (i18n_uchar *)malloc((I18N_UCHAR_CAPACITY) * sizeof(i18n_uchar));\r
- nRet = i18n_ucnv_get_display_name(hCnv, pszDisplayLocale, pszDisplayName, I18N_UCHAR_CAPACITY, &DisplayNameLen);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_display_name", BaseUtilsGetError(nRet), FREE_MEMORY(pszDisplayName); i18n_ucnv_destroy(hCnv));\r
- if(DisplayNameLen < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_get_display_name failed ,DisplayNameLen is not correct \n", __LINE__, API_NAMESPACE);\r
- FREE_MEMORY(pszDisplayName);\r
- i18n_ucnv_destroy(hCnv);\r
- return 1;\r
- }\r
- FREE_MEMORY(pszDisplayName);\r
- pszDisplayName = NULL;\r
- }\r
-\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_display_name", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_name_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_name\r
- * @apicovered i18n_ucnv_get_name\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_name\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_name\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_name_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- static const char *const pszNames[] = {\r
- "Unicode", "UTF-16",\r
- "UnicodeBigUnmarked", "UTF-16BE",\r
- "UnicodeBig", "UTF-16BE,version=1",\r
- "UnicodeLittleUnmarked", "UTF-16LE",\r
- "UnicodeLittle", "UTF-16LE,version=1",\r
- "x-UTF-16LE-BOM", "UTF-16LE,version=1"\r
- };\r
- int nCount = 12;\r
- int i = 0;\r
- const char *pszEncodedNames = NULL;\r
-\r
- for(i = 0; i < nCount; i += 2)\r
- {\r
- pszEncodedNames = NULL;\r
- hCnv = NULL;\r
- nRet = i18n_ucnv_create(pszNames[i], &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_name(hCnv, &pszEncodedNames);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_name", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- CHECK_HANDLE_CLEANUP(pszEncodedNames, "i18n_ucnv_get_name", i18n_ucnv_destroy(hCnv));\r
-\r
- if(strncmp(pszNames[i + 1], pszEncodedNames, strlen(pszNames[i + 1])) != 0)\r
- {\r
- FPRINTF("[Line : %d][%s] i18n_ucnv_get_name mismatch. pszExpected = %s, pszEncodedNames = %s\\n", __LINE__, API_NAMESPACE, pszNames[i + 1], pszEncodedNames);\r
- i18n_ucnv_destroy(hCnv);\r
- return 1;\r
- }\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_ccsid_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_ccsid\r
- * @apicovered i18n_ucnv_get_ccsid\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_ccsid\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_ccsid\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_ccsid_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- int32_t SrcCcsid[] = { 37, 850, 943, 949, 950, 1047, 1252, 1392, 33722 };\r
- int nCount = sizeof(SrcCcsid)/sizeof(SrcCcsid[0]);\r
- int i;\r
- int32_t ObtainedCcsid = 0;\r
- i18n_ucnv_h hCnv = NULL;\r
-\r
-\r
- for(i = 0; i < nCount; i++)\r
- {\r
- ObtainedCcsid = 0;\r
- hCnv = NULL;\r
-\r
- nRet = i18n_ucnv_create_ccsid(SrcCcsid[i], I18N_UCNV_IBM, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_ccsid", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create_ccsid");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_ccsid(hCnv, &ObtainedCcsid);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_ccsid", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(SrcCcsid[i], ObtainedCcsid, "i18n_ucnv_get_ccsid", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_platform_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_platform\r
- * @apicovered i18n_ucnv_get_platform\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_platform\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_platform\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_platform_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "utf-8";\r
- i18n_ucnv_platform_e platform;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_platform(hCnv, &platform);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_platform", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(platform, I18N_UCNV_IBM, "i18n_ucnv_get_platform", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_type_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_type\r
- * @apicovered i18n_ucnv_get_type\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_type\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_type\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_type_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "utf-8";\r
- i18n_ucnv_type_e type;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_type(hCnv, &type);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_type", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(type, I18N_UCNV_UTF8, "i18n_ucnv_get_type", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_starters_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_starters\r
- * @apicovered i18n_ucnv_get_starters\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_starters\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_starters\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_starters_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ksc";\r
- i18n_ubool starters[I18N_UCHAR_CAPACITY];\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_starters(hCnv, starters);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_starters", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_unicode_set_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_unicode_set\r
- * @apicovered i18n_ucnv_get_unicode_set\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_unicode_set\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_unicode_set\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_unicode_set_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_uset_h hSet = NULL;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ksc";\r
-\r
- nRet = i18n_uset_create(1, 0, &hSet);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_uset_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hSet, "i18n_uset_create");\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_unicode_set(hCnv, hSet, I18N_UCNV_ROUNDTRIP_SET);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_unicode_set", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_from_unicode_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_from_unicode\r
- * @apicovered i18n_ucnv_from_unicode\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_unicode\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_from_unicode\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_from_unicode_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszConv = "UTF-8";\r
- i18n_ucnv_h hCnv = NULL;\r
- char szBuffer[2] = {1, 1};\r
- i18n_uchar szUcharBuffer[2] = {2, 2};\r
- char *pszChars = szBuffer;\r
- i18n_uchar *pszUchars = (i18n_uchar *)szUcharBuffer;\r
- i18n_uchar *pszUcharsBad = (i18n_uchar *)(szUcharBuffer + 1);\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_from_unicode(hCnv, &pszChars, pszChars, (const i18n_uchar **)&pszUchars, pszUchars, NULL, true);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_to_unicode_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_to_unicode\r
- * @apicovered i18n_ucnv_to_unicode\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_unicode\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_unicode\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_to_unicode_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszConv = "UTF-8";\r
- i18n_ucnv_h hCnv = NULL;\r
- char szBuffer[2] = {1, 1};\r
- i18n_uchar szUcharBuffer[2] = {2, 2};\r
- char *pszChars = szBuffer;\r
- i18n_uchar *pszUchars = (i18n_uchar *)szUcharBuffer;\r
- i18n_uchar *pszUcharsBad = (i18n_uchar *)(szUcharBuffer + 1);\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_to_unicode(hCnv, &pszUchars, pszUchars, (const i18n_uchar **)&pszChars, pszChars, NULL, true);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_from_uchars_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_from_uchars\r
- * @apicovered i18n_ucnv_from_uchars\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_uchars\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_from_uchars\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_from_uchars_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "UTF-16";\r
- static const i18n_uchar szSrc[1] = {0xd900};\r
- char szBuffer[I18N_UCHAR_CAPACITY];\r
- int32_t ObtainedLength = -1;\r
- int32_t ExpectedLength = 4;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_from_uchars(hCnv, szBuffer, I18N_UCHAR_CAPACITY, szSrc, 1, &ObtainedLength);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(ExpectedLength, ObtainedLength, "i18n_ucnv_from_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_to_uchars_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_to_uchars\r
- * @apicovered i18n_ucnv_to_uchars\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_uchars\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_uchars\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_to_uchars_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-943";\r
- static const char szTarget[] = {\r
- 0x5c, 0x75, 0x73, 0x72,\r
- 0x5c, 0x6c, 0x6f, 0x63, 0x61, 0x6c,\r
- 0x5c, 0x73, 0x68, 0x61, 0x72, 0x65,\r
- 0x5c, 0x64, 0x61, 0x74, 0x61,\r
- 0x5c, 0x69, 0x63, 0x75, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x78, 0x74,\r
- 0\r
- };\r
-\r
- i18n_uchar szResult[I18N_UCHAR_CAPACITY];\r
- int32_t ObtainedLength = -1;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_to_uchars(hCnv, szResult, I18N_UCHAR_CAPACITY, szTarget, (int32_t)strlen(szTarget), &ObtainedLength);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- if(ObtainedLength < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_to_uchars failed ,ObtainedLength is not correct \n", __LINE__, API_NAMESPACE);\r
- i18n_ucnv_destroy(hCnv);\r
- return 1;\r
- }\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_next_uchar_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_next_uchar\r
- * @apicovered i18n_ucnv_get_next_uchar\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_next_uchar\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_next_uchar\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_next_uchar_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-1363";\r
- const char szSrcData[] = { (char)0xa2, (char)0xae, (char)0xa2 };\r
- const char *pszSrc = szSrcData;\r
- const char *pszSrcLimit = szSrcData + sizeof(szSrcData);\r
- i18n_uchar32 result1, result2, result3;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_next_uchar(hCnv, &pszSrc, pszSrcLimit, &result1);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(0xa1, result1, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_next_uchar(hCnv, &pszSrc, pszSrcLimit, &result2);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(0x1a, result2, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_convert_ex_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_convert_ex\r
- * @apicovered i18n_ucnv_convert_ex\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_convert_ex\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_convert_ex\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_convert_ex_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv1 = NULL;\r
- i18n_ucnv_h hCnv2 = NULL;\r
- const char *pszConv1 = "UTF-8";\r
- const char *pszConv2 = "Shift-JIS";\r
- char szTargetBuffer[I18N_UCHAR_CAPACITY];\r
- char szSrcBuffer[I18N_UCHAR_CAPACITY];\r
- char *pszTarget = szTargetBuffer;\r
- const char *pszSrc = szSrcBuffer;\r
-\r
- nRet = i18n_ucnv_create(pszConv1, &hCnv1);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv1, "i18n_ucnv_create");\r
-\r
- nRet = i18n_ucnv_create(pszConv2, &hCnv2);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2));\r
- CHECK_HANDLE_CLEANUP(hCnv2, "i18n_ucnv_create", i18n_ucnv_destroy(hCnv2));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_convert_ex(hCnv2, hCnv1, &pszTarget, szTargetBuffer + sizeof(szTargetBuffer), &pszSrc, NULL, NULL, NULL, NULL, NULL, true, true);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_convert_ex", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv2);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv1);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_convert_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_convert\r
- * @apicovered i18n_ucnv_convert\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_convert\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_convert\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_convert_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- int32_t target_limit = 0, source_limit = 0, target_capacity = 0;\r
- const uint8_t szSrc[]={ 0x00, 0x04, 0x05, 0x06, 0xa2, 0xb4, 0x00};\r
- const uint8_t szExpectedTarget[]={ 0x00, 0x37, 0x2d, 0x2e, 0x0e, 0x49, 0x62, 0x0f, 0x00};\r
- char *pszTarget = NULL;\r
- source_limit = sizeof(szSrc)/sizeof(szSrc[0]);\r
- int i = 0;\r
-\r
- nRet = i18n_ucnv_convert("ibm-1364", "ibm-1363", NULL, target_limit, (const char*)szSrc, source_limit, &target_capacity);\r
- if(nRet == I18N_ERROR_BUFFER_OVERFLOW) {\r
- target_limit = target_capacity + 1;\r
- pszTarget = (char *)malloc(sizeof(char) *target_limit);\r
- nRet = i18n_ucnv_convert("ibm-1364", "ibm-1363", pszTarget, target_limit, (const char*)szSrc, source_limit, &target_capacity);\r
- }\r
-\r
- if(pszTarget != NULL)\r
- {\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_convert", BaseUtilsGetError(nRet), FREE_MEMORY(pszTarget));\r
- for(i = 0; i < target_capacity; ++i)\r
- PRINT_RESULT_CLEANUP(pszTarget[i], szExpectedTarget[i], "i18n_ucnv_convert", "obtained and expected values are not correct", FREE_MEMORY(pszTarget));\r
- FREE_MEMORY(pszTarget);\r
- }\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_convert", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_from_algorithmic_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_from_algorithmic\r
- * @apicovered i18n_ucnv_from_algorithmic\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_algorithmic\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_from_algorithmic\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_from_algorithmic_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- static const uint8_t\r
- utf8[]={\r
- /* 4e00 30a1 ff61 0410 */\r
- 0xe4, 0xb8, 0x80, 0xe3, 0x82, 0xa1, 0xef, 0xbd, 0xa1, 0xd0, 0x90\r
- },\r
- shiftJIS[]={\r
- 0x88, 0xea, 0x83, 0x40, 0xa1, 0x84, 0x40\r
- };\r
-\r
- int32_t length = -1;\r
- char szTarget[I18N_UCHAR_CAPACITY];\r
- const char *pszConv = "shift-JIS";\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_from_algorithmic(hCnv, I18N_UCNV_UTF8, szTarget, sizeof(shiftJIS), (const char *)utf8, sizeof(utf8), &length);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_algorithmic", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(length, sizeof(shiftJIS), "i18n_ucnv_from_algorithmic", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_to_algorithmic_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_to_algorithmic\r
- * @apicovered i18n_ucnv_to_algorithmic\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_algorithmic\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_algorithmic\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_to_algorithmic_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- static const uint8_t\r
- utf8[]={\r
- /* 4e00 30a1 ff61 0410 */\r
- 0xe4, 0xb8, 0x80, 0xe3, 0x82, 0xa1, 0xef, 0xbd, 0xa1, 0xd0, 0x90\r
- },\r
- shiftJIS[]={\r
- 0x88, 0xea, 0x83, 0x40, 0xa1, 0x84, 0x40\r
- };\r
-\r
- int32_t length;\r
- char szTarget[I18N_UCHAR_CAPACITY];\r
- char szShiftJIS[I18N_UCHAR_CAPACITY];\r
- const char *pszConv = "shift-JIS";\r
-\r
- memcpy(szShiftJIS, shiftJIS, sizeof(shiftJIS));\r
- szShiftJIS[sizeof(shiftJIS)] = 0;\r
- memset(szTarget, 0x55, sizeof(szTarget));\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_to_algorithmic(I18N_UCNV_UTF8, hCnv, szTarget, sizeof(szTarget), szShiftJIS, -1, &length);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_algorithmic", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(length, sizeof(utf8), "i18n_ucnv_to_algorithmic", "obtained and expected length are different", i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_flush_cache_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_flush_cache\r
- * @apicovered i18n_ucnv_flush_cache\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_flush_cache\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_flush_cache\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_flush_cache_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hConverters[4];\r
- const char *pszConv1 = "ibm-1047";\r
- const char *pszConv2 = "ibm-954";\r
- i18n_ucnv_flush_cache();\r
-\r
- nRet = i18n_ucnv_create(pszConv1, &hConverters[0]);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hConverters[0], "i18n_ucnv_create");\r
-\r
- nRet = i18n_ucnv_create(pszConv1, &hConverters[1]);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hConverters[0]));\r
- CHECK_HANDLE_CLEANUP(hConverters[1], "i18n_ucnv_create", i18n_ucnv_destroy(hConverters[0]));\r
-\r
- nRet = i18n_ucnv_create(pszConv1, &hConverters[2]);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]));\r
- CHECK_HANDLE_CLEANUP(hConverters[2], "i18n_ucnv_create", i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]));\r
-\r
- nRet = i18n_ucnv_create(pszConv2, &hConverters[3]);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]));\r
- CHECK_HANDLE_CLEANUP(hConverters[3], "i18n_ucnv_create", i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]); i18n_ucnv_destroy(hConverters[2]));\r
-\r
- nRet = i18n_ucnv_flush_cache();\r
- PRINT_RESULT_CLEANUP(nRet, 0, "i18n_ucnv_flush_cache", "value obtained is not correct", i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]); i18n_ucnv_destroy(hConverters[2]); i18n_ucnv_destroy(hConverters[3]));\r
-\r
- nRet = i18n_ucnv_destroy(hConverters[0]);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- nRet = i18n_ucnv_destroy(hConverters[1]);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- nRet = i18n_ucnv_flush_cache();\r
- PRINT_RESULT_CLEANUP(nRet, 0, "i18n_ucnv_flush_cache", "value obtained is not correct", i18n_ucnv_destroy(hConverters[2]); i18n_ucnv_destroy(hConverters[3]));\r
-\r
- nRet = i18n_ucnv_destroy(hConverters[2]);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- nRet = i18n_ucnv_destroy(hConverters[3]);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_count_available_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_count_available\r
- * @apicovered i18n_ucnv_count_available, i18n_ucnv_get_available_name\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_count_available, i18n_ucnv_get_available_name\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_count_available, i18n_ucnv_get_available_name\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_count_available_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- int count = 0;\r
- int i = 0;\r
- const char *pszName = NULL;\r
-\r
- //Target API\r
- count = i18n_ucnv_count_available();\r
- if(count < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_available failed ,return number is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
- for(i = 0; i < count; i++)\r
- {\r
- nRet = i18n_ucnv_get_available_name(i, &pszName);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_available_name", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(pszName, "i18n_ucnv_get_available_name");\r
- }\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_available_name_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_available_name\r
- * @apicovered i18n_ucnv_get_available_name\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_available_name\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_available_name\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_available_name_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszName = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_available_name(1, &pszName);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_available_name", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(pszName, "i18n_ucnv_get_available_name");\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_create_all_names_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_create_all_names\r
- * @apicovered i18n_ucnv_create_all_names\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_all_names\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_all_names\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_create_all_names_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_uenumeration_h hEnumeration = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_create_all_names(&hEnumeration);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_all_names", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hEnumeration, "i18n_ucnv_create_all_names");\r
-\r
- nRet = i18n_uenumeration_destroy(hEnumeration);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_uenumeration_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_count_aliases_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_count_aliases\r
- * @apicovered i18n_ucnv_count_aliases\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_count_aliases\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_count_aliases\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_count_aliases_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszAlias = "utf-8";\r
- uint16_t number = -1;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_count_aliases(pszAlias, &number);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_count_aliases", BaseUtilsGetError(nRet));\r
- if(number < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_aliases failed ,return number is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_aliases_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_aliases\r
- * @apicovered i18n_ucnv_get_aliases\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_aliases\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_aliases\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_aliases_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszAlias = "utf-8";\r
- uint16_t number = -1;\r
- const char **pszAliases;\r
- pszAliases = (const char **)malloc(number * sizeof(const char *));\r
-\r
- nRet = i18n_ucnv_count_aliases(pszAlias, &number);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_count_aliases", BaseUtilsGetError(nRet));\r
- if(number < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_aliases failed ,return number is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_aliases(pszAlias, pszAliases);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_aliases", BaseUtilsGetError(nRet), FREE_MEMORY(pszAliases));\r
-\r
- FREE_MEMORY(pszAliases);\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_alias_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_alias\r
- * @apicovered i18n_ucnv_get_alias\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_alias\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_alias\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_alias_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszAlias = "utf-8";\r
- uint16_t number = -1;\r
- const char **pszAliases;\r
-\r
- const char *pszCheckAlias = NULL;\r
- uint16_t i = 0;\r
-\r
- nRet = i18n_ucnv_count_aliases(pszAlias, &number);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_count_aliases", BaseUtilsGetError(nRet));\r
- if(number < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_aliases failed ,return number is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
-\r
- pszAliases = (const char **)malloc(number * sizeof(const char *));\r
-\r
- nRet = i18n_ucnv_get_aliases(pszAlias, pszAliases);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_aliases", BaseUtilsGetError(nRet), FREE_MEMORY(pszAliases));\r
-\r
- for(i = 0; i < number; ++i)\r
- {\r
- pszCheckAlias = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_alias(pszAlias, i, &pszCheckAlias);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_alias", BaseUtilsGetError(nRet), FREE_MEMORY(pszAliases));\r
- CHECK_HANDLE_CLEANUP(pszCheckAlias, "i18n_ucnv_get_alias", FREE_MEMORY(pszAliases));\r
- if(strncmp(pszAliases[i], pszCheckAlias, strlen(pszAliases[i])) != 0)\r
- {\r
- FPRINTF("[Line : %d][%s] i18n_ucnv_get_alias mismatch. pszAliases[i] = %s, pszCheckAlias = %s\\n", __LINE__, API_NAMESPACE, pszAliases[i], pszCheckAlias);\r
- FREE_MEMORY(pszAliases);\r
- return 1;\r
- }\r
- }\r
- FREE_MEMORY(pszAliases);\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_create_standard_names_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_create_standard_names\r
- * @apicovered i18n_ucnv_create_standard_names\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_standard_names\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_standard_names\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_create_standard_names_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszConv = "ASCII";\r
- const char *pszStandard = "IANA";\r
- i18n_uenumeration_h hEnumeration = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_create_standard_names(pszConv, pszStandard, &hEnumeration);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_standard_names", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_count_standards_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_count_standards\r
- * @apicovered i18n_ucnv_count_standards\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_count_standards\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_count_standards\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_count_standards_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- uint16_t count = -1;\r
-\r
- //Target API\r
- count = i18n_ucnv_count_standards();\r
-\r
- if(count < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_standards failed ,return value is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_standard_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_standard\r
- * @apicovered i18n_ucnv_get_standard\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_standard\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_standard\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_standard_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- uint16_t count = -1;\r
- int i = 0;\r
- const char *pszStandard = NULL;\r
- int nRet = -1;\r
- count = i18n_ucnv_count_standards();\r
-\r
- if(count < 0)\r
- {\r
- FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_standards failed ,return value is not correct \n", __LINE__, API_NAMESPACE);\r
- return 1;\r
- }\r
- for(i = 0; i < count -1; ++i)\r
- {\r
- pszStandard = NULL;\r
- //Target API\r
- nRet = i18n_ucnv_get_standard(i, &pszStandard);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_standard", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(pszStandard, "i18n_ucnv_get_standard");\r
- }\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_standard_name_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_standard_names\r
- * @apicovered i18n_ucnv_get_standard_names\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_standard_names\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_standard_names\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_standard_name_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszConv = "ASCII";\r
- const char *pszStandard = "IANA";\r
- const char *pszTag = NULL;\r
- const char *pszExpected = "ANSI_X3.4-1968";\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_standard_name(pszConv, pszStandard, &pszTag);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_standard_name", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(pszTag, "i18n_ucnv_get_standard_name");\r
-\r
- if(strncmp(pszExpected, pszTag, strlen(pszExpected)) != 0)\r
- {\r
- FPRINTF("[Line : %d][%s] i18n_ucnv_get_standard_name mismatch. pszExpected = %s, pszTag = %s\\n", __LINE__, API_NAMESPACE, pszExpected, pszTag);\r
- return 1;\r
- }\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_get_canonical_name_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_get_canonical_name\r
- * @apicovered i18n_ucnv_get_canonical_name\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_canonical_name\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_canonical_name\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_get_canonical_name_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *pszConv = "UTF-8";\r
- const char *pszStandard = "IANA";\r
- const char *pszTag = NULL;\r
- const char *pszExpected = "UTF-8";\r
-\r
- //Target API\r
- nRet = i18n_ucnv_get_canonical_name(pszConv, pszStandard, &pszTag);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_canonical_name", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(pszTag, "i18n_ucnv_get_canonical_name");\r
-\r
- if(strncmp(pszExpected, pszTag, strlen(pszExpected)) != 0)\r
- {\r
- FPRINTF("[Line : %d][%s] i18n_ucnv_get_standard_names mismatch. pszExpected = %s, pszTag = %s\\n", __LINE__, API_NAMESPACE, pszExpected, pszTag);\r
- return 1;\r
- }\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_set_get_default_name_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_set_default_name, i18n_ucnv_get_default_name\r
- * @apicovered i18n_ucnv_set_default_name, i18n_ucnv_get_default_name\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_set_default_name, i18n_ucnv_get_default_name\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_set_default_name, i18n_ucnv_get_default_name\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_set_get_default_name_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- const char *pszName = "UTF-8";\r
- const char *pszGetName = NULL;\r
- //Target API\r
- i18n_ucnv_set_default_name(pszName);\r
-\r
- //Target API\r
- pszGetName = i18n_ucnv_get_default_name();\r
- if(strncmp(pszName, pszGetName, strlen(pszName)) != 0)\r
- {\r
- FPRINTF("[Line : %d][%s] i18n_ucnv_get_default_name mismatch. pszName = %s, pszExpectedName = %s\\n", __LINE__, API_NAMESPACE, pszName, pszGetName);\r
- return 1;\r
- }\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_fix_file_separator_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_fix_file_separator\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_destroy\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_fix_file_separator\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_fix_file_separator\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_fix_file_separator_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- static const char szTarget[] = {\r
- 0x5c, 0x75, 0x73, 0x72,\r
- 0x5c, 0x6c, 0x6f, 0x63, 0x61, 0x6c,\r
- 0x5c, 0x73, 0x68, 0x61, 0x72, 0x65,\r
- 0x5c, 0x64, 0x61, 0x74, 0x61,\r
- 0x5c, 0x69, 0x63, 0x75, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x78, 0x74,\r
- 0\r
- };\r
- i18n_uchar szResult[I18N_UCHAR_CAPACITY];\r
- i18n_uchar szAsciiResult[I18N_UCHAR_CAPACITY];\r
- int32_t len = -1;\r
- int32_t ascii_len = -1;\r
- const char *pszConv1 = "ibm-943";\r
- const char *pszConv2 = "LATIN-1";\r
- i18n_ucnv_h hCnv1 = NULL;\r
- i18n_ucnv_h hCnv2 = NULL;\r
- int nRet = -1;\r
-\r
- nRet = i18n_ucnv_create(pszConv1, &hCnv1);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv1, "i18n_ucnv_create");\r
-\r
- nRet = i18n_ucnv_create(pszConv2, &hCnv2);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2));\r
- CHECK_HANDLE_CLEANUP(hCnv2, "i18n_ucnv_create", i18n_ucnv_destroy(hCnv1));\r
-\r
- nRet = i18n_ucnv_to_uchars(hCnv1, szResult, I18N_UCHAR_CAPACITY, szTarget, (int32_t)strlen(szTarget), &len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));\r
-\r
- nRet = i18n_ucnv_to_uchars(hCnv2, szAsciiResult, I18N_UCHAR_CAPACITY, szTarget, (int32_t)strlen(szTarget), &ascii_len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_fix_file_separator(hCnv1, szResult, len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_fix_file_separator", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));\r
- PRINT_RESULT_CLEANUP(i18n_ustring_compare(szResult, szAsciiResult), 0, "i18n_ucnv_fix_file_separator", "values are not equal", i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv2);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv1);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_is_ambiguous_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_create, i18n_ucnv_is_ambiguous\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_is_ambiguous\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_is_ambiguous\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_is_ambiguous\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_is_ambiguous_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "UTF-8";\r
- i18n_ubool bAmbiguous = false;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_is_ambiguous(hCnv, &bAmbiguous);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_is_ambiguous", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_set_fallback_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_set_fallback\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_set_fallback\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_set_fallback\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_set_fallback\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_set_fallback_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-1371";\r
- i18n_ubool bResult = false;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_set_fallback(hCnv, true);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_uses_fallback(hCnv, &bResult);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_uses_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(true, bResult, "i18n_ucnv_uses_fallback", "value is not correct", i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_uses_fallback_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_uses_fallback\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_uses_fallback\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_uses_fallback\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_uses_fallback\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_uses_fallback_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "ibm-1371";\r
- i18n_ubool bResult = false;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- nRet = i18n_ucnv_set_fallback(hCnv, true);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_uses_fallback(hCnv, &bResult);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_uses_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(true, bResult, "i18n_ucnv_uses_fallback", "value is not correct", i18n_ucnv_destroy(hCnv));\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_detect_unicode_signature_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_detect_unicode_signature_p\r
- * @apicovered ITc_i18n_ucnv_detect_unicode_signature_p\r
- * @passcase I18N_ERROR_NONE returned by ITc_i18n_ucnv_detect_unicode_signature_p\r
- * @failcase I18N_ERROR_NONE not returned by ITc_i18n_ucnv_detect_unicode_signature_p\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_detect_unicode_signature_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- static const char* pszData[] = {\r
- "\xFE\xFF\x00\x00", /* UTF-16BE */\r
- "\xFF\xFE\x00\x00", /* UTF-16LE */\r
- "\xEF\xBB\xBF\x00", /* UTF-8 */\r
- "\x0E\xFE\xFF\x00", /* SCSU */\r
-\r
- "\xFE\xFF", /* UTF-16BE */\r
- "\xFF\xFE", /* UTF-16LE */\r
- "\xEF\xBB\xBF", /* UTF-8 */\r
- "\x0E\xFE\xFF", /* SCSU */\r
-\r
- "\xFE\xFF\x41\x42", /* UTF-16BE */\r
- "\xFF\xFE\x41\x41", /* UTF-16LE */\r
- "\xEF\xBB\xBF\x41", /* UTF-8 */\r
- "\x0E\xFE\xFF\x41", /* SCSU */\r
-\r
- "\x2B\x2F\x76\x38\x2D", /* UTF-7 */\r
- "\x2B\x2F\x76\x38\x41", /* UTF-7 */\r
- "\x2B\x2F\x76\x39\x41", /* UTF-7 */\r
- "\x2B\x2F\x76\x2B\x41", /* UTF-7 */\r
- "\x2B\x2F\x76\x2F\x41", /* UTF-7 */\r
-\r
- "\xDD\x73\x66\x73" /* UTF-EBCDIC */\r
- };\r
-\r
- static const char* pszExpected[] = {\r
- "UTF-16BE",\r
- "UTF-16LE",\r
- "UTF-8",\r
- "SCSU",\r
-\r
- "UTF-16BE",\r
- "UTF-16LE",\r
- "UTF-8",\r
- "SCSU",\r
-\r
- "UTF-16BE",\r
- "UTF-16LE",\r
- "UTF-8",\r
- "SCSU",\r
-\r
- "UTF-7",\r
- "UTF-7",\r
- "UTF-7",\r
- "UTF-7",\r
- "UTF-7",\r
-\r
- "UTF-EBCDIC"\r
- };\r
-\r
- static const int32_t expected_len[] =\r
- {\r
- 2, 2, 3, 3,\r
- 2, 2, 3, 3,\r
- 2, 2, 3, 3,\r
- 5, 4, 4, 4, 4,\r
- 4\r
- };\r
- int nRet = -1;\r
- const char *pszSrc = NULL;\r
- const char *pszName = NULL;\r
- int32_t signature_length = -1;\r
- int nCount = sizeof(pszData)/sizeof(pszData[0]);\r
- int i = 0;\r
-\r
- for(i = 0; i < nCount; ++i)\r
- {\r
- pszSrc = pszData[i];\r
- pszName = NULL;\r
-\r
- //Target API\r
- nRet = i18n_ucnv_detect_unicode_signature(pszSrc, -1, &signature_length, &pszName);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_detect_unicode_signature", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(pszName, "i18n_ucnv_detect_unicode_signature");\r
- PRINT_RESULT(signature_length, expected_len[i], "i18n_ucnv_detect_unicode_signature", "obtained and expected length are not same");\r
- if(strncmp(pszName, pszExpected[i], strlen(pszName)) != 0)\r
- {\r
- FPRINTF("[Line : %d][%s] i18n_ucnv_get_name mismatch. pszExpected = %s, pszName = %s\\n", __LINE__, API_NAMESPACE, pszExpected[i], pszName);\r
- return 1;\r
- }\r
- }\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_from_ucount_pending_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_from_ucount_pending\r
- * @apicovered i18n_ucnv_from_ucount_pending\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_ucount_pending\r
- * @failcase I18N_ERROR_NONE not returned i18n_ucnv_from_ucount_pending\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_from_ucount_pending_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- static const struct {\r
- i18n_uchar input[6];\r
- int32_t len;\r
- int32_t exp;\r
- }from_unicode_tests[] = {\r
- {{ 0xdbc4},1,1},\r
- {{ 0xdbc4, 0xde34, 0xd84d},3,1},\r
- };\r
-\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "UTF-8";\r
- char *pszTarget = NULL;\r
- char *pszTargetLimit = NULL;\r
- const i18n_uchar *pszSource = NULL;\r
- const i18n_uchar *pszSourceLimit = NULL;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- int nCount = 2;\r
- int i = 0;\r
- int32_t len = 0;\r
-\r
- for(i = 0; i < nCount; i++)\r
- {\r
- char sztgt[10];\r
- pszTarget = sztgt;\r
- pszTargetLimit = pszTarget + 10;\r
- pszSource = from_unicode_tests[i].input;\r
- pszSourceLimit = pszSource + from_unicode_tests[i].len;\r
- len = 0;\r
-\r
-\r
- nRet = i18n_ucnv_from_unicode(hCnv, &pszTarget, pszTargetLimit, &pszSource, pszSourceLimit, NULL, false);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_from_ucount_pending(hCnv, &len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_ucount_pending", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(len, from_unicode_tests[i].exp, "i18n_ucnv_from_ucount_pending", "obtained and expected length are not equal", i18n_ucnv_destroy(hCnv));\r
- }\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_to_ucount_pending_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_to_ucount_pending\r
- * @apicovered i18n_ucnv_to_ucount_pending\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_ucount_pending\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_ucount_pending\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_to_ucount_pending_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- static const struct {\r
- char input[6];\r
- int32_t len;\r
- int32_t exp;\r
- }to_unicode_tests[] = {\r
- {{0x05, 0x01, 0x02},3,3},\r
- {{0x01, 0x02},2,2},\r
- {{0x07, 0x00, 0x01, 0x02},4,4},\r
- };\r
-\r
- i18n_ucnv_h hCnv = NULL;\r
- const char *pszConv = "UTF-8";\r
- char *pszTarget = NULL;\r
- char *pszTargetLimit = NULL;\r
- const i18n_uchar *pszSource = NULL;\r
- const i18n_uchar *pszSourceLimit = NULL;\r
-\r
- nRet = i18n_ucnv_create(pszConv, &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- int nCount = 3;\r
- int i = 0;\r
- int32_t len = 0;\r
-\r
- for(i = 0; i < nCount; i++)\r
- {\r
- i18n_uchar sztgt[10];\r
- pszTarget = sztgt;\r
- pszTargetLimit = pszTarget + 10;\r
- pszSource = to_unicode_tests[i].input;\r
- pszSourceLimit = pszSource + to_unicode_tests[i].len;\r
- len = 0;\r
-\r
- nRet = i18n_ucnv_from_unicode(hCnv, &pszTarget, pszTargetLimit, &pszSource, pszSourceLimit, NULL, false);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
-\r
- //Target API\r
- nRet = i18n_ucnv_to_ucount_pending(hCnv, &len);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_ucount_pending", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- }\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
-\r
- return 0;\r
-}\r
-/*\r
- * @testcase ITc_i18n_ucnv_is_fixed_width_p\r
- * @since_tizen 6.0\r
- * @author SRID(mohit.m)\r
- * @reviewer SRID(shobhit.v)\r
- * @type auto\r
- * @scenario calls the api based on code\r
- * @apitarget i18n_ucnv_is_fixed_width\r
- * @apicovered i18n_ucnv_create, i18n_ucnv_is_fixed_width\r
- * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_is_fixed_width\r
- * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_is_fixed_width\r
- * @precondition NA\r
- * @postcondition NA\r
- */\r
-int ITc_i18n_ucnv_is_fixed_width_p(void)\r
-{\r
- START_TEST_PRINT;\r
-\r
- int nRet = -1;\r
- const char *szFixedWidth[] = {\r
- "US-ASCII",\r
- "UTF32",\r
- "ibm-5478_P100-1995"\r
- };\r
-\r
- const char *szNotFixedWidth[] = {\r
- "GB18030",\r
- "UTF8",\r
- "windows-949-2000",\r
- "UTF16"\r
- };\r
- i18n_ubool bResult = false;\r
- i18n_ucnv_h hCnv = NULL;\r
- int nCount1 = 3;\r
- int nCount2 = 4;\r
- int i = 0;\r
-\r
- for(i = 0; i < nCount1; ++i)\r
- {\r
- hCnv = NULL;\r
- bResult = false;\r
- nRet = i18n_ucnv_create(szFixedWidth[i], &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_is_fixed_width(hCnv, &bResult);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_is_fixed_width", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(true, bResult, "i18n_ucnv_is_fixed_width", "result is not correct", i18n_ucnv_destroy(hCnv));\r
- }\r
-\r
- for(i = 0; i < nCount2; ++i)\r
- {\r
- hCnv = NULL;\r
- bResult = true;\r
- nRet = i18n_ucnv_create(szNotFixedWidth[i], &hCnv);\r
- PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));\r
- CHECK_HANDLE(hCnv, "i18n_ucnv_create");\r
-\r
- //Target API\r
- nRet = i18n_ucnv_is_fixed_width(hCnv, &bResult);\r
- PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_is_fixed_width", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));\r
- PRINT_RESULT_CLEANUP(false, bResult, "i18n_ucnv_is_fixed_width", "result is not correct", i18n_ucnv_destroy(hCnv));\r
- }\r
-\r
- nRet = i18n_ucnv_destroy(hCnv);\r
- PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));\r
- return 0;\r
-}\r
+//
+// Copyright (c) 2020 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "ITs-base-utils-common.h"
+
+/** @addtogroup itc-base-utils
+* @ingroup itc
+* @{
+*/
+/**
+* @function ITs_base_utils_ucnv_startup
+* @description Called before each test
+* @parameter NA
+* @return NA
+*/
+void ITs_base_utils_ucnv_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+#if DEBUG
+ FPRINTF("\\n[Line : %d][%s] TEST SUIT start-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE);
+#endif
+ return;
+}
+/**
+* @function ITs_base_utils_ucnv_cleanup
+* @description Called after each test
+* @parameter NA
+* @return NA
+*/
+void ITs_base_utils_ucnv_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("\\n[Line : %d][%s] TEST SUIT clean-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ return;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_max_bytes_for_string_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_max_bytes_for_string
+ * @apicovered i18n_ucnv_get_max_bytes_for_string
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_max_bytes_for_string
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_max_bytes_for_string
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_max_bytes_for_string_p(void)
+{
+ START_TEST_PRINT;
+
+ int result = -1;
+ int ExpectedResult = 22;
+ int nRet = -1;
+
+ //Target API
+ result = i18n_ucnv_get_max_bytes_for_string(1, 2);
+ PRINT_RESULT(ExpectedResult, result, "i18n_ucnv_get_max_bytes_for_string", "result and ExpectedResult are not same");
+
+ nRet = get_last_result();
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "get_last_result", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_compare_names_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_compare_names
+ * @apicovered i18n_ucnv_compare_names
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_compare_names
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_compare_names
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_compare_names_p(void)
+{
+ START_TEST_PRINT;
+
+ static const char *szSrc1[] = { "UTF-8", "utf_8", "u*T@f08", "Utf 8" };
+ static const char *szSrc2[] = { "utf", "utfa", "utfb", "utfc"};
+ static const char *szSrc3[] = { "utfc", "utfb", "utfa", "utf"};
+ int count = 3;
+ int i;
+ int nRet = -1;
+
+ for(i = 0; i < count; i++)
+ {
+ //Target API
+ nRet = i18n_ucnv_compare_names(szSrc1[i], szSrc1[i + 1]);
+ PRINT_RESULT(nRet, 0 , "i18n_ucnv_compare_names", "expected and obtained result are not same");
+
+ //Target API
+ nRet = i18n_ucnv_compare_names(szSrc2[i], szSrc2[i + 1]);
+ if(nRet >= 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_compare_names failed ,return value is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ //Target API
+ nRet = i18n_ucnv_compare_names(szSrc3[i], szSrc3[i + 1]);
+ if(nRet <= 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_compare_names failed ,return value is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_create_destroy_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_create, i18n_ucnv_destroy
+ * @apicovered i18n_ucnv_create, i18n_ucnv_destroy
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_destroy
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_destroy
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_create_destroy_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-949";
+
+ //Target API
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_create_unicode_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_create_unicode
+ * @apicovered i18n_ucnv_create_unicode
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_unicode
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_unicode
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_create_unicode_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_uchar szConv[] = {0x0069, 0x0062, 0x006d, 0x002d, 0x0039, 0x0034, 0x0033, 0x0000};
+
+ i18n_ucnv_h hCnv = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_create_unicode(szConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_unicode", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create_unicode");
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ hCnv = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_create_unicode(NULL, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_unicode", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create_unicode");
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ hCnv = NULL;
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_create_ccsid_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_create_ccsid
+ * @apicovered i18n_ucnv_create_ccsid
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_ccsid
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_ccsid
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_create_ccsid_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ int szCodePointSize = -1;
+ int i;
+ int32_t szCodePoints[]={ 37, 850, 943, 949, 950, 1047, 1252, 1392, 33722 };
+ i18n_ucnv_h hCnv = NULL;
+
+ szCodePointSize = sizeof(szCodePoints)/sizeof(szCodePoints[0]);
+
+ for(i = 0; i < szCodePointSize; i++)
+ {
+ //Target API
+ nRet = i18n_ucnv_create_ccsid(szCodePoints[i], I18N_UCNV_IBM, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_ccsid", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create_ccsid");
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ hCnv = NULL;
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_safe_clone_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_safe_clone
+ * @apicovered i18n_ucnv_safe_clone
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_safe_clone
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_safe_clone
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_safe_clone_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv1 = NULL;
+ i18n_ucnv_h hCnv2 = NULL;
+ const char *pszConv = "iso-8859-3";
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv1);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv1, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_safe_clone(hCnv1, &hCnv2);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_safe_clone", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv1));
+ CHECK_HANDLE_CLEANUP(hCnv2, "i18n_ucnv_safe_clone", i18n_ucnv_destroy(hCnv1));
+
+ nRet = i18n_ucnv_destroy(hCnv2);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ nRet = i18n_ucnv_destroy(hCnv1);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_set_get_subst_chars_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars
+ * @apicovered i18n_ucnv_create, i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars, i18n_ucnv_destroy
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_set_subst_chars, i18n_ucnv_get_subst_chars
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_set_get_subst_chars_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ char new_subchars[] = {0x7F};
+ char get_subchars[10];
+ int8_t len = sizeof(new_subchars);
+ i18n_ucnv_h hCnv = NULL;
+
+ nRet = i18n_ucnv_create(NULL, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_set_subst_chars(hCnv, new_subchars, len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_subst_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ //Target API
+ nRet = i18n_ucnv_get_subst_chars(hCnv, get_subchars, &len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_subst_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(1, len, "i18n_ucnv_get_subst_chars", "expected and obtained length are not same", i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_set_subst_string_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_set_subst_string
+ * @apicovered i18n_ucnv_set_subst_string
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_set_subst_string
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_set_subst_string
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_set_subst_string_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ISO-8859-1";
+ char DestBuffer[16];
+ int8_t length;
+ static const i18n_uchar szSrc[] = { 0x61, 0x62, 0x63, 0x64, 0x65 };
+ int32_t szSrcSize = (int32_t)(sizeof(szSrc)/sizeof(szSrc[0]));
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_set_subst_string(hCnv, szSrc, szSrcSize);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_subst_string", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ length = sizeof(DestBuffer);
+ nRet = i18n_ucnv_get_subst_chars(hCnv, DestBuffer, &length);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_subst_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_invalid_chars_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_invalid_chars
+ * @apicovered i18n_ucnv_get_invalid_chars
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_invalid_chars
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_invalid_chars
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_invalid_chars_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = NULL;
+ char szInvalidChars[10];
+ int8_t InvalidLength = (int32_t)(sizeof(szInvalidChars)/sizeof(szInvalidChars[0]));
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_invalid_chars(hCnv, szInvalidChars, &InvalidLength);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_invalid_chars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_invalid_uchars_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_invalid_uchars
+ * @apicovered i18n_ucnv_get_invalid_uchars
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_invalid_uchars
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_invalid_uchars
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_invalid_uchars_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = NULL;
+ i18n_uchar szInvalidChars[10];
+ int8_t InvalidLength = (int32_t)(sizeof(szInvalidChars)/sizeof(szInvalidChars[0]));
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_invalid_uchars(hCnv, szInvalidChars, &InvalidLength);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_invalid_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_reset_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_reset
+ * @apicovered i18n_ucnv_reset
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_reset
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_reset
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_reset_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = NULL;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_reset(hCnv);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_reset", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_reset_to_unicode_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_reset_to_unicode
+ * @apicovered i18n_ucnv_reset_to_unicode
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_reset_to_unicode
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_reset_to_unicode
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_reset_to_unicode_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = NULL;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_reset_to_unicode(hCnv);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_reset_to_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_reset_from_unicode_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_reset_from_unicode
+ * @apicovered i18n_ucnv_reset_from_unicode
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_reset_from_unicode
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_reset_from_unicode
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_reset_from_unicode_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = NULL;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_reset_from_unicode(hCnv);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_reset_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_max_char_size_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_max_char_size
+ * @apicovered i18n_ucnv_get_max_char_size
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_max_char_size
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_max_char_size
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_max_char_size_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "UTF-16";
+ int8_t size = -1;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_max_char_size(hCnv, &size);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_max_char_size", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(size, 2, "i18n_ucnv_get_max_char_size", "obtained and expected size are not same", i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_min_char_size_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_min_char_size
+ * @apicovered i18n_ucnv_get_min_char_size
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_min_char_size
+ * @failcase I18N_ERROR_NONE not returned i18n_ucnv_get_min_char_size
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_min_char_size_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-949_P110-1999";
+ int8_t size = -1;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_min_char_size(hCnv, &size);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_min_char_size", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(size, 1, "i18n_ucnv_get_min_char_size", "obtained and expected size are not same", i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_display_name_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_display_name
+ * @apicovered i18n_ucnv_get_display_name
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_display_name
+ * @failcase I18N_ERROR_NONE not returned i18n_ucnv_get_display_name
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_display_name_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-949";
+ i18n_uchar *pszDisplayName = NULL;
+ int32_t DisplayCapacity = 0;
+ int32_t DisplayNameLen = -1;
+ const char *pszDisplayLocale = "ko_KR";
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ nRet = i18n_ucnv_get_display_name(hCnv, pszDisplayLocale, pszDisplayName, DisplayCapacity, &DisplayNameLen);
+ if(I18N_ERROR_BUFFER_OVERFLOW == nRet) {
+ pszDisplayName = (i18n_uchar *)malloc((I18N_UCHAR_CAPACITY) * sizeof(i18n_uchar));
+ nRet = i18n_ucnv_get_display_name(hCnv, pszDisplayLocale, pszDisplayName, I18N_UCHAR_CAPACITY, &DisplayNameLen);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_display_name", BaseUtilsGetError(nRet), FREE_MEMORY(pszDisplayName); i18n_ucnv_destroy(hCnv));
+ if(DisplayNameLen < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_get_display_name failed ,DisplayNameLen is not correct \n", __LINE__, API_NAMESPACE);
+ FREE_MEMORY(pszDisplayName);
+ i18n_ucnv_destroy(hCnv);
+ return 1;
+ }
+ FREE_MEMORY(pszDisplayName);
+ pszDisplayName = NULL;
+ }
+
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_display_name", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_name_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_name
+ * @apicovered i18n_ucnv_get_name
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_name
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_name
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_name_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ static const char *const pszNames[] = {
+ "Unicode", "UTF-16",
+ "UnicodeBigUnmarked", "UTF-16BE",
+ "UnicodeBig", "UTF-16BE,version=1",
+ "UnicodeLittleUnmarked", "UTF-16LE",
+ "UnicodeLittle", "UTF-16LE,version=1",
+ "x-UTF-16LE-BOM", "UTF-16LE,version=1"
+ };
+ int nCount = 12;
+ int i = 0;
+ const char *pszEncodedNames = NULL;
+
+ for(i = 0; i < nCount; i += 2)
+ {
+ pszEncodedNames = NULL;
+ hCnv = NULL;
+ nRet = i18n_ucnv_create(pszNames[i], &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_name(hCnv, &pszEncodedNames);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_name", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ CHECK_HANDLE_CLEANUP(pszEncodedNames, "i18n_ucnv_get_name", i18n_ucnv_destroy(hCnv));
+
+ if(strncmp(pszNames[i + 1], pszEncodedNames, strlen(pszNames[i + 1])) != 0)
+ {
+ FPRINTF("[Line : %d][%s] i18n_ucnv_get_name mismatch. pszExpected = %s, pszEncodedNames = %s\\n", __LINE__, API_NAMESPACE, pszNames[i + 1], pszEncodedNames);
+ i18n_ucnv_destroy(hCnv);
+ return 1;
+ }
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_ccsid_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_ccsid
+ * @apicovered i18n_ucnv_get_ccsid
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_ccsid
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_ccsid
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_ccsid_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ int32_t SrcCcsid[] = { 37, 850, 943, 949, 950, 1047, 1252, 1392, 33722 };
+ int nCount = sizeof(SrcCcsid)/sizeof(SrcCcsid[0]);
+ int i;
+ int32_t ObtainedCcsid = 0;
+ i18n_ucnv_h hCnv = NULL;
+
+
+ for(i = 0; i < nCount; i++)
+ {
+ ObtainedCcsid = 0;
+ hCnv = NULL;
+
+ nRet = i18n_ucnv_create_ccsid(SrcCcsid[i], I18N_UCNV_IBM, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_ccsid", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create_ccsid");
+
+ //Target API
+ nRet = i18n_ucnv_get_ccsid(hCnv, &ObtainedCcsid);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_ccsid", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(SrcCcsid[i], ObtainedCcsid, "i18n_ucnv_get_ccsid", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_platform_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_platform
+ * @apicovered i18n_ucnv_get_platform
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_platform
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_platform
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_platform_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "utf-8";
+ i18n_ucnv_platform_e platform;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_platform(hCnv, &platform);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_platform", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(platform, I18N_UCNV_IBM, "i18n_ucnv_get_platform", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_type_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_type
+ * @apicovered i18n_ucnv_get_type
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_type
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_type
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_type_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "utf-8";
+ i18n_ucnv_type_e type;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_type(hCnv, &type);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_type", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(type, I18N_UCNV_UTF8, "i18n_ucnv_get_type", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_starters_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_starters
+ * @apicovered i18n_ucnv_get_starters
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_starters
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_starters
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_starters_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ksc";
+ i18n_ubool starters[I18N_UCHAR_CAPACITY];
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_starters(hCnv, starters);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_starters", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_unicode_set_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_unicode_set
+ * @apicovered i18n_ucnv_get_unicode_set
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_unicode_set
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_unicode_set
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_unicode_set_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_uset_h hSet = NULL;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ksc";
+
+ nRet = i18n_uset_create(1, 0, &hSet);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_uset_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hSet, "i18n_uset_create");
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_unicode_set(hCnv, hSet, I18N_UCNV_ROUNDTRIP_SET);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_unicode_set", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_from_unicode_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_from_unicode
+ * @apicovered i18n_ucnv_from_unicode
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_unicode
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_from_unicode
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_from_unicode_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszConv = "UTF-8";
+ i18n_ucnv_h hCnv = NULL;
+ char szBuffer[2] = {1, 1};
+ i18n_uchar szUcharBuffer[2] = {2, 2};
+ char *pszChars = szBuffer;
+ i18n_uchar *pszUchars = (i18n_uchar *)szUcharBuffer;
+ i18n_uchar *pszUcharsBad = (i18n_uchar *)(szUcharBuffer + 1);
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_from_unicode(hCnv, &pszChars, pszChars, (const i18n_uchar **)&pszUchars, pszUchars, NULL, true);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_to_unicode_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_to_unicode
+ * @apicovered i18n_ucnv_to_unicode
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_unicode
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_unicode
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_to_unicode_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszConv = "UTF-8";
+ i18n_ucnv_h hCnv = NULL;
+ char szBuffer[2] = {1, 1};
+ i18n_uchar szUcharBuffer[2] = {2, 2};
+ char *pszChars = szBuffer;
+ i18n_uchar *pszUchars = (i18n_uchar *)szUcharBuffer;
+ i18n_uchar *pszUcharsBad = (i18n_uchar *)(szUcharBuffer + 1);
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_to_unicode(hCnv, &pszUchars, pszUchars, (const i18n_uchar **)&pszChars, pszChars, NULL, true);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_from_uchars_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_from_uchars
+ * @apicovered i18n_ucnv_from_uchars
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_uchars
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_from_uchars
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_from_uchars_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "UTF-16";
+ static const i18n_uchar szSrc[1] = {0xd900};
+ char szBuffer[I18N_UCHAR_CAPACITY];
+ int32_t ObtainedLength = -1;
+ int32_t ExpectedLength = 4;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_from_uchars(hCnv, szBuffer, I18N_UCHAR_CAPACITY, szSrc, 1, &ObtainedLength);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(ExpectedLength, ObtainedLength, "i18n_ucnv_from_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_to_uchars_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_to_uchars
+ * @apicovered i18n_ucnv_to_uchars
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_uchars
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_uchars
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_to_uchars_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-943";
+ static const char szTarget[] = {
+ 0x5c, 0x75, 0x73, 0x72,
+ 0x5c, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x5c, 0x73, 0x68, 0x61, 0x72, 0x65,
+ 0x5c, 0x64, 0x61, 0x74, 0x61,
+ 0x5c, 0x69, 0x63, 0x75, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x78, 0x74,
+ 0
+ };
+
+ i18n_uchar szResult[I18N_UCHAR_CAPACITY];
+ int32_t ObtainedLength = -1;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_to_uchars(hCnv, szResult, I18N_UCHAR_CAPACITY, szTarget, (int32_t)strlen(szTarget), &ObtainedLength);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ if(ObtainedLength < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_to_uchars failed ,ObtainedLength is not correct \n", __LINE__, API_NAMESPACE);
+ i18n_ucnv_destroy(hCnv);
+ return 1;
+ }
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_next_uchar_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_next_uchar
+ * @apicovered i18n_ucnv_get_next_uchar
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_next_uchar
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_next_uchar
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_next_uchar_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-1363";
+ const char szSrcData[] = { (char)0xa2, (char)0xae, (char)0xa2 };
+ const char *pszSrc = szSrcData;
+ const char *pszSrcLimit = szSrcData + sizeof(szSrcData);
+ i18n_uchar32 result1, result2, result3;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_get_next_uchar(hCnv, &pszSrc, pszSrcLimit, &result1);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(0xa1, result1, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ //Target API
+ nRet = i18n_ucnv_get_next_uchar(hCnv, &pszSrc, pszSrcLimit, &result2);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(0x1a, result2, "i18n_ucnv_get_next_uchar", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_convert_ex_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_convert_ex
+ * @apicovered i18n_ucnv_convert_ex
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_convert_ex
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_convert_ex
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_convert_ex_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv1 = NULL;
+ i18n_ucnv_h hCnv2 = NULL;
+ const char *pszConv1 = "UTF-8";
+ const char *pszConv2 = "Shift-JIS";
+ char szTargetBuffer[I18N_UCHAR_CAPACITY];
+ char szSrcBuffer[I18N_UCHAR_CAPACITY];
+ char *pszTarget = szTargetBuffer;
+ const char *pszSrc = szSrcBuffer;
+
+ nRet = i18n_ucnv_create(pszConv1, &hCnv1);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv1, "i18n_ucnv_create");
+
+ nRet = i18n_ucnv_create(pszConv2, &hCnv2);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2));
+ CHECK_HANDLE_CLEANUP(hCnv2, "i18n_ucnv_create", i18n_ucnv_destroy(hCnv2));
+
+ //Target API
+ nRet = i18n_ucnv_convert_ex(hCnv2, hCnv1, &pszTarget, szTargetBuffer + sizeof(szTargetBuffer), &pszSrc, NULL, NULL, NULL, NULL, NULL, true, true);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_convert_ex", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));
+
+ nRet = i18n_ucnv_destroy(hCnv2);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ nRet = i18n_ucnv_destroy(hCnv1);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_convert_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_convert
+ * @apicovered i18n_ucnv_convert
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_convert
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_convert
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_convert_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ int32_t target_limit = 0, source_limit = 0, target_capacity = 0;
+ const uint8_t szSrc[]={ 0x00, 0x04, 0x05, 0x06, 0xa2, 0xb4, 0x00};
+ const uint8_t szExpectedTarget[]={ 0x00, 0x37, 0x2d, 0x2e, 0x0e, 0x49, 0x62, 0x0f, 0x00};
+ char *pszTarget = NULL;
+ source_limit = sizeof(szSrc)/sizeof(szSrc[0]);
+ int i = 0;
+
+ nRet = i18n_ucnv_convert("ibm-1364", "ibm-1363", NULL, target_limit, (const char*)szSrc, source_limit, &target_capacity);
+ if(nRet == I18N_ERROR_BUFFER_OVERFLOW) {
+ target_limit = target_capacity + 1;
+ pszTarget = (char *)malloc(sizeof(char) *target_limit);
+ nRet = i18n_ucnv_convert("ibm-1364", "ibm-1363", pszTarget, target_limit, (const char*)szSrc, source_limit, &target_capacity);
+ }
+
+ if(pszTarget != NULL)
+ {
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_convert", BaseUtilsGetError(nRet), FREE_MEMORY(pszTarget));
+ for(i = 0; i < target_capacity; ++i)
+ PRINT_RESULT_CLEANUP(pszTarget[i], szExpectedTarget[i], "i18n_ucnv_convert", "obtained and expected values are not correct", FREE_MEMORY(pszTarget));
+ FREE_MEMORY(pszTarget);
+ }
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_convert", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_from_algorithmic_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_from_algorithmic
+ * @apicovered i18n_ucnv_from_algorithmic
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_algorithmic
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_from_algorithmic
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_from_algorithmic_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ static const uint8_t
+ utf8[]={
+ /* 4e00 30a1 ff61 0410 */
+ 0xe4, 0xb8, 0x80, 0xe3, 0x82, 0xa1, 0xef, 0xbd, 0xa1, 0xd0, 0x90
+ },
+ shiftJIS[]={
+ 0x88, 0xea, 0x83, 0x40, 0xa1, 0x84, 0x40
+ };
+
+ int32_t length = -1;
+ char szTarget[I18N_UCHAR_CAPACITY];
+ const char *pszConv = "shift-JIS";
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_from_algorithmic(hCnv, I18N_UCNV_UTF8, szTarget, sizeof(shiftJIS), (const char *)utf8, sizeof(utf8), &length);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_algorithmic", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(length, sizeof(shiftJIS), "i18n_ucnv_from_algorithmic", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_to_algorithmic_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_to_algorithmic
+ * @apicovered i18n_ucnv_to_algorithmic
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_algorithmic
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_algorithmic
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_to_algorithmic_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ static const uint8_t
+ utf8[]={
+ /* 4e00 30a1 ff61 0410 */
+ 0xe4, 0xb8, 0x80, 0xe3, 0x82, 0xa1, 0xef, 0xbd, 0xa1, 0xd0, 0x90
+ },
+ shiftJIS[]={
+ 0x88, 0xea, 0x83, 0x40, 0xa1, 0x84, 0x40
+ };
+
+ int32_t length;
+ char szTarget[I18N_UCHAR_CAPACITY];
+ char szShiftJIS[I18N_UCHAR_CAPACITY];
+ const char *pszConv = "shift-JIS";
+
+ memcpy(szShiftJIS, shiftJIS, sizeof(shiftJIS));
+ szShiftJIS[sizeof(shiftJIS)] = 0;
+ memset(szTarget, 0x55, sizeof(szTarget));
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_to_algorithmic(I18N_UCNV_UTF8, hCnv, szTarget, sizeof(szTarget), szShiftJIS, -1, &length);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_algorithmic", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(length, sizeof(utf8), "i18n_ucnv_to_algorithmic", "obtained and expected length are different", i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_flush_cache_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_flush_cache
+ * @apicovered i18n_ucnv_flush_cache
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_flush_cache
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_flush_cache
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_flush_cache_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hConverters[4];
+ const char *pszConv1 = "ibm-1047";
+ const char *pszConv2 = "ibm-954";
+ i18n_ucnv_flush_cache();
+
+ nRet = i18n_ucnv_create(pszConv1, &hConverters[0]);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hConverters[0], "i18n_ucnv_create");
+
+ nRet = i18n_ucnv_create(pszConv1, &hConverters[1]);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hConverters[0]));
+ CHECK_HANDLE_CLEANUP(hConverters[1], "i18n_ucnv_create", i18n_ucnv_destroy(hConverters[0]));
+
+ nRet = i18n_ucnv_create(pszConv1, &hConverters[2]);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]));
+ CHECK_HANDLE_CLEANUP(hConverters[2], "i18n_ucnv_create", i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]));
+
+ nRet = i18n_ucnv_create(pszConv2, &hConverters[3]);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]));
+ CHECK_HANDLE_CLEANUP(hConverters[3], "i18n_ucnv_create", i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]); i18n_ucnv_destroy(hConverters[2]));
+
+ nRet = i18n_ucnv_flush_cache();
+ PRINT_RESULT_CLEANUP(nRet, 0, "i18n_ucnv_flush_cache", "value obtained is not correct", i18n_ucnv_destroy(hConverters[0]); i18n_ucnv_destroy(hConverters[1]); i18n_ucnv_destroy(hConverters[2]); i18n_ucnv_destroy(hConverters[3]));
+
+ nRet = i18n_ucnv_destroy(hConverters[0]);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ nRet = i18n_ucnv_destroy(hConverters[1]);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ nRet = i18n_ucnv_flush_cache();
+ PRINT_RESULT_CLEANUP(nRet, 0, "i18n_ucnv_flush_cache", "value obtained is not correct", i18n_ucnv_destroy(hConverters[2]); i18n_ucnv_destroy(hConverters[3]));
+
+ nRet = i18n_ucnv_destroy(hConverters[2]);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ nRet = i18n_ucnv_destroy(hConverters[3]);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_count_available_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_count_available
+ * @apicovered i18n_ucnv_count_available, i18n_ucnv_get_available_name
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_count_available, i18n_ucnv_get_available_name
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_count_available, i18n_ucnv_get_available_name
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_count_available_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ int count = 0;
+ int i = 0;
+ const char *pszName = NULL;
+
+ //Target API
+ count = i18n_ucnv_count_available();
+ if(count < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_available failed ,return number is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ for(i = 0; i < count; i++)
+ {
+ nRet = i18n_ucnv_get_available_name(i, &pszName);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_available_name", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(pszName, "i18n_ucnv_get_available_name");
+ }
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_available_name_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_available_name
+ * @apicovered i18n_ucnv_get_available_name
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_available_name
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_available_name
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_available_name_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszName = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_get_available_name(1, &pszName);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_available_name", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(pszName, "i18n_ucnv_get_available_name");
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_create_all_names_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_create_all_names
+ * @apicovered i18n_ucnv_create_all_names
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_all_names
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_all_names
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_create_all_names_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_uenumeration_h hEnumeration = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_create_all_names(&hEnumeration);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_all_names", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hEnumeration, "i18n_ucnv_create_all_names");
+
+ nRet = i18n_uenumeration_destroy(hEnumeration);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_uenumeration_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_count_aliases_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_count_aliases
+ * @apicovered i18n_ucnv_count_aliases
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_count_aliases
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_count_aliases
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_count_aliases_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszAlias = "utf-8";
+ uint16_t number = -1;
+
+ //Target API
+ nRet = i18n_ucnv_count_aliases(pszAlias, &number);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_count_aliases", BaseUtilsGetError(nRet));
+ if(number < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_aliases failed ,return number is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_aliases_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_aliases
+ * @apicovered i18n_ucnv_get_aliases
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_aliases
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_aliases
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_aliases_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszAlias = "utf-8";
+ uint16_t number = -1;
+ const char **pszAliases;
+ pszAliases = (const char **)malloc(number * sizeof(const char *));
+
+ nRet = i18n_ucnv_count_aliases(pszAlias, &number);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_count_aliases", BaseUtilsGetError(nRet));
+ if(number < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_aliases failed ,return number is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ //Target API
+ nRet = i18n_ucnv_get_aliases(pszAlias, pszAliases);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_aliases", BaseUtilsGetError(nRet), FREE_MEMORY(pszAliases));
+
+ FREE_MEMORY(pszAliases);
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_alias_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_alias
+ * @apicovered i18n_ucnv_get_alias
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_alias
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_alias
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_alias_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszAlias = "utf-8";
+ uint16_t number = -1;
+ const char **pszAliases;
+
+ const char *pszCheckAlias = NULL;
+ uint16_t i = 0;
+
+ nRet = i18n_ucnv_count_aliases(pszAlias, &number);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_count_aliases", BaseUtilsGetError(nRet));
+ if(number < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_aliases failed ,return number is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ pszAliases = (const char **)malloc(number * sizeof(const char *));
+
+ nRet = i18n_ucnv_get_aliases(pszAlias, pszAliases);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_aliases", BaseUtilsGetError(nRet), FREE_MEMORY(pszAliases));
+
+ for(i = 0; i < number; ++i)
+ {
+ pszCheckAlias = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_get_alias(pszAlias, i, &pszCheckAlias);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_alias", BaseUtilsGetError(nRet), FREE_MEMORY(pszAliases));
+ CHECK_HANDLE_CLEANUP(pszCheckAlias, "i18n_ucnv_get_alias", FREE_MEMORY(pszAliases));
+ if(strncmp(pszAliases[i], pszCheckAlias, strlen(pszAliases[i])) != 0)
+ {
+ FPRINTF("[Line : %d][%s] i18n_ucnv_get_alias mismatch. pszAliases[i] = %s, pszCheckAlias = %s\\n", __LINE__, API_NAMESPACE, pszAliases[i], pszCheckAlias);
+ FREE_MEMORY(pszAliases);
+ return 1;
+ }
+ }
+ FREE_MEMORY(pszAliases);
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_create_standard_names_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_create_standard_names
+ * @apicovered i18n_ucnv_create_standard_names
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create_standard_names
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create_standard_names
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_create_standard_names_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszConv = "ASCII";
+ const char *pszStandard = "IANA";
+ i18n_uenumeration_h hEnumeration = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_create_standard_names(pszConv, pszStandard, &hEnumeration);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create_standard_names", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_count_standards_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_count_standards
+ * @apicovered i18n_ucnv_count_standards
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_count_standards
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_count_standards
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_count_standards_p(void)
+{
+ START_TEST_PRINT;
+
+ uint16_t count = -1;
+
+ //Target API
+ count = i18n_ucnv_count_standards();
+
+ if(count < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_standards failed ,return value is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_standard_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_standard
+ * @apicovered i18n_ucnv_get_standard
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_standard
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_standard
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_standard_p(void)
+{
+ START_TEST_PRINT;
+
+ uint16_t count = -1;
+ int i = 0;
+ const char *pszStandard = NULL;
+ int nRet = -1;
+ count = i18n_ucnv_count_standards();
+
+ if(count < 0)
+ {
+ FPRINTF("\\n[Line : %d][%s] i18n_ucnv_count_standards failed ,return value is not correct \n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ for(i = 0; i < count -1; ++i)
+ {
+ pszStandard = NULL;
+ //Target API
+ nRet = i18n_ucnv_get_standard(i, &pszStandard);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_standard", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(pszStandard, "i18n_ucnv_get_standard");
+ }
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_standard_name_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_standard_names
+ * @apicovered i18n_ucnv_get_standard_names
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_standard_names
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_standard_names
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_standard_name_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszConv = "ASCII";
+ const char *pszStandard = "IANA";
+ const char *pszTag = NULL;
+ const char *pszExpected = "ANSI_X3.4-1968";
+
+ //Target API
+ nRet = i18n_ucnv_get_standard_name(pszConv, pszStandard, &pszTag);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_standard_name", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(pszTag, "i18n_ucnv_get_standard_name");
+
+ if(strncmp(pszExpected, pszTag, strlen(pszExpected)) != 0)
+ {
+ FPRINTF("[Line : %d][%s] i18n_ucnv_get_standard_name mismatch. pszExpected = %s, pszTag = %s\\n", __LINE__, API_NAMESPACE, pszExpected, pszTag);
+ return 1;
+ }
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_get_canonical_name_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_get_canonical_name
+ * @apicovered i18n_ucnv_get_canonical_name
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_get_canonical_name
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_get_canonical_name
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_get_canonical_name_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *pszConv = "UTF-8";
+ const char *pszStandard = "IANA";
+ const char *pszTag = NULL;
+ const char *pszExpected = "UTF-8";
+
+ //Target API
+ nRet = i18n_ucnv_get_canonical_name(pszConv, pszStandard, &pszTag);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_get_canonical_name", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(pszTag, "i18n_ucnv_get_canonical_name");
+
+ if(strncmp(pszExpected, pszTag, strlen(pszExpected)) != 0)
+ {
+ FPRINTF("[Line : %d][%s] i18n_ucnv_get_standard_names mismatch. pszExpected = %s, pszTag = %s\\n", __LINE__, API_NAMESPACE, pszExpected, pszTag);
+ return 1;
+ }
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_set_get_default_name_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_set_default_name, i18n_ucnv_get_default_name
+ * @apicovered i18n_ucnv_set_default_name, i18n_ucnv_get_default_name
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_set_default_name, i18n_ucnv_get_default_name
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_set_default_name, i18n_ucnv_get_default_name
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_set_get_default_name_p(void)
+{
+ START_TEST_PRINT;
+
+ const char *pszName = "UTF-8";
+ const char *pszGetName = NULL;
+ //Target API
+ i18n_ucnv_set_default_name(pszName);
+
+ //Target API
+ pszGetName = i18n_ucnv_get_default_name();
+ if(strncmp(pszName, pszGetName, strlen(pszName)) != 0)
+ {
+ FPRINTF("[Line : %d][%s] i18n_ucnv_get_default_name mismatch. pszName = %s, pszExpectedName = %s\\n", __LINE__, API_NAMESPACE, pszName, pszGetName);
+ return 1;
+ }
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_fix_file_separator_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_fix_file_separator
+ * @apicovered i18n_ucnv_create, i18n_ucnv_destroy
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_fix_file_separator
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_fix_file_separator
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_fix_file_separator_p(void)
+{
+ START_TEST_PRINT;
+
+ static const char szTarget[] = {
+ 0x5c, 0x75, 0x73, 0x72,
+ 0x5c, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x5c, 0x73, 0x68, 0x61, 0x72, 0x65,
+ 0x5c, 0x64, 0x61, 0x74, 0x61,
+ 0x5c, 0x69, 0x63, 0x75, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x78, 0x74,
+ 0
+ };
+ i18n_uchar szResult[I18N_UCHAR_CAPACITY];
+ i18n_uchar szAsciiResult[I18N_UCHAR_CAPACITY];
+ int32_t len = -1;
+ int32_t ascii_len = -1;
+ const char *pszConv1 = "ibm-943";
+ const char *pszConv2 = "LATIN-1";
+ i18n_ucnv_h hCnv1 = NULL;
+ i18n_ucnv_h hCnv2 = NULL;
+ int nRet = -1;
+
+ nRet = i18n_ucnv_create(pszConv1, &hCnv1);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv1, "i18n_ucnv_create");
+
+ nRet = i18n_ucnv_create(pszConv2, &hCnv2);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2));
+ CHECK_HANDLE_CLEANUP(hCnv2, "i18n_ucnv_create", i18n_ucnv_destroy(hCnv1));
+
+ nRet = i18n_ucnv_to_uchars(hCnv1, szResult, I18N_UCHAR_CAPACITY, szTarget, (int32_t)strlen(szTarget), &len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));
+
+ nRet = i18n_ucnv_to_uchars(hCnv2, szAsciiResult, I18N_UCHAR_CAPACITY, szTarget, (int32_t)strlen(szTarget), &ascii_len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_to_uchars", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));
+
+ //Target API
+ nRet = i18n_ucnv_fix_file_separator(hCnv1, szResult, len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_fix_file_separator", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));
+ PRINT_RESULT_CLEANUP(i18n_ustring_compare(szResult, szAsciiResult), 0, "i18n_ucnv_fix_file_separator", "values are not equal", i18n_ucnv_destroy(hCnv2); i18n_ucnv_destroy(hCnv1));
+
+ nRet = i18n_ucnv_destroy(hCnv2);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ nRet = i18n_ucnv_destroy(hCnv1);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_is_ambiguous_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_create, i18n_ucnv_is_ambiguous
+ * @apicovered i18n_ucnv_create, i18n_ucnv_is_ambiguous
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_is_ambiguous
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_is_ambiguous
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_is_ambiguous_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "UTF-8";
+ i18n_ubool bAmbiguous = false;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_is_ambiguous(hCnv, &bAmbiguous);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_is_ambiguous", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_set_fallback_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_set_fallback
+ * @apicovered i18n_ucnv_create, i18n_ucnv_set_fallback
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_set_fallback
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_set_fallback
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_set_fallback_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-1371";
+ i18n_ubool bResult = false;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_set_fallback(hCnv, true);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_uses_fallback(hCnv, &bResult);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_uses_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(true, bResult, "i18n_ucnv_uses_fallback", "value is not correct", i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_uses_fallback_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_uses_fallback
+ * @apicovered i18n_ucnv_create, i18n_ucnv_uses_fallback
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_uses_fallback
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_uses_fallback
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_uses_fallback_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "ibm-1371";
+ i18n_ubool bResult = false;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ nRet = i18n_ucnv_set_fallback(hCnv, true);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_set_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ //Target API
+ nRet = i18n_ucnv_uses_fallback(hCnv, &bResult);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_uses_fallback", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(true, bResult, "i18n_ucnv_uses_fallback", "value is not correct", i18n_ucnv_destroy(hCnv));
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_detect_unicode_signature_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_detect_unicode_signature_p
+ * @apicovered ITc_i18n_ucnv_detect_unicode_signature_p
+ * @passcase I18N_ERROR_NONE returned by ITc_i18n_ucnv_detect_unicode_signature_p
+ * @failcase I18N_ERROR_NONE not returned by ITc_i18n_ucnv_detect_unicode_signature_p
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_detect_unicode_signature_p(void)
+{
+ START_TEST_PRINT;
+
+ static const char* pszData[] = {
+ "\xFE\xFF\x00\x00", /* UTF-16BE */
+ "\xFF\xFE\x00\x00", /* UTF-16LE */
+ "\xEF\xBB\xBF\x00", /* UTF-8 */
+ "\x0E\xFE\xFF\x00", /* SCSU */
+
+ "\xFE\xFF", /* UTF-16BE */
+ "\xFF\xFE", /* UTF-16LE */
+ "\xEF\xBB\xBF", /* UTF-8 */
+ "\x0E\xFE\xFF", /* SCSU */
+
+ "\xFE\xFF\x41\x42", /* UTF-16BE */
+ "\xFF\xFE\x41\x41", /* UTF-16LE */
+ "\xEF\xBB\xBF\x41", /* UTF-8 */
+ "\x0E\xFE\xFF\x41", /* SCSU */
+
+ "\x2B\x2F\x76\x38\x2D", /* UTF-7 */
+ "\x2B\x2F\x76\x38\x41", /* UTF-7 */
+ "\x2B\x2F\x76\x39\x41", /* UTF-7 */
+ "\x2B\x2F\x76\x2B\x41", /* UTF-7 */
+ "\x2B\x2F\x76\x2F\x41", /* UTF-7 */
+
+ "\xDD\x73\x66\x73" /* UTF-EBCDIC */
+ };
+
+ static const char* pszExpected[] = {
+ "UTF-16BE",
+ "UTF-16LE",
+ "UTF-8",
+ "SCSU",
+
+ "UTF-16BE",
+ "UTF-16LE",
+ "UTF-8",
+ "SCSU",
+
+ "UTF-16BE",
+ "UTF-16LE",
+ "UTF-8",
+ "SCSU",
+
+ "UTF-7",
+ "UTF-7",
+ "UTF-7",
+ "UTF-7",
+ "UTF-7",
+
+ "UTF-EBCDIC"
+ };
+
+ static const int32_t expected_len[] =
+ {
+ 2, 2, 3, 3,
+ 2, 2, 3, 3,
+ 2, 2, 3, 3,
+ 5, 4, 4, 4, 4,
+ 4
+ };
+ int nRet = -1;
+ const char *pszSrc = NULL;
+ const char *pszName = NULL;
+ int32_t signature_length = -1;
+ int nCount = sizeof(pszData)/sizeof(pszData[0]);
+ int i = 0;
+
+ for(i = 0; i < nCount; ++i)
+ {
+ pszSrc = pszData[i];
+ pszName = NULL;
+
+ //Target API
+ nRet = i18n_ucnv_detect_unicode_signature(pszSrc, -1, &signature_length, &pszName);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_detect_unicode_signature", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(pszName, "i18n_ucnv_detect_unicode_signature");
+ PRINT_RESULT(signature_length, expected_len[i], "i18n_ucnv_detect_unicode_signature", "obtained and expected length are not same");
+ if(strncmp(pszName, pszExpected[i], strlen(pszName)) != 0)
+ {
+ FPRINTF("[Line : %d][%s] i18n_ucnv_get_name mismatch. pszExpected = %s, pszName = %s\\n", __LINE__, API_NAMESPACE, pszExpected[i], pszName);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_from_ucount_pending_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_from_ucount_pending
+ * @apicovered i18n_ucnv_from_ucount_pending
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_from_ucount_pending
+ * @failcase I18N_ERROR_NONE not returned i18n_ucnv_from_ucount_pending
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_from_ucount_pending_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ static const struct {
+ i18n_uchar input[6];
+ int32_t len;
+ int32_t exp;
+ }from_unicode_tests[] = {
+ {{ 0xdbc4},1,1},
+ {{ 0xdbc4, 0xde34, 0xd84d},3,1},
+ };
+
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "UTF-8";
+ char *pszTarget = NULL;
+ char *pszTargetLimit = NULL;
+ const i18n_uchar *pszSource = NULL;
+ const i18n_uchar *pszSourceLimit = NULL;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ int nCount = 2;
+ int i = 0;
+ int32_t len = 0;
+
+ for(i = 0; i < nCount; i++)
+ {
+ char sztgt[10];
+ pszTarget = sztgt;
+ pszTargetLimit = pszTarget + 10;
+ pszSource = from_unicode_tests[i].input;
+ pszSourceLimit = pszSource + from_unicode_tests[i].len;
+ len = 0;
+
+
+ nRet = i18n_ucnv_from_unicode(hCnv, &pszTarget, pszTargetLimit, &pszSource, pszSourceLimit, NULL, false);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ //Target API
+ nRet = i18n_ucnv_from_ucount_pending(hCnv, &len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_ucount_pending", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(len, from_unicode_tests[i].exp, "i18n_ucnv_from_ucount_pending", "obtained and expected length are not equal", i18n_ucnv_destroy(hCnv));
+ }
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_to_ucount_pending_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_to_ucount_pending
+ * @apicovered i18n_ucnv_to_ucount_pending
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_to_ucount_pending
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_to_ucount_pending
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_to_ucount_pending_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ static const struct {
+ char input[6];
+ int32_t len;
+ int32_t exp;
+ }to_unicode_tests[] = {
+ {{0x05, 0x01, 0x02},3,3},
+ {{0x01, 0x02},2,2},
+ {{0x07, 0x00, 0x01, 0x02},4,4},
+ };
+
+ i18n_ucnv_h hCnv = NULL;
+ const char *pszConv = "UTF-8";
+ char *pszTarget = NULL;
+ char *pszTargetLimit = NULL;
+ const i18n_uchar *pszSource = NULL;
+ const i18n_uchar *pszSourceLimit = NULL;
+
+ nRet = i18n_ucnv_create(pszConv, &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ int nCount = 3;
+ int i = 0;
+ int32_t len = 0;
+
+ for(i = 0; i < nCount; i++)
+ {
+ i18n_uchar sztgt[10];
+ pszTarget = sztgt;
+ pszTargetLimit = pszTarget + 10;
+ pszSource = to_unicode_tests[i].input;
+ pszSourceLimit = pszSource + to_unicode_tests[i].len;
+ len = 0;
+
+ nRet = i18n_ucnv_from_unicode(hCnv, &pszTarget, pszTargetLimit, &pszSource, pszSourceLimit, NULL, false);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_unicode", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+
+ //Target API
+ nRet = i18n_ucnv_to_ucount_pending(hCnv, &len);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_from_ucount_pending", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ }
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+
+ return 0;
+}
+/*
+ * @testcase ITc_i18n_ucnv_is_fixed_width_p
+ * @since_tizen 6.0
+ * @author SRID(mohit.m)
+ * @reviewer SRID(shobhit.v)
+ * @type auto
+ * @scenario calls the api based on code
+ * @apitarget i18n_ucnv_is_fixed_width
+ * @apicovered i18n_ucnv_create, i18n_ucnv_is_fixed_width
+ * @passcase I18N_ERROR_NONE returned by i18n_ucnv_create, i18n_ucnv_is_fixed_width
+ * @failcase I18N_ERROR_NONE not returned by i18n_ucnv_create, i18n_ucnv_is_fixed_width
+ * @precondition NA
+ * @postcondition NA
+ */
+int ITc_i18n_ucnv_is_fixed_width_p(void)
+{
+ START_TEST_PRINT;
+
+ int nRet = -1;
+ const char *szFixedWidth[] = {
+ "US-ASCII",
+ "UTF32",
+ "ibm-5478_P100-1995"
+ };
+
+ const char *szNotFixedWidth[] = {
+ "GB18030",
+ "UTF8",
+ "windows-949-2000",
+ "UTF16"
+ };
+ i18n_ubool bResult = false;
+ i18n_ucnv_h hCnv = NULL;
+ int nCount1 = 3;
+ int nCount2 = 4;
+ int i = 0;
+
+ for(i = 0; i < nCount1; ++i)
+ {
+ hCnv = NULL;
+ bResult = false;
+ nRet = i18n_ucnv_create(szFixedWidth[i], &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_is_fixed_width(hCnv, &bResult);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_is_fixed_width", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(true, bResult, "i18n_ucnv_is_fixed_width", "result is not correct", i18n_ucnv_destroy(hCnv));
+ }
+
+ for(i = 0; i < nCount2; ++i)
+ {
+ hCnv = NULL;
+ bResult = true;
+ nRet = i18n_ucnv_create(szNotFixedWidth[i], &hCnv);
+ PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ucnv_create", BaseUtilsGetError(nRet));
+ CHECK_HANDLE(hCnv, "i18n_ucnv_create");
+
+ //Target API
+ nRet = i18n_ucnv_is_fixed_width(hCnv, &bResult);
+ PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ucnv_is_fixed_width", BaseUtilsGetError(nRet), i18n_ucnv_destroy(hCnv));
+ PRINT_RESULT_CLEANUP(false, bResult, "i18n_ucnv_is_fixed_width", "result is not correct", i18n_ucnv_destroy(hCnv));
+ }
+
+ nRet = i18n_ucnv_destroy(hCnv);
+ PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ucnv_destroy", BaseUtilsGetError(nRet));
+ return 0;
+}