Update testcase 54/10254/1
authorWonkyu Kwon <wonkyu.kwon@samsung.com>
Wed, 25 Sep 2013 02:24:11 +0000 (11:24 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Thu, 26 Sep 2013 01:12:35 +0000 (10:12 +0900)
Change-Id: I0dbed2bb85417a48614b0dda53e00c49e45ccdbf

15 files changed:
TC/_export_env.sh
TC/_export_target_env.sh
TC/config [new file with mode: 0644]
TC/config.default [deleted file]
TC/execute.sh [deleted file]
TC/push.sh [new file with mode: 0755]
TC/run.sh [new file with mode: 0755]
TC/testcase/Makefile
TC/testcase/tslist
TC/testcase/utc_network_nfc.c
TC/testcase/utc_network_nfc_ndef_message.c
TC/testcase/utc_network_nfc_ndef_record.c
TC/testcase/utc_network_nfc_se.c [new file with mode: 0755]
TC/testcase/utc_network_nfc_snep.c [new file with mode: 0755]
TC/testcase/utc_network_nfc_test.c [new file with mode: 0755]

index 72a11ecdd32729791376f26ec4d2ae65fc5ca43e..7a317f80b1a0ef73139b73e89891ec20d3132036 100755 (executable)
@@ -1,7 +1,9 @@
 #!/bin/sh
 
-. ./config
+source ./config
+
 export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path
 export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
 export PATH=$TET_TARGET_PATH/bin:$PATH
 export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
index 5ddaa53c098062c2685c83db24f03ddd05da1330..3fd8e3f8d7041c2bf26350327a24140f6932a29e 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 . ./config
+
 export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator 
 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
diff --git a/TC/config b/TC/config
new file mode 100644 (file)
index 0000000..ecb0344
--- /dev/null
+++ b/TC/config
@@ -0,0 +1,3 @@
+PKG_NAME=capi-network-nfc
+TET_INSTALL_HOST_PATH=/var/tmp/TETware
+TET_INSTALL_TARGET_PATH=/TETware
diff --git a/TC/config.default b/TC/config.default
deleted file mode 100644 (file)
index 12ac1e2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-CAPI_PROJECT_ROOT=/home/abyss/capi
-TET_INSTALL_HOST_PATH=/home/abyss/TETware
-TET_INSTALL_TARGET_PATH=/mnt/nfs/TETware
diff --git a/TC/execute.sh b/TC/execute.sh
deleted file mode 100755 (executable)
index a4f6095..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-. ./_export_target_env.sh                    # setting environment variables
-
-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/push.sh b/TC/push.sh
new file mode 100755 (executable)
index 0000000..5eb9510
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. ./config
+
+TC_PATH=/opt/home/$PKG_NAME
+
+echo $TC_PATH
+
+sdb shell "mkdir -p $TC_PATH"
+
+sdb push . $TC_PATH
+
+
diff --git a/TC/run.sh b/TC/run.sh
new file mode 100755 (executable)
index 0000000..cec5778
--- /dev/null
+++ b/TC/run.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+source ./_export_target_env.sh
+
+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 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
index afde4ee6d5a5494d75ed7989ed1aae91e05f7d83..d7683efd76a410b854d97b3c2a96125adab7b0fd 100644 (file)
@@ -2,7 +2,7 @@ CC ?= gcc
 
 C_FILES = $(shell ls *.c)
        
-PKGS = capi-network-nfc
+PKGS = glib-2.0 capi-network-nfc
 
 LDFLAGS = `pkg-config --libs $(PKGS)`
 LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
index 0571a2cafa25b3018a912ed2c7ce5353867e0121..1caa46b840093e3dade9f73a5e184ffb2aa5688b 100644 (file)
@@ -1,4 +1,6 @@
+/testcase/utc_network_nfc
 /testcase/utc_network_nfc_ndef_record
 /testcase/utc_network_nfc_ndef_message
-/testcase/utc_network_nfc
-
+/testcase/utc_network_nfc_se
+/testcase/utc_network_nfc_snep
+/testcase/utc_network_nfc_test
index d42271dc3cfaacf1f781a2d312d149c36b5fbf21..0d8a737a32c755a3841c44f5a3108df419590c5a 100644 (file)
@@ -1,48 +1,46 @@
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <tet_api.h>
 #include <nfc.h>
 
-enum {
+enum
+{
        POSITIVE_TC_IDX = 0x01,
        NEGATIVE_TC_IDX,
 };
 
-#define MY_ASSERT( fun , test , msg ) \
-{\
-       if( !test ) \
-               dts_fail(fun , msg ); \
-}
-
-
 static void startup(void);
 static void cleanup(void);
 
 void (*tet_startup)(void) = startup;
 void (*tet_cleanup)(void) = cleanup;
 
-static void nfc_manager_set_activation_changed_cb_p(void);
-static void nfc_manager_set_activation_changed_cb_n(void);
-static void nfc_manager_set_activation_p(void);
-static void nfc_manager_set_activation_n(void);
+static void nfc_manager_is_supported_p(void);
+static void nfc_manager_is_supported_n(void);
 static void nfc_manager_initialize_p(void);
 static void nfc_manager_initialize_n(void);
 static void nfc_manager_deinitialize_p(void);
 static void nfc_manager_deinitialize_n(void);
+static void nfc_manager_set_activation_changed_cb_p(void);
+static void nfc_manager_set_activation_changed_cb_n(void);
+static void nfc_manager_is_activated_p(void);
+static void nfc_manager_is_activated_n(void);
+static void nfc_manager_set_activation_p(void);
+static void nfc_manager_set_activation_n(void);
 static void nfc_manager_set_tag_discovered_cb_p(void);
 static void nfc_manager_set_tag_discovered_cb_n(void);
 static void nfc_manager_set_ndef_discovered_cb_p(void);
@@ -55,37 +53,51 @@ static void nfc_manager_set_se_transaction_event_cb_p(void);
 static void nfc_manager_set_se_transaction_event_cb_n(void);
 static void nfc_manager_set_system_handler_enable_p(void);
 static void nfc_manager_set_system_handler_enable_n(void);
-
-
-void _activation_changed_cb(bool activated , void *user_data);
-void _activation_completed_cb(int error, void *user_data);
-void utc_test_cb(void * user_data);
-
-
-
-
-
-struct tet_testlist tet_testlist[] = {
-       { nfc_manager_set_activation_changed_cb_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_activation_changed_cb_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_activation_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_activation_n , NEGATIVE_TC_IDX },
-       { nfc_manager_initialize_p , POSITIVE_TC_IDX },
-       { nfc_manager_initialize_n , NEGATIVE_TC_IDX },
-       { nfc_manager_deinitialize_p , POSITIVE_TC_IDX },
-       { nfc_manager_deinitialize_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_tag_discovered_cb_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_tag_discovered_cb_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_ndef_discovered_cb_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_ndef_discovered_cb_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_p2p_target_discovered_cb_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_p2p_target_discovered_cb_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_se_event_cb_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_se_event_cb_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_se_transaction_event_cb_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_se_transaction_event_cb_n , NEGATIVE_TC_IDX },
-       { nfc_manager_set_system_handler_enable_p , POSITIVE_TC_IDX },
-       { nfc_manager_set_system_handler_enable_n , NEGATIVE_TC_IDX },
+static void nfc_manager_set_system_handler_enable_force_p(void);
+static void nfc_manager_set_system_handler_enable_force_n(void);
+static void nfc_manager_set_card_emulation_se_type_p(void);
+static void nfc_manager_set_card_emulation_se_type_n(void);
+static void nfc_manager_get_card_emulation_se_type_p(void);
+static void nfc_manager_get_card_emulation_se_type_n(void);
+
+static void _activation_changed_cb(bool activated, void *user_data);
+static void _activation_completed_cb(int error, void *user_data);
+static void utc_test_cb(void * user_data);
+
+struct tet_testlist tet_testlist[] =
+{
+       { nfc_manager_is_supported_p, POSITIVE_TC_IDX },
+       { nfc_manager_is_supported_n, NEGATIVE_TC_IDX },
+       { nfc_manager_initialize_p, POSITIVE_TC_IDX },
+       { nfc_manager_initialize_n, NEGATIVE_TC_IDX },
+       { nfc_manager_deinitialize_p, POSITIVE_TC_IDX },
+       { nfc_manager_deinitialize_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_activation_changed_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_activation_changed_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_is_activated_p, POSITIVE_TC_IDX },
+       { nfc_manager_is_activated_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_activation_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_activation_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_tag_discovered_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_tag_discovered_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_ndef_discovered_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_ndef_discovered_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_p2p_target_discovered_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_p2p_target_discovered_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_se_event_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_se_event_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_p2p_target_discovered_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_p2p_target_discovered_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_se_transaction_event_cb_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_se_transaction_event_cb_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_system_handler_enable_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_system_handler_enable_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_system_handler_enable_force_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_system_handler_enable_force_n, NEGATIVE_TC_IDX },
+       { nfc_manager_set_card_emulation_se_type_p, POSITIVE_TC_IDX },
+       { nfc_manager_set_card_emulation_se_type_n, NEGATIVE_TC_IDX },
+       { nfc_manager_get_card_emulation_se_type_p, POSITIVE_TC_IDX },
+       { nfc_manager_get_card_emulation_se_type_n, NEGATIVE_TC_IDX },
 
        { NULL, 0 },
 };
@@ -101,209 +113,404 @@ static void cleanup(void)
        /* end of TC */
 }
 
-void _activation_changed_cb(bool activated , void *user_data)
+static void _activation_changed_cb(bool activated, void *user_data)
 {
-       ifactivated == true)
+       if (activated == true)
        {
        }
-       else ifactivated == false)
+       else if (activated == false)
        {
        }
 }
 
