summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSukHyung, Kang <shine.kang@samsung.com>2015-12-14 14:13:42 +0900
committerSukHyung, Kang <shine.kang@samsung.com>2015-12-14 14:15:04 +0900
commit4b709590a63d9eecc8dab48ed2b9e98b84b1392c (patch)
tree3575a85eca072ab00d68395a3eaae61814332741
parentf9a2b3e95a3c97263d727dd886ed06e2810d1525 (diff)
downloadbundle-4b709590a63d9eecc8dab48ed2b9e98b84b1392c.tar.gz
bundle-4b709590a63d9eecc8dab48ed2b9e98b84b1392c.tar.bz2
bundle-4b709590a63d9eecc8dab48ed2b9e98b84b1392c.zip
remove unused test files
Change-Id: I0a8729ee08fcb464a864300ad1bf914a9987c92f Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
-rw-r--r--CMakeLists.txt5
-rwxr-xr-xTC/build.sh20
-rwxr-xr-xTC/execute.sh20
-rwxr-xr-xTC/tet_code12
-rwxr-xr-xTC/tet_scen7
-rwxr-xr-xTC/tetbuild.cfg3
-rwxr-xr-xTC/tetclean.cfg2
-rwxr-xr-xTC/tetexec.cfg1
-rw-r--r--TC/unit/Makefile22
-rwxr-xr-xTC/unit/tc_gen.sh28
-rw-r--r--TC/unit/tslist10
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_add_func.c116
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_create_func.c93
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_decode_func.c111
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_del_func.c133
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_dup_func.c100
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_encode_func.c104
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_free_func.c87
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_get_count_func.c98
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_get_val_func.c116
-rw-r--r--TC/unit/utc_ApplicationFW_bundle_iterate_func.c109
-rw-r--r--TC/unit/utc_MODULE_API_func.c.in65
-rwxr-xr-xtest.sh11
-rwxr-xr-xtest/CMakeLists.txt11
-rwxr-xr-xtest/Makefile10
-rwxr-xr-xtest/TC_bundle.c1478
-rwxr-xr-xtest/test_bundle.c288
27 files changed, 0 insertions, 3060 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 850891d..e2df7b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,8 +52,3 @@ install(FILES
install(FILES ${CMAKE_BINARY_DIR}/bundle.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/
)
-
-
-### Test
-add_subdirectory(test)
-
diff --git a/TC/build.sh b/TC/build.sh
deleted file mode 100755
index 98ebeff..0000000
--- a/TC/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-export TET_INSTALL_PATH=/scratchbox/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
deleted file mode 100755
index 2d9df79..0000000
--- a/TC/execute.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#export TET_INSTALL_PATH=/mnt/nfs/tetware
-export TET_INSTALL_PATH=/scratchbox/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
deleted file mode 100755
index a2cf6c1..0000000
--- a/TC/tet_code
+++ /dev/null
@@ -1,12 +0,0 @@
-# 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
deleted file mode 100755
index 43cbc9b..0000000
--- a/TC/tet_scen
+++ /dev/null
@@ -1,7 +0,0 @@
-all
- ^TEST
-##### Scenarios for TEST #####
-
-# Test scenario
-TEST
- :include:/unit/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
deleted file mode 100755
index 6192c78..0000000
--- a/TC/tetbuild.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-TET_OUTPUT_CAPTURE=False
-TET_BUILD_TOOL=make
-TET_PASS_TC_NAME=True
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
deleted file mode 100755
index c66eda4..0000000
--- a/TC/tetclean.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-TET_OUTPUT_CAPTURE=False
-TET_CLEAN_TOOL=make clean
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
deleted file mode 100755
index 0d9d39a..0000000
--- a/TC/tetexec.cfg
+++ /dev/null
@@ -1 +0,0 @@
-TET_OUTPUT_CAPTURE=False
diff --git a/TC/unit/Makefile b/TC/unit/Makefile
deleted file mode 100644
index 2d8e954..0000000
--- a/TC/unit/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-CC ?= gcc
-
-TARGETS = utc_ApplicationFW_bundle_create_func utc_ApplicationFW_bundle_free_func utc_ApplicationFW_bundle_add_func utc_ApplicationFW_bundle_del_func utc_ApplicationFW_bundle_get_val_func utc_ApplicationFW_bundle_get_count_func utc_ApplicationFW_bundle_dup_func utc_ApplicationFW_bundle_iterate_func utc_ApplicationFW_bundle_encode_func utc_ApplicationFW_bundle_decode_func
-
-PKGS = bundle
-
-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
deleted file mode 100755
index 54f482d..0000000
--- a/TC/unit/tc_gen.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/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
deleted file mode 100644
index 3217a8f..0000000
--- a/TC/unit/tslist
+++ /dev/null
@@ -1,10 +0,0 @@
-/unit/utc_ApplicationFW_bundle_create_func
-/unit/utc_ApplicationFW_bundle_free_func
-/unit/utc_ApplicationFW_bundle_add_func
-/unit/utc_ApplicationFW_bundle_del_func
-/unit/utc_ApplicationFW_bundle_get_val_func
-/unit/utc_ApplicationFW_bundle_get_count_func
-/unit/utc_ApplicationFW_bundle_dup_func
-/unit/utc_ApplicationFW_bundle_iterate_func
-/unit/utc_ApplicationFW_bundle_encode_func
-/unit/utc_ApplicationFW_bundle_decode_func
diff --git a/TC/unit/utc_ApplicationFW_bundle_add_func.c b/TC/unit/utc_ApplicationFW_bundle_add_func.c
deleted file mode 100644
index 936d863..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_add_func.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_add_func_01(void);
-static void utc_ApplicationFW_bundle_add_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_add_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_add_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_add()
- */
-static void utc_ApplicationFW_bundle_add_func_01(void)
-{
- int r = 0;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
-
- r = bundle_add(b, "a", "abc");
-
- if (r) {
- tet_infoline("bundle_add() failed in positive test case");
- tet_result(TET_FAIL);
- return;
- }
-
- bundle_free(b);
- tet_result(TET_PASS);
-}
-
-/**
- * @brief Negative test case of ug_init bundle_add()
- */
-static void utc_ApplicationFW_bundle_add_func_02(void)
-{
- int r = 0;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
-
-
- bundle_add(b, "abc", "def");
- r = bundle_add(b, "abc", "aaa");
- if (0 == r) {
- tet_infoline("bundle_add() failed in negative test case\nduplicated key is not detected");
- tet_result(TET_FAIL);
- return;
- }
-
- r = bundle_add(b, NULL, "aaa");
- if (0 == r) {
- tet_infoline("bundle_add() failed in negative test case\nNULL key is not detected");
- tet_result(TET_FAIL);
- return;
- }
-
- r = bundle_add(b, "def", NULL);
- if (0 == r) {
- tet_infoline("bundle_add() failed in negative test case\nNULL val is not detected");
- tet_result(TET_FAIL);
- return;
- }
-
- bundle_free(b);
- tet_result(TET_PASS);
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_create_func.c b/TC/unit/utc_ApplicationFW_bundle_create_func.c
deleted file mode 100644
index 137ab37..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_create_func.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_create_func_01(void);
-static void utc_ApplicationFW_bundle_create_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_create_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_create_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_create()
- */
-static void utc_ApplicationFW_bundle_create_func_01(void)
-{
- bundle *b = NULL;
-
- b = bundle_create();
-
-/*
- r = bundle_create(...);
-*/
- if (NULL == b) {
- tet_infoline("bundle_create() failed in positive test case");
- tet_result(TET_FAIL);
- return;
- }
-
- if(b) bundle_free(b);
-
- tet_result(TET_PASS);
-}
-
-/**
- * @brief Negative test case of ug_init bundle_create()
- */
-static void utc_ApplicationFW_bundle_create_func_02(void)
-{
- int r = 0;
-
-/*
- * No argument is required
-*/
- if (r) {
- tet_infoline("bundle_create() failed in negative test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_decode_func.c b/TC/unit/utc_ApplicationFW_bundle_decode_func.c
deleted file mode 100644
index e84fec5..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_decode_func.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-#include <string.h>
-#include <stdlib.h>
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_decode_func_01(void);
-static void utc_ApplicationFW_bundle_decode_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_decode_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_decode_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_decode()
- */
-static void utc_ApplicationFW_bundle_decode_func_01(void)
-{
- int r = 0;
- int len;
- bundle_raw *raw = NULL;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
-
- r = bundle_encode(b, &raw, &len);
- if(NULL == raw) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
-
- bundle *b_dec = bundle_decode(raw, len);
- if(NULL == b_dec) {
- tet_result(TET_FAIL);
- goto cleanup;
- }
- if(0 != strcmp("123", bundle_get_val(b, "a"))) {
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- if(raw) free(raw);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_decode()
- */
-static void utc_ApplicationFW_bundle_decode_func_02(void)
-{
- if(NULL != bundle_decode(NULL, 1)) {
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-cleanup:
- return;
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_del_func.c b/TC/unit/utc_ApplicationFW_bundle_del_func.c
deleted file mode 100644
index 847a9fb..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_del_func.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_del_func_01(void);
-static void utc_ApplicationFW_bundle_del_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_del_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_del_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_del()
- */
-static void utc_ApplicationFW_bundle_del_func_01(void)
-{
- int r = 0;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
-
- r = bundle_del(b, "a");
- if (r) {
- tet_infoline("bundle_del() failed in positive test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_del()
- */
-static void utc_ApplicationFW_bundle_del_func_02(void)
-{
- int r = 0;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
-
- r = bundle_del(b, "a");
- if (r) {
- tet_infoline("bundle_del() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- r = bundle_del(b, "a");
- if(!r) {
- tet_infoline("bundle_del() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- r = bundle_del(b, NULL);
- if(!r) {
- tet_infoline("bundle_del() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- r = bundle_del(NULL, "a");
- if(!r) {
- tet_infoline("bundle_del() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_dup_func.c b/TC/unit/utc_ApplicationFW_bundle_dup_func.c
deleted file mode 100644
index 34ba8ac..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_dup_func.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_dup_func_01(void);
-static void utc_ApplicationFW_bundle_dup_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_dup_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_dup_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_dup()
- */
-static void utc_ApplicationFW_bundle_dup_func_01(void)
-{
- bundle *b = NULL;
- bundle *b_dup = NULL;
-
- b = bundle_create();
-
- bundle_add(b, "aa", "bb");
- b_dup = bundle_dup(b);
-
- if(0 != strcmp(bundle_get_val(b, "aa"), bundle_get_val(b_dup, "aa"))) {
- tet_infoline("bundle_dup() failed in positive test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- if(b_dup) bundle_free(b_dup);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_dup()
- */
-static void utc_ApplicationFW_bundle_dup_func_02(void)
-{
- bundle *b = NULL;
-
- b = bundle_dup(NULL);
-
- if(NULL != b) {
- tet_infoline("bundle_dup() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_encode_func.c b/TC/unit/utc_ApplicationFW_bundle_encode_func.c
deleted file mode 100644
index 026cb0e..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_encode_func.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 <stdlib.h>
-#include "bundle.h"
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_encode_func_01(void);
-static void utc_ApplicationFW_bundle_encode_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_encode_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_encode_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_encode()
- */
-static void utc_ApplicationFW_bundle_encode_func_01(void)
-{
- int r, len;
- bundle_raw *raw = NULL;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
-
- r = bundle_encode(b, &raw, &len);
- if(NULL == raw) {
- tet_result(TET_FAIL);
- goto cleanup;
- }
- if(len <= 0) {
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- if(raw) free(raw);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_encode()
- */
-static void utc_ApplicationFW_bundle_encode_func_02(void)
-{
- int r = 0;
-
- r = bundle_encode(NULL, NULL, NULL);
- if (!r) {
- tet_infoline("bundle_encode() failed in negative test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_free_func.c b/TC/unit/utc_ApplicationFW_bundle_free_func.c
deleted file mode 100644
index 0bd59d7..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_free_func.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_free_func_01(void);
-static void utc_ApplicationFW_bundle_free_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_free_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_free_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_free()
- */
-static void utc_ApplicationFW_bundle_free_func_01(void)
-{
- int r;
-
- bundle *b;
- b = bundle_create();
- r = bundle_free(b);
-
- if (r) {
- tet_infoline("bundle_free() failed in positive test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
-
-/**
- * @brief Negative test case of ug_init bundle_free()
- */
-static void utc_ApplicationFW_bundle_free_func_02(void)
-{
- int r = 0;
-
- r = bundle_free(NULL);
-
- if (0 == r) {
- tet_infoline("bundle_free() failed in negative test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_get_count_func.c b/TC/unit/utc_ApplicationFW_bundle_get_count_func.c
deleted file mode 100644
index d7502cc..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_get_count_func.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_get_count_func_01(void);
-static void utc_ApplicationFW_bundle_get_count_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_get_count_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_get_count_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_get_count()
- */
-static void utc_ApplicationFW_bundle_get_count_func_01(void)
-{
- int r;
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
- r = bundle_get_count(b);
- if(1 != r) {
- tet_infoline("bundle_get_count() failed in positive test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_get_count()
- */
-static void utc_ApplicationFW_bundle_get_count_func_02(void)
-{
- int r;
- r = bundle_get_count(NULL);
- if(0 != r) {
- tet_infoline("bundle_get_count() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
- tet_result(TET_PASS);
-
-cleanup:
- return;
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_get_val_func.c b/TC/unit/utc_ApplicationFW_bundle_get_val_func.c
deleted file mode 100644
index 78d9e08..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_get_val_func.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-#include <string.h>
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_get_val_func_01(void);
-static void utc_ApplicationFW_bundle_get_val_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_get_val_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_get_val_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of bundle_get_val()
- */
-static void utc_ApplicationFW_bundle_get_val_func_01(void)
-{
- char *ret;
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
- ret = bundle_get_val(b, "a");
- if(0 != strcmp("123", ret)) {
- tet_infoline("bundle_get_val() failed in positive test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_get_val()
- */
-static void utc_ApplicationFW_bundle_get_val_func_02(void)
-{
-
- char *ret;
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
- ret = bundle_get_val(NULL, "a");
- if(NULL != ret) {
- tet_infoline("bundle_get_val() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
- ret = bundle_get_val(b, NULL);
- if(NULL != ret) {
- tet_infoline("bundle_get_val() failed in negative test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
diff --git a/TC/unit/utc_ApplicationFW_bundle_iterate_func.c b/TC/unit/utc_ApplicationFW_bundle_iterate_func.c
deleted file mode 100644
index a773b0d..0000000
--- a/TC/unit/utc_ApplicationFW_bundle_iterate_func.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * bundle
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 "bundle.h"
-#include <string.h>
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_ApplicationFW_bundle_iterate_func_01(void);
-static void utc_ApplicationFW_bundle_iterate_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_ApplicationFW_bundle_iterate_func_01, POSITIVE_TC_IDX },
- { utc_ApplicationFW_bundle_iterate_func_02, NEGATIVE_TC_IDX },
- { NULL, 0 }
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-static char *cb_val = NULL;
-
-static void
-cb_test(const char *k, const char *v, void *data)
-{
- cb_val = v;
-}
-
-/**
- * @brief Positive test case of bundle_iterate()
- */
-static void utc_ApplicationFW_bundle_iterate_func_01(void)
-{
- int r = 0;
-
- bundle *b = bundle_create();
- if(!b) {
- tet_result(TET_UNINITIATED);
- return;
- }
- if(bundle_add(b, "a", "123")) {
- tet_result(TET_UNINITIATED);
- goto cleanup;
- }
-
- bundle_iterate(b, cb_test, NULL);
- if (0 != strcmp(bundle_get_val(b, "a"), cb_val)) {
- tet_infoline("bundle_iterate() failed in positive test case");
- tet_result(TET_FAIL);
- goto cleanup;
- }
-
- tet_result(TET_PASS);
-
-cleanup:
- if(b) bundle_free(b);
- return;
-}
-
-/**
- * @brief Negative test case of ug_init bundle_iterate()
- */
-static void utc_ApplicationFW_bundle_iterate_func_02(void)
-{
- int r = 0;
-
-/*
- r = bundle_iterate(...);
-*/
- if (r) {
- tet_infoline("bundle_iterate() failed in negative test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in
deleted file mode 100644
index 383a897..0000000
--- a/TC/unit/utc_MODULE_API_func.c.in
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <tet_api.h>
-
-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/test.sh b/test.sh
deleted file mode 100755
index a35b79d..0000000
--- a/test.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-cd `dirname $0`
-
-rm -rf cmake_tmp
-mkdir cmake_tmp
-cd cmake_tmp
-
-LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
-CFLAGS="-g $CFLAGS" LDFLAGS="-Wl,--as-needed -Wl,--hash-style=both" cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make test && echo "Test OK. No error."
-
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100755
index 9126b44..0000000
--- a/test/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-add_executable(test_bundle EXCLUDE_FROM_ALL
- test_bundle.c
- )
-target_link_libraries(test_bundle bundle)
-
-add_custom_target(test
- COMMAND LD_LIBRARY_PATH=${CMAKE_BINARY_DIR} ./test_bundle
- DEPENDS test_bundle
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMENT "Run 'make test'"
- )
diff --git a/test/Makefile b/test/Makefile
deleted file mode 100755
index f461477..0000000
--- a/test/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-#Steps to build the TC_bundle.c
-#1.build the bundle code
-#2.make
-#3. TC_bundle binary file would be created.
-export PKG_CONFIG_PATH=../debian/libbundle-dev/usr/lib/pkgconfig/
-
-all:
- sbs -e gcc -Wall -o TC_bundle TC_bundle.c `pkg-config --libs bundle`
-clean:
- rm -rf *.exe
diff --git a/test/TC_bundle.c b/test/TC_bundle.c
deleted file mode 100755
index 03e0c26..0000000
--- a/test/TC_bundle.c
+++ /dev/null
@@ -1,1478 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <bundle.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#define SUCCESS 1
-#define FAIL 0
-int ret_bundle_foreach=FAIL;
-int ret_bundle_foreach_invalid=FAIL;
-int ret_bundle_keyval_typeget=FAIL;
-int ret_bundle_exp_imp_p=FAIL;
-int ret_bundle_en_dec_p=FAIL;
-int ret_exp_imp_cases=FAIL;
-int ret_bundle_exp_invalid=FAIL;
-int ret_bundle_imp_invalid=FAIL;
-int ret_bundle_add=FAIL;
-int ret_bundle_get_val=FAIL;
-int ret_bundle_dup=FAIL;
-int ret_bundle_encode=FAIL;
-int ret_bundle_decode=FAIL;
-int ret_bundle_free_encoded=FAIL;
-int ret_bundle_get_type=FAIL;
-int ret_tc_free_exp_argv=FAIL;
-int ret_keyval_is_array=FAIL;
-int ret_keyval_get_basicval=FAIL;
-int ret_bundle_del=FAIL;
-int ret_keyval_get_arrval=FAIL;
-int ret_bundle_get_str_arr=FAIL;
-int ret_bundle_add_str_arr=FAIL;
-
-void iterate_bundleforeach(const char *key,const int type, bundle_keyval_t *kv, void *data)
-{
- switch(type)
- {
- case BUNDLE_TYPE_STR:
- {
- //printf("\n CASE: BUNDLE_TYPE_STR ");
- char *basic_val=NULL;
- size_t size;
- bundle_keyval_get_basic_val(kv,(void *)&basic_val,&size);
- //printf("Key: %s ---- Val: %s\n",key,basic_val);
- break;
- }
- case BUNDLE_TYPE_STR_ARRAY:
- {
- //printf("\n CASE: BUNDLE_TYPE_STR_ARRAY: ");
- void **arr=NULL;
- size_t *array_ele_size=NULL;
- unsigned int ele_nos=0;
- int i=0;
- bundle_keyval_get_array_val(kv,&arr,&ele_nos,&array_ele_size);
- //printf("Total Elements: %d\n",ele_nos);
- //printf("Key: %s \n",key);
- for(i=0;i<ele_nos;i++)
- {
- //printf("element is %s\n",(char *)*(arr+i));
- }
- break;
- }
- case BUNDLE_TYPE_BYTE:
- {
- //printf("\n CASE: BUNDLE_TYPE_BYTE ");
- char *basic_val=NULL;
- size_t size;
- bundle_keyval_get_basic_val(kv,(void *)&basic_val,&size);
- //printf("Key: %s ---- Val: %s\n",key,basic_val);
- break;
- }
- case BUNDLE_TYPE_BYTE_ARRAY:
- {
- //printf("\n CASE:BUNDLE_TYPE_BYTE_ARRAY ");
- void **arr=NULL;
- size_t *array_ele_size=NULL;
- unsigned int ele_nos=0;
- int i=0;
- bundle_keyval_get_array_val(kv,&arr,&ele_nos,&array_ele_size);
- //printf("Total Elements: %d\n",ele_nos);
- //printf("Key: %s \n",key);
- for (i=0;i<ele_nos;i++)
- {
- //printf("element is %s\n",(char *)*(arr+i));
- }
- break;
- }
- default:
- {
- //printf("\n no match found");
- //printf("Key: %s is of type %d\n",key, type);
- break;
- }
-
- }
-
- return;
-}
-
-void iterate_bundleforeach_withdata(const char *key,const int type, bundle_keyval_t *kv, void *data)
-{
- //printf("\n data received is %d",(int)data);
-}
-
-int TC_bundle_foreach()
-{
- //printf("\n ====================================================================\n");
-
- //printf("\nTESTCASE: TC_bundle_foreach");
- bundle *b=NULL;
- char **array=NULL;
- char buf[10]={0,};
- int no_of_ele=10;
- int i=0;
- int data_pass = 35;
-
- b=bundle_create();
- assert(NULL != b);
-/*add elements */
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-
-/*bundle_for each with passed data */
- bundle_foreach(b,(void *)iterate_bundleforeach_withdata,(void*)data_pass);
-
- array=(char **)malloc(no_of_ele*sizeof(char *));
- for (i=0;i<no_of_ele;i++)
- {
- sprintf(buf,"arr_val%d",i);
- *(array+i)=(char *)malloc(sizeof(char *)*strlen(buf));
- strcpy(*(array+i),buf);
- }
- assert(0==bundle_add_str_array(b,"k3", (const char **)array, no_of_ele));
-
-
-
- bundle_foreach(b,(void *)iterate_bundleforeach,NULL);
-
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-
-int TC_bundle_foreach_invalid()
-{
- //printf("\n ====================================================================\n");
-
- //printf("\nTESTCASE: TC_bundle_foreach_invalid");
- bundle *b=NULL;
-
- bundle_foreach(b,(void *)iterate_bundleforeach,NULL); //FIXED:segmentation fault- put check for b=null
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
- return SUCCESS;
-}
-void iterate_bundle_keyvalgettype(const char *key,const int type, bundle_keyval_t *kv, void *data)
-{
-
- assert(type == bundle_keyval_get_type(kv));
- return;
-}
-int TC_bundle_keyval_get_type()
-{
- //printf("\n====================================================================\n");
-
- //printf("\nTESTCASE: TC_bundle_keyval_get_type");
- bundle *b=NULL;
- char **array=NULL;
- char buf[10]={0,};
- int no_of_ele=10;
- int i=0;
-
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-
- array=(char **)malloc(no_of_ele*sizeof(char *));
- for (i=0;i<no_of_ele;i++)
- {
- sprintf(buf,"arr_val%d",i);
- *(array+i)=(char *)malloc(sizeof(char *)*strlen(buf));
- strcpy(*(array+i),buf);
- }
- assert(0==bundle_add_str_array(b,"k3", (const char **)array, no_of_ele));
-
-
- bundle_foreach(b,(void *)iterate_bundle_keyvalgettype,NULL);
- return SUCCESS;
-}
-
-int TC_bundle_export_import_print()
-{
-
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_export_import_print ");
- bundle *b=NULL;
- bundle *b_new=NULL;
- char **array=NULL;
- char buf[10]={0,};
- int no_of_ele=10;
- int i=0;
-
- int argc1=0;
- char **argv1=NULL;
-
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-
- array=(char **)malloc(no_of_ele*sizeof(char *));
- for (i=0;i<no_of_ele;i++)
- {
- sprintf(buf,"arr_val%d",i);
- *(array+i)=(char *)malloc(sizeof(char *)*strlen(buf));
- strcpy(*(array+i),buf);
- }
- assert(0==bundle_add_str_array(b,"k3", (const char **)array, no_of_ele));
-
-
- //printf("\noriginal bundle");
- bundle_foreach(b,(void *)iterate_bundleforeach,NULL);
-
- argc1=bundle_export_to_argv(b,&argv1);
- assert(0<argc1);
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
-
- //printf("\nimported bundle");
- bundle_foreach(b_new,(void *)iterate_bundleforeach,NULL);
-
-
- assert(0==bundle_free(b));
- assert(0==bundle_free(b_new));
- return SUCCESS;
-}
-
-int TC_bundle_dup_print()
-{
-
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_dup_print");
- bundle *b=NULL;
- char **array=NULL;
- char buf[10]={0,};
- int no_of_ele=10;
- int i=0;
- bundle *dup_b=NULL;
-
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-
- array=(char **)malloc(no_of_ele*sizeof(char *));
- for (i=0;i<no_of_ele;i++)
- {
- sprintf(buf,"arr_val%d",i);
- *(array+i)=(char *)malloc(sizeof(char *)*strlen(buf));
- strcpy(*(array+i),buf);
- }
- assert(0==bundle_add_str_array(b,"k3", (const char **)array, no_of_ele));
-
-
- //printf("\noriginal bundle ");
- bundle_foreach(b,(void *)iterate_bundleforeach,NULL);
-
- dup_b = bundle_dup(b);
- assert(NULL != dup_b);
- //printf("\n duplicated bundle ");
- bundle_foreach(dup_b,(void *)iterate_bundleforeach,NULL);
-
-
- assert(0==bundle_free(b));
- assert(0==bundle_free(dup_b));
- return SUCCESS;
-}
-int TC_bundle_encode_decode_print()
-{
-
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_encode_decode_print");
- bundle *b=NULL;
- char **array=NULL;
- char buf[10]={0,};
- int no_of_ele=10;
- int i=0;
- int len=-1;
- bundle_raw *bundle_data;
- bundle *dec_b=NULL;
-
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-
- array=(char **)malloc(no_of_ele*sizeof(char *));
- for (i=0;i<no_of_ele;i++)
- {
- sprintf(buf,"arr_val%d",i);
- *(array+i)=(char *)malloc(sizeof(char *)*strlen(buf));
- strcpy(*(array+i),buf);
- }
- assert(0==bundle_add_str_array(b,"k3", (const char **)array, no_of_ele));
-
-
- //printf("\noriginal bundle ");
- bundle_foreach(b,(void *)iterate_bundleforeach,NULL);
-
- assert(0==bundle_encode(b,&bundle_data,&len));
- dec_b=bundle_decode(bundle_data,len);
- assert(NULL != dec_b);
-
- //printf("\n decoded bundle ");
- bundle_foreach(dec_b,(void *)iterate_bundleforeach,NULL);
-
- assert(0==bundle_free(b));
- assert(0==bundle_free(dec_b));
- return SUCCESS;
-}
-
-int TC_bundle_export_to_argv_invalid()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_export_to_argv_invalid ");
- bundle *b_null=NULL;
- int argc1=0;
- char **argv1=NULL;
-
-/*CASE1:INVALID b= null,FIXED : segmentation fault in(put check for bundle=null) bundle_foreach (b=0x0, iter=0x4001322c <_iter_export_to_argv>, user_data=0xbead0a24)*/
- argc1=bundle_export_to_argv(b_null,&argv1);
- return SUCCESS;
-
-}
-int TC_bundle_import_from_argv_invalid()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_import_from_argv_invalid ");
- bundle *b_new=NULL;
- int argc1=0;
- char **argv1=NULL;
-
-
-/* INVALID: passing invalid arguments -not exported/encoded */
-/*CASE1: argc1=0 */
- argc1=0;
- argv1 = calloc(argc1+1,sizeof(char*));
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
- assert(0 == bundle_get_count(b_new));
- bundle_foreach(b_new,(void *)iterate_bundleforeach,NULL);
- assert(0==bundle_free(b_new));
-
-/*CASE2: argv1 =NULL--FIXED : segmentation fault-put check in code*/
- argc1=2;
- argv1=NULL;
- b_new=bundle_import_from_argv(argc1,argv1);
- //printf("\n cannot form bundle");
- assert(NULL == b_new);
-/*CASE3: argc1=4 /argv1!=NULL but all arguments value= null */
- argc1=4;
-// argv1=calloc(1,sizeof(char*)); //sigsegv - atleast no of elements= arc1 should be allocated memory properly.
- argv1=calloc(5,sizeof(char*));
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
- assert(0 == bundle_get_count(b_new));
- assert(0==bundle_free(b_new));
-/*CASE5: passing even no of arguments-[max=4] 6 arguments passed-no of bundle elements must be 2.*/
- argc1=4;
- argv1=NULL;
- argv1=calloc(5,sizeof(char*));
- argv1[0]="prog_name";
- argv1[1]="k2";
- argv1[2]="v2";
- argv1[3]="k3";
- argv1[4]="v3";
- argv1[5]="k4";//add extra- should not get added to bundle
- argv1[6]="v4";//add extra- should not get added to bundle
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
- //printf("\n no of elements in imported bundle is%d", bundle_get_count(b_new));
- assert(2 == bundle_get_count(b_new));
- bundle_foreach(b_new,(void *)iterate_bundleforeach,NULL);
- assert(0==bundle_free(b_new));
-/*CASE6: passing odd no of arguments- [max=4]3 arguments passed-no of bundle elements will be 1.*/
- argc1=4;
- argv1= NULL;
- argv1=calloc(5,sizeof(char*));
- argv1[0]="prog_name";
- argv1[1]="k4";
- argv1[2]="v4";
- argv1[3]="k5";
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
- //printf("\n no of elements in imported bundle is%d", bundle_get_count(b_new));
- //bundle_foreach(b_new,(void *)iterate_bundleforeach,NULL);
- assert(1 == bundle_get_count(b_new));
- assert(0==bundle_free(b_new));
- return SUCCESS;
-}
-int TC_bundle_export_import_cases()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_export_import_cases ");
- bundle *b=NULL;
- bundle *b_new=NULL;
- int argc1=0;
- char **argv1=NULL;
-
- b=bundle_create();
- assert(NULL != b);
-
-
-/*CASE1:bundle created succesfully- no keyval pair added ||return value of bundle_export_to_argv() >=2 in success and -1 in failure. */
- argc1=bundle_export_to_argv(b,&argv1);
- //printf("\nargc is %d",argc1);
- assert(argc1>0);
-
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
- assert(0 == bundle_get_count(b_new));
- /*reset values*/
- assert(0==bundle_free(b_new));
- argc1=0;
- argv1=NULL;
-
-/*CASE2: adding elements to bundle and then export-import*/
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
- assert(0 == bundle_add(b, "k3", "val3"));
-
- argc1=bundle_export_to_argv(b,&argv1);
- //printf("\nargc is %d",argc1);
- assert(argc1>0);
- assert(argc1==8); /*argc1 = 2*no of bundle elements +2 = actual count of argv [last null terminator not counted in argc1]*/
- assert(argv1!=NULL);
- assert(argv1[0]==NULL);
- assert(argv1[argc1]==NULL);/*last element must be NULL */
-
- b_new=bundle_import_from_argv(argc1,argv1);
- assert(NULL != b_new);
- assert(3 == bundle_get_count(b_new));
- assert(0== strcmp(bundle_get_val(b_new,"k1"),bundle_get_val(b,"k1")));
- assert(0== strcmp(bundle_get_val(b_new,"k2"),bundle_get_val(b,"k2")));
- assert(0== strcmp(bundle_get_val(b_new,"k3"),bundle_get_val(b,"k3")));
- bundle_foreach(b_new,(void *)iterate_bundleforeach,NULL);
-
-
- assert(0==bundle_free(b_new));
- assert(0==bundle_free(b));
- return SUCCESS;
-
-}
-int TC_bundle_add()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE : TC_bundle_add");
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- bundle *b2=NULL;
-
- assert(0 == bundle_add(b, "key1", "val1"));
- assert(0 == bundle_add(b, "key2", "val2"));
-/*duplicate key */
- assert(0 != bundle_add(b, "key1", "val123"));
- //printf("\n 1 %s",strerror(errno));
- assert(EPERM == errno );
-/*Null key */
- assert(0 != bundle_add(b, NULL, "val123"));
- //printf("\n 2 %s",strerror(errno));
- assert(EKEYREJECTED == errno );
-/*Empty(string) key */
- assert(0 != bundle_add(b,"","val123"));
- //printf("\n 2-empty key %s",strerror(errno));
- assert(EKEYREJECTED == errno );
-/*Null value */
- assert(0 != bundle_add(b, "key3", NULL));
- //printf("\n 3 %s",strerror(errno));
- assert(EINVAL == errno );
-/*Null bundle */
- assert(0 != bundle_add(NULL,"key4", "val123"));
- //printf("\n 4 %s",strerror(errno));
- assert(EINVAL == errno );
-/*Null bundle/value - duplicate key */
- assert(0 != bundle_add(NULL,"key4", NULL));
- //printf("\n 5 %s",strerror(errno));
- assert(EINVAL == errno );
-/*Null value - duplicate key */
- assert(0 != bundle_add(b,"key4", NULL));
- //printf("\n 6 %s",strerror(errno));
- assert(EINVAL == errno );
-/*get value for given key */
- assert(0==strcmp("val1",bundle_get_val(b,"key1")));
- assert(0==strcmp("val2",bundle_get_val(b,"key2")));
-/*get count*/
- assert(2==bundle_get_count(b));
-/* add one more key-val */
- assert(0 == bundle_add(b, "k3", "v3"));
-/*get count again - should be incremented*/
- assert(3 == bundle_get_count(b));
-/*add same key-val to different bundle- b2 */
-
- b2=bundle_create();
- assert(NULL != b2);
- assert(0 == bundle_add(b2, "key1", "val1"));
- assert(0 == bundle_add(b2, "key2", "v2"));
- assert(0==strcmp("v2",bundle_get_val(b2,"key2")));
- assert(2==bundle_get_count(b2));
-/*Empty(string) value- allowed */
- assert(0 == bundle_add(b2,"key3",""));
-/*Bundle_add without prior bundle_create */
- bundle *b3=NULL;
- assert(0 != bundle_add(b3, "k1", "v1"));
- assert(EINVAL == errno );
- return SUCCESS;
-}
-int TC_bundle_get_val()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TEST CASE :TC_bundle_get_val");
- bundle *b=NULL;
- bundle *b1=NULL;
- b=bundle_create();
- assert(NULL != b);
- assert(0 == bundle_add(b, "key1", "val1"));
- assert(0 == bundle_add(b, "key2", "val2"));
-
- assert(0==strcmp("val1",bundle_get_val(b,"key1")));
- assert(0==strcmp("val2",bundle_get_val(b,"key2")));
-/*wrong key passed as input */
- assert(NULL==bundle_get_val(b,"key4"));
- assert(ENOKEY == errno );
-/*bundle = NULL */
- assert(NULL==bundle_get_val(NULL,"key4"));
- assert(EINVAL == errno );
-/*bundle = not created */
- assert(NULL==bundle_get_val(b1,"key4"));
- assert(EINVAL == errno );
-/*key = NULL, bundle = proper */
- assert(NULL==bundle_get_val(b,NULL));
- assert(EKEYREJECTED == errno );
-/*pass string instead of bundle -sigsegv */
-// assert(NULL==bundle_get_val("bundle","key1"));
-// assert(EINVAL == errno );
-
- assert(0==bundle_free(b));
- return SUCCESS;
-
-}
-#if 0
-int TC_bundle_add_byte()
-{
-/*pass str="aa" instead of byte="aa\0"*/
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE: TC_bundle_add_byte");
- bundle *b=NULL;
- bundle *b1=NULL;
- b=bundle_create();
- assert(NULL != b);
-/*valid cases */
- char *data_1byte ="bbbbb";
- char *data_2byte ="aaaa";
- assert(0 == bundle_add_byte(b, "k4", (void *)data_1byte, strlen(data_1byte)+1));
- assert(0==bundle_add_byte(b, "k5", (void *)data_2byte, strlen(data_2byte)+1));
-/*duplicate value */
- assert(0==bundle_add_byte(b, "k7", (void *)data_2byte, strlen(data_2byte)+1));
-/*value and size NULL */
- assert(0==bundle_add_byte(b, "k8",NULL,NULL));
-/*value = NULL, size not NULL */
- assert(0==bundle_add_byte(b, "k9",NULL,9));
-
-/*invalid cases */
-/*bundle = NULL */
- assert(0!=bundle_add_byte(b1, "k5", (void *)data_2byte,(size_t)strlen(data_2byte)+1));
- assert(EINVAL == errno );
-/*duplicate key */
- assert(0!=bundle_add_byte(b, "k5","abcd",4));
- assert(EPERM == errno);
-/*empty key */
- assert(0!=bundle_add_byte(b,"","lion",4));
- assert(EKEYREJECTED == errno );
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-#endif
-//////
-int TC_bundle_add_str_array()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE :TC_bundle_add_str_array");
- const char *arr[]={"v1","v2","v3","v4"};
- bundle *b=NULL;
- bundle *b1=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- assert(0==bundle_add_str_array(b,"k1",&arr,4));
-
-
-/*bundle= NULL - fail */
- assert(0!=bundle_add_str_array(b1,"key1",NULL,6));
- assert(EINVAL == errno );
-/*duplicate key - fail */
- assert(0!=bundle_add_str_array(b,"k1",NULL,6));
- assert(EPERM == errno );
-/*empty key - fail */
- assert(0!=bundle_add_str_array(b,"",NULL,6));
- assert(EKEYREJECTED == errno );
-/*No of elements = NULL - success */
- assert(0==bundle_add_str_array(b,"k3",NULL,NULL));
-/*add new array with a different key and 6 elements -success */
- assert(0==bundle_add_str_array(b,"k4",NULL,6));
-
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-///////
-#if 0
-int TC_bundle_add_byte_array()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE :TC_bundle_add_byte_array");
- bundle *b=NULL;
- bundle *b1=NULL;
- b=bundle_create();
- assert(NULL != b);
-/* cases */
- assert(0==bundle_add_byte_array(b,"k1",NULL,4));
- assert(0==bundle_set_byte_array_element(b,"k1",0,"ccc\0",4));
- assert(0==bundle_set_byte_array_element(b,"k1",1,"dd\0",3));
- assert(0==bundle_set_byte_array_element(b,"k1",2,"eee\0",4));
-/*try to add second array element again- over writing not allowed-fail */
- assert(0!=bundle_set_byte_array_element(b,"k1",1,"new\0",4));
- assert(EINVAL == errno );
-/*add fifth element - fail */
- assert(0!=bundle_set_byte_array_element(b,"k1",4,"gggg\0",5));
- assert(EINVAL == errno );
-/*bundle= NULL - fail */
- assert(0!=bundle_add_byte_array(b1,"key1",NULL,6));
- assert(EINVAL == errno );
-/*duplicate key - fail */
- assert(0!=bundle_add_byte_array(b,"k1",NULL,6));
- assert(EPERM == errno );
-/*empty key - fail */
- assert(0!=bundle_add_byte_array(b,"",NULL,6));
- assert(EKEYREJECTED == errno );
-/*No of elements = NULL - success */
- assert(0==bundle_add_byte_array(b,"k3",NULL,NULL));
-/*add new array with a different key and 6 elements -success */
- assert(0==bundle_add_byte_array(b,"k2",NULL,6));
-/* add fifth element- 1st/2nd/3rd/4th not yet added. */
- assert(0==bundle_set_byte_array_element(b,"k2",4,"ccc\0",4));
-/* bundle = NULL */
- assert(0!=bundle_set_byte_array_element(b1,"k2",0,"ccc\0",4));
- assert(EINVAL == errno );
-/* key = NULL */
- assert(0!=bundle_set_byte_array_element(b,NULL,1,"gggg\0",5));
- assert(EKEYREJECTED == errno );
-/* pass string instead of byte in value */
- assert(0==bundle_set_byte_array_element(b,"k2",3,"hello",6));
- assert(0==bundle_set_byte_array_element(b,"k2",5,"world",6));/*note size = size of string+ 1 (for \0) -- if \0 not added then juck characters appear while encode- decode */
-
-// bundle_foreach(b,(void *)iterate_bundleforeach,NULL);
- assert(0==bundle_free(b));
- return SUCCESS;
-
-}
-int TC_bundle_get_byte()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE :TC_bundle_get_byte");
- bundle *b=NULL;
- const char *arr[]={"v1","v2","v3"};
- size_t len= -1;
- void* ret_byte;
- b=bundle_create();
- assert(NULL != b);
- /* add elements */
- assert(0 == bundle_add_byte(b, "k1","aa\0",3));
- assert(0 == bundle_add_byte(b, "k2","bb\0",3));
-
- assert(0 == bundle_add(b, "key1", "val1"));
- assert(0==bundle_add_str_array(b,"key2",arr,3));
- assert(0==bundle_add_byte_array(b,"key3",NULL,4));
- assert(0==bundle_set_byte_array_element(b,"key3",0,"ccc\0",4));
-/*valid tests */
- assert(0==bundle_get_byte(b,"k1",&ret_byte,&len));
- assert(0==strcmp("aa",ret_byte));
- assert(3==len);
- assert(0==bundle_get_byte(b,"k2",&ret_byte,&len));
- assert(0==strcmp("bb",ret_byte));
- assert(3==len);
- assert(0==bundle_get_byte(b,"k2",NULL,&len));
- assert(3==len);
- assert(0==bundle_get_byte(b,"k2",NULL,NULL));
-/*invalid tests */
- /* bundle= NULL */
- assert(0!=bundle_get_byte(NULL,"k1",&ret_byte,&len));
- assert(EINVAL == errno );
- /*key = empty */
- assert(0!=bundle_get_byte(b,"",&ret_byte,&len));
- assert(ENOKEY == errno );
- /*key does not exist */
- assert(0!=bundle_get_byte(b,"k3",&ret_byte,&len));
- assert(ENOKEY == errno );
- /*key = NULL */
- assert(0!=bundle_get_byte(b,NULL,&ret_byte,&len));
- assert(EKEYREJECTED == errno );
- /*pass the key for str type bundle-operation not supported */
- assert(0!=bundle_get_byte(b,"key1",&ret_byte,&len));
- assert(ENOTSUP == errno );
- /*pass the key for array type bundle */
- assert(0!=bundle_get_byte(b,"key2",&ret_byte,&len));
- assert(ENOTSUP == errno );
- assert(0!=bundle_get_byte(b,"key3",&ret_byte,&len));
- assert(ENOTSUP == errno );
-
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-#endif
-/*API prototype changed */
-#if 0
-int TC_bundle_get_str_array()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE :TC_bundle_get_str_array");
- bundle *b=NULL;
- const char *arr[]={"v1","v2","v3"};
- char **str_arr=NULL;
- int len = -1;
- b=bundle_create();
- assert(NULL != b);
-/* add elements */
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
- assert(0 == bundle_add_byte(b, "k3","hello\0",6));
- assert(0==bundle_add_byte_array(b,"k4",NULL,4));
- assert(0==bundle_set_byte_array_element(b,"k4",0,"ccc\0",4));
-/* valid case test */
- assert(0==bundle_get_str_array(b,"k2",&str_arr,&len));
- assert(0==strcmp("v1",str_arr[0]));
- assert(0==strcmp("v2",str_arr[1]));
- assert(3==len);
- assert(3== (strlen(str_arr[0])+1));
- assert(3== (strlen(str_arr[1])+1));
-
- assert(0==bundle_get_str_array(b,"k2",NULL,&len));
- assert(3==len);
- assert(0==bundle_get_str_array(b,"k2",NULL,NULL));
-/* invalid cases test */
- /*bundle= null */
- assert(0!=bundle_get_str_array(NULL,"k2",&str_arr,&len));
- assert(EINVAL == errno );
- /*key = empty */
- assert(0!=bundle_get_str_array(b,"",&str_arr,&len));
- assert(ENOKEY == errno );
- /*invalid key */
- assert(0!=bundle_get_str_array(b,"key1",&str_arr,&len));
- assert(ENOKEY == errno );
- /*key = NULL */
- assert(0!=bundle_get_str_array(b,NULL,&str_arr,&len));
- assert(EKEYREJECTED == errno );
- /*key for invalid type of element */
- assert(0!=bundle_get_str_array(b,"k1",&str_arr,&len));
- assert(ENOTSUP == errno );
- assert(0!=bundle_get_str_array(b,"k3",&str_arr,&len));
- assert(ENOTSUP == errno );
- assert(0!=bundle_get_str_array(b,"k4",&str_arr,&len));
- assert(ENOTSUP == errno );
-
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-#endif
-#if 1
-int TC_bundle_get_str_array()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE :TC_bundle_get_str_array");
- bundle *b=NULL;
- const char *arr[]={"v1","v2","v3"};
- const char **str_arr=NULL;
- const char **str_arr1=NULL;
- const char **str_arr2=NULL;
- int len = -1;
- b=bundle_create();
- assert(NULL != b);
-/* add elements */
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
-/* valid case test */
- str_arr=bundle_get_str_array(b,"k2",&len);
- /*printf("\nreturned array ele 1 is %s",str_arr[0]);
- printf("\nreturned array ele 2 is %s",str_arr[1]);
- printf("\nreturned array ele 3 is %s",str_arr[2]);*/
- assert(3==len);
- //assert(0==strcmp("v1",str_arr[0]));
- str_arr1=bundle_get_str_array(b,"k2",&len);
- assert(3==len);
- str_arr2=bundle_get_str_array(b,"k2",NULL);
-/* invalid cases test */
- /*bundle= null */
- assert(NULL ==bundle_get_str_array(NULL,"k2",&len));
- assert(EINVAL == errno );
- /*key = empty */
- assert(NULL==bundle_get_str_array(b,"",&len));
- assert(ENOKEY == errno );
- /*invalid key */
- assert(NULL==bundle_get_str_array(b,"key1",&len));
- assert(ENOKEY == errno );
- /*key = NULL */
- assert(NULL==bundle_get_str_array(b,NULL,&len));
- assert(EKEYREJECTED == errno );
- /*key for invalid type of element */
- assert(NULL==bundle_get_str_array(b,"k1",&len));
- assert(ENOTSUP == errno );
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-#endif
-#if 0
-int TC_bundle_get_byte_array()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE :TC_bundle_get_byte_array");
- bundle *b=NULL;
- const char *arr[]={"v1","v2","v3"};
- void **byte_arr=NULL;
- unsigned int len = -1;
- unsigned int *ele_size= NULL;
- b=bundle_create();
- assert(NULL != b);
-/* add elements */
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
- assert(0 == bundle_add_byte(b, "k3","hello\0",6));
- assert(0==bundle_add_byte_array(b,"k4",NULL,4));
- assert(0==bundle_set_byte_array_element(b,"k4",0,"ccc\0",4));
- assert(0==bundle_set_byte_array_element(b,"k4",1,"dddd\0",5));
-/* valid case test */
- assert(0==bundle_get_byte_array(b,"k4",&byte_arr,&len,&ele_size));
- assert(0==strcmp("ccc",byte_arr[0]));
- assert(0==strcmp("dddd",byte_arr[1]));
- assert(4==len);
- assert(4== (strlen(byte_arr[0])+1));
- assert(5== (strlen(byte_arr[1])+1));
-
- assert(0==bundle_get_byte_array(b,"k4",NULL,&len,&ele_size));
- assert(4==len);
- assert(0==bundle_get_byte_array(b,"k4",NULL,NULL,&ele_size));
-/* invalid cases test */
- /*bundle= null */
- assert(0!=bundle_get_byte_array(NULL,"k4",&byte_arr,&len,&ele_size));
- assert(EINVAL == errno );
- /*key = empty */
- assert(0!=bundle_get_byte_array(b,"",&byte_arr,&len,&ele_size));
- assert(ENOKEY == errno );
- /*invalid key */
- assert(0!=bundle_get_byte_array(b,"key1",&byte_arr,&len,&ele_size));
- assert(ENOKEY == errno );
- /*key = NULL */
- assert(0!=bundle_get_byte_array(b,NULL,&byte_arr,&len,&ele_size));
- assert(EKEYREJECTED == errno );
- /*key for invalid type of element */
- assert(0!=bundle_get_byte_array(b,"k1",&byte_arr,&len,&ele_size));
- assert(ENOTSUP == errno );
- assert(0!=bundle_get_byte_array(b,"k2",&byte_arr,&len,&ele_size));
- assert(ENOTSUP == errno );
- assert(0!=bundle_get_byte_array(b,"k3",&byte_arr,&len,&ele_size));
- assert(ENOTSUP == errno );
-
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-#endif
-int TC_bundle_get_type()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_get_type");
- char **array=NULL;
- char buf[10]={0,};
- int no_of_ele=10;
- int i=0;
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- /* add elements */
- assert(0 == bundle_add(b, "k1", "val1"));
- array=(char **)malloc(no_of_ele*sizeof(char *));
- for (i=0;i<no_of_ele;i++)
- {
- sprintf(buf,"arr_val%d",i);
- *(array+i)=(char *)malloc(sizeof(char *)*strlen(buf));
- strcpy(*(array+i),buf);
- }
- assert(0==bundle_add_str_array(b,"k2", (const char **)array, no_of_ele));
-
- /*valid case test for bundle_get_type */
- assert(BUNDLE_TYPE_STR==bundle_get_type(b,"k1"));
- assert(BUNDLE_TYPE_STR_ARRAY==bundle_get_type(b,"k2"));
-
- /* in valid cases test */
- assert(BUNDLE_TYPE_NONE==bundle_get_type(b,"k5"));
- assert(ENOKEY == errno);
- assert(BUNDLE_TYPE_NONE==bundle_get_type(b,NULL));
- assert(ENOKEY == errno);
- assert(BUNDLE_TYPE_NONE==bundle_get_type(b,""));
- assert(ENOKEY == errno);
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-void iterate_is_keyval_type_array(const char *key,const int type, bundle_keyval_t *kv, void *data)
-{
-
- if(0==strcmp(key,"k1"))
- assert(0 == bundle_keyval_type_is_array(kv));
- else if(0==strcmp(key,"k2"))
- assert(1 == bundle_keyval_type_is_array(kv));
- else if(0==strcmp(key,"k3"))
- assert(0 == bundle_keyval_type_is_array(kv));
- else if(0==strcmp(key,"k4"))
- assert(1 == bundle_keyval_type_is_array(kv));
- return;
-}
-int TC_bundle_keyval_type_is_array()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE : TC_bundle_keyval_type_is_array");
- bundle *b=NULL;
- const char *arr[]={"v1","v2","v3"};
- b=bundle_create();
- assert(NULL != b);
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
-
- bundle_foreach(b,(void *)iterate_is_keyval_type_array,NULL);
- return SUCCESS;
-
-}
-void iterate_keyval_get_basicval(const char *key,const int type, bundle_keyval_t *kv, void *data)
-{
- void **val=NULL;
- size_t len =-1;
- if(0==strcmp(key,"k1"))
- assert(0 == bundle_keyval_get_basic_val(kv,val,&len));
- else if(0==strcmp(key,"k2"))
- assert(0!= bundle_keyval_get_basic_val(kv,val,&len));
- else if(0==strcmp(key,"k3"))
- assert(0 == bundle_keyval_get_basic_val(kv,val,&len));
- else if(0==strcmp(key,"k4"))
- assert(0!= bundle_keyval_get_basic_val(kv,val,&len));
- return;
-}
-int TC_bundle_keyval_get_basic_val()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE:TC_bundle_keyval_get_basic_val");
- const char *arr[]={"v1","v2","v3"};
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
-
- bundle_foreach(b,(void *)iterate_keyval_get_basicval,NULL);
- return SUCCESS;
-}
-
-void iterate_is_keyval_get_arrayval(const char *key,const int type, bundle_keyval_t *kv, void *data)
-{
- void ***array_val=NULL;
- unsigned int *array_len =NULL;
- size_t **ele_size=NULL;
- if(0==strcmp(key,"k1"))
- assert(0 != bundle_keyval_get_array_val(kv,array_val,array_len,ele_size));
- else if(0==strcmp(key,"k2"))
- assert(0 == bundle_keyval_get_array_val(kv,array_val,array_len,ele_size));
- else if(0==strcmp(key,"k3"))
- assert(0 != bundle_keyval_get_array_val(kv,array_val,array_len,ele_size));
- else if(0==strcmp(key,"k4"))
- assert(0 == bundle_keyval_get_array_val(kv,array_val,array_len,ele_size));
- return;
-}
-int TC_bundle_keyval_get_array_val()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE :TC_bundle_keyval_get_array_val");
- const char *arr[]={"v1","v2","v3"};
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
-
- bundle_foreach(b,(void *)iterate_is_keyval_get_arrayval,NULL);
- return SUCCESS;
-}
-
-int TC_bundle_encode()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_encode");
- bundle *b=NULL;
- bundle_raw *bundle_data;
- int len = -1;
-/*bundle not created-encode - b= NULL*/
- assert(0!=bundle_encode(b,&bundle_data,&len));
-/*bundle created- no element added -encode */
- b=bundle_create();
- assert(NULL != b);
- assert(0==bundle_encode(b,&bundle_data,&len));
-/*2 elements added - encode */
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-
- assert(0==bundle_encode(b,&bundle_data,&len));
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-int TC_bundle_decode()
-{
- //printf("\n ====================================================================\n");
- //printf("\nTESTCASE: TC_bundle_decode");
- bundle *b=NULL;
- bundle_raw *bundle_data=NULL;
- bundle *dec_b=NULL;
- int len = -1;
-/*invalid bundle_data and len values- not encoded */
- dec_b=bundle_decode(bundle_data,len);
- assert(NULL == dec_b);
- assert(EINVAL == errno);
-/*invalid bundle_data and len values- not encoded-any random string passed -FIXED */
- dec_b=bundle_decode("not_encodeddata",len);
- assert(NULL == dec_b);
-// assert(EINVAL == errno);
-/*encode- decode but incorrect value for length */
- b=bundle_create();
- assert(NULL != b);
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
- assert(0==bundle_encode(b,&bundle_data,&len));
- dec_b=bundle_decode(bundle_data,9);
- assert(NULL != dec_b);
- bundle_foreach(dec_b,(void *)iterate_bundleforeach,NULL);
- assert(0==bundle_free(b));
- assert(0==bundle_free(dec_b));
- return SUCCESS;
-}
-#if 0
-void TC_bundle_free_encoded_raw_data()
-{
- printf("\n ====================================================================\n");
- printf("\n TESTCASE: TC_bundle_free_encoded_raw_data");
- bundle_raw *bundle_data=NULL;
- bundle_raw *bundle_data_null=NULL;
- int len =-1;
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-/* valid case */
- assert(0==bundle_encode(b,&bundle_data,&len));
- assert(0==bundle_free_encoded_rawdata(bundle_data));
-/* FIXED -sigabrt trying to free twice */
-if(0!=bundle_free_encoded_rawdata(bundle_data))
- printf("\nalready freed");
- assert(0!=bundle_free_encoded_rawdata(bundle_data));
- assert(0!=bundle_free_encoded_rawdata(bundle_data));
-/*trying to free bundle_data= NULL */
- assert(0!=bundle_free_encoded_rawdata(bundle_data_null));
-
- assert(0==bundle_free(b));
-}
-#endif
-int TC_bundle_free_encoded_raw_data()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE: TC_bundle_free_encoded_raw_data");
- bundle_raw *bundle_data=NULL;
- bundle_raw *bundle_data_null=NULL;
- int len =-1;
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
-/* valid case */
- assert(0==bundle_encode(b,&bundle_data,&len));
- assert(0==bundle_free_encoded_rawdata(&bundle_data));
-/* FIXED -sigabrt trying to free twice */
-if(0!=bundle_free_encoded_rawdata(&bundle_data))
- //printf("\nalready freed");
- assert(0!=bundle_free_encoded_rawdata(&bundle_data));
- assert(0!=bundle_free_encoded_rawdata(&bundle_data));
-/*trying to free bundle_data= NULL */
- assert(0!=bundle_free_encoded_rawdata(&bundle_data_null));
-
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-int TC_bundle_free_exported_argv()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE :TC_bundle_free_exported_argv");
- int argc1=0;
- char **argv1=NULL;
- int argc2=0;
- char **argv2=NULL;
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
- argc1=bundle_export_to_argv(b,&argv1);
- assert(0<argc1);
-/*valid args */
- assert(0 ==bundle_free_exported_argv(argc1,&argv1));
-/*invalid args- argc =0,argv = NULL */
- assert(0 !=bundle_free_exported_argv(argc2,&argv2));
-/*invalid args- argc =8 , argv= NULL */
- assert(0 !=bundle_free_exported_argv(8,&argv2));
-/* FIXED double free -sigabrt */
- assert(0 !=bundle_free_exported_argv(argc1,&argv1));
- return SUCCESS;
-}
-
-#if 0
-void TC_bundle_free_exported_argv()
-{
- printf("\n ====================================================================\n");
- printf("\n TESTCASE :TC_bundle_free_exported_argv");
- int argc1=0;
- char **argv1=NULL;
- int argc2=0;
- char **argv2=NULL;
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0 == bundle_add(b, "k2", "val2"));
- argc1=bundle_export_to_argv(b,&argv1);
- assert(0<argc1);
-/*valid args */
- assert(0 ==bundle_free_exported_argv(argc1,argv1));
-/*invalid args- argc =0,argv = NULL */
- assert(0 !=bundle_free_exported_argv(argc2,argv2));
-/*invalid args- argc =8 , argv= NULL */
- assert(0 !=bundle_free_exported_argv(8,argv2));
-/* FIXED double free -sigabrt */
-// assert(0 !=bundle_free_exported_argv(argc1,argv1));
-}
-#endif
-int TC_bundle_del()
-{
- //printf("\n ====================================================================\n");
- //printf("\n TESTCASE :TC_bundle_del");
- const char *arr[]={"v1","v2","v3"};
- bundle *b=NULL;
- b=bundle_create();
- assert(NULL != b);
-/* add elements */
- assert(0 == bundle_add(b, "k1", "val1"));
- assert(0==bundle_add_str_array(b,"k2",arr,3));
- assert(2 == bundle_get_count(b));
-/*valid case tests */
- assert(0 == bundle_del(b, "k1"));
- assert(NULL == bundle_get_val(b, "k1"));
- assert(ENOKEY == errno);
- assert(1 == bundle_get_count(b));
-
- assert(0 == bundle_del(b, "k2"));
- assert(0 == bundle_get_count(b));
-/*invalid case tests */
- /*bundle = NULL */
- assert(0 != bundle_del(NULL, "key"));
- assert(EINVAL == errno);
- /*key =NULL */
-
- assert(0 != bundle_del(b, NULL));
- assert(EKEYREJECTED == errno);
- /*key = empty */
- assert(0 != bundle_del(b, ""));
- assert(EKEYREJECTED == errno);
- /*key does not exist- invalid key */
- assert(0 != bundle_del(b, "key"));
- assert(ENOKEY == errno);
- /* invalid key-again pass the same key */
- assert(0 != bundle_del(b, "k1"));
- assert(ENOKEY == errno);
-
- assert(0 == bundle_get_count(b));
- assert(0==bundle_free(b));
- return SUCCESS;
-}
-
-int
-main(int argc, char **argv)
-{
- /*print the results */
- printf("\n************************************************************************\n");
- printf("\n Test Suite Report \n");
- printf("\n Output : 1 = Success , On failure the respective test case aborts and prints the assert log \n");
- printf("\n************************************************************************\n");
- printf("TC ID\t\tRESULT\n");
-
- pid_t tc_bundle_foreach = fork();
- if (tc_bundle_foreach == 0)
- {
- ret_bundle_foreach = TC_bundle_foreach();
- printf("TC_bundle_foreach\t%d\n",ret_bundle_foreach);
- exit(1);
- }
- waitpid(tc_bundle_foreach,NULL,WNOHANG);
-
-
- pid_t tc_bundle_foreach_invalid = fork();
- if (tc_bundle_foreach_invalid == 0)
- {
- ret_bundle_foreach_invalid =TC_bundle_foreach_invalid();
- printf("TC_bundle_foreach_invalid\t%d\n",ret_bundle_foreach_invalid);
- exit(1);
- }
- waitpid(tc_bundle_foreach,NULL,WNOHANG);
-
- pid_t tc_bundle_keyval_gettype = fork();
- if ( tc_bundle_keyval_gettype == 0)
- {
- ret_bundle_keyval_typeget = TC_bundle_keyval_get_type();
- printf("TC_bundle_keyval_get_type\t%d\n",ret_bundle_keyval_typeget );
- exit(1);
- }
- waitpid(tc_bundle_keyval_gettype ,NULL,WNOHANG);
-
- pid_t tc_bundle_export_import_print = fork();
- if ( tc_bundle_export_import_print == 0)
- {
- ret_bundle_exp_imp_p = TC_bundle_export_import_print();
- printf("TC_bundle_export_import_print\t%d\n",ret_bundle_exp_imp_p);
- exit(1);
- }
- waitpid(tc_bundle_export_import_print ,NULL,WNOHANG);
-
- pid_t tc_bundle_encode_decode_print = fork();
- if ( tc_bundle_encode_decode_print == 0)
- {
- ret_bundle_en_dec_p = TC_bundle_encode_decode_print();
- printf("TC_bundle_encode_decode_print\t%d\n",ret_bundle_en_dec_p);
- exit(1);
- }
- waitpid(tc_bundle_encode_decode_print ,NULL,WNOHANG);
-
- pid_t tc_bundle_exp_imp_case = fork();
- if ( tc_bundle_exp_imp_case == 0)
- {
- ret_exp_imp_cases = TC_bundle_export_import_cases();
- printf("TC_bundle_export_import_cases\t%d\n",ret_exp_imp_cases);
- exit(1);
- }
- waitpid(tc_bundle_exp_imp_case ,NULL,WNOHANG);
-
- pid_t tc_bundle_exp_invalid = fork();
- if ( tc_bundle_exp_invalid == 0)
- {
- ret_bundle_exp_invalid = TC_bundle_export_to_argv_invalid();
- printf("TC_bundle_export_to_argv_invalid\t%d\n",ret_bundle_exp_invalid);
- exit(1);
- }
- waitpid(tc_bundle_exp_invalid ,NULL,WNOHANG);
-
- pid_t tc_bundle_imp_invalid = fork();
- if ( tc_bundle_imp_invalid == 0)
- {
- ret_bundle_imp_invalid = TC_bundle_import_from_argv_invalid();
- printf("TC_bundle_import_from_argv_invalid\t%d\n",ret_bundle_imp_invalid );
- exit(1);
- }
- waitpid(tc_bundle_imp_invalid ,NULL,WNOHANG);
-
- pid_t tc_bundle_add = fork();
- if ( tc_bundle_add == 0)
- {
- ret_bundle_add = TC_bundle_add();
- printf("TC_bundle_add\t%d\n",ret_bundle_add);
- exit(1);
- }
- waitpid(tc_bundle_add ,NULL,WNOHANG);
-
- pid_t tc_bundle_get_val = fork();
- if ( tc_bundle_get_val == 0)
- {
- ret_bundle_get_val = TC_bundle_get_val();
- printf("TC_bundle_get_val\t%d\n",ret_bundle_get_val);
- exit(1);
- }
- waitpid( tc_bundle_get_val ,NULL,WNOHANG);
-
- pid_t tc_bundle_dup = fork();
- if ( tc_bundle_dup == 0)
- {
- ret_bundle_dup = TC_bundle_dup_print();
- printf("TC_bundle_dup_print\t%d\n",ret_bundle_dup );
- exit(1);
- }
- waitpid( tc_bundle_dup ,NULL,WNOHANG);
-
- pid_t tc_bundle_encode = fork();
- if ( tc_bundle_encode == 0)
- {
- ret_bundle_encode = TC_bundle_encode();
- printf("TC_bundle_encode\t%d\n",ret_bundle_encode );
- exit(1);
- }
- waitpid( tc_bundle_encode ,NULL,WNOHANG);
-
- pid_t tc_bundle_decode = fork();
- if ( tc_bundle_decode == 0)
- {
- ret_bundle_decode = TC_bundle_decode();
- printf("TC_bundle_decode\t%d\n",ret_bundle_decode );
- exit(1);
- }
- waitpid( tc_bundle_decode ,NULL,WNOHANG);
-
- pid_t tc_bundle_free_encoded = fork();
- if ( tc_bundle_free_encoded == 0)
- {
- ret_bundle_free_encoded = TC_bundle_free_encoded_raw_data();
- printf("TC_bundle_free_encoded_raw_data\t%d\n",ret_bundle_free_encoded );
- exit(1);
- }
- waitpid( tc_bundle_free_encoded ,NULL,WNOHANG);
-#if 0
- pid_t tc_bundle_add_byte = fork();
- if ( tc_bundle_add_byte == 0)
- {
- ret_bundle_add_byte = TC_bundle_add_byte();
- printf("TC_bundle_add_byte\t%d\n",ret_bundle_add_byte );
- exit(1);
- }
- waitpid(tc_bundle_add_byte ,NULL,WNOHANG);
-
- pid_t tc_bundle_add_byte_arr = fork();
- if ( tc_bundle_add_byte_arr == 0)
- {
- ret_bundle_add_byte_arr = TC_bundle_add_byte_array();
- printf("TC_bundle_add_byte_array\t%d\n",ret_bundle_add_byte_arr );
- exit(1);
- }
- waitpid(tc_bundle_add_byte_arr ,NULL,WNOHANG);
-#endif
- pid_t tc_bundle_get_type = fork();
- if ( tc_bundle_get_type == 0)
- {
- ret_bundle_get_type = TC_bundle_get_type();
- printf("TC_bundle_get_type\t%d\n",ret_bundle_get_type );
- exit(1);
- }
- waitpid( tc_bundle_get_type ,NULL,WNOHANG);
-
- pid_t tc_keyval_is_array = fork();
- if ( tc_keyval_is_array == 0)
- {
- ret_keyval_is_array = TC_bundle_keyval_type_is_array();
- printf("TC_bundle_keyval_type_is_array\t%d\n",ret_keyval_is_array );
- exit(1);
- exit(1);
- }
- waitpid( tc_keyval_is_array ,NULL,WNOHANG);
-
- pid_t tc_keyval_get_basicval = fork();
- if ( tc_keyval_get_basicval == 0)
- {
- ret_keyval_get_basicval = TC_bundle_keyval_get_basic_val();
- printf("TC_bundle_keyval_get_basic_val\t%d\n",ret_keyval_get_basicval );
- exit(1);
- }
- waitpid( tc_keyval_get_basicval ,NULL,WNOHANG);
-#if 0
- pid_t tc_bundle_get_byte = fork();
- if ( tc_bundle_get_byte == 0)
- {
- ret_bundle_get_byte = TC_bundle_get_byte();
- printf("TC_bundle_get_byte\t%d\n",ret_bundle_get_byte );
- exit(1);
- }
- waitpid( tc_bundle_get_byte ,NULL,WNOHANG);
-
- pid_t tc_bundle_get_byte_arr = fork();
- if ( tc_bundle_get_byte_arr == 0)
- {
- ret_bundle_get_byte_arr = TC_bundle_get_byte_array();
- printf("TC_bundle_get_byte_array\t%d\n",ret_bundle_get_byte_arr );
- exit(1);
- }
- waitpid( tc_bundle_get_byte_arr ,NULL,WNOHANG);
-#endif
- pid_t tc_free_exp_argv = fork();
- if ( tc_free_exp_argv == 0)
- {
- ret_tc_free_exp_argv = TC_bundle_free_exported_argv();
- printf("TC_bundle_free_exported_argv\t%d\n",ret_tc_free_exp_argv );
- exit(1);
- }
- waitpid( tc_free_exp_argv ,NULL,WNOHANG);
-
- pid_t tc_bundle_del = fork();
- if ( tc_bundle_del == 0)
- {
- ret_bundle_del = TC_bundle_del();
- printf("TC_bundle_del\t%d\n",ret_bundle_del );
- exit(1);
- }
- waitpid( tc_bundle_del ,NULL,WNOHANG);
-
- pid_t tc_keyval_get_arrval = fork();
- if ( tc_keyval_get_arrval == 0)
- {
- ret_keyval_get_arrval = TC_bundle_keyval_get_array_val();
- printf("TC_bundle_keyval_get_array_val\t%d\n",ret_keyval_get_arrval );
- exit(1);
- }
- waitpid( tc_keyval_get_arrval ,NULL,WNOHANG);
-
- pid_t tc_bundle_get_str_arr = fork();
- if ( tc_bundle_get_str_arr == 0)
- {
- ret_bundle_get_str_arr = TC_bundle_get_str_array();
- printf("TC_bundle_get_str_array\t%d\n",ret_bundle_get_str_arr );
- exit(1);
- }
- waitpid( tc_bundle_get_str_arr ,NULL,WNOHANG);
-
- pid_t tc_bundle_add_str_arr = fork();
- if ( tc_bundle_add_str_arr == 0)
- {
- ret_bundle_add_str_arr = TC_bundle_add_str_array();
- printf("TC_bundle_add_str_array\t%d\n",ret_bundle_add_str_arr );
- exit(1);
- }
- waitpid( tc_bundle_add_str_arr ,NULL,WNOHANG);
-
- return 0;
-}
diff --git a/test/test_bundle.c b/test/test_bundle.c
deleted file mode 100755
index 7fa5f71..0000000
--- a/test/test_bundle.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * 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 <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include "bundle.h"
-
-void test_bundle_create(void)
-{
- bundle *b;
-
- b = bundle_create();
- assert(NULL != b);
-
- bundle_free(b);
-}
-
-void test_bundle_add_get(void)
-{
- bundle *b = NULL;
-
- /* new bundle */
- b = bundle_create();
- assert(0 == bundle_add(b, "key1", "val1"));
- assert(0 == bundle_add(b, "key2", "val2"));
-
- assert(0 == strcmp("val2", bundle_get_val(b, "key2")));
- assert(2 == bundle_get_count(b));
-
- /* key duplication check
- * If key is already exist, raise error code, and ignore new val.
- * old value is preserved.
- */
- assert(0 != bundle_add(b, "key1", "val123"));
- assert(EPERM == errno);
- /* still has "val1" for "key1" */
- assert(0 == strcmp("val1", bundle_get_val(b, "key1")));
- /* still count is 2 */
- assert(2 == bundle_get_count(b));
-
- /* 3rd val */
- bundle_add(b, "key3", "val3");
- assert(3 == bundle_get_count(b)); /* now 3 */
-
- bundle_free(b);
-}
-
-void test_bundle_add_invalid(void)
-{
- bundle *b;
-
- assert(0 != bundle_add(NULL, "a", "b"));
- assert(EINVAL == errno);
-
- b = bundle_create();
- assert(-1 == bundle_add(b, NULL, "val1"));
- assert(EKEYREJECTED == errno);
-
- assert(0 != bundle_add(b, "key1", NULL));
- assert(EINVAL == errno);
-
- assert(0 != bundle_add(b, "", "aaa"));
- assert(EKEYREJECTED == errno);
-
- bundle_free(b);
-}
-
-void test_bundle_get_invalid(void)
-{
- bundle *b;
-
- assert(NULL == bundle_get_val(NULL, "key1"));
- assert(EINVAL == errno);
-
- b = bundle_create();
-
- assert(NULL == bundle_get_val(b, "key4"));
- assert(ENOKEY == errno);
-
- assert(NULL == bundle_get_val(NULL, "aaa"));
- assert(EINVAL == errno);
-
- assert(NULL == bundle_get_val(b, NULL));
- assert(EKEYREJECTED == errno);
-
- bundle_free(b);
-}
-
-void iter_f(const char *key, const char *val, void *data)
-{
- char *keys[] = { "1", "2", "3" };
- char *vals[] = { "a", "b", "c" };
- int i;
-
- for (i = 0; i < 3; i++) {
- if (0 == strcmp(key, keys[i])) {
- assert(0 == strcmp(val, vals[i]));
- break;
- }
- }
-}
-
-void test_bundle_del(void)
-{
- bundle *b;
-
- assert(0 != bundle_del(NULL, "key"));
- assert(EINVAL == errno);
-
- b = bundle_create();
-
- assert(0 != bundle_del(b, NULL));
- assert(EKEYREJECTED == errno);
-
- assert(0 != bundle_del(b, ""));
- assert(EKEYREJECTED == errno);
-
- assert(0 != bundle_del(b, "key"));
- assert(ENOKEY == errno);
-
- assert(0 == bundle_get_count(b));
-
- bundle_add(b, "k1", "v1");
- const char *v = bundle_get_val(b, "k1");
- assert(NULL != v && 0 == strcmp("v1", v));
-
- assert(1 == bundle_get_count(b));
-
- assert(0 == bundle_del(b, "k1"));
- assert(NULL == bundle_get_val(b, "k1"));
- assert(ENOKEY == errno);
-
- assert(0 == bundle_get_count(b));
-
- bundle_free(b);
-}
-
-void test_bundle_iterate(void)
-{
- bundle *b;
-
- b = bundle_create();
-
- bundle_add(b, "1", "a");
- bundle_add(b, "2", "b");
- bundle_add(b, "3", "c");
-
- bundle_iterate(b, iter_f, NULL);
-
- bundle_free(b);
-}
-
-void test_bundle_encode_decode(void)
-{
- bundle *b1, *b2;
- bundle_raw *r;
- int size_r;
-
- b1 = bundle_create();
- bundle_add(b1, "k1", "v1");
- bundle_add(b1, "k2", "v2");
- bundle_encode(b1, &r, &size_r);
-
- /* show serialized data */
- /*
- char *c = r;
- for(; c < r+size_r; c++) {
- printf("%c", *c);
- if ('\0' == *c) printf("\n");
- }
- */
-
- b2 = bundle_decode(r, size_r);
-
- assert(0 == strcmp(bundle_get_val(b1, "k1"), bundle_get_val(b2, "k1")));
- assert(0 == strcmp(bundle_get_val(b1, "k2"), bundle_get_val(b2, "k2")));
-
- bundle_free(b1);
- bundle_free(b2);
- free(r);
-}
-
-void test_bundle_2byte_chars(void)
-{
- bundle *b;
- char *k1 = "?넝리언루aaabb?ㅏ?ss처푸?";
- char *v1 = "?ㅂ짜ccc?언sss루퍼?;
- char *k2 = "ljvvn?챂?ㅇ?징?풐;?sdfxa?ㅣ?ㅁ?;
- char *v2 = "axs?ㅇ?퍼?놔미ㅇ";
-
- b = bundle_create();
-
- bundle_add(b, k1, v1);
- assert(0 == strcmp(v1, bundle_get_val(b, k1)));
- bundle_add(b, k2, v2);
- assert(0 == strcmp(v2, bundle_get_val(b, k2)));
-
- bundle_free(b);
-}
-
-static void _dup_check_cb(const char *k, const char *v, void *data)
-{
- bundle *b = (bundle *) data;
-
- assert(0 == strcmp(bundle_get_val(b, k), v));
-}
-
-void test_bundle_dup(void)
-{
- bundle *b1, *b2;
- b1 = bundle_create();
- bundle_add(b1, "k1", "v1");
- bundle_add(b1, "k2", "v2");
-
- b2 = bundle_dup(b1);
-
- assert(NULL != b2);
- bundle_iterate(b2, _dup_check_cb, b1);
- assert(bundle_get_count(b1) == bundle_get_count(b2));
-
- bundle_free(b1);
- bundle_free(b2);
-}
-
-void test_bundle_convert_argv(void)
-{
-
- bundle *b1, *b2;
-
- b1 = bundle_create();
- bundle_add(b1, "k1", "v1");
- bundle_add(b1, "k2", "v2");
-
- /* export test */
- int argc = 0;
- char **argv = NULL;
- argc = bundle_export_to_argv(b1, &argv);
- assert(5 == argc);
- assert(NULL != argv);
- assert(NULL == argv[0]);
- assert(0 == strcmp("k1", argv[1]) && 0 == strcmp("v1", argv[2]));
- assert(0 == strcmp("k2", argv[3]) && 0 == strcmp("v2", argv[4]));
- assert(NULL == argv[5]); /* Last item must be NULL */
-
- /* import test */
- b2 = bundle_import_from_argv(argc, argv);
- assert(NULL != b2);
- assert(2 == bundle_get_count(b2));
- assert(0 == strcmp("v1", bundle_get_val(b2, "k1")));
- assert(0 == strcmp("v2", bundle_get_val(b2, "k2")));
-
- free(argv);
- bundle_free(b1);
- bundle_free(b2);
-}
-
-int main(int argc, char **argv)
-{
- test_bundle_create();
- test_bundle_add_get();
- test_bundle_add_invalid();
- test_bundle_get_invalid();
- test_bundle_del();
- test_bundle_iterate();
- test_bundle_encode_decode();
- test_bundle_2byte_chars();
- test_bundle_dup();
- test_bundle_convert_argv();
-
- return 0;
-}
-