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
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);
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},
{"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}
};
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);
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},
{"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}
};
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);
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},
{"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}
};
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}