-void  _activation_completed_cb(int error, void *user_data)
+static void _activation_completed_cb(int error, void *user_data)
 {
-       error = 0;
-       return error;
 }
 
-void utc_test_cb(void *user_data)
+static void utc_test_cb(void *user_data)
 {
-       return true;
 }
 
-
-static void nfc_manager_set_activation_changed_cb_p(void)
+static void nfc_manager_is_supported_p(void)
 {
-       int ret = NFC_ERROR_NONE;
+       bool result;
 
-       ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb , NULL);
+       result = nfc_manager_is_supported();
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_p is faild");
+       dts_check_eq(__func__, result, true, "nfc_manager_is_supported is failed");
 }
 
-static void nfc_manager_set_activation_changed_cb_n(void)
+static void nfc_manager_is_supported_n(void)
+{
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_initialize_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
 
-       ret = nfc_manager_set_activation_changed_cb(NULL , NULL);
+       nfc_manager_deinitialize();
 
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_n not allow null");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is failed");
 }
 
-static void nfc_manager_set_activation_p()
+static void nfc_manager_initialize_n()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_activation(1, _activation_completed_cb, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
 
        dts_pass(__func__, "PASS");
 }
 
-static void nfc_manager_set_activation_n()
+static void nfc_manager_deinitialize_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+
+       nfc_manager_initialize(NULL, NULL);
 
-       ret = nfc_manager_set_activation(1, NULL, NULL);
+       ret = nfc_manager_deinitialize();
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is failed");
+}
+
+static void nfc_manager_deinitialize_n()
+{
+       int ret;
+
+       ret = nfc_manager_deinitialize();
 
        dts_pass(__func__, "PASS");
 }
 
-static void nfc_manager_initialize_p()
+static void nfc_manager_set_activation_changed_cb_p(void)
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
        ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb, NULL);
 
-       nfc_manager_deinitialize();
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_p is failed");
 }
 
