summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_code_test_basic.c
blob: 5ae4915c8531e12532280f76928b8b418114655c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#define ELM_INTERNAL_API_ARGESFSDFEFC

#include <stdlib.h>

#include "elm_suite.h"
#include "Elementary.h"

EFL_START_TEST (elm_code_create_test)
{
   Elm_Code *code;

   char *args[] = { "exe" };
   elm_init(1, args);
   code = elm_code_create();

   ck_assert(!!code);
   ck_assert(elm_code_file_path_get(code->file) == NULL);
   elm_code_free(code);
   elm_shutdown();
}
EFL_END_TEST

EFL_START_TEST (elm_code_open_test)
{
   char *path = TESTS_SRC_DIR "/testfile.txt";
   char realpath1[PATH_MAX], realpath2[PATH_MAX];
   Elm_Code *code;

   char *args[] = { "exe" };
   elm_init(1, args);
   code = elm_code_create();
   elm_code_file_open(code, path);

   ck_assert_ptr_ne(realpath(path, realpath1), NULL);
   ck_assert_ptr_ne(realpath(elm_code_file_path_get(code->file), realpath2), NULL);
   ck_assert(!!code);
   ck_assert_str_eq(realpath1, realpath2);
   elm_code_free(code);
   elm_shutdown();
}
EFL_END_TEST


void elm_code_test_basic(TCase *tc)
{
   tcase_add_test(tc, elm_code_create_test);
   tcase_add_test(tc, elm_code_open_test);
}