-utc_eina_accessor_clone.c
-utc_eina_accessor_free.c
-utc_eina_accessor_data_get.c
-utc_eina_accessor_container_get.c
-utc_eina_accessor_over.c
-utc_eina_accessor_lock.c
-utc_eina_accessor_unlock.c
+utc_eina_accessor.c
-utc_eina_accessor_clone.c
-utc_eina_accessor_free.c
-utc_eina_accessor_data_get.c
-utc_eina_accessor_container_get.c
-utc_eina_accessor_over.c
-utc_eina_accessor_lock.c
-utc_eina_accessor_unlock.c
+utc_eina_accessor.c
-#utc_eina_accessor_clone.c
-utc_eina_accessor_free.c
-utc_eina_accessor_data_get.c
-utc_eina_accessor_container_get.c
-utc_eina_accessor_over.c
-utc_eina_accessor_lock.c
-utc_eina_accessor_unlock.c
+utc_eina_accessor.c
-#utc_eina_accessor_clone.c
-utc_eina_accessor_free.c
-utc_eina_accessor_data_get.c
-utc_eina_accessor_container_get.c
-utc_eina_accessor_over.c
-utc_eina_accessor_lock.c
-utc_eina_accessor_unlock.c
+utc_eina_accessor.c
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+
+Eina_Bool inited = EINA_FALSE;
+int data_counter = 0;
+int counter = 0;
+
+Eina_Bool callback(const void *container, void *data, void *fdata)
+{
+ ++counter;
+ return EINA_TRUE;
+}
+
+Eina_Bool callback2(const void *container, void *data, void *fdata)
+{
+ int *c = (int *)fdata;
+ *c += 1;
+ data_counter = *c;
+ return EINA_TRUE;
+}
+
+/**
+ * @addtogroup eina
+ * @{
+ * @defgroup eina_accessor
+ *
+ *
+ * @precondition
+ * @step 1 Initialize eina library with eina_init()
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ eina_init();
+}
+
+static void
+teardown(void)
+{
+ printf(" ============ Cleanup ============ \n");
+ eina_shutdown();
+}
+
+/**
+ * @addtogroup eina_accessor
+ * @{
+ * @defgroup eina_accessor_pack_p
+ * @li eina_accessor_clone()
+ * @li eina_accessor_data_get()
+ * @li eina_accessor_free()
+ * @li eina_accessor_container_get()
+ * @li eina_accessor_lock()
+ * @li eina_accessor_unlock()
+ * @li eina_accessor_over()
+ * @{
+ * @objective Positive test case checking if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Create eina array.
+ * @step 2 Allocate data for 34 items and push them to array.
+ * @step 3 Create accessor for array.
+ * @step 4 Get data by accessor from 10-th item from array by call eina_accessor_data_get().
+ * @step 5 Check if value of data is equal 10.
+ * @step 6 Clone accessor by call eina_accessor_clone().
+ * @step 7 Get data by cloned accessor from 10-th item from array.
+ * @step 8 Check if value of data is equal 10.
+ * @step 9 Check container of cloned accessor by call eina_accessor_container_get().
+ * @step 10 Invoke eina_accessor_over with pointer to user data.
+ * @step 11 Check if 'count' equals 10 - it should be increased in the callback.
+ * @step 12 Call eina_accessor_unlock() to unlock the accessor.
+ * @step 13 Lock the accessor by call eina_accessor_lock().
+ * For API eina_accessor_lock/unlock, due to documentation none of the existing eina data structures are lockable,
+ * and if the container isn't lockable, function will return EINA_TRUE. Therefore function should return EINA_TRUE but shouldn't
+ * actually lock given data structure.
+ * @step 14 Call tested function to unlock the accessor again.
+ * @step 15 Call eina_accessor_free().
+ *
+ * @passcondition: Test passes if returned values are the same as add values.
+ * @}
+ * @}
+ */
+START_TEST(utc_eina_accessor_pack_p)
+{
+ Eina_Array *array = NULL;
+ Eina_Accessor *acc = NULL;
+ Eina_Accessor *acc_clone = NULL;
+ int *data;
+ int count = 0;
+ int i;
+ char *item;
+ Eina_Array_Iterator iterator;
+
+ array = eina_array_new(11);
+ if (!array)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < 34; ++i)
+ {
+ data = malloc(sizeof(int));
+ if (!data)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ *data = i;
+ eina_array_push(array, data);
+ }
+
+ acc = eina_array_accessor_new(array);
+ if (!acc)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if (eina_accessor_data_get(acc, 10, (void **)&data) != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if ((!data) || (*data != 10))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ acc_clone = eina_accessor_clone(acc);
+ if (!acc_clone)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if (eina_accessor_data_get(acc_clone, 10, (void **)&data) != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if ((!data) || (*data != 10))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if (eina_accessor_container_get(acc_clone) != array)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eina_accessor_over(acc, callback2, 0, 10, &count);
+ if (data_counter != 10)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. %d", __FILE__, __LINE__, data_counter);
+ }
+ counter = 0;
+
+ eina_accessor_over(acc, callback, 0, 10, NULL);
+ if (counter != 10)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ if (eina_accessor_unlock(acc) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned EINA_FALSE (for not locked accessor)..", __FILE__, __LINE__);
+ }
+/* Due to documentation none of the existing eina data structures are lockable, and if the container
+ isn't lockable, function will return EINA_TRUE. Therefore function should return EINA_TRUE but shouldn't
+ actually lock given data structure. */
+ if (eina_accessor_lock(acc) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Accessor is not locked..", __FILE__, __LINE__);
+ }
+/* Due to documentation none of the existing eina data structures are lockable, and if the container
+ isn't lockable, function will return EINA_TRUE. Therefore function should return EINA_TRUE but shouldn't
+ actually lock given data structure. */
+ if (eina_accessor_unlock(acc) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned EINA_FALSE (for locked accessor)..", __FILE__, __LINE__);
+ }
+
+ eina_accessor_free(acc_clone);
+ eina_accessor_free(acc);
+ EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
+ free(item);
+ eina_array_free(array);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+Suite *
+test_suite(void)
+{
+ Suite *suite = suite_create("utc_eina_accessor");
+
+ TCase *tcase = tcase_create("TCase");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_eina_accessor_pack_p);
+ suite_add_tcase(suite, tcase);
+
+ return suite;
+}
+
+int
+main()
+{
+ int number_failed;
+
+ Suite *suite = test_suite();
+ SRunner *srunner = srunner_create(suite);
+ srunner_set_log(srunner, "utc_eina_accessor.log");
+ srunner_set_xml(srunner, "utc_eina_accessor.xml");
+ srunner_run_all(srunner, CK_NORMAL);
+ number_failed = srunner_ntests_failed(srunner);
+ srunner_free(srunner);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-
-Eina_Bool inited = EINA_FALSE;
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_clone eina_accessor_clone()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_clone
- * @{
- * @objective Positive test case checks if function returns the container of an accessor properly.
- * @n Input Data: pointer to Eina_Accessor.
- *
- * @procedure
- * @step 1 Create eina array;
- * @step 2 Allocate data for 34 items and push them to array;
- * @step 3 Create accessor for array;
- * @step 4 Get data by accessor from 10-th item from array;
- * @step 5 Check if value of data is equal 10;
- * @step 6 Clone accessor;
- * @step 7 Get data by cloned accessor from 10-th item from array;
- * @step 8 Check if value of data is equal 10;
- * @step 9 Check if container of cloned accessor is equal to array;
- *
- * @passcondition: Function returns a non-NULL pointer that points to new accessor, cloned accessor works properly.
- * Container of cloned accessor is array.
- * @}
- */
-START_TEST(utc_eina_accessor_clone_p)
-{
- Eina_Array *array = NULL;
- Eina_Accessor *acc = NULL;
- Eina_Accessor *acc_clone = NULL;
- int *data;
- int i;
- char *item;
- Eina_Array_Iterator iterator;
-
- array = eina_array_new(11);
- if (!array)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- for (i = 0; i < 34; ++i)
- {
- data = malloc(sizeof(int));
- if (!data)
- {
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- *data = i;
-
- eina_array_push(array, data);
- }
-
- acc = eina_array_accessor_new(array);
- if (!acc)
- {
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- if (eina_accessor_data_get(acc, 10, (void **)&data) != EINA_TRUE)
- {
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- if ((!data) || (*data != 10))
- {
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- acc_clone = eina_accessor_clone(acc);
- if (!acc_clone)
- {
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- if (eina_accessor_data_get(acc_clone, 10, (void **)&data) != EINA_TRUE)
- {
- eina_accessor_free(acc_clone);
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- if ((!data) || (*data != 10))
- {
- eina_accessor_free(acc_clone);
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- if (eina_accessor_container_get(acc_clone) != array)
- {
- eina_accessor_free(acc_clone);
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- eina_accessor_free(acc_clone);
- eina_accessor_free(acc);
- EINA_ARRAY_ITER_NEXT(array, i, item, iterator)
- free(item);
- eina_array_free(array);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_clone
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of pointer to Eina_Accessor.
- * @n Input Data: NULL as pointer to accessor.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eina_accessor_clone_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(NULL, eina_accessor_clone, NULL) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_clone");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_clone_p);
- tcase_add_test(tcase, utc_eina_accessor_clone_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_clone.log");
- srunner_set_xml(srunner, "utc_eina_accessor_clone.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-Eina_Array *array = NULL;
-Eina_Accessor *acc = NULL;
-
-Eina_Bool inited = EINA_FALSE;
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_container_get eina_accessor_container_get()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- * @step 2 Create an Eina_Array
- * @step 3 Create an accessor for the array
- * @step 4 Push test string to the array
- * @step 5 Set global 'inited' variable to EINA_TRUE
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
- array = eina_array_new(1);
- acc = eina_array_accessor_new(array);
-
- if (!array)
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Eina_Array is not created..", __FILE__, __LINE__);
- }
- else if (!acc)
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Eina_Accessor is not created..", __FILE__, __LINE__);
- }
- else if (eina_array_push(array, "test") == EINA_FALSE )
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Data is not added to Eina_Array..", __FILE__, __LINE__);
- }
- else
- {
- inited = EINA_TRUE;
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_array_free(array);
- eina_accessor_free(acc);
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_container_get
- * @{
- * @objective Positive test case checks if function returns the container of an accessor properly.
- * @n Input Data: pointer to Eina_Accessor.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Call tested function to get container and check if it has the same address as array
- * the accessor was created for
- *
- * @passcondition: Function returns a non-NULL pointer that points to global Eina_Array that
- * the accessor was created for.
- * @}
- */
-START_TEST(utc_eina_accessor_container_get_p)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- void *ptr = eina_accessor_container_get(acc);
-
- if (ptr != array)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_container_get
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of pointer to Eina_Accessor.
- * @n Input Data: NULL as pointer to accessor.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eina_accessor_container_get_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(NULL, eina_accessor_container_get, NULL) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_container_get
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns NULL if given accessor has no function to get container.
- * @n Input Data: pointer to accessor.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Set get_container (accessor's pointer to function to get container) to NULL
- * @step 3 Call tested function to get container
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eina_accessor_container_get_n2)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- acc->get_container = NULL;
-
- if (eina_accessor_container_get(acc))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_container_get");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_container_get_p);
- tcase_add_test(tcase, utc_eina_accessor_container_get_n);
- tcase_add_test(tcase, utc_eina_accessor_container_get_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_container_get.log");
- srunner_set_xml(srunner, "utc_eina_accessor_container_get.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-Eina_Array *array = NULL;
-Eina_Accessor *acc = NULL;
-
-Eina_Bool inited = EINA_FALSE;
-const char *strings[] =
-{
- "even0", "odd0", "even1", "odd1", "even2", "odd2", "even3", "odd3", "even4", "odd4"
-};
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_data_get eina_accessor_data_get()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- * @step 2 Create an Eina_Array
- * @step 3 Create an accessor for the array
- * @step 4 Fill the array with 10 test strings
- * @step 5 Set global 'inited' variable to EINA_TRUE
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
- array = eina_array_new(10);
-
- if (!array)
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Eina_Array is not created..", __FILE__, __LINE__);
- return;
- }
- acc = eina_array_accessor_new(array);
-
- if (!acc)
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Eina_Accessor is not created..", __FILE__, __LINE__);
- return;
- }
- unsigned int i = 0;
-
- while (i < 10)
- {
- if (eina_array_push(array, strings[i++]) == EINA_FALSE )
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Data is not added to Eina_Array..", __FILE__, __LINE__);
- return;
- }
- }
- inited = EINA_TRUE;
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_array_free(array);
- eina_accessor_free(acc);
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_data_get
- * @{
- * @objective Positive test case checks if function returns the data of an accessor at a given position properly.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li 4 as position of the element to get;
- * @li pointer to local variable 'data' to write value of the element - output parameter.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Call tested function to get data of 5th element (with index 4)
- * @step 3 Check returned value and compare data with proper value from 'string' array
- *
- * @passcondition Function returns EINA_TRUE, got and set data are the same.
- * @}
- */
-START_TEST(utc_eina_accessor_data_get_p)
-{
- void *data = NULL;
- int result = TEST_FAIL;
-
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- else if (eina_accessor_data_get(acc, 4, &data) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned EINA_FALSE..", __FILE__, __LINE__);
- }
- else if (!data || strcmp(data, strings[4]))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Set and got values are not equal..", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- result = TEST_PASS;
- }
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_data_get
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns EINA_FALSE if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li 4 as position of the element to get;
- * @li pointer to local variable 'data' to write value of the element - output parameter.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Call function 2 times and pass (in turn) NULL instead of accessor and data to write value
- *
- * @passcondition Function doesn't cause segmentation fault and returns EINA_FALSE.
- * @}
- */
-START_TEST(utc_eina_accessor_data_get_n)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- void *data = NULL;
-
- CREATE_CHECKED_ARGS_ARRAY(1,0,1);
- UNITEST_FUNC_NEG_CA_RET(EINA_FALSE, eina_accessor_data_get, acc, 4, &data);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_data_get
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns EINA_FALSE if it is called with incorrect position of the element.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li 20 as position of the element to get;
- * @li pointer to local variable 'data' to write value of the element - output parameter.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Call tested function to get data and pass incorrect position 20 - array contains only 10 elements
- *
- * @passcondition Function doesn't cause segmentation fault, returns EINA_FALSE and writes nothing to output parameter.
- * @}
- */
-START_TEST(utc_eina_accessor_data_get_n2)
-{
- void *data = NULL;
- int result = TEST_FAIL;
-
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- else if (eina_accessor_data_get(acc, 20, &data) == EINA_TRUE || data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- result = TEST_PASS;
- }
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_data_get
- * @{
- * @objective Negative test case 3 checks if function doesn't cause segmentation fault
- * and returns EINA_FALSE if given accessor has no function to get data.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li 4 as position of the element to get;
- * @li pointer to local variable 'data' to write value of the element - output parameter.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Set get_at (accessor's pointer to function to get data) to NULL
- * @step 3 Call tested function to get data
- *
- * @passcondition Function doesn't cause segmentation fault, returns EINA_FALSE and writes nothing to output parameter.
- * @}
- */
-START_TEST(utc_eina_accessor_data_get_n3)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- void *data = NULL;
- acc->get_at = NULL;
-
- if (eina_accessor_data_get(acc, 4, &data) == EINA_TRUE || data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_data_get");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_data_get_p);
- tcase_add_test(tcase, utc_eina_accessor_data_get_n);
- tcase_add_test(tcase, utc_eina_accessor_data_get_n2);
- tcase_add_test(tcase, utc_eina_accessor_data_get_n3);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_data_get.log");
- srunner_set_xml(srunner, "utc_eina_accessor_data_get.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_free eina_accessor_free()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_free
- * @{
- * @objective Positive test case checks if function removes given accessor and frees memory properly.
- * @n Input Data: pointer to Eina_Accessor.
- *
- * @procedure
- * @step 1 Create new Eina_Array
- * @step 2 Create new Eina_Accessor for the array
- * @step 3 Call tested function to free the accessor
- *
- * @passcondition Function executes successfully.
- * @}
- */
-START_TEST(utc_eina_accessor_free_p)
-{
- Eina_Array *array = eina_array_new(10);
-
- if (!array)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Array is not created..", __FILE__, __LINE__);
- return;
- }
- Eina_Accessor *acc = eina_array_accessor_new(array);
-
- if (!acc)
- {
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Accessor is not created..", __FILE__, __LINE__);
- return;
- }
- eina_accessor_free(acc);
-
- eina_array_free(array);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_free
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of pointer to Eina_Accessor.
- * @n Input Data: NULL as pointer to accessor.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eina_accessor_free_n)
-{
-
- UNITEST_FUNC_NEG(eina_accessor_free, NULL);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_free
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * if given accessor has no function to free itself.
- * @n Input Data: pointer to accessor.
- *
- * @procedure
- * @step 1 Create new Eina_Array
- * @step 2 Create new Eina_Accessor for the array
- * @step 3 Set accessor free function acc->free to NULL
- * @step 4 Call tested function to free the accessor
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eina_accessor_free_n2)
-{
- Eina_Array *array = eina_array_new(10);
-
- if (!array)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Array is not created..", __FILE__, __LINE__);
- return;
- }
- Eina_Accessor *acc = eina_array_accessor_new(array);
-
- if (!acc)
- {
- eina_array_free(array);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Accessor is not created..", __FILE__, __LINE__);
- return;
- }
- acc->free = NULL;
-
- eina_accessor_free(acc);
-
- eina_array_free(array);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_free");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_free_p);
- tcase_add_test(tcase, utc_eina_accessor_free_n);
- tcase_add_test(tcase, utc_eina_accessor_free_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_free.log");
- srunner_set_xml(srunner, "utc_eina_accessor_free.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-
-static int count = 0;
-
-Eina_Bool callback(const void *container, void *data, void *fdata)
-{
- printf("[TEST_MSG]:: %s[%d] : enter cb", __FILE__, __LINE__);
- int *c = (int *) fdata;
- *c = *c + 1;
- count = *c;
- return EINA_TRUE;
-}
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_lock eina_accessor_lock()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_lock
- * @{
- * @objective Positive test case checks if function executes successfully and returns EINA_TRUE.
- * Due to documentation none of the existing eina data structures are lockable, and if the container
- * isn't lockable, function will return EINA_TRUE. Therefore function should return EINA_TRUE
- * but shouldn't actually lock given data structure.
- * @n Input Data: pointer to Eina_Accessor.
- *
- * @procedure
- * @step 1 Create an Eina_Array
- * @step 2 Push an element to the array
- * @step 3 Create an accessor for the array
- * @step 4 Lock the accessor
- * @step 5 Invoke eina_accessor_over
- * @step 6 Clean up
- * @step 7 Verify that eina_accessor_over causes invocation of callback
- *
- * @passcondition: Function returns EINA_TRUE, callback is called (passed integer is increased).
- * @}
- */
-START_TEST(utc_eina_accessor_lock_p)
-{
- int data_count = 0;
- int result = TEST_FAIL;
- Eina_Array *array = eina_array_new(10);
- Eina_Accessor *acc = eina_array_accessor_new(array);
-
- if (!array)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Array is not created..", __FILE__, __LINE__);
- }
- else if (!acc)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Accessor is not created..", __FILE__, __LINE__);
- }
- else if (eina_array_push(array, "strings") == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Data is not added to Eina_Array..", __FILE__, __LINE__);
- }
- else if (eina_accessor_lock(acc) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned EINA_FALSE..", __FILE__, __LINE__);
- }
- else
- {
- eina_accessor_over(acc, callback, 0, 1, &data_count);
-
- if (count != 1)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Callback is not called..", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- result = TEST_PASS;
- }
- }
- eina_array_free(array);
- eina_accessor_free(acc);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_lock
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns EINA_FALSE if it is called with NULL instead of pointer to Eina_Accessor.
- * @n Input Data: NULL as pointer to accessor.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument
- *
- * @passcondition Function doesn't cause segmentation fault and returns EINA_FALSE.
- * @}
- */
-START_TEST(utc_eina_accessor_lock_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(EINA_FALSE, eina_accessor_lock, NULL) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_lock");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_lock_p);
- tcase_add_test(tcase, utc_eina_accessor_lock_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_lock.log");
- srunner_set_xml(srunner, "utc_eina_accessor_lock.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-Eina_Array *array = NULL;
-Eina_Accessor *acc = NULL;
-
-Eina_Bool inited = EINA_FALSE;
-int data_counter = 0;
-int counter = 0;
-
-Eina_Bool callback(const void *container, void *data, void *fdata)
-{
- ++counter;
- return EINA_TRUE;
-}
-
-Eina_Bool callback2(const void *container, void *data, void *fdata)
-{
- int *c = (int *)fdata;
- *c += 1;
- data_counter = *c;
- return EINA_TRUE;
-}
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_over eina_accessor_over()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- * @step 2 Create an Eina_Array
- * @step 3 Create an accessor for the array
- * @step 4 Fill the array with 10 test strings
- * @step 5 Set global 'inited' variable to EINA_TRUE
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
- array = eina_array_new(10);
-
- if (!array)
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Eina_Array is not created..", __FILE__, __LINE__);
- return;
- }
- acc = eina_array_accessor_new(array);
-
- if (!acc)
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Eina_Accessor is not created..", __FILE__, __LINE__);
- return;
- }
- unsigned int i = 0;
- const char *strings[] = {
- "even0", "odd0", "even1", "odd1", "even2", "odd2", "even3", "odd3", "even4", "odd4"
- };
-
- while (i < 10)
- {
- if (eina_array_push(array, strings[i++]) == EINA_FALSE )
- {
- ck_abort_msg("[TET_MSG]:: %s[%d] : Data is not added to Eina_Array..", __FILE__, __LINE__);
- return;
- }
- }
- inited = EINA_TRUE;
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_array_free(array);
- eina_accessor_free(acc);
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_over
- * @{
- * @objective Positive test case 1 checks if function iterates over the container and executes
- * a callback if it is called with pointer to user data.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li callback function to be called on the chosen elements;
- * @li 0 as position of the first element;
- * @li 10 as position of the last element;
- * @li pointer to local variable 'count' with value 0 as user data.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Invoke eina_accessor_over with pointer to user data
- * @step 3 Check if 'count' equals 10 - it should be increased in the callback
- *
- * @passcondition: Local variable 'count' equals 10, it means that tested function has caused
- * invocation of the callback for every element in passed range.
- * @}
- */
-START_TEST(utc_eina_accessor_over_p)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- int count = 0;
-
- eina_accessor_over(acc, callback2, 0, 10, &count);
-
- if (data_counter != 10)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. %d", __FILE__, __LINE__, data_counter);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_over
- * @{
- * @objective Positive test case 2 checks if function iterates over the container and executes
- * a callback if it is called with NULL instead of pointer to user data (it's optional parameter).
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li callback function to be called on the chosen elements;
- * @li 0 as position of the first element;
- * @li 10 as position of the last element;
- * @li NULL as pointer to user data.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Invoke eina_accessor_over with NULL as pointer to user data
- * @step 3 Check if global variable 'counter' equals 10 - it should be increased in the callback
- *
- * @passcondition: Global variable 'counter' equals 10, it means that tested function has caused
- * invocation of the callback for every element in passed range.
- * @}
- */
-START_TEST(utc_eina_accessor_over_p2)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- counter = 0;
-
- eina_accessor_over(acc, callback, 0, 10, NULL);
-
- if (counter != 10)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_over
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and callback invocation if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li callback function to be called on the chosen elements;
- * @li 0 as position of the first element;
- * @li 10 as position of the last element;
- * @li NULL as pointer to user data.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Call function 2 times and pass (in turn) NULL instead of accessor and callback
- * @step 3 Check if global variable 'counter' equals 0 - it means that callback hasn't been called
- *
- * @passcondition Function doesn't cause segmentation and callback invocation.
- * @}
- */
-START_TEST(utc_eina_accessor_over_n)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- counter = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(1,1,0,0,0);
- UNITEST_FUNC_NEG_CA(eina_accessor_over, acc, callback, 0, 10, NULL);
-
- if (counter)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_over
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault and
- * invocation of callback if it is called with incorrect range of elements to iterate over it.
- * Due to documentation position of the last element must be greater than the first one.
- * @n Input Data:
- * @li pointer to Eina_Accessor;
- * @li callback function to be called on the chosen elements;
- * @li 10/5 as position of the first element for first/second call;
- * @li 10/2 as position of the last element for first/second call;
- * @li NULL as pointer to user data.
- *
- * @procedure
- * @step 1 Check if global variable 'inited' equals EINA_TRUE
- * @step 2 Call function wit incorrect range (10,10)
- * @step 3 Call function wit incorrect range (5,2)
- * @step 4 Check if global variable 'counter' equals 0 - it means that callback hasn't been called
- *
- * @passcondition Function doesn't cause segmentation fault and callback invocation.
- * @}
- */
-START_TEST(utc_eina_accessor_over_n2)
-{
- if (inited == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- counter = 0;
-
- eina_accessor_over(acc, callback, 10, 10, NULL);
- eina_accessor_over(acc, callback, 5, 2, NULL);
-
- if (counter)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_over");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_over_p);
- tcase_add_test(tcase, utc_eina_accessor_over_p2);
- tcase_add_test(tcase, utc_eina_accessor_over_n);
- tcase_add_test(tcase, utc_eina_accessor_over_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_over.log");
- srunner_set_xml(srunner, "utc_eina_accessor_over.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_accessor
- * @{
- * @defgroup eina_accessor_unlock eina_accessor_unlock()
- *
- *
- * @precondition
- * @step 1 Initialize eina library with eina_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_accessor_unlock
- * @{
- * @objective Positive test case checks if function executes successfully and returns EINA_TRUE.
- * Due to documentation none of the existing eina data structures are lockable, and if the container
- * isn't lockable, function will return EINA_TRUE. Therefore function should return EINA_TRUE on step 3
- * in spite of its container isn't actually locked.
- * @n Input Data: pointer to Eina_Accessor.
- *
- * @procedure
- * @step 1 Create an Eina_Array
- * @step 2 Create an accessor for the array
- * @step 3 Call tested function to unlock the accessor
- * @step 4 Lock the accessor
- * @step 5 Call tested function to unlock the accessor again
- * @step 6 Clean up
- *
- * @passcondition: Function returns EINA_TRUE for both cases.
- * @}
- */
-START_TEST(utc_eina_accessor_unlock_p)
-{
- int result = TEST_FAIL;
- Eina_Array *array = eina_array_new(10);
- Eina_Accessor *acc = eina_array_accessor_new(array);
-
- if (!array)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Array is not created..", __FILE__, __LINE__);
- }
- else if (!acc)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eina_Accessor is not created..", __FILE__, __LINE__);
- }
- else if (eina_accessor_unlock(acc) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned EINA_FALSE (for not locked accessor)..", __FILE__, __LINE__);
- }
- else if (eina_accessor_lock(acc) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Accessor is not locked..", __FILE__, __LINE__);
- }
- else if (eina_accessor_unlock(acc) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned EINA_FALSE (for locked accessor)..", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- result = TEST_PASS;
- }
- eina_array_free(array);
- eina_accessor_free(acc);
-}
-END_TEST
-
-/**
- * @addtogroup eina_accessor_unlock
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns EINA_FALSE if it is called with NULL instead of pointer to Eina_Accessor.
- * @n Input Data: NULL as pointer to accessor.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument
- *
- * @passcondition Function doesn't cause segmentation fault and returns EINA_FALSE.
- * @}
- */
-START_TEST(utc_eina_accessor_unlock_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(EINA_FALSE, eina_accessor_unlock, NULL) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_accessor_unlock");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_accessor_unlock_p);
- tcase_add_test(tcase, utc_eina_accessor_unlock_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eina_accessor_unlock.log");
- srunner_set_xml(srunner, "utc_eina_accessor_unlock.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}