-static void nfc_manager_initialize_n()
+static void nfc_manager_set_activation_changed_cb_n(void)
+{
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_activation_changed_cb(NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_n not allow null");
+}
+
+static void nfc_manager_is_activated_p(void)
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+       bool result;
 
        ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               result = nfc_manager_is_activated();
 
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_eq(__func__, result, true, "nfc_manager_is_activated is failed");
+}
+
+static void nfc_manager_is_activated_n(void)
+{
        dts_pass(__func__, "PASS");
 }
 
-static void nfc_manager_deinitialize_p()
+static void nfc_manager_set_activation_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       nfc_manager_initialize(NULL, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_activation(1, _activation_completed_cb, NULL);
 
-       ret = nfc_manager_deinitialize();
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
+       dts_pass(__func__, "PASS");
 }
 
-static void nfc_manager_deinitialize_n()
+static void nfc_manager_set_activation_n()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_deinitialize();
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_activation(1, NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
        dts_pass(__func__, "PASS");
 }
 
 static void nfc_manager_set_tag_discovered_cb_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_tag_discovered_cb(utc_test_cb, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_tag_discovered_cb(utc_test_cb, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_p is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_p is failed");
 }
 
 static void nfc_manager_set_tag_discovered_cb_n()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_tag_discovered_cb(NULL, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_tag_discovered_cb(NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_n not allow null");
 }
 
 static void nfc_manager_set_ndef_discovered_cb_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_ndef_discovered_cb(utc_test_cb , NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_ndef_discovered_cb(utc_test_cb, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_p is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_p is failed");
 }
 
 static void nfc_manager_set_ndef_discovered_cb_n()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_ndef_discovered_cb(NULL, NULL);
 
-       ret = nfc_manager_set_ndef_discovered_cb(NULL, NULL);
+               nfc_manager_deinitialize();
+       }
 
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_n not allow null");
 }
 
 static void nfc_manager_set_p2p_target_discovered_cb_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_p2p_target_discovered_cb(utc_test_cb, NULL);
 
-       ret = nfc_manager_set_p2p_target_discovered_cb(utc_test_cb , NULL);
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_p is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_p is failed");
 }
 
 static void nfc_manager_set_p2p_target_discovered_cb_n()
 {
        int ret;
 
-       ret = nfc_manager_set_p2p_target_discovered_cb(NULL, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_p2p_target_discovered_cb(NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_n not allow null");
 }
 
 static void nfc_manager_set_se_event_cb_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_se_event_cb(utc_test_cb , NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_se_event_cb(utc_test_cb, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_p is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_p is failed");
 }
 
-static void nfc_manager_set_se_event_cb_n ()
+static void nfc_manager_set_se_event_cb_n()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_se_event_cb(NULL, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_se_event_cb(NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_n not allow null");
 }
 
 static void nfc_manager_set_se_transaction_event_cb_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_se_transaction_event_cb(utc_test_cb, NULL);
 
-       ret = nfc_manager_set_se_transaction_event_cb(utc_test_cb , NULL);
+               nfc_manager_deinitialize();
+       }
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_p is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_p is failed");
 }
 
-static void nfc_manager_set_se_transaction_event_cb_n ()
+static void nfc_manager_set_se_transaction_event_cb_n()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_se_transaction_event_cb(NULL, NULL);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_se_transaction_event_cb(NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
 
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_n not allow null");
 }
 
 static void nfc_manager_set_system_handler_enable_p()
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = nfc_manager_set_system_handler_enable(true);
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_system_handler_enable(true);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_system_handler_enable is failed");
+}
+
+static void nfc_manager_set_system_handler_enable_n()
+{
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_system_handler_enable(false);
+
+               nfc_manager_deinitialize();
+       }
 
        dts_pass(__func__, "PASS");
+}
 
+static void nfc_manager_set_system_handler_enable_force_p(void)
+{
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_system_handler_enable_force(true);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_system_handler_enable_force is failed");
 }
 
-static void nfc_manager_set_system_handler_enable_n ()
+static void nfc_manager_set_system_handler_enable_force_n(void)
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_system_handler_enable_force(false);
 
-       ret = nfc_manager_set_system_handler_enable(NULL);
+               nfc_manager_deinitialize();
+       }
 
        dts_pass(__func__, "PASS");
 }
+
+static void nfc_manager_set_card_emulation_se_type_p(void)
+{
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_card_emulation_se_type(NFC_SE_TYPE_ESE, NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_card_emulation_se_type is failed");
+}
+
+static void nfc_manager_set_card_emulation_se_type_n(void)
+{
+       int ret;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_set_card_emulation_se_type((nfc_se_type_e)0xff, NULL, NULL);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_card_emulation_se_type not allow null");
+}
+
+static void nfc_manager_get_card_emulation_se_type_p(void)
+{
+       int ret;
+       nfc_se_type_e type;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_get_card_emulation_se_type(&type);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_get_card_emulation_se_type is failed");
+}
+
+static void nfc_manager_get_card_emulation_se_type_n(void)
+{
+       int ret;
+       nfc_se_type_e type;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_manager_get_card_emulation_se_type(NULL);
+
+               nfc_manager_deinitialize();
+       }
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_get_card_emulation_se_type not allow null");
+}
index 4f63a405bdadb9777a42fec5e21723707f8fce80..922370e5346ddc24af02de783326496c5cdfd592 100644 (file)
@@ -1,34 +1,28 @@
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <tet_api.h>
 #include <nfc.h>
 
