From b6a3d12850b5efd8817810e97c1e1f8b978a0cfd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Szczekutek?= Date: Thu, 30 Jun 2016 11:36:55 +0200 Subject: [PATCH] [UTC][base-utils][ACR-661][Tests for the FieldPosition module added.] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test file was added earlier. This commit simply adds functions to the test manager framework. Change-Id: I5482174e329fa6c944e56ff6a809a192746253d8 Signed-off-by: Rafał Szczekutek --- src/utc/base-utils/CMakeLists.txt | 1 + src/utc/base-utils/tct-base-utils-core_mobile.h | 51 ++- src/utc/base-utils/tct-base-utils-core_wearable.h | 50 ++ .../utc-capi-base-utils-field-position.c | 509 +++++++++++++++++++++ 4 files changed, 610 insertions(+), 1 deletion(-) create mode 100755 src/utc/base-utils/utc-capi-base-utils-field-position.c diff --git a/src/utc/base-utils/CMakeLists.txt b/src/utc/base-utils/CMakeLists.txt index f392fa2..6852778 100755 --- a/src/utc/base-utils/CMakeLists.txt +++ b/src/utc/base-utils/CMakeLists.txt @@ -25,6 +25,7 @@ SET(TC_SOURCES utc-capi-base-utils-measure-format.c utc-capi-base-utils-format.c utc-capi-base-utils-parse-position.c + utc-capi-base-utils-field-position.c ) PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED diff --git a/src/utc/base-utils/tct-base-utils-core_mobile.h b/src/utc/base-utils/tct-base-utils-core_mobile.h index 83efd2b..7fcc27c 100755 --- a/src/utc/base-utils/tct-base-utils-core_mobile.h +++ b/src/utc/base-utils/tct-base-utils-core_mobile.h @@ -59,6 +59,8 @@ extern void utc_capi_base_utils_format_startup(void); extern void utc_capi_base_utils_format_cleanup(void); extern void utc_capi_base_utils_parse_position_startup(void); extern void utc_capi_base_utils_parse_position_cleanup(void); +extern void utc_capi_base_utils_field_position_startup(void); +extern void utc_capi_base_utils_field_position_cleanup(void); extern int utc_capi_base_utils_i18n_ustring_get_length_p(void); extern int utc_capi_base_utils_i18n_ustring_get_length_n(void); @@ -1347,7 +1349,30 @@ extern int utc_capi_base_utils_i18n_parse_position_create_with_index_p(void); extern int utc_capi_base_utils_i18n_parse_position_create_with_index_n(void); extern int utc_capi_base_utils_i18n_parse_position_create_p(void); extern int utc_capi_base_utils_i18n_parse_position_create_n(void); - +extern int utc_capi_base_utils_i18n_field_position_set_end_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_set_end_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_set_begin_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_set_begin_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_set_field_p(void); +extern int utc_capi_base_utils_i18n_field_position_set_field_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_end_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_get_end_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_end_index_n2(void); +extern int utc_capi_base_utils_i18n_field_position_get_begin_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_get_begin_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_begin_index_n2(void); +extern int utc_capi_base_utils_i18n_field_position_get_field_p(void); +extern int utc_capi_base_utils_i18n_field_position_get_field_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_field_n2(void); +extern int utc_capi_base_utils_i18n_field_position_clone_p(void); +extern int utc_capi_base_utils_i18n_field_position_clone_n(void); +extern int utc_capi_base_utils_i18n_field_position_clone_n2(void); +extern int utc_capi_base_utils_i18n_field_position_destroy_p(void); +extern int utc_capi_base_utils_i18n_field_position_destroy_n(void); +extern int utc_capi_base_utils_i18n_field_position_create_for_field_p(void); +extern int utc_capi_base_utils_i18n_field_position_create_for_field_n(void); +extern int utc_capi_base_utils_i18n_field_position_create_p(void); +extern int utc_capi_base_utils_i18n_field_position_create_n(void); testcase tc_array[] = { {"utc_capi_base_utils_i18n_ustring_get_length_p", utc_capi_base_utils_i18n_ustring_get_length_p, utc_capi_base_utils_string_startup, utc_capi_base_utils_string_cleanup}, @@ -2637,6 +2662,30 @@ testcase tc_array[] = { {"utc_capi_base_utils_i18n_parse_position_create_with_index_n", utc_capi_base_utils_i18n_parse_position_create_with_index_n,utc_capi_base_utils_parse_position_startup ,utc_capi_base_utils_parse_position_cleanup}, {"utc_capi_base_utils_i18n_parse_position_create_p", utc_capi_base_utils_i18n_parse_position_create_p,utc_capi_base_utils_parse_position_startup ,utc_capi_base_utils_parse_position_cleanup}, {"utc_capi_base_utils_i18n_parse_position_create_n", utc_capi_base_utils_i18n_parse_position_create_n,utc_capi_base_utils_parse_position_startup ,utc_capi_base_utils_parse_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_end_index_p",utc_capi_base_utils_i18n_field_position_set_end_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_end_index_n",utc_capi_base_utils_i18n_field_position_set_end_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_begin_index_p",utc_capi_base_utils_i18n_field_position_set_begin_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_begin_index_n",utc_capi_base_utils_i18n_field_position_set_begin_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_field_p",utc_capi_base_utils_i18n_field_position_set_field_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_field_n",utc_capi_base_utils_i18n_field_position_set_field_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_end_index_p",utc_capi_base_utils_i18n_field_position_get_end_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_end_index_n",utc_capi_base_utils_i18n_field_position_get_end_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_end_index_n2",utc_capi_base_utils_i18n_field_position_get_end_index_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_begin_index_p",utc_capi_base_utils_i18n_field_position_get_begin_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_begin_index_n",utc_capi_base_utils_i18n_field_position_get_begin_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_begin_index_n2",utc_capi_base_utils_i18n_field_position_get_begin_index_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_field_p",utc_capi_base_utils_i18n_field_position_get_field_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_field_n",utc_capi_base_utils_i18n_field_position_get_field_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_field_n2",utc_capi_base_utils_i18n_field_position_get_field_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_clone_p",utc_capi_base_utils_i18n_field_position_clone_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_clone_n",utc_capi_base_utils_i18n_field_position_clone_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_clone_n2",utc_capi_base_utils_i18n_field_position_clone_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_destroy_p",utc_capi_base_utils_i18n_field_position_destroy_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_destroy_n",utc_capi_base_utils_i18n_field_position_destroy_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_for_field_p",utc_capi_base_utils_i18n_field_position_create_for_field_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_for_field_n",utc_capi_base_utils_i18n_field_position_create_for_field_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_p",utc_capi_base_utils_i18n_field_position_create_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_n",utc_capi_base_utils_i18n_field_position_create_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, {NULL, NULL} }; diff --git a/src/utc/base-utils/tct-base-utils-core_wearable.h b/src/utc/base-utils/tct-base-utils-core_wearable.h index b0292d9..ce98088 100755 --- a/src/utc/base-utils/tct-base-utils-core_wearable.h +++ b/src/utc/base-utils/tct-base-utils-core_wearable.h @@ -59,6 +59,8 @@ extern void utc_capi_base_utils_format_startup(void); extern void utc_capi_base_utils_format_cleanup(void); extern void utc_capi_base_utils_parse_position_startup(void); extern void utc_capi_base_utils_parse_position_cleanup(void); +extern void utc_capi_base_utils_field_position_startup(void); +extern void utc_capi_base_utils_field_position_cleanup(void); extern int utc_capi_base_utils_i18n_ustring_get_length_p(void); extern int utc_capi_base_utils_i18n_ustring_get_length_n(void); @@ -1338,6 +1340,30 @@ extern int utc_capi_base_utils_i18n_parse_position_create_with_index_p(void); extern int utc_capi_base_utils_i18n_parse_position_create_with_index_n(void); extern int utc_capi_base_utils_i18n_parse_position_create_p(void); extern int utc_capi_base_utils_i18n_parse_position_create_n(void); +extern int utc_capi_base_utils_i18n_field_position_set_end_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_set_end_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_set_begin_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_set_begin_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_set_field_p(void); +extern int utc_capi_base_utils_i18n_field_position_set_field_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_end_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_get_end_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_end_index_n2(void); +extern int utc_capi_base_utils_i18n_field_position_get_begin_index_p(void); +extern int utc_capi_base_utils_i18n_field_position_get_begin_index_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_begin_index_n2(void); +extern int utc_capi_base_utils_i18n_field_position_get_field_p(void); +extern int utc_capi_base_utils_i18n_field_position_get_field_n(void); +extern int utc_capi_base_utils_i18n_field_position_get_field_n2(void); +extern int utc_capi_base_utils_i18n_field_position_clone_p(void); +extern int utc_capi_base_utils_i18n_field_position_clone_n(void); +extern int utc_capi_base_utils_i18n_field_position_clone_n2(void); +extern int utc_capi_base_utils_i18n_field_position_destroy_p(void); +extern int utc_capi_base_utils_i18n_field_position_destroy_n(void); +extern int utc_capi_base_utils_i18n_field_position_create_for_field_p(void); +extern int utc_capi_base_utils_i18n_field_position_create_for_field_n(void); +extern int utc_capi_base_utils_i18n_field_position_create_p(void); +extern int utc_capi_base_utils_i18n_field_position_create_n(void); testcase tc_array[] = { {"utc_capi_base_utils_i18n_ustring_get_length_p", utc_capi_base_utils_i18n_ustring_get_length_p, utc_capi_base_utils_string_startup, utc_capi_base_utils_string_cleanup}, @@ -2618,6 +2644,30 @@ testcase tc_array[] = { {"utc_capi_base_utils_i18n_parse_position_create_with_index_n", utc_capi_base_utils_i18n_parse_position_create_with_index_n,utc_capi_base_utils_parse_position_startup ,utc_capi_base_utils_parse_position_cleanup}, {"utc_capi_base_utils_i18n_parse_position_create_p", utc_capi_base_utils_i18n_parse_position_create_p,utc_capi_base_utils_parse_position_startup ,utc_capi_base_utils_parse_position_cleanup}, {"utc_capi_base_utils_i18n_parse_position_create_n", utc_capi_base_utils_i18n_parse_position_create_n,utc_capi_base_utils_parse_position_startup ,utc_capi_base_utils_parse_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_end_index_p",utc_capi_base_utils_i18n_field_position_set_end_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_end_index_n",utc_capi_base_utils_i18n_field_position_set_end_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_begin_index_p",utc_capi_base_utils_i18n_field_position_set_begin_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_begin_index_n",utc_capi_base_utils_i18n_field_position_set_begin_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_field_p",utc_capi_base_utils_i18n_field_position_set_field_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_set_field_n",utc_capi_base_utils_i18n_field_position_set_field_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_end_index_p",utc_capi_base_utils_i18n_field_position_get_end_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_end_index_n",utc_capi_base_utils_i18n_field_position_get_end_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_end_index_n2",utc_capi_base_utils_i18n_field_position_get_end_index_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_begin_index_p",utc_capi_base_utils_i18n_field_position_get_begin_index_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_begin_index_n",utc_capi_base_utils_i18n_field_position_get_begin_index_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_begin_index_n2",utc_capi_base_utils_i18n_field_position_get_begin_index_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_field_p",utc_capi_base_utils_i18n_field_position_get_field_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_field_n",utc_capi_base_utils_i18n_field_position_get_field_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_get_field_n2",utc_capi_base_utils_i18n_field_position_get_field_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_clone_p",utc_capi_base_utils_i18n_field_position_clone_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_clone_n",utc_capi_base_utils_i18n_field_position_clone_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_clone_n2",utc_capi_base_utils_i18n_field_position_clone_n2,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_destroy_p",utc_capi_base_utils_i18n_field_position_destroy_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_destroy_n",utc_capi_base_utils_i18n_field_position_destroy_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_for_field_p",utc_capi_base_utils_i18n_field_position_create_for_field_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_for_field_n",utc_capi_base_utils_i18n_field_position_create_for_field_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_p",utc_capi_base_utils_i18n_field_position_create_p,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, + {"utc_capi_base_utils_i18n_field_position_create_n",utc_capi_base_utils_i18n_field_position_create_n,utc_capi_base_utils_field_position_startup,utc_capi_base_utils_field_position_cleanup}, {NULL, NULL} }; diff --git a/src/utc/base-utils/utc-capi-base-utils-field-position.c b/src/utc/base-utils/utc-capi-base-utils-field-position.c new file mode 100755 index 0000000..870ef0a --- /dev/null +++ b/src/utc/base-utils/utc-capi-base-utils-field-position.c @@ -0,0 +1,509 @@ +#include "assert.h" +#include +#include + +static i18n_field_position_h field_position = NULL; +static int ret = I18N_ERROR_NONE; + +/** + * @function utc_capi_base_utils_field_position_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void utc_capi_base_utils_field_position_startup(void) +{ + ret = i18n_field_position_create(&field_position); +} + +/** + * @function utc_capi_base_utils_field_position_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void utc_capi_base_utils_field_position_cleanup(void) +{ + if (field_position != NULL) { + i18n_field_position_destroy(field_position); + field_position = NULL; + } +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_set_end_index_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_set_end_index and checks whether function + * succeeded. + */ +int utc_capi_base_utils_i18n_field_position_set_end_index_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + int32_t end_index = 13; + + ret = i18n_field_position_set_end_index(field_position, end_index); + + assert_eq(ret, I18N_ERROR_NONE); + + int32_t ret_end_index; + ret = i18n_field_position_get_end_index(field_position, &ret_end_index); + + assert_eq(ret, I18N_ERROR_NONE); + assert_eq(ret_end_index, end_index); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_set_end_index_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_set_end_index passing invalid + * field_position and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_set_end_index_n(void) { + + int32_t end_index = 13; + + ret = i18n_field_position_set_end_index(NULL, end_index); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_set_begin_index_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_set_begin_index and checks whether + * function succeeded. + */ +int utc_capi_base_utils_i18n_field_position_set_begin_index_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + int32_t begin_index = 10; + + ret = i18n_field_position_set_begin_index(field_position, begin_index); + + assert_eq(ret, I18N_ERROR_NONE); + + int32_t ret_begin_index; + ret = i18n_field_position_get_begin_index(field_position, &ret_begin_index); + + assert_eq(ret, I18N_ERROR_NONE); + assert_eq(ret_begin_index, begin_index); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_set_begin_index_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_set_begin_index passing invalid + * field_position and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_set_begin_index_n(void) { + + int32_t begin_index = 10; + + ret = i18n_field_position_set_begin_index(NULL, begin_index); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_set_field_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_set_field and checks whether function + * succeeded. + */ +int utc_capi_base_utils_i18n_field_position_set_field_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + int32_t field = 13; + + ret = i18n_field_position_set_field(field_position, field); + + assert_eq(ret, I18N_ERROR_NONE); + + int32_t ret_field; + + ret = i18n_field_position_get_field(field_position, &ret_field); + + assert_eq(ret, I18N_ERROR_NONE); + assert_eq(ret_field, field); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_set_field_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_set_field passing invalid field_position + * and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_set_field_n(void) { + + int32_t field = 0; + + ret = i18n_field_position_set_field(NULL, field); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_end_index_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_end_index and checks whether function + * succeeded. + */ +int utc_capi_base_utils_i18n_field_position_get_end_index_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + int32_t end_index_to_set = 13; + + ret = i18n_field_position_set_end_index(field_position, end_index_to_set); + + assert_eq(ret, I18N_ERROR_NONE); + + int32_t end_index; + + ret = i18n_field_position_get_end_index(field_position, &end_index); + + assert_eq(ret, I18N_ERROR_NONE); + assert_eq(end_index, end_index_to_set); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_end_index_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_end_index passing invalid + * field_position and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_get_end_index_n(void) { + + i18n_field_position_h field_position = NULL; // Invalid parameter + + int32_t end_index; + + ret = i18n_field_position_get_end_index(field_position, &end_index); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_end_index_n2 + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_end_index passing invalid end_index + * and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_get_end_index_n2(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + ret = i18n_field_position_get_end_index(field_position, NULL); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_begin_index_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_begin_index and checks whether + * function succeeded. + */ +int utc_capi_base_utils_i18n_field_position_get_begin_index_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + int32_t begin_index_to_set = 13; + + ret = i18n_field_position_set_begin_index(field_position, begin_index_to_set); + + assert_eq(ret, I18N_ERROR_NONE); + + int32_t begin_index = NULL; + + ret = i18n_field_position_get_begin_index(field_position, &begin_index); + + assert_eq(ret, I18N_ERROR_NONE); + assert_eq(begin_index, begin_index_to_set); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_begin_index_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_begin_index passing invalid + * field_position and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_get_begin_index_n(void) { + + i18n_field_position_h field_position = NULL; // Invalid parameter + + int32_t begin_index; + + ret = i18n_field_position_get_begin_index(field_position, &begin_index); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_begin_index_n2 + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_begin_index passing invalid + * begin_index and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_get_begin_index_n2(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + ret = i18n_field_position_get_begin_index(field_position, NULL); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_field_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_field and checks whether function + * succeeded. + */ +int utc_capi_base_utils_i18n_field_position_get_field_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + int32_t field_to_set = 13; + + ret = i18n_field_position_set_field(field_position, field_to_set); + + assert_eq(ret, I18N_ERROR_NONE); + + int32_t field = NULL; + + ret = i18n_field_position_get_field(field_position, &field); + + assert_eq(ret, I18N_ERROR_NONE); + assert_eq(field_to_set, field); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_field_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_field passing invalid field_position + * and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_get_field_n(void) { + + i18n_field_position_h field_position = NULL; // Invalid parameter + + int32_t field = NULL; + + ret = i18n_field_position_get_field(field_position, &field); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_get_field_n2 + * @since_tizen 3.0 + * @description Calls i18n_field_position_get_field passing invalid field and checks + * for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_get_field_n2(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + ret = i18n_field_position_get_field(field_position, NULL); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_clone_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_clone and checks whether function succeeded. + */ +int utc_capi_base_utils_i18n_field_position_clone_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + i18n_field_position_h clone = NULL; + + ret = i18n_field_position_clone(field_position, &clone); + + assert_neq(clone, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_clone_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_clone passing invalid field_position and + * checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_clone_n(void) { + + i18n_field_position_h field_position = NULL; // Invalid parameter + + i18n_field_position_h clone = NULL; + + ret = i18n_field_position_clone(field_position, &clone); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_clone_n2 + * @since_tizen 3.0 + * @description Calls i18n_field_position_clone passing invalid clone and checks for + * an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_clone_n2(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + ret = i18n_field_position_clone(field_position, NULL); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_destroy_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_destroy and checks whether function + * succeeded. + */ +int utc_capi_base_utils_i18n_field_position_destroy_p(void) { + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + ret = i18n_field_position_destroy(field_position); + assert_eq(ret, I18N_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_destroy_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_destroy passing invalid field_position and + * checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_destroy_n(void) { + + i18n_field_position_h field_position = NULL; // Invalid parameter + + ret = i18n_field_position_destroy(field_position); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_create_for_field_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_create_for_field and checks whether + * function succeeded. + */ +int utc_capi_base_utils_i18n_field_position_create_for_field_p(void) { + + int ret; + + i18n_field_position_h field_position = NULL; + + int32_t field = 13; + + ret = i18n_field_position_create_for_field(field, &field_position); + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_create_for_field_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_create_for_field passing invalid + * field_position and checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_create_for_field_n(void) { + + int ret; + + int32_t field = 0; + + ret = i18n_field_position_create_for_field(field, NULL); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_create_p + * @since_tizen 3.0 + * @description Calls i18n_field_position_create and checks whether function + * succeeded. + */ +int utc_capi_base_utils_i18n_field_position_create_p(void) { + + int ret; + + i18n_field_position_h field_position = NULL; + + ret = i18n_field_position_create(&field_position); + + assert_neq(field_position, NULL); + assert_eq(ret, I18N_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_capi_base_utils_i18n_field_position_create_n + * @since_tizen 3.0 + * @description Calls i18n_field_position_create passing invalid field_position and + * checks for an invalid parameter error code. + */ +int utc_capi_base_utils_i18n_field_position_create_n(void) { + + int ret; + + ret = i18n_field_position_create(NULL); + assert_eq(ret, I18N_ERROR_INVALID_PARAMETER); + + return 0; +} + -- 2.7.4