summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_code_file_test_memory.c
blob: 8cc2cecd4208d939535f2d15a78853423f3d7e2b (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
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

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

EFL_START_TEST(elm_code_file_memory_lines)
{
   Elm_Code *code;

   char *args[] = { "exe" };
   elm_init(1, args);
   code = elm_code_create();
   ck_assert_uint_eq(0, elm_code_file_lines_get(code->file));

   elm_code_file_line_append(code->file, "a line", 6, NULL);

   ck_assert_uint_eq(1, elm_code_file_lines_get(code->file));
   elm_code_free(code);
   elm_shutdown();
}
EFL_END_TEST

EFL_START_TEST(elm_code_file_memory_tokens)
{
   Elm_Code_File *file;
   Elm_Code_Line *line;
   Elm_Code *code;

   char *args[] = { "exe" };
   elm_init(1, args);
   code = elm_code_create();
   file = code->file;
   elm_code_file_line_append(file, "a line", 6, NULL);

   line = elm_code_file_line_get(file, 1);
   elm_code_line_token_add(line, 2, 5, 1, ELM_CODE_TOKEN_TYPE_COMMENT);
   ck_assert_uint_eq(1, eina_list_count(line->tokens));
   elm_code_free(code);
   elm_shutdown();
}
EFL_END_TEST

void elm_code_file_test_memory(TCase *tc)
{
   tcase_add_test(tc, elm_code_file_memory_lines);
   tcase_add_test(tc, elm_code_file_memory_tokens);
}