-enum {
+enum
+{
        POSITIVE_TC_IDX = 0x01,
        NEGATIVE_TC_IDX,
 };
 
-#define MY_ASSERT( fun , test , msg ) \
-{\
-       if( !test ) \
-               dts_fail(fun , msg ); \
-}
-
-
 static void startup(void);
 static void cleanup(void);
 
@@ -54,26 +48,26 @@ static void utc_nfc_ndef_message_remove_record_n(void);
 static void utc_nfc_ndef_message_get_record_p(void);
 static void utc_nfc_ndef_message_get_record_n(void);
 
-
-struct tet_testlist tet_testlist[] = {
-       { utc_nfc_ndef_message_create_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_create_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_create_from_rawdata_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_create_from_rawdata_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_destroy_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_destroy_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_get_record_count_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_get_record_count_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_get_rawdata_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_get_rawdata_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_append_record_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_append_record_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_insert_record_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_insert_record_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_remove_record_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_remove_record_n , NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_message_get_record_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_message_get_record_n , NEGATIVE_TC_IDX },
+struct tet_testlist tet_testlist[] =
+{
+       { utc_nfc_ndef_message_create_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_create_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_create_from_rawdata_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_create_from_rawdata_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_destroy_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_destroy_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_count_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_count_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_rawdata_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_rawdata_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_append_record_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_append_record_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_insert_record_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_insert_record_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_remove_record_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_remove_record_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_n, NEGATIVE_TC_IDX },
 
        { NULL, 0 },
 };
@@ -89,194 +83,219 @@ static void cleanup(void)
        /* end of TC */
 }
 
-
 static void utc_nfc_ndef_message_create_p(void)
 {
-       int ret ;
+       int ret;
        nfc_ndef_message_h message;
+
        ret = nfc_ndef_message_create(&message);
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
        nfc_ndef_message_destroy(message);
-       dts_pass(__func__, "PASS");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create is failed");
 }
+
 static void utc_nfc_ndef_message_create_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_create(NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create not allow null");
 }
+
 static void utc_nfc_ndef_message_create_from_rawdata_p(void)
 {
-       int ret ;
+       int ret;
        unsigned char *buffer;
        int size;
        nfc_ndef_message_h message;
        nfc_ndef_message_h message2;
        nfc_ndef_record_h record1;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
        nfc_ndef_message_append_record(message, record1);
        nfc_ndef_message_get_rawdata(message, &buffer, &size);
-       ret = nfc_ndef_message_create_from_rawdata(&message2, buffer,size);
+       ret = nfc_ndef_message_create_from_rawdata(&message2, buffer, size);
 
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
        nfc_ndef_message_destroy(message2);
        nfc_ndef_message_destroy(message);
        free(buffer);
-       dts_pass(__func__, "PASS");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create_from_rawdata is failed");
 }
+
 static void utc_nfc_ndef_message_create_from_rawdata_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_create_from_rawdata(NULL, NULL, 0);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create_from_rawdata not allow null");
 }
+
 static void utc_nfc_ndef_message_destroy_p(void)
 {
-       int ret ;
+       int ret;
        nfc_ndef_message_h message;
+
        ret = nfc_ndef_message_create(&message);
        ret = nfc_ndef_message_destroy(message);
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_destroy is failed");
 }
+
 static void utc_nfc_ndef_message_destroy_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_destroy(NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_destroy not allow null");
 }
+
 static void utc_nfc_ndef_message_get_record_count_p(void)
 {
-       int ret ;
+       int ret;
        int count;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record1;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
        nfc_ndef_message_append_record(message, record1);
        ret = nfc_ndef_message_get_record_count(message, &count);
-
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
        nfc_ndef_message_destroy(message);
-       dts_pass(__func__, "PASS");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record_count is failed");
 }
+
 static void utc_nfc_ndef_message_get_record_count_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_get_record_count(NULL, NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record_count not allow null");
 }
+
 static void utc_nfc_ndef_message_get_rawdata_p(void)
 {
-       int ret ;
+       int ret;
        unsigned char *buffer;
        int size;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record1;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
        nfc_ndef_message_append_record(message, record1);
-       ret= nfc_ndef_message_get_rawdata(message, &buffer, &size);
-
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       ret = nfc_ndef_message_get_rawdata(message, &buffer, &size);
        nfc_ndef_message_destroy(message);
        free(buffer);
-       dts_pass(__func__, "PASS");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_rawdata is failed");
 }
+
 static void utc_nfc_ndef_message_get_rawdata_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_get_rawdata(NULL, NULL, NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_rawdata not allow null");
 }
+
 static void utc_nfc_ndef_message_append_record_p(void)
 {
-       int ret ;
+       int ret;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record1;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
        ret = nfc_ndef_message_append_record(message, record1);
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
        nfc_ndef_message_destroy(message);
-       dts_pass(__func__, "PASS");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_append_record is failed");
 }
+
 static void utc_nfc_ndef_message_append_record_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_append_record(NULL, NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_append_record not allow null");
 }
+
 static void utc_nfc_ndef_message_insert_record_p(void)
 {
-       int ret ;
+       int ret;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record1;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
-       ret = nfc_ndef_message_insert_record(message,0, record1);
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       ret = nfc_ndef_message_insert_record(message, 0, record1);
        nfc_ndef_message_destroy(message);
-       dts_pass(__func__, "PASS");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_insert_record is failed");
 }
