[UTC][bundle][ACR-1432][Add new testcases] 42/212642/3
authorHwankyu Jhun <h.jhun@samsung.com>
Sat, 24 Aug 2019 14:10:32 +0000 (23:10 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Aug 2019 22:45:11 +0000 (07:45 +0900)
Change-Id: I0e7c1f4f3cc25242199718b5d0f792565a9721b9
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/utc/bundle/CMakeLists.txt
src/utc/bundle/tct-bundle-core_mobile.h
src/utc/bundle/tct-bundle-core_tizeniot.h
src/utc/bundle/tct-bundle-core_wearable.h
src/utc/bundle/utc-ApplicationFW-bundle-add-byte-array-func.c [new file with mode: 0755]
src/utc/bundle/utc-ApplicationFW-bundle-get-byte-array-func.c [new file with mode: 0755]
src/utc/bundle/utc-ApplicationFW-bundle-set-byte-array-element-func.c [new file with mode: 0755]

index b3240221be92bd77f836cf0469d3e3d418efc69a..79e7624dc848603ee3908478f0b0bc68845f27aa 100644 (file)
@@ -23,6 +23,9 @@ SET(TC_SOURCES
     utc-ApplicationFW-bundle-keyval.c
     utc-ApplicationFW-bundle-keyval-get-basic-val-func.c
     utc-ApplicationFW-bundle-keyval-get-array-val-func.c
+    utc-ApplicationFW-bundle-add-byte-array-func.c
+    utc-ApplicationFW-bundle-set-byte-array-element-func.c
+    utc-ApplicationFW-bundle-get-byte-array-func.c
 )
 
 PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
index 40079f8e0916e4b599ee74ac5570c8d9e184c526..532b150273a0e3393aa57dd48e29650078d1062c 100755 (executable)
@@ -29,6 +29,12 @@ extern void utc_ApplicationFW_bundle_add_str_array_startup(void);
 extern void utc_ApplicationFW_bundle_add_str_array_cleanup(void);
 extern void utc_ApplicationFW_bundle_get_str_array_startup(void);
 extern void utc_ApplicationFW_bundle_get_str_array_cleanup(void);
+extern void utc_ApplicationFW_bundle_add_byte_array_startup(void);
+extern void utc_ApplicationFW_bundle_add_byte_array_cleanup(void);
+extern void utc_ApplicationFW_bundle_set_byte_array_element_startup(void);
+extern void utc_ApplicationFW_bundle_set_byte_array_element_cleanup(void);
+extern void utc_ApplicationFW_bundle_get_byte_array_startup(void);
+extern void utc_ApplicationFW_bundle_get_byte_array_cleanup(void);
 
 extern int utc_ApplicationFW_bundle_create_p(void);
 extern int utc_ApplicationFW_bundle_decode_p1(void);
@@ -83,6 +89,13 @@ extern int utc_bundle_keyval_get_basic_val_p(void);
 extern int utc_bundle_keyval_get_basic_val_n(void);
 extern int utc_bundle_keyval_get_array_val_p(void);
 extern int utc_bundle_keyval_get_array_val_n(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_p(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_n1(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_n2(void);
+extern int utc_ApplicationFW_bundle_set_byte_array_element_p(void);
+extern int utc_ApplicationFW_bundle_set_byte_array_element_n(void);
+extern int utc_ApplicationFW_bundle_get_byte_array_p(void);
+extern int utc_ApplicationFW_bundle_get_byte_array_n(void);
 
 testcase tc_array[] = {
        {"utc_ApplicationFW_bundle_create_p",utc_ApplicationFW_bundle_create_p,NULL,NULL},
@@ -138,6 +151,13 @@ testcase tc_array[] = {
        {"utc_bundle_keyval_get_basic_val_n",utc_bundle_keyval_get_basic_val_n,NULL,NULL},
        {"utc_bundle_keyval_get_array_val_p",utc_bundle_keyval_get_array_val_p,NULL,NULL},
        {"utc_bundle_keyval_get_array_val_n",utc_bundle_keyval_get_array_val_n,NULL,NULL},
+       {"utc_ApplicationFW_bundle_add_byte_array_p",utc_ApplicationFW_bundle_add_byte_array_p,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_add_byte_array_n1",utc_ApplicationFW_bundle_add_byte_array_n1,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_add_byte_array_n2",utc_ApplicationFW_bundle_add_byte_array_n2,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_set_byte_array_element_p",utc_ApplicationFW_bundle_set_byte_array_element_p,utc_ApplicationFW_bundle_set_byte_array_element_startup,utc_ApplicationFW_bundle_set_byte_array_element_cleanup},
+       {"utc_ApplicationFW_bundle_set_byte_array_element_n",utc_ApplicationFW_bundle_set_byte_array_element_n,utc_ApplicationFW_bundle_set_byte_array_element_startup,utc_ApplicationFW_bundle_set_byte_array_element_cleanup},
+       {"utc_ApplicationFW_bundle_get_byte_array_p",utc_ApplicationFW_bundle_get_byte_array_p,utc_ApplicationFW_bundle_get_byte_array_startup,utc_ApplicationFW_bundle_get_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_get_byte_array_n",utc_ApplicationFW_bundle_get_byte_array_n,utc_ApplicationFW_bundle_get_byte_array_startup,utc_ApplicationFW_bundle_get_byte_array_cleanup},
        {NULL, NULL}
 };
 
index 40079f8e0916e4b599ee74ac5570c8d9e184c526..532b150273a0e3393aa57dd48e29650078d1062c 100755 (executable)
@@ -29,6 +29,12 @@ extern void utc_ApplicationFW_bundle_add_str_array_startup(void);
 extern void utc_ApplicationFW_bundle_add_str_array_cleanup(void);
 extern void utc_ApplicationFW_bundle_get_str_array_startup(void);
 extern void utc_ApplicationFW_bundle_get_str_array_cleanup(void);
+extern void utc_ApplicationFW_bundle_add_byte_array_startup(void);
+extern void utc_ApplicationFW_bundle_add_byte_array_cleanup(void);
+extern void utc_ApplicationFW_bundle_set_byte_array_element_startup(void);
+extern void utc_ApplicationFW_bundle_set_byte_array_element_cleanup(void);
+extern void utc_ApplicationFW_bundle_get_byte_array_startup(void);
+extern void utc_ApplicationFW_bundle_get_byte_array_cleanup(void);
 
 extern int utc_ApplicationFW_bundle_create_p(void);
 extern int utc_ApplicationFW_bundle_decode_p1(void);
@@ -83,6 +89,13 @@ extern int utc_bundle_keyval_get_basic_val_p(void);
 extern int utc_bundle_keyval_get_basic_val_n(void);
 extern int utc_bundle_keyval_get_array_val_p(void);
 extern int utc_bundle_keyval_get_array_val_n(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_p(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_n1(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_n2(void);
+extern int utc_ApplicationFW_bundle_set_byte_array_element_p(void);
+extern int utc_ApplicationFW_bundle_set_byte_array_element_n(void);
+extern int utc_ApplicationFW_bundle_get_byte_array_p(void);
+extern int utc_ApplicationFW_bundle_get_byte_array_n(void);
 
 testcase tc_array[] = {
        {"utc_ApplicationFW_bundle_create_p",utc_ApplicationFW_bundle_create_p,NULL,NULL},
@@ -138,6 +151,13 @@ testcase tc_array[] = {
        {"utc_bundle_keyval_get_basic_val_n",utc_bundle_keyval_get_basic_val_n,NULL,NULL},
        {"utc_bundle_keyval_get_array_val_p",utc_bundle_keyval_get_array_val_p,NULL,NULL},
        {"utc_bundle_keyval_get_array_val_n",utc_bundle_keyval_get_array_val_n,NULL,NULL},
+       {"utc_ApplicationFW_bundle_add_byte_array_p",utc_ApplicationFW_bundle_add_byte_array_p,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_add_byte_array_n1",utc_ApplicationFW_bundle_add_byte_array_n1,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_add_byte_array_n2",utc_ApplicationFW_bundle_add_byte_array_n2,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_set_byte_array_element_p",utc_ApplicationFW_bundle_set_byte_array_element_p,utc_ApplicationFW_bundle_set_byte_array_element_startup,utc_ApplicationFW_bundle_set_byte_array_element_cleanup},
+       {"utc_ApplicationFW_bundle_set_byte_array_element_n",utc_ApplicationFW_bundle_set_byte_array_element_n,utc_ApplicationFW_bundle_set_byte_array_element_startup,utc_ApplicationFW_bundle_set_byte_array_element_cleanup},
+       {"utc_ApplicationFW_bundle_get_byte_array_p",utc_ApplicationFW_bundle_get_byte_array_p,utc_ApplicationFW_bundle_get_byte_array_startup,utc_ApplicationFW_bundle_get_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_get_byte_array_n",utc_ApplicationFW_bundle_get_byte_array_n,utc_ApplicationFW_bundle_get_byte_array_startup,utc_ApplicationFW_bundle_get_byte_array_cleanup},
        {NULL, NULL}
 };
 
index 40079f8e0916e4b599ee74ac5570c8d9e184c526..532b150273a0e3393aa57dd48e29650078d1062c 100755 (executable)
@@ -29,6 +29,12 @@ extern void utc_ApplicationFW_bundle_add_str_array_startup(void);
 extern void utc_ApplicationFW_bundle_add_str_array_cleanup(void);
 extern void utc_ApplicationFW_bundle_get_str_array_startup(void);
 extern void utc_ApplicationFW_bundle_get_str_array_cleanup(void);
+extern void utc_ApplicationFW_bundle_add_byte_array_startup(void);
+extern void utc_ApplicationFW_bundle_add_byte_array_cleanup(void);
+extern void utc_ApplicationFW_bundle_set_byte_array_element_startup(void);
+extern void utc_ApplicationFW_bundle_set_byte_array_element_cleanup(void);
+extern void utc_ApplicationFW_bundle_get_byte_array_startup(void);
+extern void utc_ApplicationFW_bundle_get_byte_array_cleanup(void);
 
 extern int utc_ApplicationFW_bundle_create_p(void);
 extern int utc_ApplicationFW_bundle_decode_p1(void);
@@ -83,6 +89,13 @@ extern int utc_bundle_keyval_get_basic_val_p(void);
 extern int utc_bundle_keyval_get_basic_val_n(void);
 extern int utc_bundle_keyval_get_array_val_p(void);
 extern int utc_bundle_keyval_get_array_val_n(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_p(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_n1(void);
+extern int utc_ApplicationFW_bundle_add_byte_array_n2(void);
+extern int utc_ApplicationFW_bundle_set_byte_array_element_p(void);
+extern int utc_ApplicationFW_bundle_set_byte_array_element_n(void);
+extern int utc_ApplicationFW_bundle_get_byte_array_p(void);
+extern int utc_ApplicationFW_bundle_get_byte_array_n(void);
 
 testcase tc_array[] = {
        {"utc_ApplicationFW_bundle_create_p",utc_ApplicationFW_bundle_create_p,NULL,NULL},
@@ -138,6 +151,13 @@ testcase tc_array[] = {
        {"utc_bundle_keyval_get_basic_val_n",utc_bundle_keyval_get_basic_val_n,NULL,NULL},
        {"utc_bundle_keyval_get_array_val_p",utc_bundle_keyval_get_array_val_p,NULL,NULL},
        {"utc_bundle_keyval_get_array_val_n",utc_bundle_keyval_get_array_val_n,NULL,NULL},
+       {"utc_ApplicationFW_bundle_add_byte_array_p",utc_ApplicationFW_bundle_add_byte_array_p,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_add_byte_array_n1",utc_ApplicationFW_bundle_add_byte_array_n1,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_add_byte_array_n2",utc_ApplicationFW_bundle_add_byte_array_n2,utc_ApplicationFW_bundle_add_byte_array_startup,utc_ApplicationFW_bundle_add_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_set_byte_array_element_p",utc_ApplicationFW_bundle_set_byte_array_element_p,utc_ApplicationFW_bundle_set_byte_array_element_startup,utc_ApplicationFW_bundle_set_byte_array_element_cleanup},
+       {"utc_ApplicationFW_bundle_set_byte_array_element_n",utc_ApplicationFW_bundle_set_byte_array_element_n,utc_ApplicationFW_bundle_set_byte_array_element_startup,utc_ApplicationFW_bundle_set_byte_array_element_cleanup},
+       {"utc_ApplicationFW_bundle_get_byte_array_p",utc_ApplicationFW_bundle_get_byte_array_p,utc_ApplicationFW_bundle_get_byte_array_startup,utc_ApplicationFW_bundle_get_byte_array_cleanup},
+       {"utc_ApplicationFW_bundle_get_byte_array_n",utc_ApplicationFW_bundle_get_byte_array_n,utc_ApplicationFW_bundle_get_byte_array_startup,utc_ApplicationFW_bundle_get_byte_array_cleanup},
        {NULL, NULL}
 };
 
diff --git a/src/utc/bundle/utc-ApplicationFW-bundle-add-byte-array-func.c b/src/utc/bundle/utc-ApplicationFW-bundle-add-byte-array-func.c
new file mode 100755 (executable)
index 0000000..e0e6bd4
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2019 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 <stdio.h>
+#include <bundle.h>
+
+#include "assert.h"
+
+static bundle *b = NULL;
+
+void utc_ApplicationFW_bundle_add_byte_array_startup(void)
+{
+       b = bundle_create();
+}
+
+void utc_ApplicationFW_bundle_add_byte_array_cleanup(void)
+{
+       bundle_free(b);
+}
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_add_byte_array_p
+ * @since_tizen         5.5
+ * @description         Adds an 'array of byte sequences' type key-value pair into a bundle.
+ * @scenario            Calls bundle_add_byte_array() and then checks the result.
+ */
+int utc_ApplicationFW_bundle_add_byte_array_p(void)
+{
+       int ret;
+
+       assert_neq(b, NULL);
+
+       ret = bundle_add_byte_array(b, "byte_array", 4);
+       assert_eq(ret, BUNDLE_ERROR_NONE);
+
+       ret = bundle_get_type(b, "byte_array");
+       assert_eq(ret, BUNDLE_TYPE_BYTE_ARRAY);
+
+       return 0;
+}
+
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_add_byte_array_n1
+ * @since_tizen         5.5
+ * @description         Adds an 'array of byte sequences' type key-value pair into a bundle.
+ * @scenario            Calls bundle_add_byte_array() twice.
+ *                      And then checks the result.
+ *                      The result value should be BUNDLE_ERROR_KEY_EXISTS.
+ */
+int utc_ApplicationFW_bundle_add_byte_array_n1(void)
+{
+       int ret;
+
+       assert_neq(b, NULL);
+
+       ret = bundle_add_byte_array(b, "byte_array", 4);
+       assert_eq(ret, BUNDLE_ERROR_NONE);
+
+       ret = bundle_add_byte_array(b, "byte_array", 4);
+       assert_eq(ret, BUNDLE_ERROR_KEY_EXISTS);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_add_byte_array_n2
+ * @since_tizen         5.5
+ * @description         Adds an 'array of byte sequences' type key-value pair into a bundle.
+ * @scenario            Calls bundle_add_byte_array() with invalid parameter.
+ *                      The result value should be BUNDLE_ERROR_INVALID_PARAMETER.
+ */
+int utc_ApplicationFW_bundle_add_byte_array_n2(void)
+{
+       int ret;
+
+       ret = bundle_add_byte(NULL, NULL, NULL, 0);
+       assert_eq(ret, BUNDLE_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
diff --git a/src/utc/bundle/utc-ApplicationFW-bundle-get-byte-array-func.c b/src/utc/bundle/utc-ApplicationFW-bundle-get-byte-array-func.c
new file mode 100755 (executable)
index 0000000..e916f86
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2019 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 <stdio.h>
+#include <bundle.h>
+
+#include "assert.h"
+
+static bundle *b = NULL;
+
+void utc_ApplicationFW_bundle_get_byte_array_startup(void)
+{
+       b = bundle_create();
+       bundle_add_byte_array(b, "byte_array", 3);
+       bundle_set_byte_array_element(b, "byte_array", 0, "aaa\0", 4);
+       bundle_set_byte_array_element(b, "byte_array", 1, "bbb\0", 4);
+       bundle_set_byte_array_element(b, "byte_array", 2, "ccc\0", 4);
+}
+
+void utc_ApplicationFW_bundle_get_byte_array_cleanup(void)
+{
+       bundle_free(b);
+}
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_get_byte_array_p
+ * @since_tizen         5.5
+ * @description         Gets the array of byte sequences with the given key.
+ * @scenario            Calls bundle_get_byte_array() and then checks the result.
+ */
+int utc_ApplicationFW_bundle_get_byte_array_p(void)
+{
+       int ret;
+       void **byte_array = NULL;
+       unsigned int len = 0;
+       unsigned int *array_element_size = NULL;
+
+       assert_neq(b, NULL);
+
+       ret = bundle_get_byte_array(b, "byte_array", &byte_array, &len, &array_element_size);
+       assert_eq(ret, BUNDLE_ERROR_NONE);
+
+       assert_neq(byte_array, NULL);
+       assert_neq(len, 0);
+       assert_neq(array_element_size, NULL);
+
+       assert_eq(array_element_size[0], 4);
+       assert_eq(array_element_size[1], 4);
+       assert_eq(array_element_size[2], 4);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_get_byte_array_n
+ * @since_tizen         5.5
+ * @description         Gets the array of byte sequences with the given key.
+ * @scenario            Calls bundle_set_byte_array_element() and then checks the result.
+ */
+int utc_ApplicationFW_bundle_get_byte_array_n(void)
+{
+       int ret;
+
+       assert_neq(b, NULL);
+
+       ret = bundle_get_byte_array(NULL, NULL, NULL, NULL, NULL);
+       assert_eq(ret, BUNDLE_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
diff --git a/src/utc/bundle/utc-ApplicationFW-bundle-set-byte-array-element-func.c b/src/utc/bundle/utc-ApplicationFW-bundle-set-byte-array-element-func.c
new file mode 100755 (executable)
index 0000000..c1bb358
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2019 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 <stdio.h>
+#include <bundle.h>
+
+#include "assert.h"
+
+static bundle *b = NULL;
+
+void utc_ApplicationFW_bundle_set_byte_array_element_startup(void)
+{
+       b = bundle_create();
+       bundle_add_byte_array(b, "byte_array", 3);
+}
+
+void utc_ApplicationFW_bundle_set_byte_array_element_cleanup(void)
+{
+       bundle_free(b);
+}
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_set_byte_array_element_p
+ * @since_tizen         5.5
+ * @description         Sets an element of an array of byte sequences.
+ * @scenario            Calls bundle_set_byte_array_element() and then checks the result.
+ */
+int utc_ApplicationFW_bundle_set_byte_array_element_p(void)
+{
+       int ret;
+
+       assert_neq(b, NULL);
+
+       ret = bundle_set_byte_array_element(b, "byte_array", 0, "aaa\0", 4);
+       assert_eq(ret, BUNDLE_ERROR_NONE);
+
+       ret = bundle_set_byte_array_element(b, "byte_array", 1, "bbb\0", 4);
+       assert_eq(ret, BUNDLE_ERROR_NONE);
+
+       ret = bundle_set_byte_array_element(b, "byte_array", 2, "ccc\0", 4);
+       assert_eq(ret, BUNDLE_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_ApplicationFW_bundle_set_byte_array_element_n
+ * @since_tizen         5.5
+ * @description         Sets an element of an array of byte sequences.
+ * @scenario            Calls bundle_set_byte_array_element() and then checks the result.
+ */
+int utc_ApplicationFW_bundle_set_byte_array_element_n(void)
+{
+       int ret;
+
+       assert_neq(b, NULL);
+
+       ret = bundle_set_byte_array_element(NULL, NULL, -1, NULL, 0);
+       assert_eq(ret, BUNDLE_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}