aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/tests/eina_test_file.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/tests/eina_test_file.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/eina/src/tests/eina_test_file.c')
-rw-r--r--libraries/eina/src/tests/eina_test_file.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/libraries/eina/src/tests/eina_test_file.c b/libraries/eina/src/tests/eina_test_file.c
new file mode 100644
index 0000000..aeb5461
--- /dev/null
+++ b/libraries/eina/src/tests/eina_test_file.c
@@ -0,0 +1,88 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2008 Cedric Bail
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#include <stdlib.h>
24#include <stdio.h>
25#include <string.h>
26
27#include "eina_suite.h"
28#include "Eina.h"
29#include "eina_safety_checks.h"
30
31START_TEST(eina_file_split_simple)
32{
33 Eina_Array *ea;
34
35 eina_init();
36
37#ifdef EINA_SAFETY_CHECKS
38 fprintf(stderr, "you should have a safety check failure below:\n");
39 ea = eina_file_split(NULL);
40 fail_if(ea);
41 fail_if(eina_error_get() != EINA_ERROR_SAFETY_FAILED);
42#endif
43
44#ifdef _WIN32
45 ea = eina_file_split(strdup("\\this\\is\\a\\small\\test"));
46#else
47 ea = eina_file_split(strdup("/this/is/a/small/test"));
48#endif
49
50 fail_if(!ea);
51 fail_if(eina_array_count_get(ea) != 5);
52 fail_if(strcmp(eina_array_data_get(ea, 0), "this"));
53 fail_if(strcmp(eina_array_data_get(ea, 1), "is"));
54 fail_if(strcmp(eina_array_data_get(ea, 2), "a"));
55 fail_if(strcmp(eina_array_data_get(ea, 3), "small"));
56 fail_if(strcmp(eina_array_data_get(ea, 4), "test"));
57
58 eina_array_free(ea);
59
60#ifdef _WIN32
61 ea =
62 eina_file_split(strdup(
63 "this\\\\is\\\\\\a \\more\\complex\\\\\\case\\\\\\"));
64#else
65 ea = eina_file_split(strdup("this//is///a /more/complex///case///"));
66#endif
67
68 fail_if(!ea);
69 fail_if(eina_array_count_get(ea) != 6);
70 fail_if(strcmp(eina_array_data_get(ea, 0), "this"));
71 fail_if(strcmp(eina_array_data_get(ea, 1), "is"));
72 fail_if(strcmp(eina_array_data_get(ea, 2), "a "));
73 fail_if(strcmp(eina_array_data_get(ea, 3), "more"));
74 fail_if(strcmp(eina_array_data_get(ea, 4), "complex"));
75 fail_if(strcmp(eina_array_data_get(ea, 5), "case"));
76
77 eina_array_free(ea);
78
79 eina_shutdown();
80}
81END_TEST
82
83void
84eina_test_file(TCase *tc)
85{
86 tcase_add_test(tc, eina_file_split_simple);
87}
88