-utc_eet_alias.c
-utc_eet_alias_get.c
-utc_eet_clearcache.c
-utc_eet_close.c
-utc_eet_delete.c
-utc_eet_file_get.c
-utc_eet_init.c
-utc_eet_list.c
-utc_eet_list_entries.c
-utc_eet_memopen_read.c
-utc_eet_mode_get.c
-utc_eet_num_entries.c
-utc_eet_open.c
-utc_eet_read.c
-utc_eet_read_cipher.c
-utc_eet_read_direct.c
-utc_eet_shutdown.c
-utc_eet_sync.c
-utc_eet_write.c
-utc_eet_write_cipher.c
+utc_eet_lib.c
-utc_eet_alias.c
-utc_eet_alias_get.c
-utc_eet_clearcache.c
-utc_eet_close.c
-utc_eet_delete.c
-utc_eet_file_get.c
-utc_eet_init.c
-utc_eet_list.c
-utc_eet_list_entries.c
-utc_eet_memopen_read.c
-utc_eet_mode_get.c
-utc_eet_num_entries.c
-utc_eet_open.c
-utc_eet_read.c
-utc_eet_read_cipher.c
-utc_eet_read_direct.c
-utc_eet_shutdown.c
-utc_eet_sync.c
-utc_eet_write.c
-utc_eet_write_cipher.c
+utc_eet_lib.c
-utc_eet_alias.c
-utc_eet_alias_get.c
-utc_eet_clearcache.c
-utc_eet_close.c
-utc_eet_delete.c
-utc_eet_file_get.c
-utc_eet_init.c
-utc_eet_list.c
-utc_eet_list_entries.c
-utc_eet_memopen_read.c
-utc_eet_mode_get.c
-utc_eet_num_entries.c
-utc_eet_open.c
-utc_eet_read.c
-utc_eet_read_cipher.c
-utc_eet_read_direct.c
-utc_eet_shutdown.c
-utc_eet_sync.c
-utc_eet_write.c
-utc_eet_write_cipher.c
+utc_eet_lib.c
-utc_eet_alias.c
-utc_eet_alias_get.c
-utc_eet_clearcache.c
-utc_eet_close.c
-utc_eet_delete.c
-utc_eet_file_get.c
-utc_eet_init.c
-utc_eet_list.c
-utc_eet_list_entries.c
-utc_eet_memopen_read.c
-utc_eet_mode_get.c
-utc_eet_num_entries.c
-utc_eet_open.c
-utc_eet_read.c
-utc_eet_read_cipher.c
-utc_eet_read_direct.c
-utc_eet_shutdown.c
-utc_eet_sync.c
-utc_eet_write.c
-utc_eet_write_cipher.c
+utc_eet_lib.c
+++ /dev/null
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-const char *alias = "/base/the_real_stuff_i_want";
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_alias eet_alias()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init()
- * @step 2 Call utils_eet_create_data_file to get opened eet file with test entry and data
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_alias
- * @{
- * @objective Positive test case check if invoking eet_alias succeeds
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li "/base/the_real_stuff_i_want" - alias for the entry;
- * @li 0- compression flag.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Create an alias for the entry
- *
- * @passcondition Function returns EINA_TRUE
- * @}
- */
-START_TEST(utc_eet_alias_p)
-{
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (eet_alias(ef, utc_eet_entry_name, alias, 0) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
- }
- else if (eet_alias(ef, utc_eet_entry_name, alias, 1) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 1", __FILE__, __LINE__);
- }
- else if (eet_alias(ef, utc_eet_entry_name, alias, 10) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 10", __FILE__, __LINE__);
- }
- else if (eet_alias(ef, utc_eet_entry_name, alias, 11) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 11", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_alias
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns EINA_FALSE if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li "/base/the_real_stuff_i_want" - alias for the entry;
- * @li 0- compression flag.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function 3 times and pass (in turn) NULL instead of opened file,
- * entry name and alias for the entry.
- *
- * @passcondition Function doesn't cause segmentation fault and returns EINA_FALSE.
- * @}
- */
-START_TEST(utc_eet_alias_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- const char *alias = "/base/the_real_stuff_i_want";
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 1, 0);
- UNITEST_FUNC_NEG_CA_RET(EINA_FALSE, eet_alias, ef, utc_eet_entry_name, alias, 0);
-
- 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_eet_alias");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_alias_p);
- tcase_add_test(tcase, utc_eet_alias_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_eet_alias.log");
- srunner_set_xml(srunner, "utc_eet_alias.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-const char *alias = "/base/the_real_stuff_i_want";
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_alias_get eet_alias_get()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Call utils_eet_create_data_file to get opened eet file with test entry and data
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_alias_get
- * @{
- * @objective Positive test case checks if invoking eet_alias_get succeeds
- * @n Input Data:
- * @li opened file with data
- * @li name of entry that has alias
- *
- * @procedure
- * @step 1 Check if file with entry is opened
- * @step 2 Create an alias for the entry
- * @step 3 Retrieve the destination name of the alias
- *
- * @passcondition Destination name of the alias is correct
- * @}
- */
-START_TEST(utc_eet_alias_get_p)
-{
- const char *ret = NULL;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (eet_alias(ef, utc_eet_entry_name, alias, 0) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. New alias is not set..", __FILE__, __LINE__);
- }
- else if (!(ret = eet_alias_get(ef, utc_eet_entry_name)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
- }
- else if (strcmp(ret, alias))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. New and old aliases don't match.. %s", __FILE__, __LINE__, ret);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_alias_get
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened file with data
- * @li name of entry that has alias.
- *
- * @procedure
- * @step 1 Check if file with entry is opened
- * @step 2 Create an alias for the entry
- * @step 3 Call function 2 times and pass (in turn) NULL instead of one from valid arguments.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_alias_get_n)
-{
- int result = TEST_FAIL;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (eet_alias(ef, utc_eet_entry_name, alias, 0) == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. New alias is not set..", __FILE__, __LINE__);
- }
- else
- {
- result = UNITEST_FUNC_NEG_RET(NULL, eet_alias_get, ef, utc_eet_entry_name);
-
- if (result == 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_eet_alias_get");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_alias_get_p);
- tcase_add_test(tcase, utc_eet_alias_get_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_eet_alias_get.log");
- srunner_set_xml(srunner, "utc_eet_alias_get.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eet.h>
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_clearcache eet_clearcache()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_clearcache
- * @{
- * @objective Positive test case check if invoking eet_clearcache succeeds
- * @n Input Data: function has no arguments.
- *
- * @procedure
- * @step 1 Invoke eet_clearcache if there are no opened eet files.
- *
- * @passcondition Function doesn't cause segmentation fault when there are no opened files.
- * @}
- */
-START_TEST(utc_eet_clearcache_p)
-{
- eet_clearcache();
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_clearcache");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_clearcache_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_eet_clearcache.log");
- srunner_set_xml(srunner, "utc_eet_clearcache.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_close eet_close()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_close
- * @{
- * @objective Positive test case checks if invoking eet_close succeeds
- * @n Input Data:
- * @li opened eet file
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to get opened eet file with test entry and data
- * @step 2 Attempt to close the file
- *
- * @passcondition Function returns EET_ERROR_NONE
- * @}
- */
-START_TEST(utc_eet_close_p)
-{
- Eet_File *ef = utils_eet_create_data_file();
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- if (eet_close(ef) != EET_ERROR_NONE)
- {
- eet_close(ef);
- 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
-
-/**
- * @addtogroup eet_close
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns EET_ERROR_BAD_OBJECT if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened eet file
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to get opened eet file
- * @step 2 Call function once and pass NULL instead of opened file.
- *
- * @passcondition Function doesn't cause segmentation fault and returns EET_ERROR_BAD_OBJECT.
- * @}
- */
-START_TEST(utc_eet_close_n)
-{
- Eet_File *ef = utils_eet_create_data_file();
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- int result = UNITEST_FUNC_NEG_RET(EET_ERROR_BAD_OBJECT, eet_close, ef);
-
- eet_close(ef);
- if (result == 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_eet_close");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_close_p);
- tcase_add_test(tcase, utc_eet_close_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_eet_close.log");
- srunner_set_xml(srunner, "utc_eet_close.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_delete eet_delete()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_delete
- * @{
- * @objective Positive test case checks if invoking eet_delete succeeds
- * @n Input Data:
- * @li opened eet file
- * @li name of entry
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to get opened eet file with one entry
- * @step 2 Call eet_delete
- * @step 3 Call eet_num_entries to get number of entries in the file after deletion
- * of single entry to ensure that there are no more entries.
- *
- * @passcondition Function returns value greater than 0.
- * @}
- */
-START_TEST(utc_eet_delete_p)
-{
- int num = 0;
- Eet_File *ef = utils_eet_create_data_file();
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if ((num = eet_delete(ef, utc_eet_entry_name)) <= 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, num);
- num = 0;
- }
- else if ((num = eet_num_entries(ef)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. File has entries after deletion: %d", __FILE__, __LINE__, num);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_delete
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened eet file
- * @li name of entry
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to get opened eet file with one entry
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened eet file
- * and entry name
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_delete_n_1)
-{
- Eet_File *ef = utils_eet_create_data_file();
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- int result = UNITEST_FUNC_NEG_RET(0, eet_delete, ef, utc_eet_entry_name);
-
- if (result == 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__);
-
- eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_delete
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with opened eet file and name of entry to be deleted
- * that doesn't present in the file.
- * @n Input Data:
- * @li opened eet file
- * @li "/key/not_exist/at" as name of entry
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to get opened eet file with one entry
- * @step 2 Call function and pass invalid name of entry
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_delete_n_2)
-{
- Eet_File *ef = utils_eet_create_data_file();
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- if (eet_delete(ef, "/key/not_exist/at"))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- eet_close(ef);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_delete");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_delete_p);
- tcase_add_test(tcase, utc_eet_delete_n_1);
- tcase_add_test(tcase, utc_eet_delete_n_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_eet_delete.log");
- srunner_set_xml(srunner, "utc_eet_delete.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-static Eet_File *ef = NULL;
-const char *file_name = "my_file.eet";
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_file_get eet_file_get()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file for further usage
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open(file_name, EET_FILE_MODE_WRITE);
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_file_get
- * @{
- * @objective Positive test case checks if invoking eet_file_get succeeds
- * @n Input Data:
- * @li opened eet file
- *
- * @procedure
- * @step 1 Check if test eet file is opened
- * @step 2 Call eet_file_get
- *
- * @passcondition Returned name matches with name of created file
- * (that was passed to eet_open function).
- * @}
- */
-START_TEST(utc_eet_file_get_p)
-{
- const char *ret = NULL;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (!(ret = eet_file_get(ef)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL", __FILE__, __LINE__);
- }
- else if (strcmp(ret, file_name))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned file name doesn't match with the initial one", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_file_get
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened eet file.
- *
- * @procedure
- * @step 1 Check if test eet file is opened
- * @step 2 Call eet_file_get and pass NULL instead of opened file
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_file_get_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- if (UNITEST_FUNC_NEG_RET(NULL, eet_file_get, ef) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_file_get");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_file_get_p);
- tcase_add_test(tcase, utc_eet_file_get_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_eet_file_get.log");
- srunner_set_xml(srunner, "utc_eet_file_get.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eet.h>
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_init eet_init()
- *
- *
- * @precondition No operations required.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
-}
-
-/**
- * @addtogroup eet_init
- * @{
- * @objective Positive test case check if invocation of eet_init succeeds
- * @n Input data: Function takes no arguments.
- *
- * @procedure
- * @step 1 Invoke eet_init and check returned value
- *
- * @passcondition Function returns 1.
- * @}
- */
-START_TEST(utc_eet_init_p)
-{
- int ret = eet_init();
-
- if (ret != 1)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, ret);
- }
- eet_shutdown();
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_init");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_init_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_eet_init.log");
- srunner_set_xml(srunner, "utc_eet_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 <Eet.h>
+#include "../../utc_negative_unitest.h"
+#include "../utc_eet_utils.h"
+#include "Eet.h"
+#include <string.h>
+
+static Eet_File *ef = NULL;
+const char *file_name = "my_file.eet";
+const char *alias = "/base/the_real_stuff_i_want";
+
+char ptr[]="\x1e\xe7\x0f\x42\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x35"
+ "\x00\x00\x00\xa0\x00\x00\x00\xa0\x00\x00\x00\x24\x00\x00\x00\x11"
+ "\x00\x00\x00\x00\x2f\x6d\x69\x73\x74\x65\x72\x69\x6f\x75\x73\x2f"
+ "\x64\x61\x74\x61\x00\x41\x6e\x20\x45\x45\x54\x20\x69\x6e\x73\x69"
+ "\x64\x65\x20\x6f\x66\x20\x61\x6e\x20\x45\x45\x54\x21\x0a\x54\x68"
+ "\x69\x73\x20\x77\x61\x73\x6e\x27\x74\x20\x72\x65\x61\x6c\x6c\x79"
+ "\x20\x75\x73\x65\x66\x75\x6c\x20\x62\x75\x74\x20\x69\x74\x20\x68"
+ "\x65\x6c\x70\x65\x64\x20\x74\x6f\x20\x73\x68\x6f\x77\x20\x68\x6f"
+ "\x77\x0a\x74\x6f\x20\x75\x73\x65\x20\x65\x65\x74\x5f\x6d\x65\x6d"
+ "\x6f\x70\x65\x6e\x5f\x72\x65\x61\x64\x28\x29\x20\x74\x6f\x20\x6f"
+ "\x70\x65\x6e\x20\x61\x6e\x20\x65\x65\x74\x20\x66\x69\x6c\x65\x20"
+ "\x66\x72\x6f\x6d\x0a\x64\x61\x74\x61\x20\x61\x6c\x72\x65\x61\x64"
+ "\x79\x20\x6c\x6f\x61\x64\x65\x64\x20\x69\x6e\x20\x6d\x65\x6d\x6f"
+ "\x72\x79\x2e\x0a\x00";
+
+/**
+ * @addtogroup eet
+ * @{
+ * @defgroup eet_lib
+ *
+ *
+ * @precondition
+ * @step 1 Initialize eet library with eet_init().
+ * @step 2 create eet file.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ eet_init();
+ ef = utils_eet_create_data_file();
+}
+
+static void
+teardown(void)
+{
+ printf(" ============ Cleanup ============ \n");
+ eet_close(ef);
+ eet_shutdown();
+}
+
+/**
+ * @addtogroup eet_lib
+ * @{
+ * @defgroup eet_lib_pack_p
+ * @li eet_memopen_read()
+ * @li eet_read_cipher()
+ * @li eet_num_entries()
+ * @li eet_read()
+ * @li eet_list()
+ * @li eet_sync()
+ * @li eet_write()
+ * @li eet_write_cipher()
+ * @li eet_read_direct()
+ * @li eet_alias()
+ * @li eet_alias_get()
+ * @li eet_delete()
+ * @{
+ * @objective Positive test case checking if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Clear cache and call eet_memopen_read().
+ * @step 2 Check if eet file is opened
+ * @step 3 Call eet_read_cipher() with different parameters to read data from file.
+ * @step 4 Compare loaded data and its size with value that was saved into the file.
+ * @step 5 Call eet_num_entries().
+ * @step 6 Call eet_read() with different parameters to read data from file.
+ * @step 7 Compare loaded data and its size with value that was saved into the file.
+ * @step 8 Call eet_read_direct() to read data from file.
+ * @step 9 Compare loaded data and its size with value that was saved into the file.
+ * @step 10 Call eet_list().
+ * @step 11 Call eet_sync().
+ * @step 12 Call eet_write().
+ * @step 13 Call eet_write_cipher() with different parameters.
+ * @step 14 Create an alias for the entry by call eet_alias() with different parameters.
+ * @step 15 Retrieve the destination name of the alias by call eet_alias_get().
+ * @step 16 Open eet file with different mode for create cache.
+ * @step 17 Create alias.
+ * @step 18 Write a ciphered entry to a file.
+ * @step 19 Call eet_read_cipher() and eet_read_direct(), close file.
+ * @step 20 Call eet_delete().
+ * @step 21 Get number of entries in the file after deletion to ensure that there are no more entries.
+ * @step 22 Call eet_clearcache() and close file.
+ *
+ * @passcondition Function returns valid pointer to loaded data. Without segmentation fault.
+ * @}
+ * @}
+ */
+START_TEST(utc_eet_lib_pack_p)
+{
+ Eet_File *ef_m = NULL;
+ void *data = NULL;
+ const void *data_1 = NULL;
+ int size = 0;
+ int size_m = sizeof(ptr)-1;
+ char **data_l = NULL;
+ int count = 0;
+ int ret = 0;
+ const char *ret_a = NULL;
+ Eet_File *rf = NULL;
+
+ eet_clearcache();
+ if (!(ef_m = eet_memopen_read(ptr, size_m)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ if (!ef)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
+ }
+
+ if (eet_read_cipher(ef, "/key/not_exist/at", &size, utc_eet_cipher) ||
+ !(data = eet_read_cipher(ef, utc_eet_entry_name, NULL, utc_eet_cipher)) ||
+ !(data = eet_read_cipher(ef, utc_eet_entry_name, &size, utc_eet_cipher)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Data is not read", __FILE__,__LINE__);
+ }
+ else if (strlen(utc_eet_test_string) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned and real size of data don't match %d", __FILE__,__LINE__, size);
+ }
+ else if (strncmp(data, utc_eet_test_string, size))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read data is wrong: %s", __FILE__,__LINE__, data);
+ }
+ size = 0;
+ free(data);
+
+ if (1 != eet_num_entries(ef))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__, __LINE__);
+ }
+
+ if (eet_read(ef, "/key/not_exist/at", &size) ||
+ !(data = eet_read(ef, utc_eet_entry_name, NULL)) ||
+ !(data = eet_read(ef, utc_eet_entry_name, &size)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL", __FILE__, __LINE__);
+ }
+ else if (strlen(utc_eet_test_string) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned and real size of data don't match", __FILE__, __LINE__);
+ }
+ else if (strncmp(data, utc_eet_test_string, size))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read data is wrong: %s", __FILE__, __LINE__, data);
+ }
+ free(data);
+ size = 0;
+
+ if (eet_read_direct(ef, "/key/not_exist/at", &size) ||
+ !(data_1 = eet_read_direct(ef, utc_eet_entry_name, NULL)) ||
+ !(data_1 = eet_read_direct(ef, utc_eet_entry_name, &size)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Data is not read", __FILE__,__LINE__);
+ }
+ else if (strlen(utc_eet_test_string) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned and real size of data don't match", __FILE__,__LINE__);
+ }
+ else if (strncmp(data_1, utc_eet_test_string, size))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read data is wrong: %s", __FILE__,__LINE__, data);
+ }
+
+ if (!(data_l = eet_list(ef, utc_eet_entry_name, NULL)) ||
+ !(data_l = eet_list(ef, utc_eet_entry_name, &count)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
+ }
+ else if (count != 1)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set count = %d", __FILE__, __LINE__, count);
+ }
+
+ if (eet_sync(ef) != EET_ERROR_NONE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned", __FILE__, __LINE__);
+ }
+
+ size = strlen(utc_eet_test_string);
+ if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 0) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
+ }
+ else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 1) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 1", __FILE__, __LINE__);
+ }
+ else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 10) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 10", __FILE__, __LINE__);
+ }
+ else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 11) != size)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 11", __FILE__, __LINE__);
+ }
+
+ size = strlen(utc_eet_test_string);
+ if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 0, utc_eet_cipher))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
+ }
+ else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 1, utc_eet_cipher))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 1", __FILE__, __LINE__);
+ }
+ else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 10, utc_eet_cipher))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 10", __FILE__, __LINE__);
+ }
+ else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 11, utc_eet_cipher))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 11", __FILE__, __LINE__);
+ }
+
+ if (eet_alias(ef, utc_eet_entry_name, alias, 0) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
+ }
+ else if (eet_alias(ef, utc_eet_entry_name, alias, 1) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 1", __FILE__, __LINE__);
+ }
+ else if (eet_alias(ef, utc_eet_entry_name, alias, 10) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 10", __FILE__, __LINE__);
+ }
+ else if (eet_alias(ef, utc_eet_entry_name, alias, 11) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 11", __FILE__, __LINE__);
+ }
+
+ if (!(ret_a = eet_alias_get(ef, utc_eet_entry_name)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
+ }
+ else if (strcmp(ret_a, alias))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. New and old aliases don't match.. %s", __FILE__, __LINE__, ret_a);
+ }
+
+ if (!(rf = eet_open(file_name, EET_FILE_MODE_WRITE)) ||
+ !(rf = eet_open(file_name, EET_FILE_MODE_READ)) ||
+ !(rf = eet_open(file_name, EET_FILE_MODE_READ_WRITE)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if (eet_alias(rf, utc_eet_entry_name, alias, 1) == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
+ }
+ if (!(ret = eet_write_cipher(rf, utc_eet_entry_name, (void*)utc_eet_test_string, strlen(utc_eet_test_string), 0, utc_eet_cipher)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__, __LINE__);
+ }
+ if (!(data = eet_read_cipher(rf, utc_eet_entry_name, NULL, utc_eet_cipher)) ||
+ !(data = eet_read_cipher(rf, utc_eet_entry_name, &size, utc_eet_cipher)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Data is not read", __FILE__,__LINE__);
+ }
+ eet_close(rf);
+
+ count = 0;
+ if ((count = eet_delete(ef, utc_eet_entry_name)) <= 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, count);
+ }
+ else if ((count = eet_num_entries(ef)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. File has entries after deletion: %d", __FILE__, __LINE__, count);
+ }
+
+ eet_clearcache();
+ eet_close(ef_m);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup eet_lib
+ * @{
+ * @defgroup eet_lib_pack_p2
+ * @li eet_init()
+ * @li eet_shutdown()
+ * @li eet_open()
+ * @li eet_mode_get()
+ * @li eet_list_entries()
+ * @li eet_file_get()
+ * @li eet_close()
+ * @li eet_mmap()
+ * @li eet_clearcache()
+ * @{
+ * @objective Positive test case checking if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Call eet_shutdown() for hide eet init in setup() part.
+ * @step 2 Call double eet_init() and check returned value.
+ * @step 3 Call eet_open() with NULL name.
+ * @step 4 Call eet_open() with correct parameters.
+ * @step 5 Call eet_file_get() and check file name.
+ * @step 6 Call eet_mode_get() with correct parameters.
+ * @step 7 Call eet_mode_get() and pass NULL instead of opened file.
+ * @step 8 Write to eet file some information("KEY1","KEY2","KEY3").
+ * @step 9 Get list entries keys by call eet_list_entries() and check entries keys.
+ * @step 10 Attempt to close the file by call eet_close().
+ * @step 11 Create eina file and call eet_mmap().
+ * @step 12 Close NULL file and check result.
+ * @step 13 Close mmap file.
+ * @step 14 Call eet_clearcache().
+ * @step 15 Call double eet_shutdown()
+ *
+ * @passcondition Function returns valid pointer to loaded data. Without segmentation fault.
+ * @}
+ * @}
+ */
+START_TEST(utc_eet_lib_pack_p2)
+{
+ int i = 0;
+ int size = 0;
+ const char *name = "new_dictionary.eet";
+ const char *ret_f = NULL;
+ Eet_File *efile = NULL;
+ Eet_File *e = NULL;
+ Eet_File *mfile = NULL;
+ Eina_File *efm = NULL;
+ Eet_Entry *entry_key = NULL;
+ Eina_Iterator *eet_list = NULL;
+ char entry_keys [3][5] = {{"KEY1"}, {"KEY2"}, {"KEY3"}};
+ char entry_datas [3][6] = {{"test1"}, {"test2"}, {"test3"}};
+
+ char *output_data = NULL;
+
+ if (eet_shutdown() != 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__, __LINE__);
+ }
+
+ if (eet_init() != 1)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__, __LINE__);
+ }
+ if (eet_init() != 2)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__, __LINE__);
+ }
+
+ if ((efile = eet_open(NULL, EET_FILE_MODE_WRITE)) ||
+ !(efile = eet_open(name, EET_FILE_MODE_READ_WRITE)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ if (!(ret_f = eet_file_get(efile)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL", __FILE__, __LINE__);
+ }
+ else if (strcmp(ret_f, name))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned file name doesn't match with the initial one", __FILE__, __LINE__);
+ }
+
+ if ((eet_mode_get(efile) != EET_FILE_MODE_READ_WRITE) ||
+ (eet_mode_get(NULL) != EET_FILE_MODE_INVALID))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < 3; ++i)
+ {
+ if (!eet_write(efile, entry_keys[i], entry_datas[i], strlen(entry_datas[i]) + 1, EINA_FALSE))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ }
+
+ if (!(eet_list = eet_list_entries(efile)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ EINA_ITERATOR_FOREACH(eet_list, entry_key)
+ {
+ Eina_Bool entry_key_is_find = EINA_FALSE;
+
+ for(i = 0; i < 3; ++i)
+ {
+ if (!strcmp(entry_key->name, entry_keys[i]))
+ {
+ entry_key_is_find = EINA_TRUE;
+ break;
+ }
+ }
+
+ if (entry_key_is_find == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Didn't find entry_key", __FILE__, __LINE__);
+ }
+ }
+ eina_iterator_free(eet_list);
+
+ if (eet_close(efile) != EET_ERROR_NONE)
+ {
+ eet_close(efile);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ if (!(e = eet_open(name, EET_FILE_MODE_READ_WRITE)))
+ {
+ ck_abort_msg("[TEST_MSG]:: %s[%d] : Eet error.. Eet_File is not created..", __FILE__,__LINE__);
+ }
+
+ if (!eet_write(e, entry_keys[0], entry_datas[0], strlen(entry_datas[0]) + 1, EINA_FALSE))
+ {
+ eet_close(e);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ eet_close(e);
+
+ if (!(efm = eina_file_open(name, 0)))
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ if (!(mfile = eet_mmap(efm)))
+ {
+ eina_file_close(efm);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__,__LINE__);
+ }
+ if ((!(output_data = (char *)eet_read(mfile, entry_keys[0], &size))) ||
+ (!size) || (strcmp(output_data, entry_datas[0])))
+ {
+ eet_close(mfile);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__,__LINE__);
+ }
+
+ if (eet_close(NULL) != EET_ERROR_BAD_OBJECT)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ eet_close(mfile);
+ eet_clearcache();
+
+ eet_shutdown();
+ eet_shutdown();
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+Suite *
+test_suite(void)
+{
+ Suite *suite = suite_create("utc_eet_lib");
+
+ TCase *tcase = tcase_create("TCase");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_eet_lib_pack_p);
+ tcase_add_test(tcase, utc_eet_lib_pack_p2);
+ 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_eet_lib.log");
+ srunner_set_xml(srunner, "utc_eet_lib.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_list eet_list()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Call utils_eet_create_data_file to get opened eet file with test entry and data
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_list
- * @{
- * @objective Positive test case 1 checks if invoking eet_list succeeds
- * @n Input Data:
- * @li opened file with single entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li pointer to integer to be set with count of entries.
- *
- * @procedure
- * @step 1 Check if file with entry is opened
- * @step 2 Invoke eet_list
- *
- * @passcondition: Function returns not NULL (pointer to array with entries names)
- * and counter variable is set to 1.
- * @}
- */
-START_TEST(utc_eet_list_p_1)
-{
- char **data = NULL;
- int count = 0;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (!(data = eet_list(ef, utc_eet_entry_name, &count)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
- }
- else if (count != 1)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set count = %d", __FILE__, __LINE__, count);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-
-/**
- * @addtogroup eet_list
- * @{
- * @objective Positive test case 2 checks if function returns valid pointer to
- * list of entries names if it is called with NULL instead of pointer to last argument -
- * variable to be set with count of entries.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li NULL instead of pointer to integer to be set with count of entries.
- *
- * @procedure
- * @step 1 Check if file with entry is opened
- * @step 2 Call function
- *
- * @passcondition Function returns valid pointer to list of entries names.
- * @}
- */
-START_TEST(utc_eet_list_p_2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- char **data = eet_list(ef, utc_eet_entry_name, NULL);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
- }
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_list
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li pointer to integer to be set with count of entries.
- *
- * @procedure
- * @step 1 Check if file with entry is opened
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened file
- * and name of the entry
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_list_n_1)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- int count;
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_list, ef, utc_eet_entry_name, &count);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_list
- * @{
- * @objective Negative test case 2 checks if function works properly if it is
- * called with name of inexistent entry.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/not_exist/at" - name of inexistent entry;
- * @li pointer to integer to be set with count of entries; variable has value -1
- * that allows to see that it will be changed.
- *
- * @procedure
- * @step 1 Check if file with entry is opened
- * @step 2 Call function.
- *
- * @passcondition Function doesn't cause segmentation fault, returns NULL and
- * counter variable is set to 0.
- * @}
- */
-START_TEST(utc_eet_list_n_2)
-{
- char **data = NULL;
- int count = -1;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if ((data = eet_list(ef, "/key/not_exist/at", &count)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned not NULL..\n%s", __FILE__, __LINE__, data);
- }
- else if (count)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set count = %d", __FILE__, __LINE__, count);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_list");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_list_p_1);
- tcase_add_test(tcase, utc_eet_list_p_2);
- tcase_add_test(tcase, utc_eet_list_n_1);
- tcase_add_test(tcase, utc_eet_list_n_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_eet_list.log");
- srunner_set_xml(srunner, "utc_eet_list.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 <Eet.h>
-#include <string.h>
-
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_list_entries eet_list_entries()
- *
- *
- * @precondition
- * @step 1 initialization eet module;
- * @step 2 create eet file;
- */
-
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-
- if (!(ef = eet_open("new_dictionary.eet", EET_FILE_MODE_READ_WRITE)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has FAILED... ", __FILE__, __LINE__);
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_list_entries
- * @{
- * @objective Positive test case
- * @procedure
- * @step 1 write to eet file some information("KEY1","KEY2","KEY3");
- * @step 2 get list entries keys;
- * @step 3 check entries keys;
- *
- * @passcondition : Function returns an iterator that will describe each entry of an Eet_File.
- * @}
- */
-
-START_TEST(utc_eet_list_entries_p)
-{
- int i;
- Eet_Entry *entry_key = NULL;
- Eina_Iterator *eet_list = NULL;
-
- char entry_keys [3][5] = {{"KEY1"},
- {"KEY2"},
- {"KEY3"}};
-
- char entry_datas [3][6] = {{"test1"},
- {"test2"},
- {"test3"}};
-
- for (i = 0; i < 3; ++i)
- {
- if (!eet_write(ef, entry_keys[i], entry_datas[i], strlen(entry_datas[i]) + 1, EINA_FALSE))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- }
-
- if (!(eet_list = eet_list_entries(ef)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- EINA_ITERATOR_FOREACH(eet_list, entry_key)
- {
- Eina_Bool entry_key_is_fing = EINA_FALSE;
-
- for(i = 0; i < 3; ++i)
- {
- if (!strcmp(entry_key->name, entry_keys[i]))
- {
- entry_key_is_fing = EINA_TRUE;
- break;
- }
- }
-
- if (entry_key_is_fing == EINA_FALSE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Didn't find entry_key", __FILE__, __LINE__);
- }
- }
-
- eina_iterator_free(eet_list);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed.. \n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_list_entries");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_list_entries_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_eet_list_entries.log");
- srunner_set_xml(srunner, "utc_eet_list_entries.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-
-char ptr[]="\x1e\xe7\x0f\x42\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x35"
- "\x00\x00\x00\xa0\x00\x00\x00\xa0\x00\x00\x00\x24\x00\x00\x00\x11"
- "\x00\x00\x00\x00\x2f\x6d\x69\x73\x74\x65\x72\x69\x6f\x75\x73\x2f"
- "\x64\x61\x74\x61\x00\x41\x6e\x20\x45\x45\x54\x20\x69\x6e\x73\x69"
- "\x64\x65\x20\x6f\x66\x20\x61\x6e\x20\x45\x45\x54\x21\x0a\x54\x68"
- "\x69\x73\x20\x77\x61\x73\x6e\x27\x74\x20\x72\x65\x61\x6c\x6c\x79"
- "\x20\x75\x73\x65\x66\x75\x6c\x20\x62\x75\x74\x20\x69\x74\x20\x68"
- "\x65\x6c\x70\x65\x64\x20\x74\x6f\x20\x73\x68\x6f\x77\x20\x68\x6f"
- "\x77\x0a\x74\x6f\x20\x75\x73\x65\x20\x65\x65\x74\x5f\x6d\x65\x6d"
- "\x6f\x70\x65\x6e\x5f\x72\x65\x61\x64\x28\x29\x20\x74\x6f\x20\x6f"
- "\x70\x65\x6e\x20\x61\x6e\x20\x65\x65\x74\x20\x66\x69\x6c\x65\x20"
- "\x66\x72\x6f\x6d\x0a\x64\x61\x74\x61\x20\x61\x6c\x72\x65\x61\x64"
- "\x79\x20\x6c\x6f\x61\x64\x65\x64\x20\x69\x6e\x20\x6d\x65\x6d\x6f"
- "\x72\x79\x2e\x0a\x00";
-
-int size = sizeof(ptr)-1;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_memopen_read eet_memopen_read()
- *
- *
- * @precondition
- * @step 1 Initialize eet library with eet_init().
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_memopen_read
- * @{
- * @objective Positive test case check if invocation of eet_memopen succeeds
- * @n Input Data:
- * @li pointer to data in memory
- * @li size of the data
- *
- * @procedure
- * @step 1 Invoke eet_memopen
- *
- * @passcondition Function returns pointer to opened eet file.
- * @}
- */
-START_TEST(utc_eet_memopen_read_p)
-{
- Eet_File *data = eet_memopen_read(ptr, size);
-
- if (data == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- eet_close(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_memopen_read
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li pointer to data in memory
- * @li size of the data
- *
- * @procedure
- * @step 1 Call function 2 times and pass (in turn) NULL instead of pointer to data in memory and
- * size of the data (NULL is being cast to integer with value 0).
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL in each case.
- * @}
- */
-START_TEST(utc_eet_memopen_read_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(NULL, eet_memopen_read, ptr, size) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_memopen_read");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_memopen_read_p);
- tcase_add_test(tcase, utc_eet_memopen_read_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_eet_memopen_read.log");
- srunner_set_xml(srunner, "utc_eet_memopen_read.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 "Eet.h"
-#include "../../utc_negative_unitest.h"
-static Eet_File *ef = NULL;
-const char *file_name = "my_file.eet";
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_mode_get eet_mode_get()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file with mode EET_FILE_MODE_WRITE for further usage.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open(file_name, EET_FILE_MODE_WRITE);
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_mode_get
- * @{
- * @objective Positive test case checks if invocation of eet_mode_get succeeds
- * @n Input Data:
- * @li opened eet file
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_mode_get
- *
- * @passcondition Function returns EET_FILE_MODE_WRITE.
- * @}
- */
-START_TEST(utc_eet_mode_get_p)
-{
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (eet_mode_get(ef) != EET_FILE_MODE_WRITE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_mode_get
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns expected value if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened eet file
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_mode_get and pass NULL instead of opened file
- *
- * @passcondition Function doesn't cause segmentation fault and returns EET_FILE_MODE_INVALID.
- * @}
- */
-START_TEST(utc_eet_mode_get_n)
-{
-
- if (UNITEST_FUNC_NEG_RET(EET_FILE_MODE_INVALID, eet_mode_get, ef) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_mode_get");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_mode_get_p);
- tcase_add_test(tcase, utc_eet_mode_get_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_eet_mode_get.log");
- srunner_set_xml(srunner, "utc_eet_mode_get.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_num_entries eet_num_entries()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Call utils_eet_create_data_file to get opened eet file with test entry and data.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_num_entries
- * @{
- * @objective Positive test case checks if invocation of eet_num_entries succeeds
- * @n Input Data:
- * @li opened eet file with single entry
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_num_entries
- *
- * @passcondition Function returns 1.
- * @}
- */
-START_TEST(utc_eet_num_entries_p)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- int ret = eet_num_entries(ef);
-
- if (ret != 1)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, ret);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_num_entries
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns expected value if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened eet file with single entry
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_num_entries and pass NULL instead of opened file
- *
- * @passcondition Function doesn't cause segmentation fault and returns -1.
- * @}
- */
-START_TEST(utc_eet_num_entries_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
-
- if (UNITEST_FUNC_NEG_RET(-1, eet_num_entries, ef) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_num_entries");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_num_entries_p);
- tcase_add_test(tcase, utc_eet_num_entries_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_eet_num_entries.log");
- srunner_set_xml(srunner, "utc_eet_num_entries.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 <Eet.h>
-const char *file_name = "my_file.eet";
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_open eet_open()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_open
- * @{
- * @objective Positive test case checks if invoking eet_open succeeds
- * @n Input Data:
- * @li "my_file.eet" as name of file to open
- * @li EET_FILE_MODE_WRITE as mode
- *
- * @procedure
- * @step 1 Invoke eet_open
- *
- * @passcondition Function returns valid pointer to opened file.
- * @}
- */
-START_TEST(utc_eet_open_p)
-{
- Eet_File *ef = eet_open(file_name, EET_FILE_MODE_WRITE);
-
- if (ef == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- eet_close(ef);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_open
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of name of file.
- * @n Input Data:
- * @li NULL as name of file to open
- * @li EET_FILE_MODE_WRITE as mode
- *
- * @procedure
- * @step 1 Call function once and pass NULL instead of name of file.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_open_n_1)
-{
-
- Eet_File *ef = eet_open(NULL, EET_FILE_MODE_WRITE);
-
- if (ef)
- {
- eet_close(ef);
- 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
-
-/**
- * @addtogroup eet_open
- * @{
- * @objective Negative test case 2 checks if invocation of eet_open with incorrect
- * second parameter fails.
- * @n Input Data:
- * @li "my_file.eet" as name of file to open
- * @li (Eet_File_Mode)-2 as mode
- *
- * @procedure
- * @step 1 Invoke eet_open with incorrect second parameter.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_open_n_2)
-{
-
- Eet_File *ef = eet_open(file_name, (Eet_File_Mode)-2);
-
- if (ef)
- {
- eet_close(ef);
- 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_eet_open");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_open_p);
- tcase_add_test(tcase, utc_eet_open_n_1);
- tcase_add_test(tcase, utc_eet_open_n_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_eet_open.log");
- srunner_set_xml(srunner, "utc_eet_open.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_read eet_read()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Call utils_eet_create_data_file to get opened eet file with test entry and data.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_read
- * @{
- * @objective Positive test case 1 checks if eet_read function reads data
- * from eet file properly.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/to_store/at" - name of the entry;
- * @li pointer to variable to be set with size of written data.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened.
- * @step 2 Call eet_read to read data from file.
- * @step 3 Compare loaded data and its size with value that was saved into the file.
- *
- * @passcondition Function returns pointer to loaded data, not NULL.
- * Loaded string must match to the one from saved data, and its size must match
- * with size saved into the variable.
- * @}
- */
-START_TEST(utc_eet_read_p_1)
-{
- void *data = NULL;
- int size = 0;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (!(data = eet_read(ef, utc_eet_entry_name, &size)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL", __FILE__, __LINE__);
- }
- else if (strlen(utc_eet_test_string) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned and real size of data don't match", __FILE__, __LINE__);
- }
- else if (strncmp(data, utc_eet_test_string, size))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read data is wrong: %s", __FILE__, __LINE__, data);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-
-/**
- * @addtogroup eet_read
- * @{
- * @objective Positive test case 2 checks if function returns valid pointer to loaded data
- * if it is called with NULL instead of pointer to last argument - variable to be set
- * with data length.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li NULL instead of pointer to integer to be set with length of data.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function
- *
- * @passcondition Function returns valid pointer to loaded data.
- * @}
- */
-START_TEST(utc_eet_read_p_2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- void *data = eet_read(ef, utc_eet_entry_name, NULL);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_read
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/to_store/at" - name of the entry;
- * @li pointer to variable to be set with size of written data.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened file
- * and key name.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL in each case.
- * @}
- */
-START_TEST(utc_eet_read_n_1)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- int size;
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_read, ef, utc_eet_entry_name, &size);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_read
- * @{
- * @objective Negative test case 2 checks if function works properly if it is
- * called with name of inexistent entry.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/not_exist/at" - name of inexistent entry;
- * @li pointer to variable to be set with size of written data; variable has value -1
- * that allows to see that it will be changed.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function
- *
- * @passcondition Function doesn't cause segmentation fault,
- * returns NULL and data length variable is set to 0.
- * @}
- */
-START_TEST(utc_eet_read_n_2)
-{
- void *data = NULL;
- int size = -1;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if ((data = eet_read(ef, "/key/not_exist/at", &size)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned not NULL..\n%s", __FILE__, __LINE__, data);
- }
- else if (size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set size = %d", __FILE__, __LINE__, size);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_read");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_read_p_1);
- tcase_add_test(tcase, utc_eet_read_p_2);
- tcase_add_test(tcase, utc_eet_read_n_1);
- tcase_add_test(tcase, utc_eet_read_n_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_eet_read.log");
- srunner_set_xml(srunner, "utc_eet_read.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-const char *file_name = "my_file.eet";
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_read_cipher eet_read_cipher()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file for further usage
- * @step 3 Write a ciphered entry to a file
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-
- ef = eet_open(file_name, EET_FILE_MODE_READ_WRITE);
- int ret = eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, strlen(utc_eet_test_string), 0, utc_eet_cipher);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_MSG]:: %s[%d] : Eet error.. Data is not written to Eet_File..", __FILE__, __LINE__);
- eet_close(ef);
- ef = NULL;
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_read_cipher
- * @{
- * @objective Positive test case 1 check if eet_read_cipher function reads data
- * from eet file properly.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/to_store/at" - name of the entry with saved data;
- * @li pointer to variable to be set with size of written data;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Call eet_read_cipher to read data from file.
- * @step 3 Compare loaded data and its size with value that was saved into the file.
- *
- * @passcondition Function returns pointer to loaded data, not NULL.
- * Loaded string must match to the one from saved data, and its size must match
- * with size saved into the variable.
- * @}
- */
-START_TEST(utc_eet_read_cipher_p_1)
-{
- void *data = NULL;
- int size = 0;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- else if (!(data = eet_read_cipher(ef, utc_eet_entry_name, &size, utc_eet_cipher)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Data is not read", __FILE__,__LINE__);
- }
- else if (strlen(utc_eet_test_string) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned and real size of data don't match %d", __FILE__,__LINE__, size);
- }
- else if (strncmp(data, utc_eet_test_string, size))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read data is wrong: %s", __FILE__,__LINE__, data);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-
-/**
- * @addtogroup eet_read_cipher
- * @{
- * @objective Positive test case 2 checks if function returns valid pointer to loaded data
- * if it is called with NULL instead of pointer variable to be set with data length.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li NULL instead of pointer to integer to be set with length of data;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function
- *
- * @passcondition Function returns valid pointer to loaded data.
- * @}
- */
-START_TEST(utc_eet_read_cipher_p_2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
-
- void *data = eet_read_cipher(ef, utc_eet_entry_name, NULL, utc_eet_cipher);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__,__LINE__);
- }
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_read_cipher
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/to_store/at" - name of the entry;
- * @li pointer to variable to be set with size of written data;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened file
- * and key name.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL in each case.
- * @}
- */
-START_TEST(utc_eet_read_cipher_n_1)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- int size;
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 0, 0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_read_cipher, ef, utc_eet_entry_name, &size, utc_eet_cipher);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_read_cipher
- * @{
- * @objective Negative test case 2 checks if function works properly if it is
- * called with name of inexistent entry.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/not_exist/at" - name of inexistent entry;
- * @li pointer to variable to be set with size of written data; variable has value -1
- * that allows to see that it will be changed;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function
- *
- * @passcondition Function doesn't cause segmentation fault, returns NULL
- * and data length variable is set to 0.
- * @}
- */
-START_TEST(utc_eet_read_cipher_n_2)
-{
- void *data = NULL;
- int size = -1;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- else if ((data = eet_read_cipher(ef, "/key/not_exist/at", &size, utc_eet_cipher)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned not NULL..\n%s", __FILE__,__LINE__, data);
- }
- else if (size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set size = %d", __FILE__, __LINE__, size);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_read_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_read_cipher_p_1);
- tcase_add_test(tcase, utc_eet_read_cipher_p_2);
- tcase_add_test(tcase, utc_eet_read_cipher_n_1);
- tcase_add_test(tcase, utc_eet_read_cipher_n_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_eet_read_cipher.log");
- srunner_set_xml(srunner, "utc_eet_read_cipher.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_read_direct eet_read_direct()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file for further usage
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_read_direct
- * @{
- * @objective Positive test case checks if eet_read_direct function reads data
- * from eet file properly.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/to_store/at" - saved data's key name;
- * @li pointer to variable to be set with size of written data.
- *
- * @procedure
- * @step 1 Check if eet file is opened.
- * @step 2 Call eet_read_direct to read data from file.
- * @step 3 Compare loaded data and its size with value that was saved into the file.
- *
- * @passcondition Function returns pointer to loaded data, not NULL.
- * Loaded string must match to the one from saved data, and its size must match
- * with size saved into the variable.
- * @}
- */
-START_TEST(utc_eet_read_direct_p)
-{
- void *data = NULL;
- int size = 0;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- else if (!(data = eet_read_direct(ef, utc_eet_entry_name, &size)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Data is not read", __FILE__,__LINE__);
- }
- else if (strlen(utc_eet_test_string) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Returned and real size of data don't match", __FILE__,__LINE__);
- }
- else if (strncmp(data, utc_eet_test_string, size))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read data is wrong: %s", __FILE__,__LINE__, data);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_read_direct
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/to_store/at" - saved data's key name;
- * @li pointer to variable to be set with size of written data.
- *
- * @procedure
- * @step 1 Check if eet file is opened.
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened file
- * and key name.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL in each case.
- * @}
- */
-START_TEST(utc_eet_read_direct_n_1)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- int size;
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_read_direct, ef, utc_eet_entry_name, &size);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_read_direct
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of pointer to last argument - variable to be set
- * with data length. At the same time eet_read_direct must return valid pointer to loaded data.
- * @n Input Data:
- * @li opened file with entry;
- * @li "/key/to_store/at" - name of the entry;
- * @li NULL instead of pointer to integer to be set with length of data.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Call function
- *
- * @passcondition Function doesn't cause segmentation fault and returns valid
- * pointer to loaded data.
- * @}
- */
-START_TEST(utc_eet_read_direct_n_2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- char *data = eet_read_direct(ef, utc_eet_entry_name, NULL);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__,__LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_read_direct
- * @{
- * @objective Negative test case 3 checks if function works properly if it is
- * called with name of inexistent entry.
- * @n Input Data:
- * @li opened eet file with test data;
- * @li "/key/not_exist/at" - name of inexistent entry;
- * @li pointer to variable to be set with size of written data; variable has value -1
- * that allows to see that it will be changed.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Call function
- *
- * @passcondition Function returns NULL and data length variable is set to 0.
- * @}
- */
-START_TEST(utc_eet_read_direct_n_3)
-{
- char *data = NULL;
- int size = -1;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- else if ((data = eet_read_direct(ef, "/key/not_exist/at", &size)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned not NULL..\n%s", __FILE__,__LINE__, data);
- }
- else if (size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set size = %d", __FILE__, __LINE__, size);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_read_direct");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_read_direct_p);
- tcase_add_test(tcase, utc_eet_read_direct_n_1);
- tcase_add_test(tcase, utc_eet_read_direct_n_2);
- tcase_add_test(tcase, utc_eet_read_direct_n_3);
- 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_eet_read_direct.log");
- srunner_set_xml(srunner, "utc_eet_read_direct.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 <Eet.h>
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_shutdown eet_shutdown()
- *
- *
- * @precondition No operations required.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
-}
-
-/**
- * @addtogroup eet_shutdown
- * @{
- * @objective Positive test case checks if invocation of eet_shutdown succeeds
- * @n Input data: Function takes no arguments.
- *
- * @procedure
- * @step 1 Invoke eet_shutdown and check returned value
- *
- * @passcondition Function returns 0.
- * @}
- */
-START_TEST(utc_eet_shutdown_p)
-{
- int ret = eet_shutdown();
-
- if (ret != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, ret);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_shutdown");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_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_eet_shutdown.log");
- srunner_set_xml(srunner, "utc_eet_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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_sync eet_sync()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Call utils_eet_create_data_file to get opened eet file with test entry and data.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = utils_eet_create_data_file();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_sync
- * @{
- * @objective Positive test case check if invocation of eet_sync succeeds
- * @n Input Data:
- * @li opened eet file with data
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_sync
- *
- * @passcondition Function returns EET_ERROR_NONE.
- * @}
- */
-START_TEST(utc_eet_sync_p)
-{
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (eet_sync(ef) != EET_ERROR_NONE)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_sync
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns expected value if it is called with NULL instead of any argument.
- * @n Input Data:
- * @li opened eet file with data
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_sync and pass NULL instead of opened file
- *
- * @passcondition Function doesn't cause segmentation fault and returns EET_ERROR_BAD_OBJECT.
- * @}
- */
-START_TEST(utc_eet_sync_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
-
- if (UNITEST_FUNC_NEG_RET(EET_ERROR_BAD_OBJECT, eet_sync, ef) == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_sync");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_sync_p);
- tcase_add_test(tcase, utc_eet_sync_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_eet_sync.log");
- srunner_set_xml(srunner, "utc_eet_sync.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_write eet_write()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file for further usage.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("my_file.eet", EET_FILE_MODE_READ_WRITE);
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_write
- * @{
- * @objective Positive test case checks if invocation of eet_write succeeds.
- * @n Input Data:
- * @li opened eet file;
- * @li "/key/to_store/at" - name of the entry with data;
- * @li "Test String" - data to write in the file;
- * @li length of the data;
- * @li 0 - compression flag.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_write
- *
- * @passcondition Function returns correct written data length.
- * @}
- */
-START_TEST(utc_eet_write_p)
-{
- int size = strlen(utc_eet_test_string);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 0) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
- }
- else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 1) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 1", __FILE__, __LINE__);
- }
- else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 10) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 10", __FILE__, __LINE__);
- }
- else if (eet_write(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 11) != size)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 11", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_write
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns expected value (0) if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file;
- * @li "/key/to_store/at" - name of the entry;
- * @li "Test String" - data to write in the file;
- * @li length of the data;
- * @li 0 - compression flag.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Call function 3 times and pass (in turn) NULL instead of opened file,
- * entry name and data to be saved.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_write_n_1)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- int size = strlen(utc_eet_test_string);
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 1, 0, 0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_write, ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 0);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_write
- * @{
- * @objective Negative test case 2 checks if invocation of eet_write fails with 0
- * instead of real size of data.
- * @n Input Data:
- * @li opened eet file;
- * @li "/key/to_store/at" - name of the entry;
- * @li "Test String" - data to write in the file;
- * @li 0 as length of the data;
- * @li 0 - compression flag.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Invoke eet_write
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_write_n_2)
-{
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
- }
- int ret = eet_write(ef, utc_eet_entry_name, (void*) utc_eet_test_string, 0, 0);
-
- if (ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, ret);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_write");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_write_p);
- tcase_add_test(tcase, utc_eet_write_n_1);
- tcase_add_test(tcase, utc_eet_write_n_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_eet_write.log");
- srunner_set_xml(srunner, "utc_eet_write.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 <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_lib
- * @{
- * @defgroup eet_write_cipher eet_write_cipher()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file for further usage.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("my_file.eet", EET_FILE_MODE_WRITE);
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_write_cipher
- * @{
- * @objective Positive test case checks if invocation of eet_write_cipher succeeds.
- * @n Input Data:
- * @li opened eet file;
- * @li "/key/to_store/at" - name of the entry;
- * @li "Test String" - data to write in the file;
- * @li length of the data;
- * @li 0 - compression flag;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Invoke eet_write_cipher
- *
- * @passcondition Function returns correct written cipher data length - it mustn't be equal 0.
- * @}
- */
-START_TEST(utc_eet_write_cipher_p)
-{
- int size = strlen(utc_eet_test_string);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 0, utc_eet_cipher))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 0", __FILE__, __LINE__);
- }
- else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 1, utc_eet_cipher))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 1", __FILE__, __LINE__);
- }
- else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 10, utc_eet_cipher))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 10", __FILE__, __LINE__);
- }
- else if (!eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 11, utc_eet_cipher))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed with compress = 11", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-
-/**
- * @addtogroup eet_write_cipher
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns expected value (0) if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file;
- * @li "/key/to_store/at" - name of the entry;
- * @li "Test String" - data to write in the file;
- * @li length of the data;
- * @li 0 - compression flag;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file is opened
- * @step 2 Call function 3 times and pass (in turn) NULL instead of opened file,
- * entry name and data to be saved.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_write_cipher_n_1)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- int size = strlen(utc_eet_test_string);
-
- CREATE_CHECKED_ARGS_ARRAY(1, 1, 1, 0, 0, 0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_write_cipher, ef, utc_eet_entry_name, (void*)utc_eet_test_string, size, 0, utc_eet_cipher);
-
- if (result_of_testing == TEST_FAIL)
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- else
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_write_cipher
- * @{
- * @objective Negative test case 2 checks if invocation of eet_write_cipher fails with 0
- * instead of real size of data.
- * @n Input Data:
- * @li opened eet file;
- * @li "/key/to_store/at" - name of the entry;
- * @li "Test String" - data to write in the file;
- * @li 0 as length of the data;
- * @li 0 - compression flag;
- * @li "This is crypto key" - cipher key.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Invoke eet_write_cipher
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_write_cipher_n_2)
-{
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__,__LINE__);
- }
- int ret = eet_write_cipher(ef, utc_eet_entry_name, (void*)utc_eet_test_string, 0, 0, utc_eet_cipher);
-
- if (ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned %d", __FILE__, __LINE__, ret);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_write_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_write_cipher_p);
- tcase_add_test(tcase, utc_eet_write_cipher_n_1);
- tcase_add_test(tcase, utc_eet_write_cipher_n_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_eet_write_cipher.log");
- srunner_set_xml(srunner, "utc_eet_write_cipher.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
-CC ?= gcc
-
-C_FILES = $(shell cat tslist)
-
-PKGS = eet eina check
-
-LDFLAGS = `pkg-config --libs $(PKGS)`
-
-CFLAGS = -I. `pkg-config --cflags $(PKGS)`
-CFLAGS += -Wall
-
-#TARGETS = $(C_FILES:%.c=tc-%)
-TCS := $(shell ls -1 *.c | cut -d. -f1)
-
-all: $(TCS)
-
-%: %.c
- $(CC) $(CFLAGS) $< -o $@ ../utc_eet_utils.c $(LDFLAGS)
-
-clean:
- rm -f $(TCS)
+++ /dev/null
-utc_eet_mmap.c
+++ /dev/null
-utc_eet_mmap.c
+++ /dev/null
-#utc_eet_mmap.c
\ No newline at end of file
+++ /dev/null
-#utc_eet_mmap.c
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Eet.h>
-#include <string.h>
-#include <stdio.h>
-
-/**
- * @addtogroup eet_mmap
- * @{
- * @defgroup eet_mmap eet_mmap()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_mmap
- * @{
- * @objective Positive test case checks if eet_mmap opened eet file
- * and read correct data from file
- * @n Input Data:
- * @li file path;
- *
- * @procedure
- * @step 1 Open eet file and check result.
- * @step 2 Write data to eet file.
- * @step 3 Close eet file.
- * @step 4 Open eet file be eina_file_open function and check resutl operation.
- * @step 5 Open eet file by eina_file_open function and check result operation.
- * @step 6 Read and check data from eet file.
- *
- * @passcondition Function returns a handle to the file, if it cannot be opened
- * for writing or a memory error occurs, NULL is returned
- * @}
- */
-START_TEST(utc_eet_mmap_p)
-{
- Eet_File *ef = NULL;
- Eet_File *ef_mmap = NULL;
- Eina_File *e_file = NULL;
- const char *input_data = "input_data";
- const char *data_key = "data_key";
- char *output_data = NULL;
- int output_data_size = 0;
-
- if (!(ef = eet_open("eet_test.eet", EET_FILE_MODE_READ_WRITE)))
- {
- ck_abort_msg("[TEST_MSG]:: %s[%d] : Eet error.. Eet_File is not created..", __FILE__,__LINE__);
- }
-
- if (!eet_write(ef, data_key, input_data, strlen(input_data) + 1, EINA_FALSE))
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- eet_close(ef);
-
- if (!(e_file = eina_file_open("eet_test.eet", 0)))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__,__LINE__);
- }
-
- if (!(ef_mmap = eet_mmap(e_file)))
- {
- eina_file_close(e_file);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__,__LINE__);
- }
-
- if ((!(output_data = (char *)eet_read(ef_mmap, data_key, &output_data_size))) ||
- (!output_data_size) ||
- (strcmp(output_data, input_data)))
- {
- eet_close(ef_mmap);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__,__LINE__);
- }
-
- eet_close(ef_mmap);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_mmap");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_mmap_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_eet_mmap.log");
- srunner_set_xml(srunner, "utc_eet_mmap.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
/eet/eet_identity/tslist
/eet/eet_image/tslist
/eet/eet_lib/tslist
-/eet/eet_mmap/tslist
/eet/eet_node/tslist
EFREET-build
/eet/eet_identity/tslist_mobile
/eet/eet_image/tslist_mobile
/eet/eet_lib/tslist_mobile
-/eet/eet_mmap/tslist_mobile
/eet/eet_node/tslist_mobile
EFREET-mobile
#/eet/eet_identity/tslist_wear
#/eet/eet_image/tslist_wear
#/eet/eet_lib/tslist_wear
-#/eet/eet_mmap/tslist_wear
#/eet/eet_node/tslist_wear
EFREET-wear
#/eet/eet_identity/tslist_tv
#/eet/eet_image/tslist_tv
#/eet/eet_lib/tslist_tv
-#/eet/eet_mmap/tslist_tv
#/eet/eet_node/tslist_tv
EFREET-tv