-utc_eina_clist_move_head.c
-utc_eina_clist_move_tail.c
-utc_eina_clist_next.c
-utc_eina_clist_prev.c
-utc_eina_clist_remove.c
-utc_eina_clist_tail.c
-utc_eina_clist_add_after.c
-utc_eina_clist_add_before.c
-utc_eina_clist_add_head.c
-utc_eina_clist_add_tail.c
-utc_eina_clist_count.c
-utc_eina_clist_element_init.c
-utc_eina_clist_element_is_linked.c
-utc_eina_clist_empty.c
-utc_eina_clist_head.c
-utc_eina_clist_init.c
+utc_eina_clist.c
-utc_eina_clist_move_head.c
-utc_eina_clist_move_tail.c
-utc_eina_clist_next.c
-utc_eina_clist_prev.c
-utc_eina_clist_remove.c
-utc_eina_clist_tail.c
-utc_eina_clist_add_after.c
-utc_eina_clist_add_before.c
-utc_eina_clist_add_head.c
-utc_eina_clist_add_tail.c
-utc_eina_clist_count.c
-utc_eina_clist_element_init.c
-utc_eina_clist_element_is_linked.c
-utc_eina_clist_empty.c
-utc_eina_clist_head.c
-utc_eina_clist_init.c
+utc_eina_clist.c
-utc_eina_clist_move_head.c
-utc_eina_clist_move_tail.c
-utc_eina_clist_next.c
-utc_eina_clist_prev.c
-utc_eina_clist_remove.c
-utc_eina_clist_tail.c
-utc_eina_clist_add_after.c
-utc_eina_clist_add_before.c
-utc_eina_clist_add_head.c
-utc_eina_clist_add_tail.c
-utc_eina_clist_count.c
-utc_eina_clist_element_init.c
-utc_eina_clist_element_is_linked.c
-utc_eina_clist_empty.c
-utc_eina_clist_head.c
-utc_eina_clist_init.c
+utc_eina_clist.c
-utc_eina_clist_move_head.c
-utc_eina_clist_move_tail.c
-utc_eina_clist_next.c
-utc_eina_clist_prev.c
-utc_eina_clist_remove.c
-utc_eina_clist_tail.c
-utc_eina_clist_add_after.c
-utc_eina_clist_add_before.c
-utc_eina_clist_add_head.c
-utc_eina_clist_add_tail.c
-utc_eina_clist_count.c
-utc_eina_clist_element_init.c
-utc_eina_clist_element_is_linked.c
-utc_eina_clist_empty.c
-utc_eina_clist_head.c
-utc_eina_clist_init.c
+utc_eina_clist.c
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <eina_clist.h>
+
+typedef struct _List
+{
+ Eina_Clist* head;
+} List;
+
+/**
+ * @addtogroup eina
+ * @{
+ * @defgroup eina_clist
+ *
+ *
+ * @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_clist
+ * @{
+ * @defgroup eina_clist_pack_p
+ * @li eina_clist_element_init()
+ * @li eina_clist_init()
+ * @li eina_clist_add_head()
+ * @li eina_clist_count()
+ * @li eina_clist_tail()
+ * @li eina_clist_remove()
+ * @li eina_clist_next()
+ * @li eina_clist_element_is_linked()
+ * @li eina_clist_head()
+ * @li eina_clist_empty()
+ * @li eina_clist_add_tail()
+ * @li eina_clist_prev()
+ * @li eina_clist_move_tail()
+ * @li eina_clist_move_head()
+ * @li eina_clist_add_after()
+ * @li eina_clist_add_before()
+ * @{
+ * @objective Positive test case 01 checking if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Define a two lists entry in a struct List.
+ * @step 2 Call eina_clist_init() to initialize a source's clist head.
+ * @step 3 Check list count and list empty call eina_clist_empty().
+ * @step 4 Create an auxiliary array with pointers to a clist nodes with eina_clist_element_init().
+ * @step 5 Check element for linked by call eina_clist_element_is_linked().
+ * @step 6 Allocate clist new nodes and add them to the head of the source clist by calling eina_clist_add_head().
+ * @step 7 Get clist head by call eina_clist_head().
+ * @step 8 Call eina_clist_count() to check whether all elements have been added to the source clist.
+ * @step 9 Call eina_clist_tail() to get clist tail.
+ * @step 10 Call eina_clist_next() to get forward element and check if its uqual to one in the
+ * aux array.
+ * @step 11 Call eina_clist_prev() to get back element and check if its uqual to one in the
+ * aux array.
+ * @step 12 Add tail by call eina_clist_add_tail().
+ * @step 13 Move tail to new empty clist by call eina_clist_move_tail().
+ * @step 14 Check count of elements.
+ * @step 15 Move head to to new empty clist by call eina_clist_move_tail().
+ * @step 16 Check count of elements.
+ * @step 17 Call eina_clist_add_after() with correct parameters and check result.
+ * @step 18 Call eina_clist_add_before() with correct parameters and check result.
+ * @step 19 Call eina_clist_remove() to remove item from the clist and check result.
+ *
+ * @passcondition Test passes if returned values are the same as add values.
+ * @}
+ * @}
+ */
+START_TEST(utc_eina_clist_pack_p)
+{
+ List _list;
+ List _tail;
+ const int N = 3;
+ int count = 0;
+ List arr[N];
+ int i = 0;
+ int j = 0;
+
+ _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
+ if (_list.head == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ _tail.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
+ if (_tail.head == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eina_clist_init(_list.head);
+ if (eina_clist_count(_list.head) != 0)
+ {
+ free(_list.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ else if (!eina_clist_empty(_list.head))
+ {
+ free(_list.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ for (; i != N; ++i)
+ {
+ arr[i].head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
+ if (arr[i].head == NULL)
+ {
+ for (j = 0; j != i; j++)
+ {
+ free(arr[j].head);
+ }
+ free(_list.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eina_clist_element_init(arr[i].head);
+ if (eina_clist_element_is_linked(arr[i].head) != 0)
+ {
+ free(arr[i].head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eina_clist_add_head(_list.head, arr[i].head);
+ if (eina_clist_head(_list.head) != arr[i].head)
+ {
+ for (j = 0; j != i; j++)
+ {
+ free(arr[j].head);
+ }
+ free(_list.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ }
+
+ if (N != eina_clist_count(_list.head))
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_list.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ for (i = 0; i != N; ++i)
+ {
+ if (eina_clist_element_is_linked(arr[i].head) == 0)
+ {
+ free(arr[i].head);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ }
+
+ Eina_Clist* curr = _list.head;
+ Eina_Clist* tail = eina_clist_tail(_list.head);
+ i = 0;
+
+ while (curr != tail && NULL != curr)
+ {
+ curr = eina_clist_next(_list.head, curr);
+ if (arr[N - i - 1].head != curr)
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_list.head);
+ free(_tail.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ ++i;
+ }
+
+ i = 0;
+ tail = eina_clist_tail(_list.head);
+ while (tail != _list.head && NULL != tail)
+ {
+ if (arr[i++].head != tail)
+ {
+ for (; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_list.head);
+ free(_tail.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ tail = eina_clist_prev(_list.head, tail);
+ }
+
+ eina_clist_add_tail(_list.head, _tail.head);
+ tail = eina_clist_tail(_list.head);
+ if (tail != _tail.head)
+ {
+ free(_list.head);
+ free(_tail.head);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ Eina_Clist *clist = (Eina_Clist*)malloc(sizeof(Eina_Clist));
+ eina_clist_init(clist);
+ count = eina_clist_count(_list.head);
+ if (eina_clist_count(clist) != 0)
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_list.head);
+ free(_tail.head);
+ free(clist);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eina_clist_move_tail(clist, _list.head);
+ if (!eina_clist_empty(_list.head) || (eina_clist_count(clist) != count))
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_list.head);
+ free(_tail.head);
+ free(clist);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ free(_list.head);
+
+ Eina_Clist *clist2 = (Eina_Clist*)malloc(sizeof(Eina_Clist));
+ eina_clist_init(clist2);
+ eina_clist_add_tail(clist, _tail.head);
+ eina_clist_move_head(clist2, clist);
+ if (!eina_clist_empty(clist) || (eina_clist_count(clist2) != count))
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_tail.head);
+ free(clist);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ free(clist);
+
+ tail = eina_clist_tail(clist2);
+ eina_clist_add_after(tail, arr[1].head);
+ if (eina_clist_next(clist2, tail) != arr[1].head)
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_tail.head);
+ free(clist2);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ tail = eina_clist_head(clist2);
+ eina_clist_add_before(tail, arr[2].head);
+ if (eina_clist_prev(clist2, tail) != arr[2].head)
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_tail.head);
+ free(clist2);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eina_clist_remove(arr[2].head);
+ if (eina_clist_empty(arr[2].head) || (eina_clist_prev(clist2, tail) == arr[2].head))
+ {
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_tail.head);
+ free(clist2);
+
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ for (i = 0; i != N; ++i)
+ {
+ free(arr[i].head);
+ }
+ free(_tail.head);
+ free(clist2);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @}
+ */
+Suite *
+test_suite(void)
+{
+ Suite *suite = suite_create("utc_eina_clist");
+
+ TCase *tcase = tcase_create("TCase");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_eina_clist_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_clist.log");
+ srunner_set_xml(srunner, "utc_eina_clist.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_add_after eina_clist_add_after()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_add_after
- * @{
- * @objective Positive Test case 01: Check if the function add an element after the specified one.
- * @n Input Data:
- * @li an element in the list;
- * @li the element to add to the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Add to the list 3 elements.
- * @step 4 Add the element after the specified one.
- * @step 5 Check next and previous elements for added element.
- *
- * @passcondition: Test passes if element is added successfully to the right place and there is no segfault.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_add_after_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_after(clist_array[1].entry, clist_element.entry);
-
- if ((eina_clist_prev(clist_test.entry, clist_element.entry) != clist_array[1].entry) || (eina_clist_next(clist_test.entry, clist_element.entry) != clist_array[2].entry))
- {
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_add_after");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_add_after_p_1);
- 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_clist_add_after.log");
- srunner_set_xml(srunner, "utc_eina_clist_add_after.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_add_before eina_clist_add_before()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_add_before
- * @{
- * @objective Positive Test case 01: Check if the function add an element before the specified one.
- * @n Input Data:
- * @li an element in the list;
- * @li the element to add to the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Add to the list 3 elements.
- * @step 4 Add the element before the specified one.
- * @step 5 Check next and previous elements for added element.
- *
- * @passcondition: Test passes if element is added successfully to the right place and there is no segfault.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_add_before_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_before(clist_array[2].entry, clist_element.entry);
-
- if ((eina_clist_prev(clist_test.entry, clist_element.entry) != clist_array[1].entry) || (eina_clist_next(clist_test.entry, clist_element.entry) != clist_array[2].entry))
- {
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_add_before");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_add_before_p_1);
- 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_clist_add_before.log");
- srunner_set_xml(srunner, "utc_eina_clist_add_before.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_add_head eina_clist_add_head()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_add_head
- * @{
- * @objective Positive Test case 01: Check if the function add element at the head of the list.
- * @n Input Data:
- * @li the list;
- * @li the element to add to the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Add to the list 3 elements.
- * @step 4 Add element at the head of the list.
- * @step 5 Check added element to be in the head of the list.
- *
- * @passcondition: Test passes if element is added successfully to the head of the list and there is no segfault.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_add_head_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_head(clist_test.entry, clist_element.entry);
-
- if (eina_clist_head(clist_test.entry) != clist_element.entry)
- {
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_add_head");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_add_head_p_1);
- 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_clist_add_head.log");
- srunner_set_xml(srunner, "utc_eina_clist_add_head.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_add_tail eina_clist_add_tail()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_add_tail
- * @{
- * @objective Positive Test case 01: Check if the function add element at the tail of the list.
- * @n Input Data:
- * @li the list;
- * @li the element to add to the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Add to the list 3 elements.
- * @step 4 Add element at the tail of the list.
- * @step 5 Check added element to be in the tail of the list.
- *
- * @passcondition: Test passes if element is added successfully to the tail of the list and there is no segfault.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_add_tail_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_element.entry);
-
- if (eina_clist_tail(clist_test.entry) != clist_element.entry)
- {
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_element.entry);
- clist_element.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
- free(clist_test.entry);
-
- clist_test.entry = NULL;
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_add_tail");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_add_tail_p_1);
- 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_clist_add_tail.log");
- srunner_set_xml(srunner, "utc_eina_clist_add_tail.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_count eina_clist_count()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_count
- * @{
- * @objective Positive Test case 01: Check if the function correctly count the elements of the list.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Check number of elements of the list to be 0.
- * @step 4 Add to the list 3 elements.
- * @step 5 Check number of elements of the list to be 3.
- *
- * @passcondition: Test passes if returned number of elements is equal to the number of added elements.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_count_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- if (eina_clist_count(clist_test.entry) != 0)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Not enough memory", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- if (eina_clist_count(clist_test.entry) != n)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_test.entry);
- clist_test.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_count");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_count_p_1);
- 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_clist_count.log");
- srunner_set_xml(srunner, "utc_eina_clist_count.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_element_init eina_clist_element_init()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_element_init
- * @{
- * @objective Positive Test case 01: Initialize the list element.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list element.
- * @step 3 Check if the element is in any list.
- *
- * @passcondition: Test passes if the list element is not in any list and there is no segmentation fault.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_element_init_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_element_init(clist_element.entry);
-
- if (eina_clist_element_is_linked(clist_element.entry) != 0)
- {
- free(clist_element.entry);
- clist_element.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_element.entry);
- clist_element.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_element_init");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_element_init_p_1);
- 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_clist_element_init.log");
- srunner_set_xml(srunner, "utc_eina_clist_element_init.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_element_is_linked eina_clist_element_is_linked()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_element_is_linked
- * @{
- * @objective Positive Test case 01: Check if an element is in a list or not.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list element.
- * @step 3 Check if the element is in any list.
- *
- * @passcondition: Test passes if zero (not linked) is returned.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_element_is_linked_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_element_init(clist_element.entry);
-
- if (eina_clist_element_is_linked(clist_element.entry) != 0)
- {
- free(clist_element.entry);
- clist_element.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_element.entry);
- clist_element.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @addtogroup eina_clist_element_is_linked
- * @{
- * @objective Positive Test case 02: Check if an element is in a list or not.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Initialize the list element.
- * @step 4 Add the elements to the list.
- * @step 5 Check if the element is in any list.
- *
- * @passcondition: Test passes if non-zero (linked) is returned.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_element_is_linked_p_2)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- struct Compact_List clist_element;
- clist_element.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_element.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_element_init(clist_element.entry);
-
- eina_clist_add_tail(clist_test.entry, clist_element.entry);
- if (eina_clist_element_is_linked(clist_element.entry) == 0)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
- free(clist_element.entry);
- clist_element.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_test.entry);
- clist_test.entry = NULL;
- free(clist_element.entry);
- clist_element.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_element_is_linked");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_element_is_linked_p_1);
- tcase_add_test(tcase, utc_UIFW_eina_clist_element_is_linked_p_2);
- 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_clist_element_is_linked.log");
- srunner_set_xml(srunner, "utc_eina_clist_element_is_linked.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_empty eina_clist_empty()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_empty
- * @{
- * @objective Positive Test case 01: Check if a list is empty.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Check if the list is empty.
- *
- * @passcondition: Test passes if returned number is non-zero (list is empty).
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_empty_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- if (eina_clist_empty(clist_test.entry) == 0)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @addtogroup eina_clist_empty
- * @{
- * @objective Positive Test case 02: Check if the list is empty.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Add to the list 3 elements.
- * @step 4 Check if the list is empty.
- *
- * @passcondition: Test passes if returned number is zero (list is not empty).
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_empty_p_2)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- if (eina_clist_empty(clist_test.entry) != 0)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_test.entry);
- clist_test.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_empty");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_empty_p_1);
- tcase_add_test(tcase, utc_UIFW_eina_clist_empty_p_2);
- 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_clist_empty.log");
- srunner_set_xml(srunner, "utc_eina_clist_empty.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_head eina_clist_head()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_head
- * @{
- * @objective Positive Test case 01: Check if the function get the first element.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Add to the list 3 elements.
- * @step 4 Get the first element.
- *
- * @passcondition: Test passes if returned element is the first in the list.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_head_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- const int n = 3;
- struct Compact_List clist_array[n];
-
- int i = 0;
- int j = 0;
- for (i = 0; i != n; i++)
- {
- clist_array[i].entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_array[i].entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(clist_array[j].entry);
- clist_array[j].entry = NULL;
- }
- free(clist_test.entry);
- clist_test.entry = NULL;
- return;
- }
-
- eina_clist_add_tail(clist_test.entry, clist_array[i].entry);
- }
-
- if (eina_clist_head(clist_test.entry) != clist_array[0].entry)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_test.entry);
- clist_test.entry = NULL;
- for (i = 0; i != n; i++)
- {
- free(clist_array[i].entry);
- clist_array[i].entry = NULL;
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_head");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_head_p_1);
- 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_clist_head.log");
- srunner_set_xml(srunner, "utc_eina_clist_head.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>
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_init eina_clist_init()
- *
- * @precondition
- * @step 1 Initialize the Eina library.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eina_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eina_shutdown();
-}
-
-/**
- * @addtogroup eina_clist_init
- * @{
- * @objective Positive Test case 01: Initialize a list.
- * @n Input Data:
- * @li the list.
- *
- * @procedure
- * @step 1 Define the structure containing Eina_List* field.
- * @step 2 Initialize the list.
- * @step 3 Check if the list is empty.
- *
- * @passcondition: Test passes if the list is empty and there is no segmentation fault.
- * @}
- */
-START_TEST(utc_UIFW_eina_clist_init_p_1)
-{
- struct Compact_List
- {
- Eina_Clist* entry;
- };
-
- struct Compact_List clist_test;
- clist_test.entry = (Eina_Clist*) malloc(sizeof(Eina_Clist));
- if (clist_test.entry == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(clist_test.entry);
-
- if (eina_clist_empty(clist_test.entry) == 0)
- {
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(clist_test.entry);
- clist_test.entry = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- return;
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_init");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_UIFW_eina_clist_init_p_1);
- 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_clist_init.log");
- srunner_set_xml(srunner, "utc_eina_clist_init.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 <eina_clist.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_move_head eina_clist_move_head()
- *
- * @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_clist_move_head
- * @{
- * @objective Positive test case 01 checks whether elements from one eina_clist are moved into another clist
- * passing every new element to the front of the list
- * @n Input Data:
- * @li source clist
- * @li destination clist
- *
- * @procedure
- * @step 1 Define a list entry in a struct List
- * @step 2 Call eina_clist_init() to initialize a source's clist head
- * @step 3 Create an auxiliary array with pointers to a clist nodes
- * @step 4 Allocate clist new nodes and add them to the head of the source clist by calling eina_clist_add_head()
- * @step 5 Call eina_clist_count() to check whether all elements have been added to the source clist
- * @step 6 Create and init destination clist, add an element to its head and cache a pointer to the destination list head
- * @step 7 Call eina_clist_move_head() to move all elements from the source clist to the destination one
- * @step 8 Check whether the source list is empty and that the destination list size is equal to N
- * @step 9 Call eina_clist_tail() to get a pointer to the destination list's tail and check whether
- * @its equal to the cached pointer to the head
- *
- * @passcondition
- * @source clist contains N elements, after eina_clist_move_head() call source clist is empty and the destination list contains
- * @N elements and pointer to the head before eina_clist_move_head() call is equal to the pointer to the
- * @tail of the clist after move is happened
- * @}
- */
-START_TEST(utc_eina_clist_move_head_p_01)
-{
- struct List
- {
- Eina_Clist* head;
- };
-
- struct List _list;
- _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (_list.head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(_list.head);
-
- const int N = 3;
- struct List arr[N];
-
- int i = 0;
- int j = 0;
- for (; i != N; ++i)
- {
- arr[i].head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (arr[i].head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(arr[j].head);
- arr[j].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_element_init(arr[i].head);
- eina_clist_add_head(_list.head, arr[i].head);
- }
-
- if (N != eina_clist_count(_list.head))
- {
- i = 0;
- for(; i != N; ++i) {
- free(arr[i].head);
- }
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- Eina_Clist* dest_list = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (dest_list == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != N; i++)
- {
- free(arr[i].head);
- arr[i].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_init(dest_list);
-
- Eina_Clist* clist = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (clist == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != N; i++)
- {
- free(arr[i].head);
- arr[i].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- free(dest_list);
- dest_list = NULL;
- return;
- }
-
- eina_clist_add_head(dest_list, clist);
-
- Eina_Clist* dest_head_before_move = eina_clist_head(dest_list);
-
- //move all elements from src to the head of dst
- eina_clist_move_head(dest_list, _list.head);
- if ((!eina_clist_empty(_list.head) && N != eina_clist_count(dest_list)) ||
- (dest_head_before_move != eina_clist_tail(dest_list))) {
- for (i = 0; i != N; i++)
- {
- free(arr[i].head);
- arr[i].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- dest_head_before_move = eina_clist_head(dest_list);
- if (dest_head_before_move != NULL)
- free(eina_clist_next(dest_list, dest_head_before_move));
-
- free(dest_list);
- dest_list = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- i = 0;
- for(; i != N; ++i) {
- eina_clist_remove(arr[i].head);
- free(arr[i].head);
- arr[i].head = NULL;
- }
-
- free(_list.head);
- _list.head = NULL;
-
- dest_head_before_move = eina_clist_head(dest_list);
- if (dest_head_before_move != NULL)
- free(eina_clist_next(dest_list, dest_head_before_move));
-
- free(dest_list);
- dest_list = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_move_head");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_clist_move_head_p_01);
- 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_clist_move_head.log");
- srunner_set_xml(srunner, "utc_eina_clist_move_head.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 <eina_clist.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_move_tail eina_clist_move_tail()
- *
- * @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_clist_move_tail
- * @{
- * @objective Positive test case 01 checks whether elements from one eina_clist are moved into another clist
- * passing every new element to the end of the list
- * @n Input Data:
- * @li source clist
- * @li destination clist
- *
- * @procedure
- * @step 1 Define a list entry in a struct List
- * @step 2 Call eina_clist_init() to initialize a source's clist head
- * @step 3 Create an auxiliary array with pointers to a clist nodes
- * @step 4 Allocate clist new nodes and add them to the head of the source clist by calling eina_clist_add_head()
- * @step 5 Call eina_clist_count() to check whether all elements have been added to the source clist
- * @step 6 Create and init destination clist, add an element to its head and cache a pointer to the destination list tail
- * @step 7 Cache source list's head pointer
- * @step 8 Call eina_clist_move_tail() to move all elements from the source clist to the destination one
- * @step 9 Check whether the source list is empty and that the destination list size is equal to N
- * @step 10 Call eina_clist_next() passing destination list and cached pointer to the tail to get next added
- * @element pointer and check whether its equal to cached pointer to the source clist head
- *
- * @passcondition
- * @source clist contains N elements, after eina_clist_move_tail() call source clist is empty and the destination list contains N elements
- * @and next to the cached pointer to the destination clist tail is equal to the chached pointer to the source clist head
- * @}
- */
-START_TEST(utc_eina_clist_move_tail_p_01)
-{
- struct List
- {
- Eina_Clist* head;
- };
-
- struct List _list;
- _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (_list.head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(_list.head);
-
- const int N = 3;
- struct List arr[N];
-
- int i = 0;
- int j = 0;
- for (; i != N; ++i)
- {
- arr[i].head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (arr[i].head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(arr[j].head);
- arr[j].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_element_init(arr[i].head);
- eina_clist_add_head(_list.head, arr[i].head);
- }
-
- if (N != eina_clist_count(_list.head))
- {
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- Eina_Clist* dest_list = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (dest_list == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != N; i++)
- {
- free(arr[i].head);
- arr[i].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_init(dest_list);
-
- Eina_Clist* clist = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (clist == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (i = 0; i != N; i++)
- {
- free(arr[i].head);
- arr[i].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- free(dest_list);
- dest_list = NULL;
- return;
- }
-
- eina_clist_add_head(dest_list, clist);
- Eina_Clist* dest_tail = eina_clist_tail(dest_list);
- Eina_Clist* source_head = eina_clist_head(_list.head);
-
- eina_clist_move_tail(dest_list, _list.head);
- if ((!eina_clist_empty(_list.head) && N != eina_clist_count(dest_list)) ||
- (dest_tail == NULL) ||
- (eina_clist_next(dest_list, dest_tail) != source_head)) {
- for (i = 0; i != N; i++)
- {
- free(arr[i].head);
- arr[i].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- source_head = eina_clist_head(dest_list);
- if (source_head != NULL)
- free(eina_clist_next(dest_list, source_head));
- free(dest_list);
- dest_list = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- i = 0;
- for (; i != N; ++i)
- {
- eina_clist_remove(arr[i].head);
- free(arr[i].head);
- arr[i].head = NULL;
- }
-
- free(_list.head);
- _list.head = NULL;
-
- source_head = eina_clist_head(dest_list);
- if (source_head != NULL)
- free(eina_clist_next(dest_list, source_head));
-
- free(dest_list);
- dest_list = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_move_tail");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_clist_move_tail_p_01);
- 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_clist_move_tail.log");
- srunner_set_xml(srunner, "utc_eina_clist_move_tail.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 <eina_clist.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_next eina_clist_next()
- *
- * @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_clist_next
- * @{
- * @objective Positive test case 01 checks whether eina_clist_next() returns forward to item element
- * of the clist
- * @n Input Data:
- * @li clist
- * @li pointer to the current item
- *
- * @procedure
- * @step 1 Define a list entry in a struct List
- * @step 2 Call eina_clist_init() to initialize a source's clist head
- * @step 3 Create an auxiliary array with pointers to a clist nodes
- * @step 4 Allocate clist new nodes and add them to the head of the source clist by calling eina_clist_add_head()
- * @step 5 Call eina_clist_count() to check whether all elements have been added to the source clist
- * @step 6 Call eina_clist_next() to get forward element and check if its uqual to one in the
- * aux array
- *
- * @passcondition
- * @li Source clist contains N elements
- * @li each call of eina_clist_next() returns appropriate forward element of the clist
- * @}
- */
-START_TEST(utc_eina_clist_next_p_01)
-{
- struct List
- {
- Eina_Clist* head;
- };
-
- struct List _list;
- _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (_list.head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(_list.head);
-
- const int N = 3;
- struct List arr[N];
-
- int i = 0;
- int j = 0;
- for (; i != N; ++i)
- {
- arr[i].head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (arr[i].head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(arr[j].head);
- arr[j].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_element_init(arr[i].head);
- eina_clist_add_head(_list.head, arr[i].head);
- }
-
- if (N != eina_clist_count(_list.head))
- {
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- Eina_Clist* curr = _list.head;
- Eina_Clist* tail = eina_clist_tail(_list.head);
- i = 0;
-
- while (curr != tail && NULL != curr)
- {
- curr = eina_clist_next(_list.head, curr);
- if (arr[N-i-1].head != curr)
- {
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- ++i;
- }
-
- i = 0;
- for (; i != N; ++i)
- {
- eina_clist_remove(arr[i].head);
- free(arr[i].head);
- arr[i].head = NULL;
- }
-
- free(_list.head);
- _list.head = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_next");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_clist_next_p_01);
- 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_clist_next.log");
- srunner_set_xml(srunner, "utc_eina_clist_next.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 <eina_clist.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_prev eina_clist_prev()
- *
- * @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_clist_prev
- * @{
- * @objective Positive test case 01 checks whether eina_clist_prev() returns backward to item element
- * of the clist
- * @n Input Data:
- * @li clist
- * @li pointer to the current item
- *
- * @procedure
- * @step 1 Define a list entry in a struct List
- * @step 2 Call eina_clist_init() to initialize a source's clist head
- * @step 3 Create an auxiliary array with pointers to a clist nodes
- * @step 4 Allocate clist new nodes and add them to the head of the source clist by calling eina_clist_add_head()
- * @step 5 Call eina_clist_count() to check whether all elements have been added to the source clist
- * @step 6 Call eina_clist_prev() to get backward element and check if its uqual to one in the
- * aux array
- *
- * @passcondition
- * @li Source clist contains N elements
- * @li each call of eina_clist_prev() returns appropriate backward element of the clist
- * @}
- */
-START_TEST(utc_eina_clist_prev_p_01)
-{
- struct List
- {
- Eina_Clist* head;
- };
-
- struct List _list;
- _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (_list.head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(_list.head);
-
- const int N = 3;
- struct List arr[N];
-
- int i = 0;
- int j = 0;
- for (; i != N; ++i)
- {
- arr[i].head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (arr[i].head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Not enough memory", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(arr[j].head);
- arr[j].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_element_init(arr[i].head);
- eina_clist_add_head(_list.head, arr[i].head);
- }
-
- if (N != eina_clist_count(_list.head))
- {
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- Eina_Clist* curr = eina_clist_tail(_list.head);
- i = 0;
-
- while (curr != _list.head && NULL != curr)
- {
- if (arr[i++].head != curr)
- {
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- curr = eina_clist_prev(_list.head, curr);
- }
-
- i = 0;
- for (; i != N; ++i)
- {
- eina_clist_remove(arr[i].head);
- free(arr[i].head);
- arr[i].head = NULL;
- }
-
- free(_list.head);
- _list.head = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_prev");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_clist_prev_p_01);
- 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_clist_prev.log");
- srunner_set_xml(srunner, "utc_eina_clist_prev.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 <eina_clist.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_remove eina_clist_remove()
- *
- * @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_clist_remove
- * @{
- * @objective Positive test case 01 checks whether element is removed successfully from a clist
- * @n Input Data:
- * @li source clist
- * @li clist element to remove
- *
- * @procedure
- * @step 1 Define a list entry in a struct List
- * @step 2 Call eina_clist_init() to initialize a source's clist head
- * @step 3 Create element and add it to the clist
- * @step 4 Check whether added element is linked e.g. is a list item
- * @step 5 Call eina_clist_remove() to remove item from the clist
- * @step 6 Check whether clist is empty
- *
- * @passcondition
- * @li Initially added to clist item is linked
- * @li After removing an item from clist, clist is empty
- * @}
- */
-START_TEST(utc_eina_clist_remove_p_01)
-{
- struct List
- {
- Eina_Clist* head;
- };
-
- struct List _list;
- _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (_list.head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(_list.head);
-
- Eina_Clist* p_elem = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (p_elem == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_element_init(p_elem);
- eina_clist_add_head(_list.head, p_elem);
-
- Eina_Clist* source_head = eina_clist_head(_list.head);
- if ((source_head == NULL) || (!eina_clist_element_is_linked(source_head)))
- {
- free(p_elem);
- p_elem = NULL;
- free(_list.head);
- _list.head = NULL;
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_remove(source_head);
- if (!eina_clist_empty(_list.head))
- {
- free(p_elem);
- free(_list.head);
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- free(p_elem);
- p_elem = NULL;
-
- free(_list.head);
- _list.head = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_remove");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_clist_remove_p_01);
- 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_clist_remove.log");
- srunner_set_xml(srunner, "utc_eina_clist_remove.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 <eina_clist.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_clist
- * @{
- * @defgroup eina_clist_tail eina_clist_tail()
- *
- * @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_clist_tail
- * @{
- * @objective Positive test case 01 checks whether eina_clist_tail returns appropriate tail element
- * @n Input Data:
- * @li source clist
- *
- * @procedure
- * @step 1 Define a list entry in a struct List
- * @step 2 Call eina_clist_init() to initialize a source's clist head
- * @step 3 Create an auxiliary array with pointers to a clist nodes
- * @step 4 Allocate clist new nodes and add them to the head of the source clist by calling eina_clist_add_head()
- * @step 5 Call eina_clist_count() to check whether all elements have been added to the source clist
- * @step 6 Call eina_clist_tail() to get pointer to a back element of the clist
- * @step 7 Check whether tail pointer is equal to one from aux array
- *
- * @passcondition
- * @li Source clist contains N elements
- * @li eina_clist_tail returns correct pointer to a tail clist item
- * @}
- */
-START_TEST(utc_eina_clist_tail_p_01)
-{
- struct List
- {
- Eina_Clist* head;
- };
-
- struct List _list;
- _list.head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (_list.head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- eina_clist_init(_list.head);
-
- const int N = 3;
- struct List arr[N];
-
- int i = 0;
- int j = 0;
- for (; i != N; ++i)
- {
- arr[i].head = (Eina_Clist*)malloc(sizeof(Eina_Clist));
- if (arr[i].head == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- for (j = 0; j != i; j++)
- {
- free(arr[j].head);
- arr[j].head = NULL;
- }
- free(_list.head);
- _list.head = NULL;
- return;
- }
-
- eina_clist_element_init(arr[i].head);
- eina_clist_add_head(_list.head, arr[i].head);
- }
-
- if (N != eina_clist_count(_list.head))
- {
- free(_list.head);
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- if (arr[0].head != eina_clist_tail(_list.head))
- {
- free(_list.head);
- i = 0;
- for (; i != N; ++i)
- {
- free(arr[i].head);
- }
-
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
-
- i = 0;
- for (; i != N; ++i)
- {
- eina_clist_remove(arr[i].head);
- free(arr[i].head);
- arr[i].head = NULL;
- }
-
- free(_list.head);
- _list.head = NULL;
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_clist_tail");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_clist_tail_p_01);
- 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_clist_tail.log");
- srunner_set_xml(srunner, "utc_eina_clist_tail.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}