diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2012-09-11 16:13:11 +0000 |
---|---|---|
committer | Vincent Torri <vincent.torri@gmail.com> | 2012-09-11 16:13:11 +0000 |
commit | cd69ef4c8a66e7155967a8b661a014856979cf31 (patch) | |
tree | 4a351ae4a4ca91abf29c85254b85ea8da71f74b0 /src/bin/evil/evil_test_util.c | |
parent | 59a9dfd11860888a35e96dfe51af63cea5cecfe1 (diff) |
merge: add evil files
SVN revision: 76464
Diffstat (limited to 'src/bin/evil/evil_test_util.c')
-rw-r--r-- | src/bin/evil/evil_test_util.c | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/src/bin/evil/evil_test_util.c b/src/bin/evil/evil_test_util.c new file mode 100644 index 0000000000..6226ceb040 --- /dev/null +++ b/src/bin/evil/evil_test_util.c | |||
@@ -0,0 +1,110 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif /* HAVE_CONFIG_H */ | ||
4 | |||
5 | #include <string.h> | ||
6 | |||
7 | #include <Evil.h> | ||
8 | |||
9 | #include "evil_suite.h" | ||
10 | #include "evil_test_util.h" | ||
11 | |||
12 | |||
13 | static int test_path_absolute_test_1(void) | ||
14 | { | ||
15 | char *path; | ||
16 | int result; | ||
17 | |||
18 | path = NULL; | ||
19 | result = evil_path_is_absolute(path); | ||
20 | if (result != 0) | ||
21 | return 0; | ||
22 | |||
23 | return 1; | ||
24 | } | ||
25 | |||
26 | static int test_path_absolute_test_2(void) | ||
27 | { | ||
28 | char *path; | ||
29 | int result; | ||
30 | |||
31 | path = "1"; | ||
32 | result = evil_path_is_absolute(path); | ||
33 | if (result != 0) | ||
34 | return 0; | ||
35 | |||
36 | return 1; | ||
37 | } | ||
38 | |||
39 | static int test_path_absolute_test_3(void) | ||
40 | { | ||
41 | char *path; | ||
42 | int result; | ||
43 | |||
44 | path = "1:\\"; | ||
45 | result = evil_path_is_absolute(path); | ||
46 | if (result != 0) | ||
47 | return 0; | ||
48 | |||
49 | return 1; | ||
50 | } | ||
51 | |||
52 | static int test_path_absolute_test_4(void) | ||
53 | { | ||
54 | char *path; | ||
55 | int result; | ||
56 | |||
57 | path = "1/\\"; | ||
58 | result = evil_path_is_absolute(path); | ||
59 | if (result != 0) | ||
60 | return 0; | ||
61 | |||
62 | return 1; | ||
63 | } | ||
64 | |||
65 | static int test_path_absolute_test_5(void) | ||
66 | { | ||
67 | char *path; | ||
68 | int result; | ||
69 | |||
70 | path = "F:/foo"; | ||
71 | result = evil_path_is_absolute(path); | ||
72 | if (result == 0) | ||
73 | return 0; | ||
74 | |||
75 | return 1; | ||
76 | } | ||
77 | |||
78 | static int test_path_absolute_test_6(void) | ||
79 | { | ||
80 | char *path; | ||
81 | int result; | ||
82 | |||
83 | path = "C:\\foo"; | ||
84 | result = evil_path_is_absolute(path); | ||
85 | if (result == 0) | ||
86 | return 0; | ||
87 | |||
88 | return 1; | ||
89 | } | ||
90 | |||
91 | static int | ||
92 | test_path_absolute_run(suite *s __UNUSED__) | ||
93 | { | ||
94 | int res; | ||
95 | |||
96 | res = test_path_absolute_test_1(); | ||
97 | res &= test_path_absolute_test_2(); | ||
98 | res &= test_path_absolute_test_3(); | ||
99 | res &= test_path_absolute_test_4(); | ||
100 | res &= test_path_absolute_test_5(); | ||
101 | res &= test_path_absolute_test_6(); | ||
102 | |||
103 | return res; | ||
104 | } | ||
105 | |||
106 | int | ||
107 | test_util(suite *s) | ||
108 | { | ||
109 | return test_path_absolute_run(s); | ||
110 | } | ||