-utc_eina_binshare_del.c
-utc_eina_binshare_add_length.c
-utc_eina_binshare_dump.c
-utc_eina_binshare_length.c
-utc_eina_binshare_ref.c
-utc_eina_binshare_init_shutdown.c
\ No newline at end of file
+utc_eina_binshare.c
-utc_eina_binshare_del.c
-utc_eina_binshare_add_length.c
-utc_eina_binshare_dump.c
-utc_eina_binshare_length.c
-utc_eina_binshare_ref.c
-utc_eina_binshare_init_shutdown.c
\ No newline at end of file
+utc_eina_binshare.c
-utc_eina_binshare_del.c
-utc_eina_binshare_add_length.c
-utc_eina_binshare_dump.c
-utc_eina_binshare_length.c
-utc_eina_binshare_ref.c
-#utc_eina_binshare_init_shutdown.c
\ No newline at end of file
+utc_eina_binshare.c
-utc_eina_binshare_del.c
-utc_eina_binshare_add_length.c
-utc_eina_binshare_dump.c
-utc_eina_binshare_length.c
-utc_eina_binshare_ref.c
-#utc_eina_binshare_init_shutdown.c
\ No newline at end of file
+utc_eina_binshare.c
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <stdio.h>
+#include <string.h>
+
+/**
+ * @addtogroup eina
+ * @{
+ * @defgroup eina_binshare
+ *
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+}
+
+static void
+teardown(void)
+{
+ printf(" ============ Cleanup ============ \n");
+}
+
+/**
+ * @addtogroup eina_binshare
+ * @{
+ * @defgroup eina_binshare_pack_p
+ * @li eina_binshare_dump()
+ * @li eina_binshare_add()
+ * @li eina_binshare_ref()
+ * @li eina_binshare_del()
+ * @li eina_binshare_length()
+ * @li eina_binshare_add_length()
+ * @li eina_binshare_shutdown()
+ * @li eina_binshare_init()
+ * @{
+ * @objective Positive test case checking if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Call eina_binshare_init().
+ * @step 2 Create shared object from string "test" by call eina_binshare_add().
+ * @step 3 Get reference to the instance by call eina_binshare_ref().
+ * @step 4 Close standard output stream stdout
+ * @step 5 Reopen stdout to write output to test file.
+ * @step 6 Dump the contents of the share_common by call eina_binshare_dump().
+ * @step 7 Close stdout again to flush data on the disk.
+ * @step 8 Open the file that should contain dumped data in reading mode.
+ * @step 9 Get numbers of bytes in the file.
+ * @step 10 Allocate memory to load data from the file.
+ * @step 11 Read the file to the buffer.
+ * @step 12 Check if the buffer contains substring "DDD" - according to documentation function.
+ * dumps all objects to stdout with this prefix.
+ * @step 13 Call eina_binshare_del().
+ * @step 14 Create string "test" as object to share by call eina_binshare_add_length().
+ * @step 15 Get length of the instance by call eina_binshare_length().
+ * @step 16 Check result.
+ * @step 17 Call eina_binshare_shutdown().
+ *
+ * @passcondition Test passes if returned values are the same as add values.
+ * @}
+ * @}
+ */
+START_TEST(utc_eina_binshare_pack_p)
+{
+ const char *fname = "binshare_dump_test";
+ char *buf = NULL;
+ FILE *f = NULL;
+ FILE *old_std_out = stdout;
+ long sz = 0;
+
+ if (!eina_binshare_init())
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ const void *ptr = eina_binshare_add("test");
+ if (!ptr)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Shared object is NULL..", __FILE__, __LINE__);
+ }
+
+ const void *ret = eina_binshare_ref(ptr);
+ if (ret != ptr)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ stdout = fopen(fname, "w");
+ if (!stdout)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. stdout is not reopened to write in file..", __FILE__, __LINE__);
+ }
+ eina_binshare_dump();
+ fclose(stdout);
+ stdout = old_std_out;
+ f = fopen(fname, "r");
+
+ if (!f)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. File is not opened for reading..", __FILE__, __LINE__);
+ }
+ else if (fseek(f, 0, SEEK_END))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'fseek' to the end error..", __FILE__, __LINE__);
+ }
+ else if ((sz = ftell(f)) <= 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'ftell' error.. maybe dump file is empty..", __FILE__, __LINE__);
+ }
+ else if (fseek(f, 0, SEEK_SET))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'fseek' to the start error..", __FILE__, __LINE__);
+ }
+ else if (!(buf = malloc(2 * sz + 1)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'malloc' error..", __FILE__, __LINE__);
+ }
+ else if (!fread(buf, 1, sz, f))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'fread' error..", __FILE__, __LINE__);
+ }
+ else
+ {
+ buf[sz] = '\0';
+
+ if (!strstr(buf, "DDD"))
+ {
+ if (f) fclose(f);
+ free(buf);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Dump file doesn't contain 'DDD' prefix:\n", __FILE__, __LINE__);
+ }
+ }
+ eina_binshare_del(ptr);
+ eina_binshare_del(ret);
+
+ const void *retl1 = eina_binshare_add_length("test_string", 5);
+ const void *retl2 = eina_binshare_add_length("test_string", 5);
+ if (!retl1 || retl1 != retl2 || !strcmp((const char *)retl1, "test_string") || strncmp(retl1, "test_" , 5))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ int length = eina_binshare_length(retl1);
+ eina_binshare_del(retl1);
+ eina_binshare_del(retl2);
+ if (length != 5)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ if (!eina_binshare_shutdown())
+ {
+ 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_binshare");
+
+ TCase *tcase = tcase_create("TCase");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_eina_binshare_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_binshare.log");
+ srunner_set_xml(srunner, "utc_eina_binshare.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_binshare
- * @{
- * @defgroup eina_binshare_add_length eina_binshare_add_length()
- *
- *
- * @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_binshare_add_length
- * @{
- * @objective Positive test case checks if function returns duplicated or existent instance of an object properly.
- * @n Input Data:
- * @li "test_string";
- * @li 5 as length of string.
- *
- * @procedure
- * @step 1 Create two shared objects with string "test" as data (because length is 4)
- * @step 2 Compare received instances
- * @step 3 Check if first 5 bytes of shared object equals "test_"
- *
- * @passcondition
- * @li Returned instances of shared object should be equal and not NULL, also they shouldn't be equal
- * to pointer to the initial one. It means that in first call function duplicates object and in second
- * call function finds existent shared object and returns it.
- * @li Shared 5 bytes of object should be equal "test_" instead of passed "test_string" - it
- * means function considers given length argument properly.
- * @}
- */
-START_TEST(utc_eina_binshare_add_length_p)
-{
- const char *obj = "test_string";
-
- const char *ptr1 = eina_binshare_add_length(obj, 5);
- const char *ptr2 = eina_binshare_add_length(obj, 5);
-
- if (!ptr1 || ptr1 != ptr2 || ptr1 == obj || strncmp(ptr1, "test_" , 5))
- {
- eina_binshare_del(ptr1);
- eina_binshare_del(ptr2);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- eina_binshare_del(ptr1);
- eina_binshare_del(ptr2);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_binshare_add_length
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of object.
- * @n Input Data:
- * @li NULL instead of object;
- * @li 4 as length.
- *
- * @procedure
- * @step 1 Call function once and pass NULL instead of its first argument
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eina_binshare_add_length_n)
-{
-
- CREATE_CHECKED_ARGS_ARRAY(1, 0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eina_binshare_add_length, NULL, 4);
-
- 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
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_binshare_add_length");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_binshare_add_length_p);
- tcase_add_test(tcase, utc_eina_binshare_add_length_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_binshare_add_length.log");
- srunner_set_xml(srunner, "utc_eina_binshare_add_length.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_binshare
- * @{
- * @defgroup eina_binshare_del eina_binshare_del()
- *
- *
- * @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_binshare_del
- * @{
- * @objective Positive test case checks if function executes successfully.
- * @n Input Data: pointer to shared object.
- *
- * @procedure
- * @step 1 Create shared object as string "test"
- * @step 2 Delete shared object
- *
- * @passcondition Function executes successfully without segmentation faults.
- * @}
- */
-START_TEST(utc_eina_binshare_del_p)
-{
- const void *ptr = eina_binshare_add("test");
-
- if (!ptr)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Shared object is NULL..", __FILE__, __LINE__);
- return;
- }
- eina_binshare_del(ptr);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_binshare_del
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of shared object.
- * @n Input Data: NULL as shared object.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eina_binshare_del_n)
-{
-
- UNITEST_FUNC_NEG(eina_binshare_del, NULL);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_binshare_del");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_binshare_del_p);
- tcase_add_test(tcase, utc_eina_binshare_del_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_binshare_del.log");
- srunner_set_xml(srunner, "utc_eina_binshare_del.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 <stdio.h>
-
-/**
- * @addtogroup eina_binshare
- * @{
- * @defgroup eina_binshare_dump eina_binshare_dump()
- *
- *
- * @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_binshare_dump
- * @{
- * @objective Positive test case checks if function dumps the contents of the share_common properly.
- * @n Input Data: function has no arguments.
- *
- * @procedure
- * @step 1 Close standard output stream stdout
- * @step 2 Reopen stdout to write output to test file
- * @step 3 Dump the contents of the share_common
- * @step 4 Close stdout again to flush data on the disk
- * @step 5 Open the file that should contain dumped data in reading mode
- * @step 6 Get numbers of bytes in the file
- * @step 7 Allocate memory to load data from the file
- * @step 8 Read the file to the buffer
- * @step 9 Check if the buffer contains substring "DDD" - according to documentation function
- * dumps all objects to stdout with this prefix
- *
- * @passcondition Function dumps data properly. Test file with dump isn't empty and contains prefix "DDD".
- * @}
- */
-START_TEST(utc_eina_binshare_dump_p)
-{
- const char *fname = "binshare_dump_test";
- char *buf = NULL;
- FILE *f = NULL;
- FILE *old_std_out = stdout;
- long sz = 0;
-
- stdout = fopen(fname, "w");
-
- if (!stdout)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. stdout is not reopened to write in file..", __FILE__, __LINE__);
- }
- eina_binshare_dump();
- fclose(stdout);
- stdout = old_std_out;
- f = fopen(fname, "r");
-
- if (!f)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. File is not opened for reading..", __FILE__, __LINE__);
- }
- else if (fseek(f, 0, SEEK_END))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'fseek' to the end error..", __FILE__, __LINE__);
- }
- else if ((sz = ftell(f)) <= 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'ftell' error.. maybe dump file is empty..", __FILE__, __LINE__);
- }
- else if (fseek(f, 0, SEEK_SET))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'fseek' to the start error..", __FILE__, __LINE__);
- }
- else if (!(buf = malloc(2 * sz + 1)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'malloc' error..", __FILE__, __LINE__);
- }
- else if (!fread(buf, 1, sz, f))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. 'fread' error..", __FILE__, __LINE__);
- }
- else
- {
-
- buf[sz] = '\0';
-
- if (!strstr(buf, "DDD"))
- {
- if (f) fclose(f);
- free(buf);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Dump file doesn't contain 'DDD' prefix:\n", __FILE__, __LINE__);
- }
- else
- {
- if (f) fclose(f);
- free(buf);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- }
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eina_binshare_dump");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_binshare_dump_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_binshare_dump.log");
- srunner_set_xml(srunner, "utc_eina_binshare_dump.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_binshare
- * @{
- * @defgroup eina_binshare_init_shutdown
- * eina_binshare_init()
- * eina_binshare_shutdown()
- *
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
-}
-
-/**
- * @addtogroup eina_binshare_init_shutdown
- * @{
- * @objective Positive test case checks if functions initialize/shutdown the share_common module
- * without segmentation fault
- *
- * @procedure
- * @step 1 Call eina_binshare_init function to initialize the share_common module
- * and check on EINA_TRUE
- * @step 1 Call eina_binshare_shutdown function to shut down the share_common module
- * and check on EINA_TRUE
- *
- * @passcondition
- * Test passes if functions initialize/shutdown the share_common module without segmentation fault
- * @}
- */
-START_TEST(utc_eina_binshare_init_shutdown_p)
-{
- if (!eina_binshare_init())
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- if (!eina_binshare_shutdown())
- {
- 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_binshare_init_shutdown");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_binshare_init_shutdown_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_binshare_init_shutdown.log");
- srunner_set_xml(srunner, "utc_eina_binshare_init_shutdown.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 <string.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_binshare
- * @{
- * @defgroup eina_binshare_length eina_binshare_length()
- *
- *
- * @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_binshare_length
- * @{
- * @objective Positive test case checks if function returns proper length of shared object.
- * @n Input Data: pointer to shared object.
- *
- * @procedure
- * @step 1 Create string "test" as object to share
- * @step 2 Get instance of shared object
- * @step 3 Get length of the instance
- *
- * @passcondition Function returns proper length that equals strlen("test") - length of shared string.
- * @}
- */
-START_TEST(utc_eina_binshare_length_p)
-{
- const char *obj = "test";
- size_t len = strlen(obj);
- const void *ret = eina_binshare_add_length(obj, len);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Shared object is NULL..", __FILE__, __LINE__);
- return;
- }
- int length = eina_binshare_length(ret);
- eina_binshare_del(ret);
-
- if (length != (int)len)
- {
- 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_binshare_length
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns -1 if it is called with NULL instead of shared object.
- * @n Input Data: NULL as shared object.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of its argument
- *
- * @passcondition Function doesn't cause segmentation fault and returns -1.
- * @}
- */
-START_TEST(utc_eina_binshare_length_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(-1, eina_binshare_length, 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_binshare_length");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_binshare_length_p);
- tcase_add_test(tcase, utc_eina_binshare_length_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_binshare_length.log");
- srunner_set_xml(srunner, "utc_eina_binshare_length.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 <string.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eina_binshare
- * @{
- * @defgroup eina_binshare_ref eina_binshare_ref()
- *
- *
- * @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_binshare_ref
- * @{
- * @objective Positive test case checks if function returns increments references of the given shared object properly.
- * @n Input Data: pointer to shared object.
- *
- * @procedure
- * @step 1 Create shared object from string "test"
- * @step 2 Get reference to the instance
- *
- * @passcondition Function returns non-NULL pointer that points to the same object as passed to function.
- * @}
- */
-START_TEST(utc_eina_binshare_ref_p)
-{
- const void *ptr = eina_binshare_add("test");
-
- if (!ptr)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Shared object is NULL..", __FILE__, __LINE__);
- return;
- }
- const void *ret = eina_binshare_ref(ptr);
-
- if (ret != ptr)
- {
- eina_binshare_del(ptr);
- eina_binshare_del(ret);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
- }
- eina_binshare_del(ptr);
- eina_binshare_del(ret);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eina_binshare_ref
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of shared object.
- * @n Input Data: NULL as shared object.
- *
- * @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_binshare_ref_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(NULL, eina_binshare_ref, 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_binshare_ref");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eina_binshare_ref_p);
- tcase_add_test(tcase, utc_eina_binshare_ref_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_binshare_ref.log");
- srunner_set_xml(srunner, "utc_eina_binshare_ref.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}