+
 static void utc_nfc_ndef_message_insert_record_n(void)
 {
-       int ret ;
-       ret = nfc_ndef_message_insert_record(NULL, 0 , NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+       int ret;
+
+       ret = nfc_ndef_message_insert_record(NULL, 0, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_insert_record not allow null");
 }
+
 static void utc_nfc_ndef_message_remove_record_p(void)
 {
-       int ret ;
+       int ret;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record1;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
-       ret = nfc_ndef_message_insert_record(message,0, record1);
+       ret = nfc_ndef_message_insert_record(message, 0, record1);
        ret = nfc_ndef_message_remove_record(message, 0);
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
        nfc_ndef_message_destroy(message);
-       dts_pass(__func__, "PASS");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_remove_record is failed");
 }
+
 static void utc_nfc_ndef_message_remove_record_n(void)
 {
-       int ret ;
+       int ret;
+
        ret = nfc_ndef_message_remove_record(NULL, 0);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_remove_record not allow null");
 }
+
 static void utc_nfc_ndef_message_get_record_p(void)
 {
-       int ret ;
+       int ret;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record1, record2;
+
        ret = nfc_ndef_message_create(&message);
        nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
-       ret = nfc_ndef_message_insert_record(message,0, record1);
+       ret = nfc_ndef_message_insert_record(message, 0, record1);
        ret = nfc_ndef_message_get_record(message, 0, &record2);
-       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
        nfc_ndef_message_destroy(message);
-       dts_pass(__func__, "PASS");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record is failed");
 }
+
 static void utc_nfc_ndef_message_get_record_n(void)
 {
-       int ret ;
-       ret = nfc_ndef_message_get_record(NULL, 0 , NULL);
-       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
-       dts_pass(__func__, "PASS");
-}
+       int ret;
+
+       ret = nfc_ndef_message_get_record(NULL, 0, NULL);
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record not allow null");
+}
index b45231ef6abd632df27c033e0367e7732183dca9..84997af78331988ba75a362e885e585a10cb76f8 100644 (file)
@@ -1,26 +1,28 @@
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <tet_api.h>
 #include <nfc.h>
 
-enum {
+enum
+{
        POSITIVE_TC_IDX = 0x01,
        NEGATIVE_TC_IDX,
 };
+
 static void startup(void);
 static void cleanup(void);
 
@@ -61,38 +63,38 @@ static void utc_nfc_ndef_record_get_mime_type_p(void);
 static void utc_nfc_ndef_record_get_mime_type_n(void);
 
 struct tet_testlist tet_testlist[] = {
-       { utc_nfc_ndef_record_create_p , POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_n, NEGATIVE_TC_IDX },
        { utc_nfc_ndef_record_create_text_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_text_n , NEGATIVE_TC_IDX},
-       { utc_nfc_ndef_record_create_uri_p, 1},
-       { utc_nfc_ndef_record_create_uri_n, 2 },
-       { utc_nfc_ndef_record_create_mime_p, 1},
-       { utc_nfc_ndef_record_create_mime_n_1, 2 },
-       { utc_nfc_ndef_record_create_mime_n_2, 2 },
-       { utc_nfc_ndef_record_create_mime_n_3, 2 },
-       { utc_nfc_ndef_record_destroy_p, 1},
-       { utc_nfc_ndef_record_destroy_n, 2},
-       { utc_nfc_ndef_record_set_id_p, 1 },
-       { utc_nfc_ndef_record_set_id_n, 2 },
-       { utc_nfc_ndef_record_get_id_p, 1 },
-       { utc_nfc_ndef_record_get_id_n, 2 },
-       { utc_nfc_ndef_record_get_payload_p, 1},
-       { utc_nfc_ndef_record_get_payload_n, 2},
-       { utc_nfc_ndef_record_get_type_p, 1},
-       { utc_nfc_ndef_record_get_type_n, 2},
-       { utc_nfc_ndef_record_get_tnf_p, 1},
-       { utc_nfc_ndef_record_get_tnf_n, 2},
-       { utc_nfc_ndef_record_get_text_p, 1},
-       { utc_nfc_ndef_record_get_text_n, 2},
-       { utc_nfc_ndef_record_get_langcode_p, 1},
-       { utc_nfc_ndef_record_get_langcode_n, 2},
-       { utc_nfc_ndef_record_get_encode_type_p, 1},
-       { utc_nfc_ndef_record_get_encode_type_n, 2},
-       { utc_nfc_ndef_record_get_uri_p, 1},
-       { utc_nfc_ndef_record_get_uri_n, 2},
-       { utc_nfc_ndef_record_get_mime_type_p, 1},
-       { utc_nfc_ndef_record_get_mime_type_n, 2},
+       { utc_nfc_ndef_record_create_text_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_uri_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_uri_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_mime_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_mime_n_1, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_mime_n_2, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_mime_n_3, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_destroy_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_destroy_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_set_id_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_set_id_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_id_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_id_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_payload_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_payload_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_type_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_type_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_tnf_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_tnf_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_text_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_text_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_langcode_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_langcode_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_encode_type_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_encode_type_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_uri_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_uri_n, NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_mime_type_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_get_mime_type_n, NEGATIVE_TC_IDX },
        { NULL, 0 },
 };
 
@@ -106,303 +108,438 @@ static void cleanup(void)
 {
        /* end of TC */
 }
+
 static void utc_nfc_ndef_record_create_p(void)
 {
-       int ret=0;
+       int ret;
        nfc_ndef_record_h record;
-       unsigned char testbuffer[]  = "TEST";
+       unsigned char testbuffer[] = "TEST";
 
-       ret = nfc_ndef_record_create(&record, NFC_RECORD_TNF_WELL_KNOWN, testbuffer,1, testbuffer, 4, testbuffer, 4);
-       if( ret == 0 )
+       ret = nfc_ndef_record_create(&record, NFC_RECORD_TNF_WELL_KNOWN, testbuffer, 1, testbuffer, 4, testbuffer, 4);
+       if (ret == 0)
                nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create is failed");
 }
 
 static void utc_nfc_ndef_record_create_n(void)
 {
-       int ret=0;
-       unsigned char testbuffer[]  = "TEST";
+       int ret;
+       unsigned char testbuffer[] = "TEST";
+
+       ret = nfc_ndef_record_create(NULL, NFC_RECORD_TNF_WELL_KNOWN, testbuffer, 1, testbuffer, 4, testbuffer, 4);
 
-       ret = nfc_ndef_record_create(NULL, NFC_RECORD_TNF_WELL_KNOWN, testbuffer,1, testbuffer, 4, testbuffer, 4);
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_create_text_p(void)
 {
-       int ret = 0;
+       int ret;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
-       if( ret == 0 )
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret == 0)
                nfc_ndef_record_destroy(record);
 
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_text is faild");
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_text is failed");
 }
+
 static void utc_nfc_ndef_record_create_text_n(void)
 {
-       int ret = 0;
-       ret = nfc_ndef_record_create_text(NULL, "test", "en-US", NFC_ENCODE_UTF_8 );
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+       int ret;
 
+       ret = nfc_ndef_record_create_text(NULL, "test", "en-US", NFC_ENCODE_UTF_8);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_create_uri_p(void)
 {
-       int ret = 0;
+       int ret;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_uri(&record , "http://test.com");
-       if( ret == 0)
+
+       ret = nfc_ndef_record_create_uri(&record, "http://test.com");
+       if (ret == 0)
                nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_uri is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_uri is failed");
 }
+
 static void utc_nfc_ndef_record_create_uri_n(void)
 {
-       int ret = 0;
-       ret = nfc_ndef_record_create_uri(NULL , "http://test.com");
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+       int ret;
 
+       ret = nfc_ndef_record_create_uri(NULL, "http://test.com");
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
 
 static void utc_nfc_ndef_record_create_mime_p(void)
 {
-    int ret = NFC_ERROR_NONE;
-    nfc_ndef_record_h record;
+       int ret;
+       nfc_ndef_record_h record;
 
-    ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
-    if( ret == NFC_ERROR_NONE)
-        nfc_ndef_record_destroy(record);
-    dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_mime is faild");
+       ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char *)"the text record", sizeof("the text record"));
+       if (ret == NFC_ERROR_NONE)
+               nfc_ndef_record_destroy(record);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_mime is failed");
 }
 
 static void utc_nfc_ndef_record_create_mime_n_1(void)
 {
-    int ret = NFC_ERROR_NONE;
+       int ret = NFC_ERROR_NONE;
 
-    ret = nfc_ndef_record_create_mime(NULL, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
-    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h null not allowed");
+       ret = nfc_ndef_record_create_mime(NULL, "text/plain", (unsigned char *)"the text record", sizeof("the text record"));
+
+       dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h null not allowed");
 }
 
 static void utc_nfc_ndef_record_create_mime_n_2(void)
 {
-    int ret = NFC_ERROR_NONE;
-    nfc_ndef_record_h record;
+       int ret;
+       nfc_ndef_record_h record;
 
-    ret = nfc_ndef_record_create_mime(&record, NULL, (unsigned char*)"the text record", sizeof("the text record"));
-    if( ret == NFC_ERROR_NONE)
-        nfc_ndef_record_destroy(record);
+       ret = nfc_ndef_record_create_mime(&record, NULL, (unsigned char *)"the text record", sizeof("the text record"));
+       if (ret == NFC_ERROR_NONE)
+               nfc_ndef_record_destroy(record);
 
-    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "mime_type null not allowed");
+       dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "mime_type null not allowed");
 }
 
 static void utc_nfc_ndef_record_create_mime_n_3(void)
 {
-    int ret = NFC_ERROR_NONE;
-    nfc_ndef_record_h record;
+       int ret;
+       nfc_ndef_record_h record;
 
-    ret = nfc_ndef_record_create_mime(&record, "text/plain", NULL, sizeof("the text record"));
-    if( ret == NFC_ERROR_NONE)
-        nfc_ndef_record_destroy(record);
+       ret = nfc_ndef_record_create_mime(&record, "text/plain", NULL, sizeof("the text record"));
+       if (ret == NFC_ERROR_NONE)
+               nfc_ndef_record_destroy(record);
 
-    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "data null not allowed");
+       dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "data null not allowed");
 }
 
 static void utc_nfc_ndef_record_destroy_p(void)
 {
-       int ret = 0;
+       int ret;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
-       if( ret != 0){
-                       dts_fail(__func__, "can't create record\n");
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != 0) {
+               dts_fail(__func__, "can't create record\n");
+               return;
        }
+
        ret = nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_destroy is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_destroy is failed");
 }
