From: seungho Date: Tue, 21 Aug 2012 12:48:42 +0000 (+0900) Subject: external/icu X-Git-Tag: 2.0_alpha^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=external%2Ficu.git external/icu --- diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..2d93822 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +export TET_INSTALL_PATH=/home/tetware/TETware # local tetware path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..3fe6ab2 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,20 @@ +#!/bin/sh +#export TET_INSTALL_PATH=/mnt/nfs/tetware +export TET_INSTALL_PATH=/mnt/nfs/tetware/TETware/ +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/tet_code b/TC/tet_code new file mode 100755 index 0000000..a2cf6c1 --- /dev/null +++ b/TC/tet_code @@ -0,0 +1,12 @@ +# TET reserved codes +0 "PASS" +1 "FAIL" +2 "UNRESOLVED" +3 "NOTINUSE" +4 "UNSUPPORTED" +5 "UNTESTED" +6 "UNINITIATED" +7 "NORESULT" + +# Test suite additional codes +33 "INSPECT" diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100755 index 0000000..43cbc9b --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/unit/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100755 index 0000000..6192c78 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,3 @@ +TET_OUTPUT_CAPTURE=False +TET_BUILD_TOOL=make +TET_PASS_TC_NAME=True diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100755 index 0000000..c66eda4 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,2 @@ +TET_OUTPUT_CAPTURE=False +TET_CLEAN_TOOL=make clean diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100755 index 0000000..0d9d39a --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1 @@ +TET_OUTPUT_CAPTURE=False diff --git a/TC/unit/Makefile b/TC/unit/Makefile new file mode 100755 index 0000000..418b5c8 --- /dev/null +++ b/TC/unit/Makefile @@ -0,0 +1,100 @@ +CC ?= gcc + +TARGETS = utc_tizen_icu_api_uloc_getDefault_func \ + utc_tizen_icu_api_uloc_setDefault_func \ + utc_tizen_icu_api_uloc_getAvailable_func \ + utc_tizen_icu_api_uloc_getCountry_func \ + utc_tizen_icu_api_uloc_getDisplayCountry_func \ + utc_tizen_icu_api_uloc_getDisplayLanguage_func \ + utc_tizen_icu_api_uloc_getDisplayName_func \ + utc_tizen_icu_api_uloc_getDisplayVariant_func \ + utc_tizen_icu_api_uloc_getISO3Country_func \ + utc_tizen_icu_api_uloc_getISO3Language_func \ + utc_tizen_icu_api_uloc_getISOCountries_func \ + utc_tizen_icu_api_uloc_getISOLanguages_func \ + utc_tizen_icu_api_uloc_getLanguage_func \ + utc_tizen_icu_api_uloc_getVariant_func \ + utc_tizen_icu_api_ucal_clearField_func \ + utc_tizen_icu_api_ucal_clear_func \ + utc_tizen_icu_api_ucal_close_func \ + utc_tizen_icu_api_ucal_equivalentTo_func \ + utc_tizen_icu_api_ucal_getAvailable_func \ + utc_tizen_icu_api_ucal_getDefaultTimeZone_func \ + utc_tizen_icu_api_ucal_getDSTSavings_func \ + utc_tizen_icu_api_ucal_getLimit_func \ + utc_tizen_icu_api_ucal_getMillis_func \ + utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func \ + utc_tizen_icu_api_ucal_inDaylightTime_func \ + utc_tizen_icu_api_ucal_isSet_func \ + utc_tizen_icu_api_ucal_open_func \ + utc_tizen_icu_api_ucal_roll_func \ + utc_tizen_icu_api_ucal_setDate_func \ + utc_tizen_icu_api_ucal_setDateTime_func \ + utc_tizen_icu_api_ucal_setDefaultTimeZone_func \ + utc_tizen_icu_api_ucal_set_func \ + utc_tizen_icu_api_ucal_setGregorianChange_func \ + utc_tizen_icu_api_ucal_setMillis_func \ + utc_tizen_icu_api_ucal_setTimeZone_func \ + utc_tizen_icu_api_ucnv_close_func \ + utc_tizen_icu_api_ucnv_compareNames_func \ + utc_tizen_icu_api_ucnv_convertEx_func \ + utc_tizen_icu_api_ucnv_countAvailable_func \ + utc_tizen_icu_api_ucnv_flushCache_func \ + utc_tizen_icu_api_u_errorName_func \ + utc_tizen_icu_api_u_strFromWCS_func \ + utc_tizen_icu_api_u_strToWCS_func \ + utc_tizen_icu_api_udat_close_func \ + utc_tizen_icu_api_udat_format_func \ + utc_tizen_icu_api_udat_getCalendar_func \ + utc_tizen_icu_api_udat_getSymbols_func \ + utc_tizen_icu_api_udat_isLenient_func \ + utc_tizen_icu_api_udat_open_func \ + utc_tizen_icu_api_udat_setLenient_func \ + utc_tizen_icu_api_udat_setSymbols_func \ + utc_tizen_icu_api_udat_toPatternRelativeDate_func \ + utc_tizen_icu_api_unum_close_func \ + utc_tizen_icu_api_unum_formatDecimal_func \ + utc_tizen_icu_api_unum_formatDouble_func \ + utc_tizen_icu_api_unum_format_func \ + utc_tizen_icu_api_unum_formatInt64_func \ + utc_tizen_icu_api_unum_open_func \ + utc_tizen_icu_api_unum_parseDecimal_func \ + utc_tizen_icu_api_unum_parseDouble_func \ + utc_tizen_icu_api_unum_parse_func \ + utc_tizen_icu_api_unum_parseInt64_func \ + utc_tizen_icu_api_ucnv_fromUChars_func \ + utc_tizen_icu_api_ucnv_fromUnicode_func \ + utc_tizen_icu_api_ucnv_getAlias_func \ + utc_tizen_icu_api_ucnv_getAvailableName_func \ + utc_tizen_icu_api_ucnv_getCanonicalName_func \ + utc_tizen_icu_api_ucnv_getDisplayName_func \ + utc_tizen_icu_api_ucnv_getMaxCharSize_func \ + utc_tizen_icu_api_ucnv_getMinCharSize_func \ + utc_tizen_icu_api_ucnv_getName_func \ + utc_tizen_icu_api_ucnv_open_func \ + utc_tizen_icu_api_ucnv_reset_func \ + utc_tizen_icu_api_ucnv_setFallback_func \ + utc_tizen_icu_api_ucnv_setFromUCallBack_func \ + utc_tizen_icu_api_ucnv_setToUCallBack_func \ + utc_tizen_icu_api_ucnv_toUChars_func \ + utc_tizen_icu_api_ucnv_toUnicode_func + + +PKGS= icu-i18n icu-io icu-le icu-lx icu-uc + +LDFLAGS= `pkg-config --libs $(PKGS)` +LDFLAGS+= $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS+= -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS+= -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS= -I. `pkg-config --cflags $(PKGS)` +CFLAGS+= -I$(TET_ROOT)/inc/tet3 +CFLAGS+= -Wall + +all: $(TARGETS) + +$(TARGETS): %: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TARGETS) diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh new file mode 100755 index 0000000..54f482d --- /dev/null +++ b/TC/unit/tc_gen.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +TMPSTR=$0 +SCRIPT=${TMPSTR##*/} + +if [ $# -lt 2 ]; then + echo "Usage) $SCRIPT module_name api_name" + exit 1 +fi + +MODULE=$1 +API=$2 +TEMPLATE=utc_MODULE_API_func.c.in +TESTCASE=utc_${MODULE}_${API}_func + +sed -e ' + s^@API@^'"$API"'^g + s^@MODULE@^'"$MODULE"'^g + ' $TEMPLATE > $TESTCASE.c + +if [ ! -e "$TESTCASE.c" ]; then + echo "Failed" + exit 1 +fi +echo "Testcase file is $TESTCASE.c" +echo "Done" +echo "please put \"$TESTCASE\" as Target in Makefile" +echo "please put \"/unit/$TESTCASE\" in tslist" diff --git a/TC/unit/tslist b/TC/unit/tslist new file mode 100755 index 0000000..2636e7d --- /dev/null +++ b/TC/unit/tslist @@ -0,0 +1,78 @@ +/unit/utc_tizen_icu_api_uloc_getDefault_func +/unit/utc_tizen_icu_api_uloc_setDefault_func +/unit/utc_tizen_icu_api_uloc_getAvailable_func +/unit/utc_tizen_icu_api_uloc_getCountry_func +/unit/utc_tizen_icu_api_uloc_getDisplayCountry_func +/unit/utc_tizen_icu_api_uloc_getDisplayLanguage_func +/unit/utc_tizen_icu_api_uloc_getDisplayName_func +/unit/utc_tizen_icu_api_uloc_getDisplayVariant_func +/unit/utc_tizen_icu_api_uloc_getISO3Country_func +/unit/utc_tizen_icu_api_uloc_getISO3Language_func +/unit/utc_tizen_icu_api_uloc_getISOCountries_func +/unit/utc_tizen_icu_api_uloc_getISOLanguages_func +/unit/utc_tizen_icu_api_uloc_getLanguage_func +/unit/utc_tizen_icu_api_uloc_getVariant_func +/unit/utc_tizen_icu_api_ucal_clearField_func +/unit/utc_tizen_icu_api_ucal_clear_func +/unit/utc_tizen_icu_api_ucal_close_func +/unit/utc_tizen_icu_api_ucal_equivalentTo_func +/unit/utc_tizen_icu_api_ucal_getAvailable_func +/unit/utc_tizen_icu_api_ucal_getDefaultTimeZone_func +/unit/utc_tizen_icu_api_ucal_getDSTSavings_func +/unit/utc_tizen_icu_api_ucal_getLimit_func +/unit/utc_tizen_icu_api_ucal_getMillis_func +/unit/utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func +/unit/utc_tizen_icu_api_ucal_inDaylightTime_func +/unit/utc_tizen_icu_api_ucal_isSet_func +/unit/utc_tizen_icu_api_ucal_open_func +/unit/utc_tizen_icu_api_ucal_roll_func +/unit/utc_tizen_icu_api_ucal_setDate_func +/unit/utc_tizen_icu_api_ucal_setDateTime_func +/unit/utc_tizen_icu_api_ucal_setDefaultTimeZone_func +/unit/utc_tizen_icu_api_ucal_set_func +/unit/utc_tizen_icu_api_ucal_setGregorianChange_func +/unit/utc_tizen_icu_api_ucal_setMillis_func +/unit/utc_tizen_icu_api_ucal_setTimeZone_func +/unit/utc_tizen_icu_api_ucnv_close_func +/unit/utc_tizen_icu_api_ucnv_compareNames_func +/unit/utc_tizen_icu_api_ucnv_convertEx_func +/unit/utc_tizen_icu_api_ucnv_countAvailable_func +/unit/utc_tizen_icu_api_ucnv_flushCache_func +/unit/utc_tizen_icu_api_u_errorName_func +/unit/utc_tizen_icu_api_u_strFromWCS_func +/unit/utc_tizen_icu_api_u_strToWCS_func +/unit/utc_tizen_icu_api_udat_close_func +/unit/utc_tizen_icu_api_udat_format_func +/unit/utc_tizen_icu_api_udat_getCalendar_func +/unit/utc_tizen_icu_api_udat_getSymbols_func +/unit/utc_tizen_icu_api_udat_isLenient_func +/unit/utc_tizen_icu_api_udat_open_func +/unit/utc_tizen_icu_api_udat_setLenient_func +/unit/utc_tizen_icu_api_udat_setSymbols_func +/unit/utc_tizen_icu_api_udat_toPatternRelativeDate_func +/unit/utc_tizen_icu_api_unum_close_func +/unit/utc_tizen_icu_api_unum_formatDecimal_func +/unit/utc_tizen_icu_api_unum_formatDouble_func +/unit/utc_tizen_icu_api_unum_format_func +/unit/utc_tizen_icu_api_unum_formatInt64_func +/unit/utc_tizen_icu_api_unum_open_func +/unit/utc_tizen_icu_api_unum_parseDecimal_func +/unit/utc_tizen_icu_api_unum_parseDouble_func +/unit/utc_tizen_icu_api_unum_parse_func +/unit/utc_tizen_icu_api_unum_parseInt64_func +/unit/utc_tizen_icu_api_ucnv_fromUChars_func +/unit/utc_tizen_icu_api_ucnv_fromUnicode_func +/unit/utc_tizen_icu_api_ucnv_getAlias_func +/unit/utc_tizen_icu_api_ucnv_getAvailableName_func +/unit/utc_tizen_icu_api_ucnv_getCanonicalName_func +/unit/utc_tizen_icu_api_ucnv_getDisplayName_func +/unit/utc_tizen_icu_api_ucnv_getMaxCharSize_func +/unit/utc_tizen_icu_api_ucnv_getMinCharSize_func +/unit/utc_tizen_icu_api_ucnv_getName_func +/unit/utc_tizen_icu_api_ucnv_open_func +/unit/utc_tizen_icu_api_ucnv_reset_func +/unit/utc_tizen_icu_api_ucnv_setFallback_func +/unit/utc_tizen_icu_api_ucnv_setFromUCallBack_func +/unit/utc_tizen_icu_api_ucnv_setToUCallBack_func +/unit/utc_tizen_icu_api_ucnv_toUChars_func +/unit/utc_tizen_icu_api_ucnv_toUnicode_func diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in new file mode 100755 index 0000000..383a897 --- /dev/null +++ b/TC/unit/utc_MODULE_API_func.c.in @@ -0,0 +1,65 @@ +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_@MODULE@_@API@_func_01(void); +static void utc_@MODULE@_@API@_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, + { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of @API@() + */ +static void utc_@MODULE@_@API@_func_01(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init @API@() + */ +static void utc_@MODULE@_@API@_func_02(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_tizen_icu_api_u_errorName_func.c b/TC/unit/utc_tizen_icu_api_u_errorName_func.c new file mode 100755 index 0000000..18b102f --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_u_errorName_func.c @@ -0,0 +1,103 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_u_errorName_func_01(void); +static void utc_tizen_icu_api_u_errorName_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_u_errorName_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_u_errorName_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_u_errorName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_u_errorName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_u_errorName() + */ +static void utc_tizen_icu_api_u_errorName_func_01(void) +{ + const char *result = NULL; + + result = u_errorName(2); + if (result != NULL) { + tet_infoline("utc_tizen_icu_api_u_errorName test PASS!"); + tet_printf("error name for %d error code is %s\n", 2, result); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_u_errorName test FAIL!"); + tet_result(TET_FAIL); + } + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_u_errorName() + * Giving wrong error code will return null + */ +static void utc_tizen_icu_api_u_errorName_func_02(void) +{ + const char *result = NULL; + int32_t U_INVALID_ERROR_CODE = -100; + /* Giving wrong error code will return null */ + result = u_errorName(U_INVALID_ERROR_CODE); + if (result != NULL) { + tet_infoline("utc_tizen_icu_api_u_errorName test PASS!"); + tet_printf("error name %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_u_errorName test FAIL!"); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_u_strFromWCS_func.c b/TC/unit/utc_tizen_icu_api_u_strFromWCS_func.c new file mode 100755 index 0000000..198e4e0 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_u_strFromWCS_func.c @@ -0,0 +1,114 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_u_strFromWCS_func_01(void); +static void utc_tizen_icu_api_u_strFromWCS_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_u_strFromWCS_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_u_strFromWCS_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_u_strFromWCS start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_u_strFromWCS ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_u_strFromWCS() + */ +static void utc_tizen_icu_api_u_strFromWCS_func_01(void) +{ + UChar dest[50]; + int32_t dest_capacity = 50; + int32_t *pdest_len = &dest_capacity; + const wchar_t *src = L"hello world"; + int32_t src_len = 12; + UErrorCode status = U_ZERO_ERROR; + UChar *result = NULL; + + result = + u_strFromWCS(dest, dest_capacity, pdest_len, src, src_len, &status); + if (U_SUCCESS(status)) { + tet_infoline("utc_tizen_icu_api_u_strFromWCS test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_u_strFromWCS test FAIL!"); + tet_printf("error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_u_strFromWCS() + * sending source as null will return error + */ +static void utc_tizen_icu_api_u_strFromWCS_func_02(void) +{ + UChar dest[50]; + int32_t dest_capacity = 50; + int32_t *pdest_len = &dest_capacity; + UErrorCode status = U_ZERO_ERROR; + UChar *result = NULL; + + result = + u_strFromWCS(dest, dest_capacity, pdest_len, NULL, -1, &status); + if (U_FAILURE(status)) { + tet_infoline("utc_tizen_icu_api_u_strFromWCS test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_u_strFromWCS test FAIL!"); + tet_printf("error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_u_strToWCS_func.c b/TC/unit/utc_tizen_icu_api_u_strToWCS_func.c new file mode 100755 index 0000000..1ffc983 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_u_strToWCS_func.c @@ -0,0 +1,113 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_u_strToWCS_func_01(void); +static void utc_tizen_icu_api_u_strToWCS_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_u_strToWCS_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_u_strToWCS_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_u_strToWCS start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_u_strToWCS ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_u_strToWCS() + */ +static void utc_tizen_icu_api_u_strToWCS_func_01(void) +{ + wchar_t dest[100]; + int32_t dest_capacity = 100; + int32_t *pdest_len = &dest_capacity; + const UChar *src = (const UChar *)"hello world"; + int32_t src_len = u_strlen(src); + UErrorCode status = U_ZERO_ERROR; + wchar_t *result = NULL; + + result = + u_strToWCS(dest, dest_capacity, pdest_len, src, src_len, &status); + if (U_SUCCESS(status)) { + tet_infoline("utc_tizen_icu_api_u_strToWCS test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_u_strToWCS test FAIL!"); + tet_printf("error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_u_strToWCS() + * sending source as null will return error + */ +static void utc_tizen_icu_api_u_strToWCS_func_02(void) +{ + wchar_t dest[50]; + int32_t dest_capacity = 50; + int32_t *pdest_len = &dest_capacity; + UErrorCode status = U_ZERO_ERROR; + wchar_t *result = NULL; + + result = u_strToWCS(dest, dest_capacity, pdest_len, NULL, -1, &status); + if (U_FAILURE(status)) { + tet_infoline("utc_tizen_icu_api_u_strToWCS test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_u_strToWCS test FAIL!"); + tet_printf("error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_clearField_func.c b/TC/unit/utc_tizen_icu_api_ucal_clearField_func.c new file mode 100755 index 0000000..0a2833d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_clearField_func.c @@ -0,0 +1,91 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_clearField_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_clearField_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_clearField start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_clearField ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_clearField() + */ +static void utc_tizen_icu_api_ucal_clearField_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field = UCAL_MONTH; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_clearField(cal, field); + if (ucal_isSet(cal, field) == FALSE) { + tet_infoline + ("utc_tizen_icu_api_ucal_clearField test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_clearField test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_clear_func.c b/TC/unit/utc_tizen_icu_api_ucal_clear_func.c new file mode 100755 index 0000000..1dfad29 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_clear_func.c @@ -0,0 +1,108 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_clear_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_clear_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_clear start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_clear ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_clear() + */ +static void utc_tizen_icu_api_ucal_clear_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field[] = { UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, + UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, + UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, + UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, + UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, + UCAL_ZONE_OFFSET, UCAL_DST_OFFSET + }; + int32_t index = 0; + int32_t value = 1; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + /* setting all the field in that calendar */ + for (index = 0; index < 17; index++) { + ucal_set(cal, field[index], value); + } + /* clear the entire calendar */ + ucal_clear(cal); + for (index = 0; index < 17; index++) { + if (!ucal_isSet(cal, field[index])) { + tet_infoline + ("utc_tizen_icu_api_ucal_open test PASS!"); + tet_result(TET_PASS); + + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_result(TET_FAIL); + } + } + + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_close_func.c b/TC/unit/utc_tizen_icu_api_ucal_close_func.c new file mode 100755 index 0000000..2b11520 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_close_func.c @@ -0,0 +1,84 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_close_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_close_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_close start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_close ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_close() + */ +static void utc_tizen_icu_api_ucal_close_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_close(cal); + tet_infoline("utc_tizen_icu_api_ucal_close test PASS!"); + tet_result(TET_PASS); + } + else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_equivalentTo_func.c b/TC/unit/utc_tizen_icu_api_ucal_equivalentTo_func.c new file mode 100755 index 0000000..28b1597 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_equivalentTo_func.c @@ -0,0 +1,131 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_equivalentTo_func_01(void); +static void utc_tizen_icu_api_ucal_equivalentTo_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_equivalentTo_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_equivalentTo_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_equivalentTo start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_equivalentTo ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_equivalentTo() + */ +static void utc_tizen_icu_api_ucal_equivalentTo_func_01(void) +{ + UCalendar *cal1 = NULL; + UCalendar *cal2 = NULL; + UBool result; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + + cal1 = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal1)) { + cal2 = cal1; + result = ucal_equivalentTo(cal1, cal2); + if (result) { + tet_infoline + ("utc_tizen_icu_api_ucal_equivalentTo test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_equivalentTo test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal1); + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_equivalentTo() + * camparing two calendar + */ +static void utc_tizen_icu_api_ucal_equivalentTo_func_02(void) +{ + UCalendar *cal1 = NULL; + UCalendar *cal2 = NULL; + UBool result; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + + cal1 = ucal_open(NULL, -1, NULL, type, &status); + cal2 = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &status); + + if (U_SUCCESS(status)) { + result = ucal_equivalentTo(cal1, cal2); + if (result == TRUE) { + tet_infoline + ("utc_tizen_icu_api_ucal_equivalentTo test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_equivalentTo test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal1); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_getAvailable_func.c b/TC/unit/utc_tizen_icu_api_ucal_getAvailable_func.c new file mode 100755 index 0000000..cc99201 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_getAvailable_func.c @@ -0,0 +1,103 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_getAvailable_func_01(void); +static void utc_tizen_icu_api_ucal_getAvailable_func_02(void); +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_getAvailable_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_getAvailable_func_02, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getAvailable start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getAvailable ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_getAvailable() + */ +static void utc_tizen_icu_api_ucal_getAvailable_func_01(void) +{ + const char *calendar = NULL; + int32_t locale_index = 5; + + calendar = ucal_getAvailable(locale_index); + if (NULL != calendar) { + tet_infoline("utc_tizen_icu_api_ucal_getAvailable test PASS!"); + tet_printf("Calendar for the give locale %s\n", calendar); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_getAvailable test FAIL!"); + tet_result(TET_FAIL); + } + + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_getAvailable() + * Invalid locale index will return null + */ +static void utc_tizen_icu_api_ucal_getAvailable_func_02(void) +{ + const char *calendar = NULL; + + calendar = ucal_getAvailable(-20); + if (NULL == calendar) { + tet_infoline("utc_tizen_icu_api_ucal_getAvailable test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_getAvailable test FAIL!"); + tet_result(TET_FAIL); + } + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_getDSTSavings_func.c b/TC/unit/utc_tizen_icu_api_ucal_getDSTSavings_func.c new file mode 100755 index 0000000..d1df840 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_getDSTSavings_func.c @@ -0,0 +1,81 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_getDSTSavings_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_getDSTSavings_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getDSTSavings start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getDSTSavings ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_getDSTSavings() + */ +static void utc_tizen_icu_api_ucal_getDSTSavings_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t result; + + result = ucal_getDSTSavings((const UChar *)"PST", &status); + if (U_SUCCESS(status)) { + tet_infoline("utc_tizen_icu_api_ucal_getDSTSavings test PASS!"); + tet_printf("DST Saving %d\n", result); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_getDSTSavings test FAIL!"); + tet_result(TET_FAIL); + } + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_getDefaultTimeZone_func.c b/TC/unit/utc_tizen_icu_api_ucal_getDefaultTimeZone_func.c new file mode 100755 index 0000000..f8b323b --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_getDefaultTimeZone_func.c @@ -0,0 +1,114 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_getDefaultTimeZone_func_01(void); +static void utc_tizen_icu_api_ucal_getDefaultTimeZone_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_getDefaultTimeZone_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_getDefaultTimeZone_func_02, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_getDefaultTimeZone start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_getDefaultTimeZone ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_getDefaultTimeZone() + */ +static void utc_tizen_icu_api_ucal_getDefaultTimeZone_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + UChar result[20] = { 0, }; + int32_t result_capacity = 20; + int32_t ret; + + ret = ucal_getDefaultTimeZone(result, result_capacity, &status); + if (U_SUCCESS(status) && (0 != ret)) { + tet_infoline + ("utc_tizen_icu_api_ucal_getDefaultTimeZone test PASS!"); + tet_printf("Default time zone is %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_getDefaultTimeZone test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_getDefaultTimeZone() + * checks if null sends as a result arg will return buffer overflow error status + */ +static void utc_tizen_icu_api_ucal_getDefaultTimeZone_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t ret; + + ret = ucal_getDefaultTimeZone(NULL, 0, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_getDefaultTimeZone test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_getDefaultTimeZone test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_getLimit_func.c b/TC/unit/utc_tizen_icu_api_ucal_getLimit_func.c new file mode 100755 index 0000000..2737200 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_getLimit_func.c @@ -0,0 +1,161 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_getLimit_func_01(void); +static void utc_tizen_icu_api_ucal_getLimit_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_getLimit_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_getLimit_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getLimit start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getLimit ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_getLimit() + */ +static void utc_tizen_icu_api_ucal_getLimit_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field[] = { UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, + UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, + UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, + UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, + UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, + UCAL_ZONE_OFFSET, UCAL_DST_OFFSET + }; + int32_t index = 0; + int32_t limit_type[] = + { UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM, + UCAL_LEAST_MAXIMUM, UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM + }; + int32_t value = 1; + int32_t result = 0; + int32_t lp_cnt = 0; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + for (index = 0; index < 17; index++) { + ucal_set(cal, field[index], value); + if (ucal_isSet(cal, field[index])) { + for (lp_cnt = 0; lp_cnt < 6; lp_cnt++) { + result = + ucal_getLimit(cal, field[index], + limit_type[lp_cnt], + &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_getLimit test PASS!"); + tet_result(TET_PASS); + + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_getLimit test FAIL!"); + tet_printf("Error code %s", + u_errorName(status)); + tet_result(TET_FAIL); + } + } + + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", + u_errorName(status)); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucal_close(cal); + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_getLimit() + * if status is null will return error + */ +static void utc_tizen_icu_api_ucal_getLimit_func_02(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field = UCAL_ERA; + int32_t limit_type = UCAL_GREATEST_MINIMUM; + int32_t result = 0; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + result = ucal_getLimit(cal, field, limit_type, NULL); + if (result) { + tet_infoline("utc_tizen_icu_api_ucal_getLimit test PASS!"); + tet_result(TET_PASS); + + } else { + tet_infoline("utc_tizen_icu_api_ucal_getLimit test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_getMillis_func.c b/TC/unit/utc_tizen_icu_api_ucal_getMillis_func.c new file mode 100755 index 0000000..6a14b5c --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_getMillis_func.c @@ -0,0 +1,93 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_getMillis_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_getMillis_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getMillis start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_getMillis ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_getMillis() + */ +static void utc_tizen_icu_api_ucal_getMillis_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + UDate date; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + date = ucal_getMillis(cal, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_getMillis test PASS!"); + tet_printf("The current time in millis %ld\n", date); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_getMillis test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func.c b/TC/unit/utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func.c new file mode 100755 index 0000000..ba8db66 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func.c @@ -0,0 +1,102 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func_01, + POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_getTimeZoneDisplayName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_getTimeZoneDisplayName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_getTimeZoneDisplayName() + */ +static void utc_tizen_icu_api_ucal_getTimeZoneDisplayName_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t display_type = UCAL_STANDARD; + UChar result[20] = { 0, }; + int32_t ret = 0; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ret = ucal_getTimeZoneDisplayName(cal, display_type, + NULL, result, 20, + &status); + if (U_SUCCESS(status)) { + tet_printf("Time zone Display Name %s\n", + result); + tet_infoline + ("utc_tizen_icu_api_ucal_getTimeZoneDisplayName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_getTimeZoneDisplayName test FAIL!"); + tet_printf("Error name %s\n", + u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucal_close(cal); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_inDaylightTime_func.c b/TC/unit/utc_tizen_icu_api_ucal_inDaylightTime_func.c new file mode 100755 index 0000000..808af00 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_inDaylightTime_func.c @@ -0,0 +1,93 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_inDaylightTime_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_inDaylightTime_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_inDaylightTime start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_inDaylightTime ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_inDaylightTime() + */ +static void utc_tizen_icu_api_ucal_inDaylightTime_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + UBool result; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + result = ucal_inDaylightTime(cal, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_inDaylightTime test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_inDaylightTime test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_isSet_func.c b/TC/unit/utc_tizen_icu_api_ucal_isSet_func.c new file mode 100755 index 0000000..e8fc031 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_isSet_func.c @@ -0,0 +1,125 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_isSet_func_01(void); +static void utc_tizen_icu_api_ucal_isSet_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_isSet_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_isSet_func_02, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_isSet start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_isSet ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_isSet() + */ +static void utc_tizen_icu_api_ucal_isSet_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field = UCAL_MONTH; + UBool result; + int32_t value = UCAL_JANUARY; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_set(cal, field, value); + result = ucal_isSet(cal, field); + if (result) { + tet_infoline("utc_tizen_icu_api_ucal_isSet test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_isSet test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_isSet() + * verify after clearing the field it should show false + */ +static void utc_tizen_icu_api_ucal_isSet_func_02(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field = UCAL_MONTH; + UBool result; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_clearField(cal, field); + result = ucal_isSet(cal, field); + if (result == FALSE) { + tet_infoline("utc_tizen_icu_api_ucal_isSet test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_isSet test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_open_func.c b/TC/unit/utc_tizen_icu_api_ucal_open_func.c new file mode 100755 index 0000000..3b9e3ec --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_open_func.c @@ -0,0 +1,113 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_open_func_01(void); +static void utc_tizen_icu_api_ucal_open_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_open_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_open_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_open start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_open ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_open() + */ +static void utc_tizen_icu_api_ucal_open_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type[] = { UCAL_TRADITIONAL, UCAL_GREGORIAN }; + int32_t index; + + for (index = 0; index < 2; index++) { + status = U_ZERO_ERROR; + cal = + ucal_open((const UChar *)"PST", -1, NULL, type[index], + &status); + if (U_SUCCESS(status) ) { + tet_infoline("utc_tizen_icu_api_ucal_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_open() + * sending time zone as null will take default time zone + */ +static void utc_tizen_icu_api_ucal_open_func_02(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status)) { + tet_infoline("utc_tizen_icu_api_ucal_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_roll_func.c b/TC/unit/utc_tizen_icu_api_ucal_roll_func.c new file mode 100755 index 0000000..1a3eebd --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_roll_func.c @@ -0,0 +1,101 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_roll_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_roll_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_roll start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_roll ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_roll() + */ +static void utc_tizen_icu_api_ucal_roll_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field[] = { UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, + UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, + UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, + UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, + UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, + UCAL_ZONE_OFFSET, UCAL_DST_OFFSET + }; + int32_t index = 0; + int32_t amount = 1; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status)) { + for (index = 0; index < 15; index++) { + ucal_roll(cal, field[index], amount, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_roll test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_roll test FAIL!"); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_setDateTime_func.c b/TC/unit/utc_tizen_icu_api_ucal_setDateTime_func.c new file mode 100755 index 0000000..1be3222 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_setDateTime_func.c @@ -0,0 +1,142 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_setDateTime_func_01(void); +static void utc_tizen_icu_api_ucal_setDateTime_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_setDateTime_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_setDateTime_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setDateTime start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setDateTime ends "); + return; +} + +/** + * @brief Postive test case of utc_tizen_icu_api_ucal_setDateTime() + */ +static void utc_tizen_icu_api_ucal_setDateTime_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t year = 2012; + int32_t month = UCAL_MARCH; + int32_t date = 10; + int32_t hour = 0; + int32_t minute = 0; + int32_t second = 0; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_setDateTime(cal, year, month, date, hour, minute, second, + &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_setDateTime test PASS!"); + tet_printf("The current time in millis %ld\n", date); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setDateTime test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_setDateTime() + * Invalid miniute will give error + */ +static void utc_tizen_icu_api_ucal_setDateTime_func_02(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t year = 2012; + int32_t month = UCAL_MARCH; + int32_t date = 10; + int32_t hour = 0; + int32_t minute = 80; /* invalid minute*/ + int32_t second = 0; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_setDateTime(cal, year, month, date, hour, minute, second, + &status); + if (U_SUCCESS(status)) { /* It will give fallback warning*/ + tet_infoline + ("utc_tizen_icu_api_ucal_setDateTime test PASS!"); + tet_printf("The current time in millis %ld\n", date); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setDateTime test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} + diff --git a/TC/unit/utc_tizen_icu_api_ucal_setDate_func.c b/TC/unit/utc_tizen_icu_api_ucal_setDate_func.c new file mode 100755 index 0000000..f56de9c --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_setDate_func.c @@ -0,0 +1,132 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_setDate_func_01(void); +static void utc_tizen_icu_api_ucal_setDate_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_setDate_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucal_setDate_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setDate start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setDate ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_setDate() + */ +static void utc_tizen_icu_api_ucal_setDate_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t year = 2012; + int32_t month = UCAL_MARCH; + int32_t date = 10; + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_setDate(cal, year, month, date, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_setDate test PASS!"); + tet_printf("The current time in millis %ld\n", date); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setDate test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucal_setDate() + * calling this API without opening the calendar handler + */ +static void utc_tizen_icu_api_ucal_setDate_func_02(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t year = 2012; + int32_t month = UCAL_MARCH; + int32_t date = 32; /* invalid date */ + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status)) { + ucal_setDate(cal, year, month, date, &status); + if (U_SUCCESS(status)) { /* it will give fallback waring*/ + tet_infoline + ("utc_tizen_icu_api_ucal_setDate test PASS!"); + tet_printf("The current time in millis %ld\n", date); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setDate test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_setDefaultTimeZone_func.c b/TC/unit/utc_tizen_icu_api_ucal_setDefaultTimeZone_func.c new file mode 100755 index 0000000..0f5b9fe --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_setDefaultTimeZone_func.c @@ -0,0 +1,85 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_setDefaultTimeZone_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_setDefaultTimeZone_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_setDefaultTimeZone start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_setDefaultTimeZone ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_setDefaultTimeZone() + */ +static void utc_tizen_icu_api_ucal_setDefaultTimeZone_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + + ucal_setDefaultTimeZone((const UChar *)"PST", &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_setDefaultTimeZone test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setDefaultTimeZone test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; + +} + diff --git a/TC/unit/utc_tizen_icu_api_ucal_setGregorianChange_func.c b/TC/unit/utc_tizen_icu_api_ucal_setGregorianChange_func.c new file mode 100755 index 0000000..a1340c5 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_setGregorianChange_func.c @@ -0,0 +1,96 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_setGregorianChange_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_setGregorianChange_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_setGregorianChange start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucal_setGregorianChange ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_setGregorianChange() + */ +static void utc_tizen_icu_api_ucal_setGregorianChange_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_GREGORIAN; + UDate date = ucal_getNow(); + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_setGregorianChange(cal, date, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_setGregorianChange test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setGregorianChange test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; + +} + diff --git a/TC/unit/utc_tizen_icu_api_ucal_setMillis_func.c b/TC/unit/utc_tizen_icu_api_ucal_setMillis_func.c new file mode 100755 index 0000000..2f6f6d8 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_setMillis_func.c @@ -0,0 +1,93 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_setMillis_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_setMillis_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setMillis start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setMillis ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_setMillis() + */ +static void utc_tizen_icu_api_ucal_setMillis_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + UDate date = ucal_getNow(); + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_setMillis(cal, date, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_setMillis test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setMillis test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} + diff --git a/TC/unit/utc_tizen_icu_api_ucal_setTimeZone_func.c b/TC/unit/utc_tizen_icu_api_ucal_setTimeZone_func.c new file mode 100755 index 0000000..17e1ec7 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_setTimeZone_func.c @@ -0,0 +1,91 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_setTimeZone_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_setTimeZone_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setTimeZone start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_setTimeZone ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_setTimeZone() + */ +static void utc_tizen_icu_api_ucal_setTimeZone_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + ucal_setTimeZone(cal, (const UChar *)"PST", 4, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucal_setTimeZone test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_setTimeZone test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucal_set_func.c b/TC/unit/utc_tizen_icu_api_ucal_set_func.c new file mode 100755 index 0000000..8848405 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucal_set_func.c @@ -0,0 +1,101 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucal_set_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucal_set_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_set start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucal_set ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucal_set() + */ +static void utc_tizen_icu_api_ucal_set_func_01(void) +{ + UCalendar *cal = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t type = UCAL_DEFAULT; + int32_t field[] = { UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, + UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, + UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, + UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, + UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, + UCAL_ZONE_OFFSET, UCAL_DST_OFFSET + }; + int32_t index = 0; + int32_t value = 1; + + cal = ucal_open(NULL, -1, NULL, type, &status); + if (U_SUCCESS(status) && (NULL != cal)) { + for (index = 0; index < 17; index++) { + ucal_set(cal, field[index], value); + if (ucal_isSet(cal, field[index])) { + tet_infoline + ("utc_tizen_icu_api_ucal_set test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucal_set test FAIL!"); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_ucal_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + ucal_close(cal); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_close_func.c b/TC/unit/utc_tizen_icu_api_ucnv_close_func.c new file mode 100755 index 0000000..e0c130c --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_close_func.c @@ -0,0 +1,83 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_close_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_close_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_close start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_close ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_close() + */ +static void utc_tizen_icu_api_ucnv_close_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_close(cnv); + tet_infoline("utc_tizen_icu_api_ucnv_close test PASS!"); + tet_result(TET_PASS); + } + else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_compareNames_func.c b/TC/unit/utc_tizen_icu_api_ucnv_compareNames_func.c new file mode 100755 index 0000000..21b8c3c --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_compareNames_func.c @@ -0,0 +1,101 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_compareNames_func_01(void); +static void utc_tizen_icu_api_ucnv_compareNames_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_compareNames_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_compareNames_func_02, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_compareNames start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_compareNames ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_compareNames() + */ +static void utc_tizen_icu_api_ucnv_compareNames_func_01(void) +{ + const char *converter_name1 = "UTF-8,version=1"; + const char *converter_name2 = "UTF-8,version=1"; + int result; + + result = ucnv_compareNames(converter_name1, converter_name2); + if (0 == result) { + tet_infoline("utc_tizen_icu_api_ucnv_compareNames test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_compareNames test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_compareNames() + */ +static void utc_tizen_icu_api_ucnv_compareNames_func_02(void) +{ + const char *converter_name1 = "UTF-7,version=1"; + const char *converter_name2 = "UTF-8,version=1"; + int result; + + result = ucnv_compareNames(converter_name1, converter_name2); + if (0 != result) { + tet_infoline("utc_tizen_icu_api_ucnv_compareNames test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_compareNames test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_convertEx_func.c b/TC/unit/utc_tizen_icu_api_ucnv_convertEx_func.c new file mode 100755 index 0000000..7008613 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_convertEx_func.c @@ -0,0 +1,158 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_convertEx_func_01(void); +static void utc_tizen_icu_api_ucnv_convertEx_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_convertEx_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_convertEx_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_convertEx start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_convertEx ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_convertEx() + */ +static void utc_tizen_icu_api_ucnv_convertEx_func_01(void) +{ + const char *cnv_name1 = "UTF-8"; + const char *cnv_name2 = "US-ASCII"; + UErrorCode status = U_ZERO_ERROR; + UErrorCode err1 = U_ZERO_ERROR; + UErrorCode err2 = U_ZERO_ERROR; + UConverter *src_cnv = NULL; + UConverter *target_cnv = NULL; + char output[100]; + int32_t capacity = 100; + const char *input = "Text here"; + int32_t length = strlen(input); + char *target = output; + const char *src = input; + + src_cnv = ucnv_open(cnv_name1, &err1); + target_cnv = ucnv_open(cnv_name2, &err2); + if (U_SUCCESS(err1) && (U_SUCCESS(err2))) { + ucnv_convertEx(target_cnv, src_cnv, + &target, output + capacity, + &src, input + length, NULL, NULL, + NULL, NULL, TRUE, TRUE, &status); + + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_convertEx test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_convertEx test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(src_cnv); + ucnv_close(target_cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_convertEx() + * sending target as null will return error + */ +static void utc_tizen_icu_api_ucnv_convertEx_func_02(void) +{ + const char *cnv_name1 = "UTF-8"; + const char *cnv_name2 = "US-ASCII"; + UErrorCode status = U_ZERO_ERROR; + UErrorCode err1 = U_ZERO_ERROR; + UErrorCode err2 = U_ZERO_ERROR; + UConverter *src_cnv = NULL; + UConverter *target_cnv = NULL; + char output[100]; + int32_t capacity = 100; + const char *input = "Text here"; + int32_t length = strlen(input); + const char *src = input; + + src_cnv = ucnv_open(cnv_name1, &err1); + target_cnv = ucnv_open(cnv_name2, &err2); + if (U_SUCCESS(err1) && (U_SUCCESS(err2))) { + ucnv_convertEx(target_cnv, src_cnv, + NULL, output + capacity, + &src, input + length, NULL, NULL, + NULL, NULL, TRUE, TRUE, &status); + + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_convertEx test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_convertEx test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(src_cnv); + ucnv_close(target_cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_countAvailable_func.c b/TC/unit/utc_tizen_icu_api_ucnv_countAvailable_func.c new file mode 100755 index 0000000..aabc62a --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_countAvailable_func.c @@ -0,0 +1,91 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_countAvailable_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_countAvailable_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_countAvailable start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_countAvailable ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_countAvailable() + */ +static void utc_tizen_icu_api_ucnv_countAvailable_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = ucnv_countAvailable(); + if (0 != result) { + tet_infoline + ("utc_tizen_icu_api_ucnv_countAvailable test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_countAvailable test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_flushCache_func.c b/TC/unit/utc_tizen_icu_api_ucnv_flushCache_func.c new file mode 100755 index 0000000..ccaa03d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_flushCache_func.c @@ -0,0 +1,113 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_flushCache_func_01(void); +static void utc_tizen_icu_api_ucnv_flushCache_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_flushCache_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_flushCache_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_flushCache start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_flushCache ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_flushCache() + */ +static void utc_tizen_icu_api_ucnv_flushCache_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + int32_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status)) { + result = ucnv_flushCache(); + if (0 <= result) { + tet_infoline + ("utc_tizen_icu_api_ucnv_flushCache test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_flushCache test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_flushCache() + * calling this api without opening the converter will return 0 + */ +static void utc_tizen_icu_api_ucnv_flushCache_func_02(void) +{ + int32_t result = 0; + + result = ucnv_flushCache(); + if (result == 0) { + tet_infoline("utc_tizen_icu_api_ucnv_flushCache test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_flushCache test FAIL!"); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_fromUChars_func.c b/TC/unit/utc_tizen_icu_api_ucnv_fromUChars_func.c new file mode 100755 index 0000000..51b5e8d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_fromUChars_func.c @@ -0,0 +1,137 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_fromUChars_func_01(void); +static void utc_tizen_icu_api_ucnv_fromUChars_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_fromUChars_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_fromUChars_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_fromUChars start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_fromUChars ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_fromUChars() + */ +static void utc_tizen_icu_api_ucnv_fromUChars_func_01(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + char dest[50] = { 0, }; + const UChar *src = "The text is here"; + int32_t length = u_strlen(src); + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_resetFromUnicode(cnv); + result = + ucnv_fromUChars(cnv, dest, 50, (const UChar *)"hello", + length, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_fromUChars test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_fromUChars test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_fromUChars() + * sending source as null will return error + */ +static void utc_tizen_icu_api_ucnv_fromUChars_func_02(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + char dest[50] = { 0, }; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_resetFromUnicode(cnv); + result = ucnv_fromUChars(cnv, dest, 50, NULL, 1, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_fromUChars test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_fromUChars test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_fromUnicode_func.c b/TC/unit/utc_tizen_icu_api_ucnv_fromUnicode_func.c new file mode 100755 index 0000000..6e42841 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_fromUnicode_func.c @@ -0,0 +1,126 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_fromUnicode_func_01(void); +static void utc_tizen_icu_api_ucnv_fromUnicode_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_fromUnicode_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_fromUnicode_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_fromUnicode start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_fromUnicode ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_fromUnicode() + */ +static void utc_tizen_icu_api_ucnv_fromUnicode_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UChar *input = "Hello world"; + char output[100] = { 0, }; + char *target = output; + const UChar *source = input; + UConverter *cnv = NULL; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_fromUnicode(cnv, &target, + output + sizeof(output) / U_SIZEOF_UCHAR, + &source, input + sizeof(input), NULL, TRUE, + &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_fromUnicode test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_fromUnicode test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_fromUnicode() + * sending target as a null will return buffer overflow error + */ +static void utc_tizen_icu_api_ucnv_fromUnicode_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + UChar *input = "Hello world"; + char output[100] = { 0, }; + const UChar *source = input; + + ucnv_fromUnicode(NULL, NULL, + output + sizeof(output) / U_SIZEOF_UCHAR, &source, + input + sizeof(input), NULL, TRUE, &status); + if (U_FAILURE(status)) { + tet_infoline("utc_tizen_icu_api_ucnv_fromUnicode test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_fromUnicode test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getAlias_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getAlias_func.c new file mode 100755 index 0000000..41f03c1 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getAlias_func.c @@ -0,0 +1,114 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getAlias_func_01(void); +static void utc_tizen_icu_api_ucnv_getAlias_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getAlias_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_getAlias_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getAlias start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getAlias ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getAlias() + */ +static void utc_tizen_icu_api_ucnv_getAlias_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + const char *result = NULL; + const char *name = NULL; + int32_t ncnv_cnt; + + ncnv_cnt = ucnv_countAvailable(); + + if(ncnv_cnt > 0) { + name = ucnv_getAvailableName(0); + result = ucnv_getAlias(name, 0, &status); + if ((U_SUCCESS(status)) && (NULL != result)) { + tet_infoline("utc_tizen_icu_api_ucnv_getAlias test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_getAlias test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_getAlias test FAIL!"); + tet_printf("ucnv available count is 0\n"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_getAlias() + * sending converter as null will return error + */ +static void utc_tizen_icu_api_ucnv_getAlias_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + const char *result; + + result = ucnv_getAlias("UTF-7", 2, &status); + if ((U_FAILURE(status)) || (NULL == result)) { + tet_infoline("utc_tizen_icu_api_ucnv_getAlias test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_getAlias test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getAvailableName_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getAvailableName_func.c new file mode 100755 index 0000000..e890fb3 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getAvailableName_func.c @@ -0,0 +1,111 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getAvailableName_func_01(void); +static void utc_tizen_icu_api_ucnv_getAvailableName_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getAvailableName_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_getAvailableName_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucnv_getAvailableName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucnv_getAvailableName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getAvailableName() + */ +static void utc_tizen_icu_api_ucnv_getAvailableName_func_01(void) +{ + const char *result = NULL; + int32_t max_count = ucnv_countAvailable(); + int32_t index = 0; + + for (index = 0; index < max_count; index++) { + result = ucnv_getAvailableName(index); + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getAvailableName test PASS!"); + tet_printf("Converter Name %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getAvailableName test FAIL!"); + tet_result(TET_FAIL); + } + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_getAvailableName() + * giving index as out of bound will return null + */ +static void utc_tizen_icu_api_ucnv_getAvailableName_func_02(void) +{ + const char *result = NULL; + int32_t index = 0; + + index = ucnv_countAvailable() + 2; + result = ucnv_getAvailableName(index); /* index is out of bound value */ + if (result == NULL) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getAvailableName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getAvailableName test FAIL!"); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getCanonicalName_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getCanonicalName_func.c new file mode 100755 index 0000000..de4b471 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getCanonicalName_func.c @@ -0,0 +1,128 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getCanonicalName_func_01(void); +static void utc_tizen_icu_api_ucnv_getCanonicalName_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getCanonicalName_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_getCanonicalName_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucnv_getCanonicalName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucnv_getCanonicalName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getCanonicalName() + */ +static void utc_tizen_icu_api_ucnv_getCanonicalName_func_01(void) +{ + const char *alias = "ibm-1208"; + const char *standard = "IBM"; + UErrorCode status = U_ZERO_ERROR; + const char *result = NULL; + const char *expect = "UTF-8"; + + result = ucnv_getCanonicalName(alias, standard, &status); + if ((U_SUCCESS(status)) && (NULL != result)) { + if(strcmp(expect, result) == 0) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getCanonicalName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getCanonicalName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getCanonicalName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_getCanonicalName() + * sending converter as null will return error + */ +static void utc_tizen_icu_api_ucnv_getCanonicalName_func_02(void) +{ + const char *alias = "ibm-5305"; + const char *standard = "IBM"; + UErrorCode status = U_ZERO_ERROR; + const char *result = NULL; + const char *expect = "UTF-16BE"; + + result = ucnv_getCanonicalName(alias, standard, &status); + if ((U_SUCCESS(status)) && (NULL != result)) { + if(alias == result || strcmp(expect, result) != 0) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getCanonicalName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getCanonicalName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getCanonicalName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getDisplayName_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getDisplayName_func.c new file mode 100755 index 0000000..e4f0d30 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getDisplayName_func.c @@ -0,0 +1,132 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getDisplayName_func_01(void); +static void utc_tizen_icu_api_ucnv_getDisplayName_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getDisplayName_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_getDisplayName_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getDisplayName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getDisplayName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getDisplayName() + */ +static void utc_tizen_icu_api_ucnv_getDisplayName_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UChar display_name[20] = { 0, }; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = + ucnv_getDisplayName(cnv, NULL, display_name, 20, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getDisplayName test PASS!"); + tet_printf("Display name %s\n", display_name); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getDisplayName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_getDisplayName() + * sending display name null will return buffer overflow error + */ +static void utc_tizen_icu_api_ucnv_getDisplayName_func_02(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = ucnv_getDisplayName(cnv, NULL, NULL, 20, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getDisplayName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getDisplayName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getMaxCharSize_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getMaxCharSize_func.c new file mode 100755 index 0000000..4e269eb --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getMaxCharSize_func.c @@ -0,0 +1,92 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getMaxCharSize_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getMaxCharSize_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getMaxCharSize start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getMaxCharSize ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getMaxCharSize() + */ +static void utc_tizen_icu_api_ucnv_getMaxCharSize_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = ucnv_getMaxCharSize(cnv); + if (0 != result) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getMaxCharSize test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getMaxCharSize test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getMinCharSize_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getMinCharSize_func.c new file mode 100755 index 0000000..1c5f3d1 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getMinCharSize_func.c @@ -0,0 +1,92 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getMinCharSize_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getMinCharSize_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getMinCharSize start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getMinCharSize ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getMinCharSize() + */ +static void utc_tizen_icu_api_ucnv_getMinCharSize_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = ucnv_getMinCharSize(cnv); + if (0 != result) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getMinCharSize test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getMinCharSize test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_getName_func.c b/TC/unit/utc_tizen_icu_api_ucnv_getName_func.c new file mode 100755 index 0000000..5743b5f --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_getName_func.c @@ -0,0 +1,92 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_getName_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_getName_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_getName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_getName() + */ +static void utc_tizen_icu_api_ucnv_getName_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + const char *result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = ucnv_getName(cnv, &status); + if ((U_SUCCESS(status)) && (NULL != result)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_getName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_getName test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_open_func.c b/TC/unit/utc_tizen_icu_api_ucnv_open_func.c new file mode 100755 index 0000000..13ef632 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_open_func.c @@ -0,0 +1,107 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_open_func_01(void); +static void utc_tizen_icu_api_ucnv_open_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_open_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_open_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_open start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_open ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_open() + */ +static void utc_tizen_icu_api_ucnv_open_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + tet_infoline("utc_tizen_icu_api_ucnv_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucnv_close(cnv); + + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_open() + * sending converter name as null will take default converter + */ +static void utc_tizen_icu_api_ucnv_open_func_02(void) +{ + UConverter *cnv = NULL; + UErrorCode status = U_ZERO_ERROR; + + cnv = ucnv_open(NULL, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + tet_infoline("utc_tizen_icu_api_ucnv_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_reset_func.c b/TC/unit/utc_tizen_icu_api_ucnv_reset_func.c new file mode 100755 index 0000000..6734e22 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_reset_func.c @@ -0,0 +1,83 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_reset_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_reset_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_reset start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_reset ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_reset() + */ +static void utc_tizen_icu_api_ucnv_reset_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_reset(cnv); + tet_infoline("utc_tizen_icu_api_ucnv_reset test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_reset test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + ucnv_close(cnv); + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_setFallback_func.c b/TC/unit/utc_tizen_icu_api_ucnv_setFallback_func.c new file mode 100755 index 0000000..505d52d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_setFallback_func.c @@ -0,0 +1,129 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_setFallback_func_01(void); +static void utc_tizen_icu_api_ucnv_setFallback_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_setFallback_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_setFallback_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_setFallback start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_setFallback ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_setFallback() + */ +static void utc_tizen_icu_api_ucnv_setFallback_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UBool uses_fallback = TRUE; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_setFallback(cnv, uses_fallback); + /* checks if converter uses fallback or not */ + if (ucnv_usesFallback(cnv)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFallback test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFallback test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_setFallback() + * sending converter as null will return error + */ +static void utc_tizen_icu_api_ucnv_setFallback_func_02(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UBool uses_fallback = FALSE; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_setFallback(cnv, uses_fallback); + /* checks if converter uses fallback or not */ + if (ucnv_usesFallback(cnv) == FALSE) { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFallback test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFallback test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_setFromUCallBack_func.c b/TC/unit/utc_tizen_icu_api_ucnv_setFromUCallBack_func.c new file mode 100755 index 0000000..d3b8190 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_setFromUCallBack_func.c @@ -0,0 +1,143 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_setFromUCallBack_func_01(void); +static void utc_tizen_icu_api_ucnv_setFromUCallBack_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_setFromUCallBack_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_setFromUCallBack_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucnv_setFromUCallBack start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_ucnv_setFromUCallBack ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_setFromUCallBack() + */ +static void utc_tizen_icu_api_ucnv_setFromUCallBack_func_01(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UConverterFromUCallback oldFromUAction = NULL; + UConverterFromUCallback oldFromUAction2 = NULL; + const void* oldFromUContext = NULL; + const void* oldFromUContext2 = NULL; + UChar newFromUContext = 0x0000; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_getFromUCallBack(cnv, &oldFromUAction, &oldFromUContext); + ucnv_setFromUCallBack(cnv, + UCNV_FROM_U_CALLBACK_SUBSTITUTE, &newFromUContext, + &oldFromUAction2, &oldFromUContext2, + &status); + if (U_FAILURE(status) || oldFromUAction != oldFromUAction2 || oldFromUContext != oldFromUContext2) { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFromUCallBack test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFromUCallBack test PASS!"); + tet_result(TET_PASS); + + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_setFromUCallBack() + * sending callback function as null will return error + */ +static void utc_tizen_icu_api_ucnv_setFromUCallBack_func_02(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UChar newFromUContext = 0x0000; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + status = U_ILLEGAL_ARGUMENT_ERROR; + ucnv_setFromUCallBack(cnv, + UCNV_FROM_U_CALLBACK_STOP, &newFromUContext, + NULL, NULL, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFromUCallBack test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_setFromUCallBack test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_setToUCallBack_func.c b/TC/unit/utc_tizen_icu_api_ucnv_setToUCallBack_func.c new file mode 100755 index 0000000..2b9b350 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_setToUCallBack_func.c @@ -0,0 +1,135 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_setToUCallBack_func_01(void); +static void utc_tizen_icu_api_ucnv_setToUCallBack_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_setToUCallBack_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_setToUCallBack_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_setToUCallBack start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_setToUCallBack ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_setToUCallBack() + */ +static void utc_tizen_icu_api_ucnv_setToUCallBack_func_01(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UConverterToUCallback oldToUAction = NULL; + UConverterToUCallback oldToUAction2 = NULL; + const void* oldToUContext = NULL; + const void* oldToUContext2 = NULL; + UChar newToUContext = 0x0000; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_getToUCallBack(cnv, &oldToUAction, &oldToUContext); + ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_SUBSTITUTE, &newToUContext, &oldToUAction2, &oldToUContext2, &status); + if (U_FAILURE(status) || oldToUAction != oldToUAction2 || oldToUContext != oldToUContext2) { + tet_infoline + ("utc_tizen_icu_api_ucnv_setToUCallBack test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_setToUCallBack test PASS!"); + tet_result(TET_PASS); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_setToUCallBack() + * sending callback function as null will return error + */ +static void utc_tizen_icu_api_ucnv_setToUCallBack_func_02(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UChar newToUContext = 0x0000; + cnv = ucnv_open(converter_name, &status); + + if (U_SUCCESS(status) && (NULL != cnv)) { + status = U_ILLEGAL_ARGUMENT_ERROR; + ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, &newToUContext, NULL, NULL, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_setToUCallBack test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_setToUCallBack test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_toUChars_func.c b/TC/unit/utc_tizen_icu_api_ucnv_toUChars_func.c new file mode 100755 index 0000000..7d497ed --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_toUChars_func.c @@ -0,0 +1,133 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_toUChars_func_01(void); +static void utc_tizen_icu_api_ucnv_toUChars_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_toUChars_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_toUChars_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_ucnv_toUChars start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_ucnv_toUChars ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_ucnv_toUChars() + */ +static void utc_tizen_icu_api_ucnv_toUChars_func_01(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UChar dest[50] = { 0, }; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + result = + ucnv_toUChars(cnv, dest, 50, "hello world", 12, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_ucnv_toUChars test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_ucnv_toUChars test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_ucnv_toUChars() + * sending source as null will return error + */ +static void utc_tizen_icu_api_ucnv_toUChars_func_02(void) +{ + const char *converter_name = "UTF-8"; + UErrorCode status = U_ZERO_ERROR; + UConverter *cnv = NULL; + UChar dest[50]; + int8_t result; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + ucnv_resetToUnicode(cnv); /* reset it to unicode */ + result = ucnv_toUChars(cnv, dest, 50, NULL, 0, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_ucnv_toUChars test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_ucnv_toUChars test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_ucnv_toUnicode_func.c b/TC/unit/utc_tizen_icu_api_ucnv_toUnicode_func.c new file mode 100755 index 0000000..a001c26 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_ucnv_toUnicode_func.c @@ -0,0 +1,126 @@ + /* + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_ucnv_toUnicode_func_01(void); +static void utc_tizen_icu_api_ucnv_toUnicode_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_ucnv_toUnicode_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_ucnv_toUnicode_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_toUnicode start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_ucnv_toUnicode ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_ucnv_toUnicode() + */ +static void utc_tizen_icu_api_ucnv_toUnicode_func_01(void) +{ + const char *converter_name = "UTF-7,version=1"; + UErrorCode status = U_ZERO_ERROR; + char input[] = { '\xEF', '\xBB', '\xBF', '\x41', '\x42', '\x43' }; + UChar output[100]; + UChar *target = output; + const char *source = input; + UConverter *cnv = NULL; + + cnv = ucnv_open(converter_name, &status); + if (U_SUCCESS(status) && (NULL != cnv)) { + + ucnv_toUnicode(cnv, &target, + output + sizeof(output) / U_SIZEOF_UCHAR, + &source, input + sizeof(input), NULL, TRUE, + &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_ucnv_toUnicode test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_ucnv_toUnicode test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_ucnv_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + ucnv_close(cnv); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_ucnv_toUnicode() + * sending target as null will return buffer overflow error + */ +static void utc_tizen_icu_api_ucnv_toUnicode_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + char input[] = { '\xEF', '\xBB', '\xBF', '\x41', '\x42', '\x43' }; + UChar output[100]; + const char *source = input; + + ucnv_toUnicode(NULL, NULL, output + sizeof(output) / U_SIZEOF_UCHAR, + &source, input + sizeof(input), NULL, TRUE, &status); + if (U_FAILURE(status)) { + tet_infoline("utc_tizen_icu_api_ucnv_toUnicode test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_ucnv_toUnicode test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_udat_close_func.c b/TC/unit/utc_tizen_icu_api_udat_close_func.c new file mode 100755 index 0000000..ae68bdb --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_close_func.c @@ -0,0 +1,89 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_close_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_close_func_01, POSITIVE_TC_IDX}, + + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_close start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_close ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_close() + */ +static void utc_tizen_icu_api_udat_close_func_01(void) +{ + UDateFormat *date_fmt; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + + date_fmt = + udat_open(UDAT_NONE, UDAT_LONG, locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + udat_close(date_fmt); + tet_infoline("utc_tizen_icu_api_udat_close test PASS!"); + tet_result(TET_PASS); + + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_udat_format_func.c b/TC/unit/utc_tizen_icu_api_udat_format_func.c new file mode 100755 index 0000000..d10eac9 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_format_func.c @@ -0,0 +1,100 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_format_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_format_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_format start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_format ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_format() + */ +static void utc_tizen_icu_api_udat_format_func_01(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + UChar str[100] = { 0, }; + int32_t len; + UDate date = ucal_getNow(); + + date_fmt = + udat_open(UDAT_DEFAULT, UDAT_DEFAULT, locale, NULL, -1, NULL, + -1, &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + status = U_ZERO_ERROR; + len = udat_format(date_fmt, date, str, 100, NULL, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_udat_format test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_format test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_udat_getCalendar_func.c b/TC/unit/utc_tizen_icu_api_udat_getCalendar_func.c new file mode 100755 index 0000000..30f9457 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_getCalendar_func.c @@ -0,0 +1,96 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_getCalendar_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_getCalendar_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_getCalendar start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_getCalendar ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_getCalendar() + */ +static void utc_tizen_icu_api_udat_getCalendar_func_01(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + const UCalendar *calendar = NULL; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + calendar = udat_getCalendar(date_fmt); + if ((NULL != calendar)) { + tet_infoline + ("utc_tizen_icu_api_udat_getCalendar test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_getCalendar test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_udat_getSymbols_func.c b/TC/unit/utc_tizen_icu_api_udat_getSymbols_func.c new file mode 100755 index 0000000..524e34c --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_getSymbols_func.c @@ -0,0 +1,145 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_getSymbols_func_01(void); +static void utc_tizen_icu_api_udat_getSymbols_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_getSymbols_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_udat_getSymbols_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_getSymbols start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_getSymbols ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_getSymbols() + */ +static void utc_tizen_icu_api_udat_getSymbols_func_01(void) +{ + UDateFormat *date_fmt = NULL; + int32_t type[] = + { UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, UDAT_WEEKDAYS, + UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, UDAT_LOCALIZED_CHARS + }; + UChar result[50] = { 0, }; + UErrorCode status = U_ZERO_ERROR; + int32_t ret = 0; + int32_t i; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, NULL, NULL, -1, NULL, -1, &status); + + if (U_SUCCESS(status) ) { + for (i = 0; i < 7; i++) { + ret = + udat_getSymbols(date_fmt, type[i], 5, result, 50, + &status); + if ((U_SUCCESS(status))) { + tet_infoline + ("utc_tizen_icu_api_udat_getSymbols test PASS!"); + tet_printf("Date Symbol %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_getSymbols test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + + return; +} + + +/** + * @brief Negative test case of utc_tizen_icu_api_udat_getSymbols() + * passing the NULL as a result will through error. + */ +static void utc_tizen_icu_api_udat_getSymbols_func_02(void) +{ + UDateFormat *date_fmt = NULL; + UErrorCode status = U_ZERO_ERROR; + int32_t ret; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, NULL, NULL, -1, NULL, -1, &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + + ret = + udat_getSymbols(date_fmt, UDAT_MONTHS, 1, NULL, -1, + &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_udat_getSymbols test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_getSymbols test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + +} diff --git a/TC/unit/utc_tizen_icu_api_udat_isLenient_func.c b/TC/unit/utc_tizen_icu_api_udat_isLenient_func.c new file mode 100755 index 0000000..90b17e7 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_isLenient_func.c @@ -0,0 +1,98 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_isLenient_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_isLenient_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_isLenient start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_isLenient ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_isLenient() + */ +static void utc_tizen_icu_api_udat_isLenient_func_01(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + UBool result; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + udat_setLenient(date_fmt, TRUE); /* Setting the date handler to lenient format */ + result = udat_isLenient(date_fmt); + if ((TRUE == result)) { + tet_infoline + ("utc_tizen_icu_api_udat_isLenient test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_isLenient test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + + return; +} + diff --git a/TC/unit/utc_tizen_icu_api_udat_open_func.c b/TC/unit/utc_tizen_icu_api_udat_open_func.c new file mode 100755 index 0000000..0101d4d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_open_func.c @@ -0,0 +1,123 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_open_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_open_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_open start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_open ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_open() + */ +static void utc_tizen_icu_api_udat_open_func_01(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + int32_t pattern[] = { UDAT_FULL, UDAT_LONG, UDAT_MEDIUM, UDAT_SHORT }; + int32_t i; + + for (i = 0; i < 4; i++) { + date_fmt = + udat_open(UDAT_NONE, pattern[i], locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + tet_infoline("utc_tizen_icu_api_udat_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + } + + for (i = 0; i < 4; i++) { + date_fmt = + udat_open(pattern[i], UDAT_NONE, locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + tet_infoline("utc_tizen_icu_api_udat_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + } + + for (i = 0; i < 4; i++) { + date_fmt = + udat_open(pattern[i], pattern[i], locale, NULL, -1, NULL, + -1, &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + tet_infoline("utc_tizen_icu_api_udat_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + } + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_udat_setLenient_func.c b/TC/unit/utc_tizen_icu_api_udat_setLenient_func.c new file mode 100755 index 0000000..dbd139f --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_setLenient_func.c @@ -0,0 +1,97 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_setLenient_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_setLenient_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_setLenient start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_setLenient ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_setLenient() + */ +static void utc_tizen_icu_api_udat_setLenient_func_01(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + UBool result; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status) && (NULL != date_fmt)) { + udat_setLenient(date_fmt, TRUE); /* Setting the date handler to lenient format */ + result = udat_isLenient(date_fmt); + if ((TRUE == result)) { + tet_infoline + ("utc_tizen_icu_api_udat_setLenient test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_setLenient test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_udat_setSymbols_func.c b/TC/unit/utc_tizen_icu_api_udat_setSymbols_func.c new file mode 100755 index 0000000..3c1c011 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_setSymbols_func.c @@ -0,0 +1,102 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_setSymbols_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_setSymbols_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_setSymbols start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_udat_setSymbols ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_setSymbols() + */ +static void utc_tizen_icu_api_udat_setSymbols_func_01(void) +{ + UDateFormat *date_fmt; + int32_t type[] = + { UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, UDAT_WEEKDAYS, + UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, UDAT_LOCALIZED_CHARS + }; + UChar value[50]; + UErrorCode status = U_ZERO_ERROR; + int32_t i; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, NULL, NULL, -1, NULL, -1, &status); + + if (U_SUCCESS(status) ) { + for (i = 0; i < 5; i++) { + udat_setSymbols(date_fmt, type[i], i, value, -1, + &status); + if ((U_SUCCESS(status))) { + tet_infoline + ("utc_tizen_icu_api_udat_setSymbols test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_setSymbols test FAIL!"); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + udat_close(date_fmt); + + return; +} diff --git a/TC/unit/utc_tizen_icu_api_udat_toPatternRelativeDate_func.c b/TC/unit/utc_tizen_icu_api_udat_toPatternRelativeDate_func.c new file mode 100755 index 0000000..b94eb8d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_udat_toPatternRelativeDate_func.c @@ -0,0 +1,160 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_udat_toPatternRelativeDate_func_01(void); +static void utc_tizen_icu_api_udat_toPatternRelativeDate_func_02(void); +static void utc_tizen_icu_api_udat_toPatternRelativeDate_func_03(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_udat_toPatternRelativeDate_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_udat_toPatternRelativeDate_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_udat_toPatternRelativeDate_func_03, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_udat_toPatternRelativeDate start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_udat_toPatternRelativeDate ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_udat_toPatternRelativeDate() + */ +static void utc_tizen_icu_api_udat_toPatternRelativeDate_func_01(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UChar result[50] = { 0, }; + UErrorCode status = U_ZERO_ERROR; + int32_t ret; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, locale, NULL, -1, NULL, -1, + &status); + + if (U_SUCCESS(status)) { + ret = udat_toPatternRelativeDate(date_fmt, result, 50, &status); + if (!(U_SUCCESS(status))) { + tet_infoline + ("utc_tizen_icu_api_udat_toPatternRelativeDate test PASS!"); + tet_printf("Date patttern %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_toPatternRelativeDate test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_udat_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + + udat_close(date_fmt); + + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_udat_toPatternRelativeDate() + * passing the fmt arg to function without opening udat_open + */ +static void utc_tizen_icu_api_udat_toPatternRelativeDate_func_02(void) +{ + UChar result[50] = { 0, }; + UErrorCode status = U_ZERO_ERROR; + int32_t ret; + + ret = udat_toPatternRelativeDate(NULL, result, 50, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_udat_toPatternRelativeDate test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_toPatternRelativeDate test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of utc_tizen_icu_api_udat_toPatternRelativeDate() + * passing the NULL as a result will through error. + */ +static void utc_tizen_icu_api_udat_toPatternRelativeDate_func_03(void) +{ + UDateFormat *date_fmt = NULL; + const char *locale = uloc_getDefault(); + UErrorCode status = U_ZERO_ERROR; + int32_t ret; + + date_fmt = + udat_open(UDAT_NONE, UDAT_SHORT, locale, NULL, -1, NULL, -1, + &status); + if (U_SUCCESS(status) && (NULL != date_fmt)) { + ret = udat_toPatternRelativeDate(date_fmt, NULL, -1, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_udat_toPatternRelativeDate test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_udat_toPatternRelativeDate test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } + +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getAvailable_func.c b/TC/unit/utc_tizen_icu_api_uloc_getAvailable_func.c new file mode 100755 index 0000000..3ff63de --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getAvailable_func.c @@ -0,0 +1,103 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getAvailable_func_01(void); +static void utc_tizen_icu_api_uloc_getAvailable_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getAvailable_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getAvailable_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getAvailable start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getAvailable ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getAvailable() + */ +static void utc_tizen_icu_api_uloc_getAvailable_func_01(void) +{ + const char *result = NULL; + int32_t index = 5; + result = uloc_getAvailable(index); + + if (NULL != result) { + tet_infoline("utc_tizen_icu_api_uloc_getAvailable test PASS!"); + tet_printf("locale for give index %d is %s\n", index, result); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getAvailable test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getAvailable() + * if index is greater than installed locale count it will return null + */ +static void utc_tizen_icu_api_uloc_getAvailable_func_02(void) +{ + const char *result = NULL; + int32_t index = 5000; /* invalide index */ + result = uloc_getAvailable(index); + + if (NULL == result) { + tet_infoline("utc_tizen_icu_api_uloc_getAvailable test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getAvailable test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getCountry_func.c b/TC/unit/utc_tizen_icu_api_uloc_getCountry_func.c new file mode 100755 index 0000000..b7293be --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getCountry_func.c @@ -0,0 +1,140 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getCountry_func_01(void); +static void utc_tizen_icu_api_uloc_getCountry_func_02(void); +static void utc_tizen_icu_api_uloc_getCountry_func_03(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getCountry_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getCountry_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getCountry_func_03, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getCountry start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getCountry ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getCountry() + */ +static void utc_tizen_icu_api_uloc_getCountry_func_01(void) +{ + const char *locale_id = uloc_getDefault(); + char country[ULOC_COUNTRY_CAPACITY]; + int32_t country_capacity = ULOC_COUNTRY_CAPACITY; + UErrorCode err = U_ZERO_ERROR; + int32_t result; + + result = uloc_getCountry(locale_id, country, country_capacity, &err); + + if (U_SUCCESS(err)) { + tet_infoline("utc_tizen_icu_api_uloc_getCountry test PASS!"); + tet_printf("country for this %s locale %s\n", locale_id, + country); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getCountry test FAIL!"); + tet_printf("Error is %d\n", err); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getCountry() + * function should return 0 if errcode is null + */ +static void utc_tizen_icu_api_uloc_getCountry_func_02(void) +{ + const char *locale_id = "fr_FR"; + char country[ULOC_COUNTRY_CAPACITY]; + int32_t country_capacity = ULOC_COUNTRY_CAPACITY; + UErrorCode err = U_ZERO_ERROR; + int32_t result; + + result = uloc_getCountry(locale_id, country, country_capacity, NULL); + + if (0 == result) { + tet_infoline("utc_tizen_icu_api_uloc_getCountry test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getCountry test FAIL!"); + tet_printf("Error is %d\n", err); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getCountry() + * function should return 0 if error code is positive value. + */ +static void utc_tizen_icu_api_uloc_getCountry_func_03(void) +{ + const char *locale_id = "fr_FR"; + char country[ULOC_COUNTRY_CAPACITY]; + int32_t country_capacity = ULOC_COUNTRY_CAPACITY; + UErrorCode err = 1; + int32_t result; + + result = uloc_getCountry(locale_id, country, country_capacity, &err); + + if (0 == result) { + tet_infoline("utc_tizen_icu_api_uloc_getCountry test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getCountry test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getDefault_func.c b/TC/unit/utc_tizen_icu_api_uloc_getDefault_func.c new file mode 100755 index 0000000..53a4fd2 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getDefault_func.c @@ -0,0 +1,80 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getDefault_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getDefault_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getDefault start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getDefault ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getDefault() + */ +static void utc_tizen_icu_api_uloc_getDefault_func_01(void) +{ + const char *result = NULL; + result = uloc_getDefault(); + + if (NULL != result) { + tet_infoline("utc_tizen_icu_api_uloc_getDefault test PASS!"); + tet_printf("Default locale %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getDefault test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getDisplayCountry_func.c b/TC/unit/utc_tizen_icu_api_uloc_getDisplayCountry_func.c new file mode 100755 index 0000000..082ed74 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getDisplayCountry_func.c @@ -0,0 +1,176 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_01(void); +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_02(void); +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_03(void); +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getDisplayCountry_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayCountry_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayCountry_func_03, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayCountry_func_04, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getDisplayCountry start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getDisplayCountry ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getDisplayCountry() + */ +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_01(void) +{ + const char *locale = uloc_getDefault(); + UChar Country[50] = { 0, }; + int32_t Country_capacity = 50; + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = + uloc_getDisplayCountry(locale, NULL, Country, Country_capacity, + &status); + if ((U_SUCCESS(status)) ) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test PASS!"); + tet_printf("Display Country %s\n", Country); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayCountry() + * status variable null will return error + */ +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_02(void) +{ + const char *locale = uloc_getDefault(); + UChar Country[50] = { 0, }; + int32_t Country_capacity = 50; + int32_t result; + + result = + uloc_getDisplayCountry(locale, NULL, Country, Country_capacity, + NULL); + if (result == 0) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayCountry() + * if Country is null it should return the status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_03(void) +{ + int32_t Country_capacity = 50; + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = + uloc_getDisplayCountry(NULL, NULL, NULL, Country_capacity, &status); + if ((result == 0) || (U_FAILURE(status))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test FAIL!"); + tet_printf("Status %d\n", status); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayCountry() + * if Country capacity is less than zero it will return status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayCountry_func_04(void) +{ + UChar Country[50] = { 0, }; + int32_t Country_capacity = 0; + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = + uloc_getDisplayCountry(NULL, NULL, Country, Country_capacity, + &status); + if ((result == 0) || (U_FAILURE(status))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayCountry test FAIL!"); + tet_printf("Status %d\n", status); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getDisplayLanguage_func.c b/TC/unit/utc_tizen_icu_api_uloc_getDisplayLanguage_func.c new file mode 100755 index 0000000..86c9863 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getDisplayLanguage_func.c @@ -0,0 +1,169 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_01(void); +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_02(void); +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_03(void); +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getDisplayLanguage_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayLanguage_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayLanguage_func_03, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayLanguage_func_04, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getDisplayLanguage start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getDisplayLanguage ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getDisplayLanguage() + */ +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_01(void) +{ + const char *locale = uloc_getDefault(); + UChar language[50] = { 0, }; + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = uloc_getDisplayLanguage(locale, NULL, language, 50, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test PASS!"); + tet_printf("Display language %s\n", language); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayLanguage() + * status variable null will return error + */ +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_02(void) +{ + const char *locale = uloc_getDefault(); + UChar language[50] = { 0, }; + int32_t language_capacity = 50; + int32_t result; + + result = + uloc_getDisplayLanguage(locale, NULL, language, language_capacity, + NULL); + if (result == 0) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayLanguage() + * if language is null it should return the status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_03(void) +{ + int32_t result; + UErrorCode status; + + /* locale and display locale is null mean it will take default one */ + result = uloc_getDisplayLanguage(NULL, NULL, NULL, 50, &status); + if ((result == 0) || (U_FAILURE(status))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test FAIL!"); + tet_printf("Status %d\n", status); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayLanguage() + * if language capacity is less than zero it will return status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayLanguage_func_04(void) +{ + UChar language[50] = { 0, }; + int32_t result; + UErrorCode status; + + result = uloc_getDisplayLanguage(NULL, NULL, language, 0, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayLanguage test FAIL!"); + tet_printf("Status %d\n", status); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getDisplayName_func.c b/TC/unit/utc_tizen_icu_api_uloc_getDisplayName_func.c new file mode 100755 index 0000000..3c53500 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getDisplayName_func.c @@ -0,0 +1,175 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getDisplayName_func_01(void); +static void utc_tizen_icu_api_uloc_getDisplayName_func_02(void); +static void utc_tizen_icu_api_uloc_getDisplayName_func_03(void); +static void utc_tizen_icu_api_uloc_getDisplayName_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getDisplayName_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayName_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayName_func_03, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayName_func_04, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getDisplayName start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getDisplayName ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getDisplayName() + */ +static void utc_tizen_icu_api_uloc_getDisplayName_func_01(void) +{ + const char *locale_id = "fr_FR"; + UChar result[50] = { 0, }; + int32_t max_result_size = 50; + UErrorCode err = U_ZERO_ERROR; + int32_t ret; + + ret = + uloc_getDisplayName(locale_id, NULL, result, max_result_size, &err); + if ((U_SUCCESS(err)) && (0 != ret)) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test PASS!"); + tet_printf("Display Name %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayName() + * if error code is null it will return 0 + */ +static void utc_tizen_icu_api_uloc_getDisplayName_func_02(void) +{ + const char *locale_id = "fr_FR"; + UChar result[50] = { 0, }; + int32_t max_result_size = 50; + int32_t ret; + + ret = + uloc_getDisplayName(locale_id, NULL, result, max_result_size, NULL); + + if (ret == 0) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayName() + * if result is null it should return the status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayName_func_03(void) +{ + const char *locale_id = "fr_FR"; + int32_t max_result_size = 50; + UErrorCode err = U_ZERO_ERROR; + int32_t ret; + + ret = uloc_getDisplayName(locale_id, NULL, NULL, max_result_size, &err); + + if ((U_FAILURE(err))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test FAIL!"); + tet_printf("Status %d\n", err); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayName() + * if result size is less than zero it will return status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayName_func_04(void) +{ + const char *locale_id = "fr_FR"; + UChar result[50] = { 0, }; + int32_t max_result_size = 0; + UErrorCode err = U_ZERO_ERROR; + int32_t ret; + + ret = + uloc_getDisplayName(locale_id, NULL, result, max_result_size, &err); + + if ((result == 0) || (U_FAILURE(err))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayName test FAIL!"); + tet_printf("Status %d\n", err); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getDisplayVariant_func.c b/TC/unit/utc_tizen_icu_api_uloc_getDisplayVariant_func.c new file mode 100755 index 0000000..f0fdc4e --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getDisplayVariant_func.c @@ -0,0 +1,169 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_01(void); +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_02(void); +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_03(void); +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getDisplayVariant_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayVariant_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayVariant_func_03, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getDisplayVariant_func_04, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getDisplayVariant start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getDisplayVariant ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getDisplayVariant() + */ +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_01(void) +{ + const char *locale = uloc_getDefault(); + UChar variant[50] = { 0, }; + int32_t variant_capacity = 50; + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = + uloc_getDisplayVariant(locale, NULL, variant, variant_capacity, + &status); + if (U_SUCCESS(status) && (result > 0)) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test PASS!"); + tet_printf("Display Variant %s\n", variant); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayVariant() + * if status is null it will return 0 + */ +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_02(void) +{ + UChar variant[50] = { 0, }; + int32_t variant_capacity = 50; + int32_t result; + + result = + uloc_getDisplayVariant(NULL, NULL, variant, variant_capacity, NULL); + if (result == 0) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayVariant() + * if Variant is null it should return the status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_03(void) +{ + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = uloc_getDisplayVariant(NULL, NULL, NULL, 50, &status); + if ((result == 0) || (U_FAILURE(status))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test FAIL!"); + tet_printf("Status %d\n", status); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getDisplayVariant() + * if Variant capacity is less than zero it will return status as U_ILLEGAL_ARGUMENT_ERROR + * + */ +static void utc_tizen_icu_api_uloc_getDisplayVariant_func_04(void) +{ + UChar variant[50] = { 0, }; + int32_t result; + UErrorCode status = U_ZERO_ERROR; + + result = uloc_getDisplayVariant(NULL, NULL, variant, 0, &status); + if ((result == 0) || (U_FAILURE(status))) { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getDisplayVariant test FAIL!"); + tet_printf("Status %d\n", status); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getISO3Country_func.c b/TC/unit/utc_tizen_icu_api_uloc_getISO3Country_func.c new file mode 100755 index 0000000..27220ef --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getISO3Country_func.c @@ -0,0 +1,111 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getISO3Country_func_01(void); +static void utc_tizen_icu_api_uloc_getISO3Country_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getISO3Country_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getISO3Country_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getISO3Country start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getISO3Country ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getISO3Country() + */ +static void utc_tizen_icu_api_uloc_getISO3Country_func_01(void) +{ + const char *result = NULL; + const char *locale_id = "fr_FR"; + + result = uloc_getISO3Country(locale_id); + + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Country test PASS!"); + tet_printf("ISO3 Country for %s locale is %s\n", locale_id, + result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Country test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getISO3Country() + * if locale id is null if will return the Country code of default locale. + */ +static void utc_tizen_icu_api_uloc_getISO3Country_func_02(void) +{ + const char *result = NULL; + + result = uloc_getISO3Country(NULL); + + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Country test PASS!"); + tet_printf("ISO3 Country for %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Country test FAIL!"); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getISO3Language_func.c b/TC/unit/utc_tizen_icu_api_uloc_getISO3Language_func.c new file mode 100755 index 0000000..519ab8b --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getISO3Language_func.c @@ -0,0 +1,113 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getISO3Language_func_01(void); +static void utc_tizen_icu_api_uloc_getISO3Language_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getISO3Language_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getISO3Language_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getISO3Language start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getISO3Language ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getISO3Language() + */ +static void utc_tizen_icu_api_uloc_getISO3Language_func_01(void) +{ + const char *result = NULL; + const char *locale_id = "fr_FR"; + + result = uloc_getISO3Language(locale_id); + + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Language test PASS!"); + tet_printf("ISO3 language for %s locale is %s\n", locale_id, + result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Language test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getISO3Language() + * if locale id is null if will return the langauge code of default locale. + */ +static void utc_tizen_icu_api_uloc_getISO3Language_func_02(void) +{ + const char *result = NULL; + + result = uloc_getISO3Language(NULL); + + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Language test PASS!"); + tet_printf("ISO3 language for %s\n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getISO3Language test FAIL!"); + tet_result(TET_FAIL); + } + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getISOCountries_func.c b/TC/unit/utc_tizen_icu_api_uloc_getISOCountries_func.c new file mode 100755 index 0000000..81abcd1 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getISOCountries_func.c @@ -0,0 +1,85 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getISOCountries_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getISOCountries_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getISOCountries start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getISOCountries ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getISOCountries() + */ +static void utc_tizen_icu_api_uloc_getISOCountries_func_01(void) +{ + const char *const *result = NULL; + + result = uloc_getISOCountries(); + + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_uloc_getISOCountries test PASS!"); + tet_printf("ISO3 language for %s \n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getISOCountries test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getISOLanguages_func.c b/TC/unit/utc_tizen_icu_api_uloc_getISOLanguages_func.c new file mode 100755 index 0000000..4ef9a2d --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getISOLanguages_func.c @@ -0,0 +1,85 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getISOLanguages_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getISOLanguages_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getISOLanguages start"); + return; +} + +static void cleanup(void) +{ + tet_infoline + ("Testing API utc_tizen_icu_api_uloc_getISOLanguages ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getISOLanguages() + */ +static void utc_tizen_icu_api_uloc_getISOLanguages_func_01(void) +{ + const char *const *result = NULL; + + result = uloc_getISOLanguages(); + + if (NULL != result) { + tet_infoline + ("utc_tizen_icu_api_uloc_getISOLanguages test PASS!"); + tet_printf("ISO3 language for %s \n", result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_uloc_getISOLanguages test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getLanguage_func.c b/TC/unit/utc_tizen_icu_api_uloc_getLanguage_func.c new file mode 100755 index 0000000..4092379 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getLanguage_func.c @@ -0,0 +1,141 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getLangugae_func_01(void); +static void utc_tizen_icu_api_uloc_getLangugae_func_02(void); +static void utc_tizen_icu_api_uloc_getLangugae_func_03(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getLangugae_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getLangugae_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getLangugae_func_03, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getLangugae start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getLangugae ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getLangugae() + */ +static void utc_tizen_icu_api_uloc_getLangugae_func_01(void) +{ + const char *locale_id = uloc_getDefault(); + char language[20] = { 0, }; + int32_t language_capacity = 20; + UErrorCode err = U_ZERO_ERROR; + int32_t result; + + result = uloc_getLanguage(locale_id, language, language_capacity, &err); + + /*result = 0 failed to getLanguage result > languageCapacity mean + language truncated */ + if ((result != 0) && (U_SUCCESS(err))) { + + tet_infoline("utc_tizen_icu_api_uloc_getLangugae test PASS!"); + tet_printf("Langauage for the %s locale %s", locale_id, + language); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getLangugae test FAIL!"); + tet_printf("Error is %d\n", err); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getLangugae() + * if errcode is assigned to null function should return 0 + */ +static void utc_tizen_icu_api_uloc_getLangugae_func_02(void) +{ + const char *locale_id = uloc_getDefault(); + char language[20] = { + 0, + }; + int32_t language_capacity = 20; + int32_t result; + result = uloc_getLanguage(locale_id, language, language_capacity, NULL); + /* function should return zero if errorcode is null */ + if (0 == result) { + tet_infoline("utc_tizen_icu_api_uloc_getLangugae test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getLangugae test FAIL!"); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getLangugae() + * if errcode is postive value it will return 0 + */ +static void utc_tizen_icu_api_uloc_getLangugae_func_03(void) +{ + const char *locale_id = uloc_getDefault(); + UErrorCode err = 5; + char language[20] = {0,}; + int32_t result; + result = uloc_getLanguage(locale_id, language, 20, &err); + /* function should return zero if the errorcode is not equal to zero */ + if (0 == result) { + tet_infoline("utc_tizen_icu_api_uloc_getLangugae test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getLangugae test FAIL!"); + tet_printf("Error is %d\n", err); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_getVariant_func.c b/TC/unit/utc_tizen_icu_api_uloc_getVariant_func.c new file mode 100755 index 0000000..b986c0b --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_getVariant_func.c @@ -0,0 +1,113 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_getVariant_func_01(void); +static void utc_tizen_icu_api_uloc_getVariant_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_getVariant_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_getVariant_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getVariant start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_getVariant ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_getVariant() + */ +static void utc_tizen_icu_api_uloc_getVariant_func_01(void) +{ + const char *locale_id = uloc_getDefault(); + char variant[20] = {0,}; + int32_t variant_capacity = 20; + UErrorCode err = U_ZERO_ERROR; + int32_t result; + + result = uloc_getVariant(locale_id, variant, variant_capacity, &err); + + if (U_SUCCESS(err)) { + tet_infoline("utc_tizen_icu_api_uloc_getVariant test PASS!"); + tet_printf("variant for this %s locale %s\n", locale_id, + variant); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getVariant test FAIL!"); + tet_printf("Error is %d\n", err); + tet_result(TET_FAIL); + } + return; +} + + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_getVariant() + * if err code is null will return error + */ +static void utc_tizen_icu_api_uloc_getVariant_func_02(void) +{ + const char *locale_id = uloc_getDefault(); + char variant[20] = { 0, }; + int32_t variant_capacity = 20; + int32_t result; + + result = uloc_getVariant(locale_id, variant, variant_capacity, NULL); + + if (0 == result) { + tet_infoline("utc_tizen_icu_api_uloc_getVariant test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_getVariant test FAIL!"); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_uloc_setDefault_func.c b/TC/unit/utc_tizen_icu_api_uloc_setDefault_func.c new file mode 100755 index 0000000..44b2052 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_uloc_setDefault_func.c @@ -0,0 +1,134 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_uloc_setDefault_func_01(void); +static void utc_tizen_icu_api_uloc_setDefault_func_02(void); +static void utc_tizen_icu_api_uloc_setDefault_func_03(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_uloc_setDefault_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_setDefault_func_02, NEGATIVE_TC_IDX}, + {utc_tizen_icu_api_uloc_setDefault_func_03, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_setDefault start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_uloc_setDefault ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_uloc_setDefault() + */ +static void utc_tizen_icu_api_uloc_setDefault_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + const char *locale = uloc_getDefault(); + + uloc_setDefault(locale, &status); + + if (U_SUCCESS(status)) { + tet_infoline("utc_tizen_icu_api_uloc_setDefault test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_setDefault test FAIL!"); + tet_printf("Error is %d", status); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_setDefault() + * to check if null send as a locale id it should set default locale id + */ +static void utc_tizen_icu_api_uloc_setDefault_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + const char *def_locale_before = uloc_getDefault(); + const char *def_locale_after; + + uloc_setDefault(NULL, &status); + // If null send to the locale id it will set the default locale + def_locale_after = uloc_getDefault(); + + //checking old and new locale id is same + if (!strcmp(def_locale_before, def_locale_after)) { + tet_infoline("utc_tizen_icu_api_uloc_setDefault test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_setDefault test FAIL!"); + tet_printf("Error is %d", status); + tet_result(TET_FAIL); + } + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_uloc_setDefault() + * to check if error code is greater than zero it should return the error code + */ +static void utc_tizen_icu_api_uloc_setDefault_func_03(void) +{ + UErrorCode status = U_ILLEGAL_ARGUMENT_ERROR; + + uloc_setDefault(uloc_getDefault(), &status); + + // the status value is more than 0 it will simply return + if (U_ILLEGAL_ARGUMENT_ERROR == status) { + tet_infoline("utc_tizen_icu_api_uloc_setDefault test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_uloc_setDefault test FAIL!"); + tet_printf("Error is %d", status); + tet_result(TET_FAIL); + } + return; +} diff --git a/TC/unit/utc_tizen_icu_api_unum_close_func.c b/TC/unit/utc_tizen_icu_api_unum_close_func.c new file mode 100755 index 0000000..07282e7 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_close_func.c @@ -0,0 +1,89 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_close_func_01(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_close_func_01, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_close start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_close ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_close() + */ +static void utc_tizen_icu_api_unum_close_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + UNumberFormat *num_fmt = NULL; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + + if (U_SUCCESS(status) && (NULL != num_fmt)) { + unum_close(num_fmt); + tet_infoline("utc_tizen_icu_api_unum_close test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + unum_close(num_fmt); + } + return; +} + +/** + * @brief No Negative test case + */ + diff --git a/TC/unit/utc_tizen_icu_api_unum_formatDecimal_func.c b/TC/unit/utc_tizen_icu_api_unum_formatDecimal_func.c new file mode 100755 index 0000000..75cafc3 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_formatDecimal_func.c @@ -0,0 +1,146 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_formatDecimal_func_01(void); +static void utc_tizen_icu_api_unum_formatDecimal_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_formatDecimal_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_formatDecimal_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_formatDecimal start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_formatDecimal ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_formatDecimal() + */ +static void utc_tizen_icu_api_unum_formatDecimal_func_01(void) +{ + uint32_t index = 0; + UErrorCode status = U_ZERO_ERROR; + const char *number[] = { "768.3412", "8970.21", "23114" }; + UNumberFormat *num_fmt = NULL; + UChar result[20] = { 0, }; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + + for (index = 0; index < 3; index++) { + ret = + unum_formatDecimal(num_fmt, number[index], -1, + result, 20, NULL, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_formatDecimal test PASS!"); + tet_printf + ("Input number %s formatted result %s\n", + number[index], result); + memset(result, '\0', 20); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_formatDecimal test FAIL!"); + tet_printf("Error code %s\n", + u_errorName(status)); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_formatDecimal() + * passing result NULL will give BUFFER_OVERFLOW error + */ +static void utc_tizen_icu_api_unum_formatDecimal_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + const char *number = "7611.21"; + UNumberFormat *num_fmt = NULL; + UChar result[20] = { 0, }; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + ret = + unum_formatDecimal(num_fmt, NULL, 0, NULL, 20, NULL, + &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_formatDecimal test PASS!"); + tet_printf("Input number %s formatted result %s\n", + number, result); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_formatDecimal test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_unum_formatDouble_func.c b/TC/unit/utc_tizen_icu_api_unum_formatDouble_func.c new file mode 100755 index 0000000..215ce6e --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_formatDouble_func.c @@ -0,0 +1,142 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_formatDouble_func_01(void); +static void utc_tizen_icu_api_unum_formatDouble_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_formatDouble_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_formatDouble_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_formatDouble start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_formatDouble ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_formatDouble() + */ +static void utc_tizen_icu_api_unum_formatDouble_func_01(void) +{ + uint32_t index = 0; + UErrorCode status = U_ZERO_ERROR; + double number[] = { 5.0, 6.2, -1.7 }; + UNumberFormat *num_fmt = NULL; + UChar result[20] = { 0, }; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + + for (index = 0; index < 3; index++) { + ret = + unum_formatDouble(num_fmt, number[index], result, + 20, NULL, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_formatDouble test PASS!"); + tet_printf + ("Input number %f formatted result %s\n", + number[index], result); + memset(result, '\0', 20); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_formatDouble test FAIL!"); + tet_printf("Error code %s\n", + u_errorName(status)); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_formatDouble() + * passing result NULL will give BUFFER_OVERFLOW error + */ +static void utc_tizen_icu_api_unum_formatDouble_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + double number = 9.0; + UNumberFormat *num_fmt = NULL; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + ret = + unum_formatDouble(num_fmt, number, NULL, 20, NULL, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_formatDouble test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_formatDouble test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_unum_formatInt64_func.c b/TC/unit/utc_tizen_icu_api_unum_formatInt64_func.c new file mode 100755 index 0000000..18450f2 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_formatInt64_func.c @@ -0,0 +1,137 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_formatInt64_func_01(void); +static void utc_tizen_icu_api_unum_formatInt64_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_formatInt64_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_formatInt64_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_formatInt64 start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_formatInt64 ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_formatInt64() + */ +static void utc_tizen_icu_api_unum_formatInt64_func_01(void) +{ + uint32_t index = 0; + UErrorCode status = U_ZERO_ERROR; + int64_t number[] = { 574857, 454, -435454 }; + UNumberFormat *num_fmt = NULL; + UChar result[20] = { 0, }; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + + for (index = 0; index < 3; index++) { + ret = + unum_formatInt64(num_fmt, number[index], result, 20, + NULL, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_formatInt64 test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_formatInt64 test FAIL!"); + tet_printf("Error code %s\n", + u_errorName(status)); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_formatInt64() + * passing result NULL will give BUFFER_OVERFLOW error + */ +static void utc_tizen_icu_api_unum_formatInt64_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + int64_t number = 123142; + UNumberFormat *num_fmt = NULL; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + ret = + unum_formatInt64(num_fmt, number, NULL, 20, NULL, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_formatInt64 test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_formatInt64 test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_unum_format_func.c b/TC/unit/utc_tizen_icu_api_unum_format_func.c new file mode 100755 index 0000000..db2fc28 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_format_func.c @@ -0,0 +1,141 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_format_func_01(void); +static void utc_tizen_icu_api_unum_format_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_format_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_format_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_format start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_format ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_format() + */ +static void utc_tizen_icu_api_unum_format_func_01(void) +{ + uint32_t index = 0; + UErrorCode status = U_ZERO_ERROR; + uint32_t number[] = { 123, 3333, -1234567 }; + UNumberFormat *num_fmt; + UChar result[20] = { 0, }; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + + for (index = 0; index < 3; index++) { + ret = + unum_format(num_fmt, number[index], result, 20, + NULL, &status); + if (U_SUCCESS(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_format test PASS!"); + tet_printf + ("Input number %d formatted result %s\n", + number[index], result); + memset(result, '\0', 20); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_format test FAIL!"); + tet_printf("Error code %s\n", + u_errorName(status)); + tet_result(TET_FAIL); + } + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_format() + * passing result NULL will give BUFFER_OVERFLOW error + */ +static void utc_tizen_icu_api_unum_format_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + uint32_t number = 123; + UNumberFormat *num_fmt; + uint32_t ret; + + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + ret = unum_format(num_fmt, number, NULL, 20, NULL, &status); + if (U_FAILURE(status)) { + tet_infoline + ("utc_tizen_icu_api_unum_format test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_format test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_unum_open_func.c b/TC/unit/utc_tizen_icu_api_unum_open_func.c new file mode 100755 index 0000000..39ffd3f --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_open_func.c @@ -0,0 +1,131 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_open_func_01(void); +static void utc_tizen_icu_api_unum_open_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_open_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_open_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_open start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_open ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_open() + */ +static void utc_tizen_icu_api_unum_open_func_01(void) +{ + + int32_t style[] = + { UNUM_DECIMAL, UNUM_CURRENCY, UNUM_PERCENT, UNUM_SCIENTIFIC, + UNUM_SPELLOUT, UNUM_PATTERN_DECIMAL, + UNUM_PATTERN_RULEBASED, UNUM_DEFAULT + }; + UErrorCode status = U_ZERO_ERROR; + UNumberFormat *num_fmt = NULL; + int i; + + for (i = 0; i < 8; i++) { /*If UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED is passed then + the number format is opened using the given pattern */ + status = U_ZERO_ERROR; + if ((style[i] == UNUM_PATTERN_DECIMAL) + || (style[i] == UNUM_PATTERN_RULEBASED)) { + + num_fmt = + unum_open(style[i], (const UChar *)"#,##,###", -1, + NULL, NULL, &status); + } else { + num_fmt = + unum_open(style[i], NULL, -1, NULL, NULL, &status); + } + if (U_SUCCESS(status) && (NULL != num_fmt)) { + tet_infoline("utc_tizen_icu_api_unum_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + } + + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_open() + * sent null for pattern in UNUM_PATTERN_DECIMAL & UNUM_PATTERN_RULEBASED + */ +static void utc_tizen_icu_api_unum_open_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + UNumberFormat *num_fmt = NULL; + + num_fmt = + unum_open(-1, NULL, -1, NULL, NULL, &status); + + if (U_FAILURE(status) && (NULL == num_fmt)) { + tet_infoline("utc_tizen_icu_api_unum_open test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + + return; + +} diff --git a/TC/unit/utc_tizen_icu_api_unum_parseDecimal_func.c b/TC/unit/utc_tizen_icu_api_unum_parseDecimal_func.c new file mode 100755 index 0000000..9590fb1 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_parseDecimal_func.c @@ -0,0 +1,138 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_parseDecimal_func_01(void); +static void utc_tizen_icu_api_unum_parseDecimal_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_parseDecimal_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_parseDecimal_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parseDecimal start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parseDecimal ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_parseDecimal() + */ +static void utc_tizen_icu_api_unum_parseDecimal_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t num = 0; + UNumberFormat num_fmt = NULL; + const char *cs = "123,456,789,0"; + const char *comp = "123"; + const int text_len = 13; + UChar text[13]; + char parse[64]; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + num = unum_parseDecimal(num_fmt, text, -1, NULL, parse, 64, &status); + if (U_SUCCESS(status) && strcmp(comp,parse)==0) { + tet_infoline + ("utc_tizen_icu_api_unum_parseDecimal test PASS!"); + tet_printf("The parsed number %ld\n", num); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_parseDecimal test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_parseDecimal() + * Passing input text as null will return buffer overflow error + */ +static void utc_tizen_icu_api_unum_parseDecimal_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t num = 0; + UNumberFormat num_fmt = NULL; + const char *cs = "123,456,789,0"; + const char *comp = "1234567890"; + const int text_len = 13; + UChar text[13]; + char parse[64]; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + + if (U_SUCCESS(status) && (NULL != num_fmt)) { + num = unum_parseDecimal(num_fmt, text, -1, NULL, parse, 64, &status); + if (U_FAILURE(status) || strcmp(comp,parse) != 0) { + tet_infoline + ("utc_tizen_icu_api_unum_parseDecimal test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_parseDecimal test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_unum_parseDouble_func.c b/TC/unit/utc_tizen_icu_api_unum_parseDouble_func.c new file mode 100755 index 0000000..9f3a2c1 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_parseDouble_func.c @@ -0,0 +1,134 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_parseDouble_func_01(void); +static void utc_tizen_icu_api_unum_parseDouble_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_parseDouble_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_parseDouble_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parseDouble start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parseDouble ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_parseDouble() + */ +static void utc_tizen_icu_api_unum_parseDouble_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + double num; + UNumberFormat num_fmt = NULL; + const char *cs = "1234.5678"; + const double comp = 1234.5678; + const int text_len = 9; + UChar text[9]; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + num = unum_parseDouble(num_fmt, text, text_len, 0, &status); + if (U_SUCCESS(status) && num == comp) { + tet_infoline + ("utc_tizen_icu_api_unum_parseDouble test PASS!"); + tet_printf("The parsed number %ld\n", num); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_parseDouble test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_parseDouble() + * Passing input text as null will return buffer overflow error + */ +static void utc_tizen_icu_api_unum_parseDouble_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + double num; + UNumberFormat num_fmt = NULL; + const char *cs = "1234.5678"; + const int text_len = 9; + UChar text[9]; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + status = U_ILLEGAL_ARGUMENT_ERROR; + num = unum_parseDouble(num_fmt, text, text_len, 0, &status); + if (U_FAILURE(status)) { + tet_infoline("utc_tizen_icu_api_unum_parseDouble test PASS!"); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_unum_parseDouble test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_unum_parseInt64_func.c b/TC/unit/utc_tizen_icu_api_unum_parseInt64_func.c new file mode 100755 index 0000000..0f33db4 --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_parseInt64_func.c @@ -0,0 +1,135 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_parseInt64_func_01(void); +static void utc_tizen_icu_api_unum_parseInt64_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_parseInt64_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_parseInt64_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parseInt64 start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parseInt64 ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_parseInt64() + */ +static void utc_tizen_icu_api_unum_parseInt64_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t num; + UNumberFormat num_fmt = NULL; + const char *cs = "980006754"; + const int text_len = 9; + UChar text[9]; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + num = unum_parseInt64(num_fmt, text, text_len, 0, &status); + if (U_SUCCESS(status) && num == atoi(cs)) { + tet_infoline + ("utc_tizen_icu_api_unum_parseInt64 test PASS!"); + tet_printf("The parsed number %ld\n", num); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_parseInt64 test FAIL!"); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_parseInt64() + * Passing input text as null will return buffer overflow error + */ +static void utc_tizen_icu_api_unum_parseInt64_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t num; + UNumberFormat num_fmt = NULL; + const char *cs = "980006754"; + const int text_len = 9; + UChar text[9]; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + num = unum_parseInt64(num_fmt, text, text_len-1, 0, &status); + if (U_FAILURE(status) || num != atoi(cs)) { + tet_infoline + ("utc_tizen_icu_api_unum_parseInt64 test PASS!"); + tet_printf("The parsed number %d\n", num); + tet_result(TET_PASS); + } else { + tet_infoline + ("utc_tizen_icu_api_unum_parseInt64 test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} diff --git a/TC/unit/utc_tizen_icu_api_unum_parse_func.c b/TC/unit/utc_tizen_icu_api_unum_parse_func.c new file mode 100755 index 0000000..543538b --- /dev/null +++ b/TC/unit/utc_tizen_icu_api_unum_parse_func.c @@ -0,0 +1,135 @@ +/* + * tizen-icu-api + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_tizen_icu_api_unum_parse_func_01(void); +static void utc_tizen_icu_api_unum_parse_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + {utc_tizen_icu_api_unum_parse_func_01, POSITIVE_TC_IDX}, + {utc_tizen_icu_api_unum_parse_func_02, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parse start"); + return; +} + +static void cleanup(void) +{ + tet_infoline("Testing API utc_tizen_icu_api_unum_parse ends "); + return; +} + +/** + * @brief Positive test case of utc_tizen_icu_api_unum_parse() + */ +static void utc_tizen_icu_api_unum_parse_func_01(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t num; + UNumberFormat *num_fmt = NULL; + const char *cs = "1234"; + const int text_len = 4; + UChar text[4]; + int32_t parse = 1; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + num = unum_parse(num_fmt, text, text_len, &parse, &status); + if (U_SUCCESS(status) && num == 234) { + tet_infoline("utc_tizen_icu_api_unum_parse test PASS!"); + tet_printf("The parsed number %d\n", num); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_unum_parse test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} + +/** + * @brief Negative test case of utc_tizen_icu_api_unum_parse() + * Passing input text as null will return buffer overflow error + */ +static void utc_tizen_icu_api_unum_parse_func_02(void) +{ + UErrorCode status = U_ZERO_ERROR; + int32_t num; + UNumberFormat *num_fmt = NULL; + const char *cs = "1234"; + const int text_len = 4; + UChar text[4]; + int32_t parse = 1; + + u_charsToUChars(cs, text, text_len); + num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status); + if (U_SUCCESS(status) && (NULL != num_fmt)) { + status = U_ILLEGAL_ARGUMENT_ERROR; + num = unum_parse(num_fmt, text, text_len, &parse, &status); + if (U_FAILURE(status) || num != 1234) { + tet_infoline("utc_tizen_icu_api_unum_parse test PASS!"); + tet_printf("The parsed number %d\n", num); + tet_result(TET_PASS); + } else { + tet_infoline("utc_tizen_icu_api_unum_parse test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + } else { + tet_infoline("utc_tizen_icu_api_unum_open test FAIL!"); + tet_printf("Error code %s\n", u_errorName(status)); + tet_result(TET_FAIL); + } + unum_close(num_fmt); + return; +} diff --git a/data/in/icudt48l.dat b/data/in/icudt48l.dat old mode 100644 new mode 100755 index d175867..fbe7c0c Binary files a/data/in/icudt48l.dat and b/data/in/icudt48l.dat differ diff --git a/debian/changelog b/debian/changelog index 5c8a6a8..90fc95d 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,202 @@ +icu (4.8-1slp11) unstable; urgency=low + + * icu timezone upgrade to 2012b + * ISO-8859-16 added as default encoding + * Git : slp/unmodified/icu + * Tag : icu_4.8-1slp11 + + -- Hyungdeuk Kim Thu, 5 Apr 2012 10:16:04 +0900 + +icu (4.8-1slp10) unstable; urgency=low + + * upload TC + * Git : slp/unmodified/icu + * Tag : icu_4.8-1slp10 + + -- Hyungdeuk Kim Thu, 22 Mar 2012 12:39:12 +0900 + +icu (4.8-1slp9) unstable; urgency=low + + * update latest spec file + * Git : slp/unmodified/icu + * Tag : icu_4.8-1slp9 + + -- Hyungdeuk Kim Tue, 20 Mar 2012 20:09:33 +0900 + icu (4.8-1slp8) unstable; urgency=low + * upload spec file for rpm + * Git : slp/unmodified/icu + * Tag : icu_4.8-1slp8 + + -- Hyungdeuk Kim Sun, 18 Mar 2012 00:29:33 +0900 + +icu (4.8-1slp7) unstable; urgency=low + + * icu timezone upgrade to 2011n + * Git : slp/unmodified/icu + * Tag : icu_4.8-1slp7 + + -- Shivakumar B T Fri, 13 Jan 2012 09:39:33 +0900 + +icu (4.8-1slp6) unstable; urgency=low + + * icu library upgrade 4.8.1 + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp6 + + -- Sangil Yoon Tue, 25 Oct 2011 09:39:33 +0900 + +icu (4.8-1slp5) unstable; urgency=low + + * add missed files + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp5 + + -- Sangil Yoon Fri, 21 Oct 2011 10:40:39 +0900 + +icu (4.8-1slp4) unstable; urgency=low + + * rollback icu version to 4.6-1slp6 + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp4 + + -- Sangil Yoon Fri, 21 Oct 2011 09:30:50 +0900 + +icu (4.8-1slp3) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp3 + * icu (4.8.1) TZDEFAULT modified to /opt/etc/localtime + + -- Seokkyu Jang Thu, 20 Oct 2011 09:15:05 +0900 + +icu (4.8-1slp2) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp2 + * icu (4.8.1) Added dbg package for ICU + + -- Seokkyu Jang Tue, 18 Oct 2011 04:41:07 +0900 + +icu (4.8-1slp1) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp1 + * icu (4.8.1) removed autogenerated makefiles,unwanted files + + -- Seokkyu Jang Wed, 05 Oct 2011 07:47:07 +0900 + +icu (4.8-1slp1) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.8-1slp1 + * icu library upgrade (4.8.1) + + -- Seokkyu Jang Mon, 04 Oct 2011 09:00:07 +0900 + +icu (4.6-1slp6) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.6-1slp6 + * ICU Timezone upgradation from 2011c to 2011h + + -- Seokkyu Jang Thu, 29 Sep 2011 16:47:05 +0900 + +icu (4.6-1slp5) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.6-1slp5 + * Add ko locales (korean) + + -- Seokkyu Jang Wed, 10 Aug 2011 20:12:37 +0900 + +icu (4.6-1slp4) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.6-1slp4 + + * Locale Resource Customization corresponding to SLP 15 languages + * Before : 435 locales , After : 123 locales + + -- Seokkyu Jang Wed, 10 Aug 2011 11:27:26 +0900 + +icu (4.6-1slp3) unstable; urgency=low + + * Git : 165.213.180.234:slp/unmodified/icu + * Tag : icu_4.6-1slp3 + + * Re-release + + -- Jaehun Lim Mon, 16 May 2011 09:51:24 +0900 + +icu (4.6-1slp1) unstable; urgency=low + + * Git : 165.213.180.234:/git/slp/unmodified/icu + * Tag : icu_4.6-1slp1 + + * icu library upgrade (4.6.1) + + -- Jaehun Lim Wed, 11 May 2011 19:25:07 +0900 + +icu (4.0-1slp2) unstable; urgency=low + + * Git : 165.213.180.234:/git/slp/unmodified/icu + * Tag : icu_4.0-1slp2 + + * Re-release icu + + -- Gyuyoung Kim Wed, 01 Dec 2010 08:16:18 +0900 + +icu (4.0-1slp1) unstable; urgency=low + + * Git : 165.213.180.234:/git/slp/unmodified/icu + * Tag : icu_4.0-1slp1 + + * Just version up + + -- Gyuyoung Kim Fri, 12 Nov 2010 14:16:25 +0900 + +icu (3.6-6slp2) unstable; urgency=low + + * change the package name + + -- SooChan Lim Tue, 30 Mar 2010 13:17:53 +0900 + +icu (3.6-5) unstable; urgency=low + + * To sync version between i386 and armel. No source changed. + + -- Jongwoo Chae Fri, 08 Jan 2010 10:09:50 +0900 + +icu (3.6-4) unstable; urgency=low + + * Location of license.html changed from ../license.html to + * ./license.html + + -- Jongwoo Chae Fri, 08 Jan 2010 09:30:52 +0900 + +icu (3.6-3) unstable; urgency=low + + * Previous version of this package has arm-built *.o files. + * Just remove them and upload again. + + -- Jongwoo Chae Fri, 08 Jan 2010 08:56:25 +0900 + +icu (3.6-2) unstable; urgency=low + + * fix dependency + + -- youmin Fri, 27 Nov 2009 18:01:56 +0900 + +icu (3.6-1) unstable; urgency=low + + * change arch to any + + -- youmin Fri, 27 Nov 2009 16:40:56 +0900 + +icu (3.6) unstable; urgency=low + * Initial Release. - * Git: pkgs/i/icu - * Tag: icu_4.8-1slp8 - - -- Seokkyu Jang Wed, 07 Dec 2011 12:58:04 +0900 + + -- youmin Fri, 20 Nov 2009 21:54:04 +0900 diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..8534dc4 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,26 @@ +This is icu, written and maintained by unknown +on Fri, 20 Nov 2009 21:54:04 +0900. + +The original source can always be found at: + ftp://ftp.debian.org/dists/unstable/main/source/ + +Copyright Holder: unknown + +License: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. diff --git a/packaging/hack-atomics.diff b/packaging/hack-atomics.diff index 2a3a923..c20bb64 100644 --- a/packaging/hack-atomics.diff +++ b/packaging/hack-atomics.diff @@ -1,42 +1,11 @@ -3b1de280a4acb348b7d704ce568c4d82af112a13 diff --git a/configure.in b/configure.in -index 107912b..d9302de 100644 ---- a/source/configure.in -+++ b/source/configure.in -@@ -808,21 +808,22 @@ AC_SUBST(U_HAVE_PLACEMENT_NEW) - - # gcc atomic built-in functions check - # AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],, --AC_LANG(C) --AC_MSG_CHECKING([for gcc atomic functions]) --AC_LINK_IFELSE([AC_LANG_PROGRAM( -- [[ -- void *p; -- int i; -- ]], -- [[ -- __sync_fetch_and_add(&i, 1); -- __sync_fetch_and_sub(&i, 1); -- __sync_val_compare_and_swap(&p, 0, 0); -- ]] --)], --[U_HAVE_GCC_ATOMICS=1; AC_MSG_RESULT([yes])], --[U_HAVE_GCC_ATOMICS=0; AC_MSG_RESULT([no])]) -+dnl AC_LANG(C) -+dnl AC_MSG_CHECKING([for gcc atomic functions]) -+dnl AC_LINK_IFELSE([AC_LANG_PROGRAM( -+dnl [[ -+dnl void *p; -+dnl int i; -+dnl ]], -+dnl [[ -+dnl __sync_fetch_and_add(&i, 1); -+dnl __sync_fetch_and_sub(&i, 1); -+dnl __sync_val_compare_and_swap(&p, 0, 0); -+dnl ]] -+dnl )], -+dnl [U_HAVE_GCC_ATOMICS=1; AC_MSG_RESULT([yes])], -+dnl [U_HAVE_GCC_ATOMICS=0; AC_MSG_RESULT([no])]) +index 107912b..aad44c8 100644 +--- a/configure.in ++++ b/configure.in +@@ -823,6 +823,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM( + )], + [U_HAVE_GCC_ATOMICS=1; AC_MSG_RESULT([yes])], + [U_HAVE_GCC_ATOMICS=0; AC_MSG_RESULT([no])]) +U_HAVE_GCC_ATOMICS=0 AC_SUBST(U_HAVE_GCC_ATOMICS) diff --git a/packaging/icu.spec b/packaging/icu.spec index 299bcb3..5943321 100644 --- a/packaging/icu.spec +++ b/packaging/icu.spec @@ -64,7 +64,7 @@ rm -rf $RPM_BUILD_ROOT %files %files -n lib%{name} -%{_libdir}/*.so.* +%{_libdir}/*.so* %{_bindir}/derb %{_bindir}/genbrk %{_bindir}/gencfu