GCC Code Coverage Report


Directory: ./
File: tests/functional_test_inhibitors.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 164 178 92.1%
Functions: 28 28 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** 42sh
4 ** File description:
5 ** The inhibitors.ini
6 */
7
8 #include "criterion/criterion.h"
9 #include "criterion/redirect.h"
10 #include "../include/myshell.h"
11
12 4 Test(inhibitors1, full_gcorv)
13 {
14 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
15 2 FILE *file = fopen("test_input.txt", "w");
16
17 2 fprintf(file, "ls > \"test file\"\n");
18 2 fprintf(file, "ls >> \"test file\"\n");
19 2 fprintf(file, "\"test file\"\n");
20 2 fprintf(file, "ls | grep *test*file*\n");
21 2 fprintf(file, "cat \"test file\"\n");
22 2 fprintf(file, "exit\n");
23 2 fclose(file);
24 2 freopen("test_input.txt", "r", stdin);
25 2 shell(env);
26 }
27
28 4 Test(inhibitors2, full_gcorv)
29 {
30 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
31 2 FILE *file = fopen("test_input.txt", "w");
32
33 2 fprintf(file, "ls > \'test file\'\n");
34 2 fprintf(file, "ls >> \'test file\'\n");
35 2 fprintf(file, "\'test file\'\n");
36 2 fprintf(file, "ls | grep *test*file*\n");
37 2 fprintf(file, "cat \'test file\'\n");
38 2 fprintf(file, "exit\n");
39 2 fclose(file);
40 2 freopen("test_input.txt", "r", stdin);
41 2 shell(env);
42 }
43
44 4 Test(inhibitors3, full_gcorv)
45 {
46 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
47 2 FILE *file = fopen("test_input.txt", "w");
48
49 2 fprintf(file, "ls > test\\ file\n");
50 2 fprintf(file, "ls >> test\\ file\n");
51 2 fprintf(file, "test\\ file\n");
52 2 fprintf(file, "ls | grep *test*file*\n");
53 2 fprintf(file, "cat test\\ file\n");
54 2 fprintf(file, "exit\n");
55 2 fclose(file);
56 2 freopen("test_input.txt", "r", stdin);
57 2 shell(env);
58 }
59
60 4 Test(inhibitors4, full_gcorv)
61 {
62 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
63 2 FILE *file = fopen("test_input.txt", "w");
64
65 2 fprintf(file, "ls > \"test\\ file\"\n");
66 2 fprintf(file, "ls >> \"test\\ file\"\n");
67 2 fprintf(file, "\"test\\ file\"\n");
68 2 fprintf(file, "ls | grep *test*file*\n");
69 2 fprintf(file, "cat \"test\\ file\"\n");
70 2 fprintf(file, "exit\n");
71 2 fclose(file);
72 2 freopen("test_input.txt", "r", stdin);
73 2 shell(env);
74 }
75
76 4 Test(inhibitors5, full_gcorv)
77 {
78 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
79 2 FILE *file = fopen("test_input.txt", "w");
80
81 2 fprintf(file, "ls > \\\"test\\ file\\\"\n");
82 2 fprintf(file, "ls >> \\\"test\\ file\\\"\n");
83 2 fprintf(file, "\\\"test\\ file\\\"\n");
84 2 fprintf(file, "ls | grep *test*file*\n");
85 2 fprintf(file, "cat \\\"test\\ file\\\"\n");
86 2 fprintf(file, "exit\n");
87 2 fclose(file);
88 2 freopen("test_input.txt", "r", stdin);
89 2 shell(env);
90 }
91
92 4 Test(inhibitors6, full_gcorv)
93 {
94 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
95 2 FILE *file = fopen("test_input.txt", "w");
96
97 2 fprintf(file, "ls > \"test;;;file\"\n");
98 2 fprintf(file, "ls >> \"test;;;file\"\n");
99 2 fprintf(file, "\"test;;;file\"\n");
100 2 fprintf(file, "ls | grep *test*file*\n");
101 2 fprintf(file, "cat \"test;;;file\"\n");
102 2 fprintf(file, "exit\n");
103 2 fclose(file);
104 2 freopen("test_input.txt", "r", stdin);
105 2 shell(env);
106 }
107
108 4 Test(inhibitors7, full_gcorv)
109 {
110 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
111 2 FILE *file = fopen("test_input.txt", "w");
112
113 2 fprintf(file, "ls > \"test&&&file\"\n");
114 2 fprintf(file, "ls >> \"test&&&file\"\n");
115 2 fprintf(file, "\"test&&&file\"\n");
116 2 fprintf(file, "ls | grep *test*file*\n");
117 2 fprintf(file, "cat \"test&&&file\"\n");
118 2 fprintf(file, "exit\n");
119 2 fclose(file);
120 2 freopen("test_input.txt", "r", stdin);
121 2 shell(env);
122 }
123
124 4 Test(inhibitors8, full_gcorv)
125 {
126 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
127 2 FILE *file = fopen("test_input.txt", "w");
128
129 2 fprintf(file, "ls > \"test|||file\"\n");
130 2 fprintf(file, "ls >> \"test|||file\"\n");
131 2 fprintf(file, "\"test|||file\"\n");
132 2 fprintf(file, "ls | grep *test*file*\n");
133 2 fprintf(file, "cat \"test|||file\"\n");
134 2 fprintf(file, "exit\n");
135 2 fclose(file);
136 2 freopen("test_input.txt", "r", stdin);
137 2 shell(env);
138 }
139
140 4 Test(inhibitors9, full_gcorv)
141 {
142 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
143 2 FILE *file = fopen("test_input.txt", "w");
144
145 2 fprintf(file, "ls > \"test|file\"\n");
146 2 fprintf(file, "ls >> \"test|file\"\n");
147 2 fprintf(file, "\"test|file\"\n");
148 2 fprintf(file, "ls | grep *test*file*\n");
149 2 fprintf(file, "cat \"test|file\"\n");
150 2 fprintf(file, "exit\n");
151 2 fclose(file);
152 2 freopen("test_input.txt", "r", stdin);
153 2 shell(env);
154 }
155
156 4 Test(inhibitors10, full_gcorv)
157 {
158 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
159 2 FILE *file = fopen("test_input.txt", "w");
160
161 2 fprintf(file, "ls > \"test<file\"\n");
162 2 fprintf(file, "ls >> \"test<file\"\n");
163 2 fprintf(file, "\"test<file\"\n");
164 2 fprintf(file, "ls | grep *test*file*\n");
165 2 fprintf(file, "cat \"test<file\"\n");
166 2 fprintf(file, "exit\n");
167 2 fclose(file);
168 2 freopen("test_input.txt", "r", stdin);
169 2 shell(env);
170 }
171
172 4 Test(inhibitors11, full_gcorv)
173 {
174 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
175 2 FILE *file = fopen("test_input.txt", "w");
176
177 2 fprintf(file, "ls > \"test>file\"\n");
178 2 fprintf(file, "ls >> \"test>file\"\n");
179 2 fprintf(file, "\"test>file\"\n");
180 2 fprintf(file, "ls | grep *test*file*\n");
181 2 fprintf(file, "cat \"test>file\"\n");
182 2 fprintf(file, "exit\n");
183 2 fclose(file);
184 2 freopen("test_input.txt", "r", stdin);
185 2 shell(env);
186 }
187
188 4 Test(inhibitors12, full_gcorv)
189 {
190 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
191 2 FILE *file = fopen("test_input.txt", "w");
192
193 2 fprintf(file, "ls > \"test\"\\ \\\'file\\\' \n");
194 2 fprintf(file, "ls >> \"test\"\\ \\\'file\\\' \n");
195 2 fprintf(file, "\"test\"\\ \\\'file\\\' \n");
196 2 fprintf(file, "ls | grep *test*file*\n");
197 2 fprintf(file, "cat \"test\"\\ \\\'file\\\' \n");
198 2 fprintf(file, "exit\n");
199 2 fclose(file);
200 2 freopen("test_input.txt", "r", stdin);
201 2 shell(env);
202 }
203
204 4 Test(inhibitors13, full_gcorv)
205 {
206 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
207 2 FILE *file = fopen("test_input.txt", "w");
208
209 2 fprintf(file, "ls > \\ \"test|file\"\"here\"\\ \n");
210 2 fprintf(file, "ls >> \\ \"test|file\"\"here\"\\ \n");
211 2 fprintf(file, "\\ \"test|file\"\"here\"\\ \n");
212 2 fprintf(file, "ls | grep *test*file*\n");
213 2 fprintf(file, "cat \\ \"test|file\"\"here\"\\ \n");
214 2 fprintf(file, "exit\n");
215 2 fclose(file);
216 2 freopen("test_input.txt", "r", stdin);
217 2 shell(env);
218 }
219
220 4 Test(inhibitors14, full_gcorv)
221 {
222 2 char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;");
223 2 FILE *file = fopen("test_input.txt", "w");
224
225 2 fprintf(file, "ls > \"test\\\"file\"\n");
226 2 fprintf(file, "exit\n");
227 2 fclose(file);
228 2 freopen("test_input.txt", "r", stdin);
229 2 shell(env);
230 }
231