+
 static void utc_nfc_ndef_record_destroy_n(void)
 {
-       int ret = 0;
+       int ret;
+
        ret = nfc_ndef_record_destroy(NULL);
+
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_set_id_p(void)
 {
-       int ret = 0;
+       int ret;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_set_id is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_set_id is failed");
 }
+
 static void utc_nfc_ndef_record_set_id_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_set_id(NULL, (unsigned char *)"test", 4);
+
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_id_p(void)
 {
-       int ret = 0;
+       int ret;
        int size;
        nfc_ndef_record_h record;
        unsigned char *id;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't set id\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_id(record, &id, &size);
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_id is faild");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_id is failed");
 }
+
 static void utc_nfc_ndef_record_get_id_n(void)
 {
        int ret;
-       ret = nfc_ndef_record_get_id(NULL,NULL, NULL);
+
+       ret = nfc_ndef_record_get_id(NULL, NULL, NULL);
+
        dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_payload_p(void)
 {
-       int ret = 0;
+       int ret;
        int size;
        nfc_ndef_record_h record;
        unsigned char *payload;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_payload(record, &payload, &size);
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_payload is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_payload is failed");
 }
+
 static void utc_nfc_ndef_record_get_payload_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_set_id(NULL, (unsigned char *)"test", 4);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_type_p(void)
 {
-       int ret = 0;
+       int ret;
        int size;
        nfc_ndef_record_h record;
        unsigned char *data;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_type(record, &data, &size);
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_type is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_type is failed");
 }
+
 static void utc_nfc_ndef_record_get_type_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_get_type(NULL, NULL, NULL);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_tnf_p(void)
 {
-       int ret = 0;
-
+       int ret;
        nfc_ndef_record_h record;
        nfc_record_tnf_e tnf;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_tnf(record, &tnf);
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is failed");
 }
+
 static void utc_nfc_ndef_record_get_tnf_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_get_tnf(NULL, NULL);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_text_p(void)
 {
-       int ret = 0;
+       int ret;
        char *text;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_text(record, &text);
-       free(text);
+       if (ret == 0) {
+               free(text);
+       }
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is failed");
 }
+
 static void utc_nfc_ndef_record_get_text_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_get_text(NULL, NULL);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_langcode_p(void)
 {
-       int ret = 0;
+       int ret;
        char *text;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_langcode(record, &text);
-       free(text);
+       if (ret == 0) {
+               free(text);
+       }
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is failed");
 
 }
 static void utc_nfc_ndef_record_get_langcode_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_get_langcode(NULL, NULL);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_encode_type_p(void)
 {
-       int ret = 0;
+       int ret;
        nfc_encode_type_e type;
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_encode_type(record, &type);
+
        nfc_ndef_record_destroy(record);
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_encode_type is faild");
 
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_encode_type is failed");
 }
+
 static void utc_nfc_ndef_record_get_encode_type_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_get_encode_type(NULL, NULL);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
+
 static void utc_nfc_ndef_record_get_uri_p(void)
 {
-       int ret = 0;
+       int ret;
        char *uri;
        nfc_ndef_record_h record;
+
        ret = nfc_ndef_record_create_uri(&record, "http://test.com");
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_uri(record, &uri);
-       if(ret == 0 ){
+       if (ret == 0) {
                free(uri);
-               nfc_ndef_record_destroy(record);
        }
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_uri is faild");
+
+       nfc_ndef_record_destroy(record);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_uri is failed");
 }
+
 static void utc_nfc_ndef_record_get_uri_n(void)
 {
        int ret;
+
        ret = nfc_ndef_record_get_uri(NULL, NULL);
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
 }
 
 static void utc_nfc_ndef_record_get_mime_type_p(void)
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
        char *mime_type;
-
        nfc_ndef_record_h record;
-       ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+
+       ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char *)"the text record", sizeof("the text record"));
+       if (ret != NFC_ERROR_NONE) {
+               dts_fail(__func__, "can't create record\n");
+               return;
+       }
+
        ret = nfc_ndef_record_get_mime_type(record, &mime_type);
-       if(ret == NFC_ERROR_NONE ){
+       if (ret == NFC_ERROR_NONE) {
                free(mime_type);
-               nfc_ndef_record_destroy(record);
        }
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_mime_type is faild");
+
+       nfc_ndef_record_destroy(record);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_mime_type is failed");
 }
+
 static void utc_nfc_ndef_record_get_mime_type_n(void)
 {
-    int ret;
+       int ret;
+
+       ret = nfc_ndef_record_get_mime_type(NULL, NULL);
 
-    ret = nfc_ndef_record_get_mime_type(NULL, NULL);
-    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h not allow null");
+       dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h not allow null");
 }
diff --git a/TC/testcase/utc_network_nfc_se.c b/TC/testcase/utc_network_nfc_se.c
new file mode 100755 (executable)
index 0000000..7181f2e
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum
+{
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void nfc_se_open_secure_element_p(void);
+static void nfc_se_open_secure_element_n(void);
+static void nfc_se_get_atr_p(void);
+static void nfc_se_get_atr_n(void);
+static void nfc_se_send_apdu_p(void);
+static void nfc_se_send_apdu_n(void);
+static void nfc_se_close_secure_element_p(void);
+static void nfc_se_close_secure_element_n(void);
+
+struct tet_testlist tet_testlist[] =
+{
+       { nfc_se_open_secure_element_p, POSITIVE_TC_IDX },
+       { nfc_se_open_secure_element_n, NEGATIVE_TC_IDX },
+       { nfc_se_get_atr_p, POSITIVE_TC_IDX },
+       { nfc_se_get_atr_n, NEGATIVE_TC_IDX },
+       { nfc_se_send_apdu_p, POSITIVE_TC_IDX },
+       { nfc_se_send_apdu_n, NEGATIVE_TC_IDX },
+       { nfc_se_close_secure_element_p, POSITIVE_TC_IDX },
+       { nfc_se_close_secure_element_n, NEGATIVE_TC_IDX },
+
+       { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+       /* start of TC */
+       nfc_manager_initialize(NULL, NULL);
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+       nfc_manager_deinitialize();
+}
+
+static nfc_se_h se_handle;
+
+static void nfc_se_open_secure_element_p(void)
+{
+       int ret;
+
+       ret = nfc_se_open_secure_element(NFC_SE_TYPE_ESE, &se_handle);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_open_secure_element is failed");
+}
+
+static void nfc_se_open_secure_element_n(void)
+{
+       int ret;
+
+       ret = nfc_se_open_secure_element((nfc_se_type_e)0xff, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_open_secure_element not allow null");
+}
+
+static void nfc_se_get_atr_p(void)
+{
+       int ret;
+       unsigned char *atr;
+       unsigned int atr_len;
+
+       ret = nfc_se_get_atr(se_handle, &atr, &atr_len);
+       if (ret == NFC_ERROR_NONE) {
+               free(atr);
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_get_atr is failed");
+}
+
+static void nfc_se_get_atr_n(void)
+{
+       int ret;
+
+       ret = nfc_se_get_atr(NULL, NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_get_atr not allow null");
+}
+
+static void nfc_se_send_apdu_p(void)
+{
+       int ret;
+       unsigned char cmd[] = { 0x00, 0x70, 0x00, 0x00, 0x00 };
+       unsigned char *resp;
+       unsigned int resp_len;
+
+       ret = nfc_se_send_apdu(se_handle, cmd, sizeof(cmd), &resp, &resp_len);
+       if (ret == NFC_ERROR_NONE) {
+               free(resp);
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_send_apdu is failed");
+}
+
+static void nfc_se_send_apdu_n(void)
+{
+       int ret;
+
+       ret = nfc_se_send_apdu(NULL, NULL, 0, NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_send_apdu not allow null");
+}
+
+static void nfc_se_close_secure_element_p(void)
+{
+       int ret;
+
+       ret = nfc_se_close_secure_element(se_handle);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_close_secure_element is failed");
+}
+
+static void nfc_se_close_secure_element_n(void)
+{
+       int ret;
+
+       ret = nfc_se_close_secure_element(NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_close_secure_element not allow null");
+}
diff --git a/TC/testcase/utc_network_nfc_snep.c b/TC/testcase/utc_network_nfc_snep.c
new file mode 100755 (executable)
index 0000000..602825e
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <tet_api.h>
+#include <nfc.h>
+
+enum
+{
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void nfc_snep_register_server_p(void);
+static void nfc_snep_register_server_n(void);
+static void nfc_snep_unregister_server_p(void);
+static void nfc_snep_unregister_server_n(void);
+
+struct tet_testlist tet_testlist[] =
+{
+       { nfc_snep_register_server_p, POSITIVE_TC_IDX },
+       { nfc_snep_register_server_n, NEGATIVE_TC_IDX },
+       { nfc_snep_unregister_server_p, POSITIVE_TC_IDX },
+       { nfc_snep_unregister_server_n, NEGATIVE_TC_IDX },
+
+       { NULL, 0 },
+};
+
+static void _activation_completed_cb(nfc_error_e error, void *user_data)
+{
+       g_main_loop_quit((GMainLoop *)user_data);
+}
+
+//this method is called only once in start
+static void startup(void)
+{
+       /* start of TC */
+       nfc_manager_initialize(NULL, NULL);
+
+       if (nfc_manager_is_activated() == false) {
+               GMainLoop *loop;
+
+               loop = g_main_loop_new(NULL, false);
+
+               nfc_manager_set_activation(true, _activation_completed_cb, loop);
+
+               g_main_loop_run(loop);
+       }
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+       nfc_manager_deinitialize();
+}
+
+static const char *san = "abcd:efgh";
+static int sap = 0x22;
+
+static void _snep_event_cb(nfc_p2p_snep_h handle,
+       nfc_snep_event_e event, nfc_error_e result,
+       nfc_ndef_message_h msg, void *user_data)
+{
+
+}
+
+static void nfc_snep_register_server_p(void)
+{
+       int ret;
+
+       ret = nfc_snep_register_server(san, sap, _snep_event_cb, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               nfc_snep_unregister_server(san, sap);
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server is failed");
+}
+
+static void nfc_snep_register_server_n(void)
+{
+       int ret;
+
+       ret = nfc_snep_register_server(NULL, 0, NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server not allowed");
+}
+
+static void nfc_snep_unregister_server_p(void)
+{
+       int ret;
+
+       ret = nfc_snep_register_server(san, sap, _snep_event_cb, NULL);
+       if (ret == NFC_ERROR_NONE) {
+               ret = nfc_snep_unregister_server(san, sap);
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server is failed");
+}
+
+static void nfc_snep_unregister_server_n(void)
+{
+       int ret;
+
+       ret = nfc_snep_unregister_server(san, sap);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server is failed");
+}
diff --git a/TC/testcase/utc_network_nfc_test.c b/TC/testcase/utc_network_nfc_test.c
new file mode 100755 (executable)
index 0000000..f12ca34
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <tet_api.h>
+#include <nfc.h>
+
+enum
+{
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void nfc_test_sim_test_p(void);
+static void nfc_test_sim_test_n(void);
+static void nfc_test_prbs_test_p(void);
+static void nfc_test_prbs_test_n(void);
+static void nfc_test_get_firmware_version_p(void);
+static void nfc_test_get_firmware_version_n(void);
+static void nfc_test_set_nfcc_register_p(void);
+static void nfc_test_set_nfcc_register_n(void);
+
+struct tet_testlist tet_testlist[] =
+{
+       { nfc_test_sim_test_p, POSITIVE_TC_IDX },
+       { nfc_test_sim_test_n, NEGATIVE_TC_IDX },
+       { nfc_test_prbs_test_p, POSITIVE_TC_IDX },
+       { nfc_test_prbs_test_n, NEGATIVE_TC_IDX },
+       { nfc_test_get_firmware_version_p, POSITIVE_TC_IDX },
+       { nfc_test_get_firmware_version_n, NEGATIVE_TC_IDX },
+       { nfc_test_set_nfcc_register_p, POSITIVE_TC_IDX },
+       { nfc_test_set_nfcc_register_n, NEGATIVE_TC_IDX },
+
+       { NULL, 0 },
+};
+
+static void _activation_completed_cb(nfc_error_e error, void *user_data)
+{
+       g_main_loop_quit((GMainLoop *)user_data);
+}
+
+//this method is called only once in start
+static void startup(void)
+{
+       /* start of TC */
+       nfc_manager_initialize(NULL, NULL);
+
+       if (nfc_manager_is_activated() == false) {
+               GMainLoop *loop;
+
+               loop = g_main_loop_new(NULL, false);
+
+               nfc_manager_set_activation(true, _activation_completed_cb, loop);
+
+               g_main_loop_run(loop);
+       }
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+       nfc_manager_deinitialize();
+}
+
+
+static void nfc_test_sim_test_p(void)
+{
+       int ret;
+
+       ret = nfc_test_sim_test();
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "PASS");
+}
+
+static void nfc_test_sim_test_n(void)
+{
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_test_prbs_test_p(void)
+{
+       int ret;
+
+       ret = nfc_test_prbs_test(NFC_PRBS_TECH_A, NFC_PRBS_RATE_106K);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "PASS");
+}
+
+static void nfc_test_prbs_test_n(void)
+{
+       int ret;
+
+       ret = nfc_test_prbs_test((nfc_prbs_tech_e)0xff, (nfc_prbs_rate_e)0xff);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "PASS");
+}
+
+static void nfc_test_get_firmware_version_p(void)
+{
+       int ret;
+       char *version = NULL;
+
+       ret = nfc_test_get_firmware_version(&version);
+       if (version != NULL) {
+               free(version);
+       }
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "PASS");
+}
+
+static void nfc_test_get_firmware_version_n(void)
+{
+       int ret;
+
+       ret = nfc_test_get_firmware_version(NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "PASS");
+}
+
+static void nfc_test_set_nfcc_register_p(void)
+{
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_test_set_nfcc_register_n(void)
+{
+       dts_pass(__func__, "PASS");
+}