How to use to class

Best Quick code snippet using .to

Run Quick automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

bug20927.phpt

Source: bug20927.phpt Github

copy
1--TEST--
2Bug #20927 (Segfault on wordwrap statement)
3--FILE--
4<?php
5$string		= str_repeat("1234567890 X ", 10);
6$break		= str_repeat("a-very-long-break-string-to-clobber-the-heap", 8);
7$linelength	= 10;
8
9echo "Length of original string:  ".strlen($string)."\n";
10echo "Length of break string:     ".strlen($break)."\n";
11
12var_dump(wordwrap($string, $linelength, $break, 1));
13?>
14--EXPECT--
15Length of original string:  130
16Length of break string:     352
17string(6799) "1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapX "
18
Full Screen

is_executable_basic-win32-mb.phpt

Source: is_executable_basic-win32-mb.phpt Github

copy
1--TEST--
2Test is_executable() function: basic functionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6    die('skip.. only for Windows');
7}
8?>
9--FILE--
10<?php
11require __DIR__.'/file.inc';
12
13echo "*** Testing is_executable(): basic functionality ***\n";
14
15// create a file
16$filename = __DIR__."/私はガラスを食べられますis_executable.tmp";
17create_file($filename);
18
19$counter = 1;
20/* loop to check if the file with new mode is executable
21   using is_executable() */
22for($mode = 0000; $mode <= 0777; $mode++) {
23  echo "-- Changing mode of file to $mode --\n";
24  chmod($filename, $mode);  // change mode of file
25  var_dump( is_executable($filename) );
26  $counter++;
27  clearstatcache();
28}
29
30// delete the temp file
31delete_file($filename);
32
33echo "Done\n";
34?>
35--EXPECT--
36*** Testing is_executable(): basic functionality ***
37-- Changing mode of file to 0 --
38bool(false)
39-- Changing mode of file to 1 --
40bool(false)
41-- Changing mode of file to 2 --
42bool(false)
43-- Changing mode of file to 3 --
44bool(false)
45-- Changing mode of file to 4 --
46bool(false)
47-- Changing mode of file to 5 --
48bool(false)
49-- Changing mode of file to 6 --
50bool(false)
51-- Changing mode of file to 7 --
52bool(false)
53-- Changing mode of file to 8 --
54bool(false)
55-- Changing mode of file to 9 --
56bool(false)
57-- Changing mode of file to 10 --
58bool(false)
59-- Changing mode of file to 11 --
60bool(false)
61-- Changing mode of file to 12 --
62bool(false)
63-- Changing mode of file to 13 --
64bool(false)
65-- Changing mode of file to 14 --
66bool(false)
67-- Changing mode of file to 15 --
68bool(false)
69-- Changing mode of file to 16 --
70bool(false)
71-- Changing mode of file to 17 --
72bool(false)
73-- Changing mode of file to 18 --
74bool(false)
75-- Changing mode of file to 19 --
76bool(false)
77-- Changing mode of file to 20 --
78bool(false)
79-- Changing mode of file to 21 --
80bool(false)
81-- Changing mode of file to 22 --
82bool(false)
83-- Changing mode of file to 23 --
84bool(false)
85-- Changing mode of file to 24 --
86bool(false)
87-- Changing mode of file to 25 --
88bool(false)
89-- Changing mode of file to 26 --
90bool(false)
91-- Changing mode of file to 27 --
92bool(false)
93-- Changing mode of file to 28 --
94bool(false)
95-- Changing mode of file to 29 --
96bool(false)
97-- Changing mode of file to 30 --
98bool(false)
99-- Changing mode of file to 31 --
100bool(false)
101-- Changing mode of file to 32 --
102bool(false)
103-- Changing mode of file to 33 --
104bool(false)
105-- Changing mode of file to 34 --
106bool(false)
107-- Changing mode of file to 35 --
108bool(false)
109-- Changing mode of file to 36 --
110bool(false)
111-- Changing mode of file to 37 --
112bool(false)
113-- Changing mode of file to 38 --
114bool(false)
115-- Changing mode of file to 39 --
116bool(false)
117-- Changing mode of file to 40 --
118bool(false)
119-- Changing mode of file to 41 --
120bool(false)
121-- Changing mode of file to 42 --
122bool(false)
123-- Changing mode of file to 43 --
124bool(false)
125-- Changing mode of file to 44 --
126bool(false)
127-- Changing mode of file to 45 --
128bool(false)
129-- Changing mode of file to 46 --
130bool(false)
131-- Changing mode of file to 47 --
132bool(false)
133-- Changing mode of file to 48 --
134bool(false)
135-- Changing mode of file to 49 --
136bool(false)
137-- Changing mode of file to 50 --
138bool(false)
139-- Changing mode of file to 51 --
140bool(false)
141-- Changing mode of file to 52 --
142bool(false)
143-- Changing mode of file to 53 --
144bool(false)
145-- Changing mode of file to 54 --
146bool(false)
147-- Changing mode of file to 55 --
148bool(false)
149-- Changing mode of file to 56 --
150bool(false)
151-- Changing mode of file to 57 --
152bool(false)
153-- Changing mode of file to 58 --
154bool(false)
155-- Changing mode of file to 59 --
156bool(false)
157-- Changing mode of file to 60 --
158bool(false)
159-- Changing mode of file to 61 --
160bool(false)
161-- Changing mode of file to 62 --
162bool(false)
163-- Changing mode of file to 63 --
164bool(false)
165-- Changing mode of file to 64 --
166bool(false)
167-- Changing mode of file to 65 --
168bool(false)
169-- Changing mode of file to 66 --
170bool(false)
171-- Changing mode of file to 67 --
172bool(false)
173-- Changing mode of file to 68 --
174bool(false)
175-- Changing mode of file to 69 --
176bool(false)
177-- Changing mode of file to 70 --
178bool(false)
179-- Changing mode of file to 71 --
180bool(false)
181-- Changing mode of file to 72 --
182bool(false)
183-- Changing mode of file to 73 --
184bool(false)
185-- Changing mode of file to 74 --
186bool(false)
187-- Changing mode of file to 75 --
188bool(false)
189-- Changing mode of file to 76 --
190bool(false)
191-- Changing mode of file to 77 --
192bool(false)
193-- Changing mode of file to 78 --
194bool(false)
195-- Changing mode of file to 79 --
196bool(false)
197-- Changing mode of file to 80 --
198bool(false)
199-- Changing mode of file to 81 --
200bool(false)
201-- Changing mode of file to 82 --
202bool(false)
203-- Changing mode of file to 83 --
204bool(false)
205-- Changing mode of file to 84 --
206bool(false)
207-- Changing mode of file to 85 --
208bool(false)
209-- Changing mode of file to 86 --
210bool(false)
211-- Changing mode of file to 87 --
212bool(false)
213-- Changing mode of file to 88 --
214bool(false)
215-- Changing mode of file to 89 --
216bool(false)
217-- Changing mode of file to 90 --
218bool(false)
219-- Changing mode of file to 91 --
220bool(false)
221-- Changing mode of file to 92 --
222bool(false)
223-- Changing mode of file to 93 --
224bool(false)
225-- Changing mode of file to 94 --
226bool(false)
227-- Changing mode of file to 95 --
228bool(false)
229-- Changing mode of file to 96 --
230bool(false)
231-- Changing mode of file to 97 --
232bool(false)
233-- Changing mode of file to 98 --
234bool(false)
235-- Changing mode of file to 99 --
236bool(false)
237-- Changing mode of file to 100 --
238bool(false)
239-- Changing mode of file to 101 --
240bool(false)
241-- Changing mode of file to 102 --
242bool(false)
243-- Changing mode of file to 103 --
244bool(false)
245-- Changing mode of file to 104 --
246bool(false)
247-- Changing mode of file to 105 --
248bool(false)
249-- Changing mode of file to 106 --
250bool(false)
251-- Changing mode of file to 107 --
252bool(false)
253-- Changing mode of file to 108 --
254bool(false)
255-- Changing mode of file to 109 --
256bool(false)
257-- Changing mode of file to 110 --
258bool(false)
259-- Changing mode of file to 111 --
260bool(false)
261-- Changing mode of file to 112 --
262bool(false)
263-- Changing mode of file to 113 --
264bool(false)
265-- Changing mode of file to 114 --
266bool(false)
267-- Changing mode of file to 115 --
268bool(false)
269-- Changing mode of file to 116 --
270bool(false)
271-- Changing mode of file to 117 --
272bool(false)
273-- Changing mode of file to 118 --
274bool(false)
275-- Changing mode of file to 119 --
276bool(false)
277-- Changing mode of file to 120 --
278bool(false)
279-- Changing mode of file to 121 --
280bool(false)
281-- Changing mode of file to 122 --
282bool(false)
283-- Changing mode of file to 123 --
284bool(false)
285-- Changing mode of file to 124 --
286bool(false)
287-- Changing mode of file to 125 --
288bool(false)
289-- Changing mode of file to 126 --
290bool(false)
291-- Changing mode of file to 127 --
292bool(false)
293-- Changing mode of file to 128 --
294bool(false)
295-- Changing mode of file to 129 --
296bool(false)
297-- Changing mode of file to 130 --
298bool(false)
299-- Changing mode of file to 131 --
300bool(false)
301-- Changing mode of file to 132 --
302bool(false)
303-- Changing mode of file to 133 --
304bool(false)
305-- Changing mode of file to 134 --
306bool(false)
307-- Changing mode of file to 135 --
308bool(false)
309-- Changing mode of file to 136 --
310bool(false)
311-- Changing mode of file to 137 --
312bool(false)
313-- Changing mode of file to 138 --
314bool(false)
315-- Changing mode of file to 139 --
316bool(false)
317-- Changing mode of file to 140 --
318bool(false)
319-- Changing mode of file to 141 --
320bool(false)
321-- Changing mode of file to 142 --
322bool(false)
323-- Changing mode of file to 143 --
324bool(false)
325-- Changing mode of file to 144 --
326bool(false)
327-- Changing mode of file to 145 --
328bool(false)
329-- Changing mode of file to 146 --
330bool(false)
331-- Changing mode of file to 147 --
332bool(false)
333-- Changing mode of file to 148 --
334bool(false)
335-- Changing mode of file to 149 --
336bool(false)
337-- Changing mode of file to 150 --
338bool(false)
339-- Changing mode of file to 151 --
340bool(false)
341-- Changing mode of file to 152 --
342bool(false)
343-- Changing mode of file to 153 --
344bool(false)
345-- Changing mode of file to 154 --
346bool(false)
347-- Changing mode of file to 155 --
348bool(false)
349-- Changing mode of file to 156 --
350bool(false)
351-- Changing mode of file to 157 --
352bool(false)
353-- Changing mode of file to 158 --
354bool(false)
355-- Changing mode of file to 159 --
356bool(false)
357-- Changing mode of file to 160 --
358bool(false)
359-- Changing mode of file to 161 --
360bool(false)
361-- Changing mode of file to 162 --
362bool(false)
363-- Changing mode of file to 163 --
364bool(false)
365-- Changing mode of file to 164 --
366bool(false)
367-- Changing mode of file to 165 --
368bool(false)
369-- Changing mode of file to 166 --
370bool(false)
371-- Changing mode of file to 167 --
372bool(false)
373-- Changing mode of file to 168 --
374bool(false)
375-- Changing mode of file to 169 --
376bool(false)
377-- Changing mode of file to 170 --
378bool(false)
379-- Changing mode of file to 171 --
380bool(false)
381-- Changing mode of file to 172 --
382bool(false)
383-- Changing mode of file to 173 --
384bool(false)
385-- Changing mode of file to 174 --
386bool(false)
387-- Changing mode of file to 175 --
388bool(false)
389-- Changing mode of file to 176 --
390bool(false)
391-- Changing mode of file to 177 --
392bool(false)
393-- Changing mode of file to 178 --
394bool(false)
395-- Changing mode of file to 179 --
396bool(false)
397-- Changing mode of file to 180 --
398bool(false)
399-- Changing mode of file to 181 --
400bool(false)
401-- Changing mode of file to 182 --
402bool(false)
403-- Changing mode of file to 183 --
404bool(false)
405-- Changing mode of file to 184 --
406bool(false)
407-- Changing mode of file to 185 --
408bool(false)
409-- Changing mode of file to 186 --
410bool(false)
411-- Changing mode of file to 187 --
412bool(false)
413-- Changing mode of file to 188 --
414bool(false)
415-- Changing mode of file to 189 --
416bool(false)
417-- Changing mode of file to 190 --
418bool(false)
419-- Changing mode of file to 191 --
420bool(false)
421-- Changing mode of file to 192 --
422bool(false)
423-- Changing mode of file to 193 --
424bool(false)
425-- Changing mode of file to 194 --
426bool(false)
427-- Changing mode of file to 195 --
428bool(false)
429-- Changing mode of file to 196 --
430bool(false)
431-- Changing mode of file to 197 --
432bool(false)
433-- Changing mode of file to 198 --
434bool(false)
435-- Changing mode of file to 199 --
436bool(false)
437-- Changing mode of file to 200 --
438bool(false)
439-- Changing mode of file to 201 --
440bool(false)
441-- Changing mode of file to 202 --
442bool(false)
443-- Changing mode of file to 203 --
444bool(false)
445-- Changing mode of file to 204 --
446bool(false)
447-- Changing mode of file to 205 --
448bool(false)
449-- Changing mode of file to 206 --
450bool(false)
451-- Changing mode of file to 207 --
452bool(false)
453-- Changing mode of file to 208 --
454bool(false)
455-- Changing mode of file to 209 --
456bool(false)
457-- Changing mode of file to 210 --
458bool(false)
459-- Changing mode of file to 211 --
460bool(false)
461-- Changing mode of file to 212 --
462bool(false)
463-- Changing mode of file to 213 --
464bool(false)
465-- Changing mode of file to 214 --
466bool(false)
467-- Changing mode of file to 215 --
468bool(false)
469-- Changing mode of file to 216 --
470bool(false)
471-- Changing mode of file to 217 --
472bool(false)
473-- Changing mode of file to 218 --
474bool(false)
475-- Changing mode of file to 219 --
476bool(false)
477-- Changing mode of file to 220 --
478bool(false)
479-- Changing mode of file to 221 --
480bool(false)
481-- Changing mode of file to 222 --
482bool(false)
483-- Changing mode of file to 223 --
484bool(false)
485-- Changing mode of file to 224 --
486bool(false)
487-- Changing mode of file to 225 --
488bool(false)
489-- Changing mode of file to 226 --
490bool(false)
491-- Changing mode of file to 227 --
492bool(false)
493-- Changing mode of file to 228 --
494bool(false)
495-- Changing mode of file to 229 --
496bool(false)
497-- Changing mode of file to 230 --
498bool(false)
499-- Changing mode of file to 231 --
500bool(false)
501-- Changing mode of file to 232 --
502bool(false)
503-- Changing mode of file to 233 --
504bool(false)
505-- Changing mode of file to 234 --
506bool(false)
507-- Changing mode of file to 235 --
508bool(false)
509-- Changing mode of file to 236 --
510bool(false)
511-- Changing mode of file to 237 --
512bool(false)
513-- Changing mode of file to 238 --
514bool(false)
515-- Changing mode of file to 239 --
516bool(false)
517-- Changing mode of file to 240 --
518bool(false)
519-- Changing mode of file to 241 --
520bool(false)
521-- Changing mode of file to 242 --
522bool(false)
523-- Changing mode of file to 243 --
524bool(false)
525-- Changing mode of file to 244 --
526bool(false)
527-- Changing mode of file to 245 --
528bool(false)
529-- Changing mode of file to 246 --
530bool(false)
531-- Changing mode of file to 247 --
532bool(false)
533-- Changing mode of file to 248 --
534bool(false)
535-- Changing mode of file to 249 --
536bool(false)
537-- Changing mode of file to 250 --
538bool(false)
539-- Changing mode of file to 251 --
540bool(false)
541-- Changing mode of file to 252 --
542bool(false)
543-- Changing mode of file to 253 --
544bool(false)
545-- Changing mode of file to 254 --
546bool(false)
547-- Changing mode of file to 255 --
548bool(false)
549-- Changing mode of file to 256 --
550bool(false)
551-- Changing mode of file to 257 --
552bool(false)
553-- Changing mode of file to 258 --
554bool(false)
555-- Changing mode of file to 259 --
556bool(false)
557-- Changing mode of file to 260 --
558bool(false)
559-- Changing mode of file to 261 --
560bool(false)
561-- Changing mode of file to 262 --
562bool(false)
563-- Changing mode of file to 263 --
564bool(false)
565-- Changing mode of file to 264 --
566bool(false)
567-- Changing mode of file to 265 --
568bool(false)
569-- Changing mode of file to 266 --
570bool(false)
571-- Changing mode of file to 267 --
572bool(false)
573-- Changing mode of file to 268 --
574bool(false)
575-- Changing mode of file to 269 --
576bool(false)
577-- Changing mode of file to 270 --
578bool(false)
579-- Changing mode of file to 271 --
580bool(false)
581-- Changing mode of file to 272 --
582bool(false)
583-- Changing mode of file to 273 --
584bool(false)
585-- Changing mode of file to 274 --
586bool(false)
587-- Changing mode of file to 275 --
588bool(false)
589-- Changing mode of file to 276 --
590bool(false)
591-- Changing mode of file to 277 --
592bool(false)
593-- Changing mode of file to 278 --
594bool(false)
595-- Changing mode of file to 279 --
596bool(false)
597-- Changing mode of file to 280 --
598bool(false)
599-- Changing mode of file to 281 --
600bool(false)
601-- Changing mode of file to 282 --
602bool(false)
603-- Changing mode of file to 283 --
604bool(false)
605-- Changing mode of file to 284 --
606bool(false)
607-- Changing mode of file to 285 --
608bool(false)
609-- Changing mode of file to 286 --
610bool(false)
611-- Changing mode of file to 287 --
612bool(false)
613-- Changing mode of file to 288 --
614bool(false)
615-- Changing mode of file to 289 --
616bool(false)
617-- Changing mode of file to 290 --
618bool(false)
619-- Changing mode of file to 291 --
620bool(false)
621-- Changing mode of file to 292 --
622bool(false)
623-- Changing mode of file to 293 --
624bool(false)
625-- Changing mode of file to 294 --
626bool(false)
627-- Changing mode of file to 295 --
628bool(false)
629-- Changing mode of file to 296 --
630bool(false)
631-- Changing mode of file to 297 --
632bool(false)
633-- Changing mode of file to 298 --
634bool(false)
635-- Changing mode of file to 299 --
636bool(false)
637-- Changing mode of file to 300 --
638bool(false)
639-- Changing mode of file to 301 --
640bool(false)
641-- Changing mode of file to 302 --
642bool(false)
643-- Changing mode of file to 303 --
644bool(false)
645-- Changing mode of file to 304 --
646bool(false)
647-- Changing mode of file to 305 --
648bool(false)
649-- Changing mode of file to 306 --
650bool(false)
651-- Changing mode of file to 307 --
652bool(false)
653-- Changing mode of file to 308 --
654bool(false)
655-- Changing mode of file to 309 --
656bool(false)
657-- Changing mode of file to 310 --
658bool(false)
659-- Changing mode of file to 311 --
660bool(false)
661-- Changing mode of file to 312 --
662bool(false)
663-- Changing mode of file to 313 --
664bool(false)
665-- Changing mode of file to 314 --
666bool(false)
667-- Changing mode of file to 315 --
668bool(false)
669-- Changing mode of file to 316 --
670bool(false)
671-- Changing mode of file to 317 --
672bool(false)
673-- Changing mode of file to 318 --
674bool(false)
675-- Changing mode of file to 319 --
676bool(false)
677-- Changing mode of file to 320 --
678bool(false)
679-- Changing mode of file to 321 --
680bool(false)
681-- Changing mode of file to 322 --
682bool(false)
683-- Changing mode of file to 323 --
684bool(false)
685-- Changing mode of file to 324 --
686bool(false)
687-- Changing mode of file to 325 --
688bool(false)
689-- Changing mode of file to 326 --
690bool(false)
691-- Changing mode of file to 327 --
692bool(false)
693-- Changing mode of file to 328 --
694bool(false)
695-- Changing mode of file to 329 --
696bool(false)
697-- Changing mode of file to 330 --
698bool(false)
699-- Changing mode of file to 331 --
700bool(false)
701-- Changing mode of file to 332 --
702bool(false)
703-- Changing mode of file to 333 --
704bool(false)
705-- Changing mode of file to 334 --
706bool(false)
707-- Changing mode of file to 335 --
708bool(false)
709-- Changing mode of file to 336 --
710bool(false)
711-- Changing mode of file to 337 --
712bool(false)
713-- Changing mode of file to 338 --
714bool(false)
715-- Changing mode of file to 339 --
716bool(false)
717-- Changing mode of file to 340 --
718bool(false)
719-- Changing mode of file to 341 --
720bool(false)
721-- Changing mode of file to 342 --
722bool(false)
723-- Changing mode of file to 343 --
724bool(false)
725-- Changing mode of file to 344 --
726bool(false)
727-- Changing mode of file to 345 --
728bool(false)
729-- Changing mode of file to 346 --
730bool(false)
731-- Changing mode of file to 347 --
732bool(false)
733-- Changing mode of file to 348 --
734bool(false)
735-- Changing mode of file to 349 --
736bool(false)
737-- Changing mode of file to 350 --
738bool(false)
739-- Changing mode of file to 351 --
740bool(false)
741-- Changing mode of file to 352 --
742bool(false)
743-- Changing mode of file to 353 --
744bool(false)
745-- Changing mode of file to 354 --
746bool(false)
747-- Changing mode of file to 355 --
748bool(false)
749-- Changing mode of file to 356 --
750bool(false)
751-- Changing mode of file to 357 --
752bool(false)
753-- Changing mode of file to 358 --
754bool(false)
755-- Changing mode of file to 359 --
756bool(false)
757-- Changing mode of file to 360 --
758bool(false)
759-- Changing mode of file to 361 --
760bool(false)
761-- Changing mode of file to 362 --
762bool(false)
763-- Changing mode of file to 363 --
764bool(false)
765-- Changing mode of file to 364 --
766bool(false)
767-- Changing mode of file to 365 --
768bool(false)
769-- Changing mode of file to 366 --
770bool(false)
771-- Changing mode of file to 367 --
772bool(false)
773-- Changing mode of file to 368 --
774bool(false)
775-- Changing mode of file to 369 --
776bool(false)
777-- Changing mode of file to 370 --
778bool(false)
779-- Changing mode of file to 371 --
780bool(false)
781-- Changing mode of file to 372 --
782bool(false)
783-- Changing mode of file to 373 --
784bool(false)
785-- Changing mode of file to 374 --
786bool(false)
787-- Changing mode of file to 375 --
788bool(false)
789-- Changing mode of file to 376 --
790bool(false)
791-- Changing mode of file to 377 --
792bool(false)
793-- Changing mode of file to 378 --
794bool(false)
795-- Changing mode of file to 379 --
796bool(false)
797-- Changing mode of file to 380 --
798bool(false)
799-- Changing mode of file to 381 --
800bool(false)
801-- Changing mode of file to 382 --
802bool(false)
803-- Changing mode of file to 383 --
804bool(false)
805-- Changing mode of file to 384 --
806bool(false)
807-- Changing mode of file to 385 --
808bool(false)
809-- Changing mode of file to 386 --
810bool(false)
811-- Changing mode of file to 387 --
812bool(false)
813-- Changing mode of file to 388 --
814bool(false)
815-- Changing mode of file to 389 --
816bool(false)
817-- Changing mode of file to 390 --
818bool(false)
819-- Changing mode of file to 391 --
820bool(false)
821-- Changing mode of file to 392 --
822bool(false)
823-- Changing mode of file to 393 --
824bool(false)
825-- Changing mode of file to 394 --
826bool(false)
827-- Changing mode of file to 395 --
828bool(false)
829-- Changing mode of file to 396 --
830bool(false)
831-- Changing mode of file to 397 --
832bool(false)
833-- Changing mode of file to 398 --
834bool(false)
835-- Changing mode of file to 399 --
836bool(false)
837-- Changing mode of file to 400 --
838bool(false)
839-- Changing mode of file to 401 --
840bool(false)
841-- Changing mode of file to 402 --
842bool(false)
843-- Changing mode of file to 403 --
844bool(false)
845-- Changing mode of file to 404 --
846bool(false)
847-- Changing mode of file to 405 --
848bool(false)
849-- Changing mode of file to 406 --
850bool(false)
851-- Changing mode of file to 407 --
852bool(false)
853-- Changing mode of file to 408 --
854bool(false)
855-- Changing mode of file to 409 --
856bool(false)
857-- Changing mode of file to 410 --
858bool(false)
859-- Changing mode of file to 411 --
860bool(false)
861-- Changing mode of file to 412 --
862bool(false)
863-- Changing mode of file to 413 --
864bool(false)
865-- Changing mode of file to 414 --
866bool(false)
867-- Changing mode of file to 415 --
868bool(false)
869-- Changing mode of file to 416 --
870bool(false)
871-- Changing mode of file to 417 --
872bool(false)
873-- Changing mode of file to 418 --
874bool(false)
875-- Changing mode of file to 419 --
876bool(false)
877-- Changing mode of file to 420 --
878bool(false)
879-- Changing mode of file to 421 --
880bool(false)
881-- Changing mode of file to 422 --
882bool(false)
883-- Changing mode of file to 423 --
884bool(false)
885-- Changing mode of file to 424 --
886bool(false)
887-- Changing mode of file to 425 --
888bool(false)
889-- Changing mode of file to 426 --
890bool(false)
891-- Changing mode of file to 427 --
892bool(false)
893-- Changing mode of file to 428 --
894bool(false)
895-- Changing mode of file to 429 --
896bool(false)
897-- Changing mode of file to 430 --
898bool(false)
899-- Changing mode of file to 431 --
900bool(false)
901-- Changing mode of file to 432 --
902bool(false)
903-- Changing mode of file to 433 --
904bool(false)
905-- Changing mode of file to 434 --
906bool(false)
907-- Changing mode of file to 435 --
908bool(false)
909-- Changing mode of file to 436 --
910bool(false)
911-- Changing mode of file to 437 --
912bool(false)
913-- Changing mode of file to 438 --
914bool(false)
915-- Changing mode of file to 439 --
916bool(false)
917-- Changing mode of file to 440 --
918bool(false)
919-- Changing mode of file to 441 --
920bool(false)
921-- Changing mode of file to 442 --
922bool(false)
923-- Changing mode of file to 443 --
924bool(false)
925-- Changing mode of file to 444 --
926bool(false)
927-- Changing mode of file to 445 --
928bool(false)
929-- Changing mode of file to 446 --
930bool(false)
931-- Changing mode of file to 447 --
932bool(false)
933-- Changing mode of file to 448 --
934bool(false)
935-- Changing mode of file to 449 --
936bool(false)
937-- Changing mode of file to 450 --
938bool(false)
939-- Changing mode of file to 451 --
940bool(false)
941-- Changing mode of file to 452 --
942bool(false)
943-- Changing mode of file to 453 --
944bool(false)
945-- Changing mode of file to 454 --
946bool(false)
947-- Changing mode of file to 455 --
948bool(false)
949-- Changing mode of file to 456 --
950bool(false)
951-- Changing mode of file to 457 --
952bool(false)
953-- Changing mode of file to 458 --
954bool(false)
955-- Changing mode of file to 459 --
956bool(false)
957-- Changing mode of file to 460 --
958bool(false)
959-- Changing mode of file to 461 --
960bool(false)
961-- Changing mode of file to 462 --
962bool(false)
963-- Changing mode of file to 463 --
964bool(false)
965-- Changing mode of file to 464 --
966bool(false)
967-- Changing mode of file to 465 --
968bool(false)
969-- Changing mode of file to 466 --
970bool(false)
971-- Changing mode of file to 467 --
972bool(false)
973-- Changing mode of file to 468 --
974bool(false)
975-- Changing mode of file to 469 --
976bool(false)
977-- Changing mode of file to 470 --
978bool(false)
979-- Changing mode of file to 471 --
980bool(false)
981-- Changing mode of file to 472 --
982bool(false)
983-- Changing mode of file to 473 --
984bool(false)
985-- Changing mode of file to 474 --
986bool(false)
987-- Changing mode of file to 475 --
988bool(false)
989-- Changing mode of file to 476 --
990bool(false)
991-- Changing mode of file to 477 --
992bool(false)
993-- Changing mode of file to 478 --
994bool(false)
995-- Changing mode of file to 479 --
996bool(false)
997-- Changing mode of file to 480 --
998bool(false)
999-- Changing mode of file to 481 --
1000bool(false)
1001-- Changing mode of file to 482 --
1002bool(false)
1003-- Changing mode of file to 483 --
1004bool(false)
1005-- Changing mode of file to 484 --
1006bool(false)
1007-- Changing mode of file to 485 --
1008bool(false)
1009-- Changing mode of file to 486 --
1010bool(false)
1011-- Changing mode of file to 487 --
1012bool(false)
1013-- Changing mode of file to 488 --
1014bool(false)
1015-- Changing mode of file to 489 --
1016bool(false)
1017-- Changing mode of file to 490 --
1018bool(false)
1019-- Changing mode of file to 491 --
1020bool(false)
1021-- Changing mode of file to 492 --
1022bool(false)
1023-- Changing mode of file to 493 --
1024bool(false)
1025-- Changing mode of file to 494 --
1026bool(false)
1027-- Changing mode of file to 495 --
1028bool(false)
1029-- Changing mode of file to 496 --
1030bool(false)
1031-- Changing mode of file to 497 --
1032bool(false)
1033-- Changing mode of file to 498 --
1034bool(false)
1035-- Changing mode of file to 499 --
1036bool(false)
1037-- Changing mode of file to 500 --
1038bool(false)
1039-- Changing mode of file to 501 --
1040bool(false)
1041-- Changing mode of file to 502 --
1042bool(false)
1043-- Changing mode of file to 503 --
1044bool(false)
1045-- Changing mode of file to 504 --
1046bool(false)
1047-- Changing mode of file to 505 --
1048bool(false)
1049-- Changing mode of file to 506 --
1050bool(false)
1051-- Changing mode of file to 507 --
1052bool(false)
1053-- Changing mode of file to 508 --
1054bool(false)
1055-- Changing mode of file to 509 --
1056bool(false)
1057-- Changing mode of file to 510 --
1058bool(false)
1059-- Changing mode of file to 511 --
1060bool(false)
1061Done
1062
Full Screen

is_readable_basic.phpt

Source: is_readable_basic.phpt Github

copy
1--TEST--
2Test is_readable() function: basic functionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip not for windows');
7}
8require __DIR__ . '/../skipif_root.inc';
9?>
10--FILE--
11<?php
12// include common file test functions
13require __DIR__.'/file.inc';
14
15echo "*** Testing is_readable(): basic functionality ***\n";
16
17// create a file
18$filename = __DIR__."/is_readable.tmp";
19create_file($filename);
20
21$counter = 1;
22/* loop to check if the file with new mode is readable
23   using is_readable() */
24for($mode = 0000; $mode <= 0777; $mode++) {
25  echo "-- Changing mode of file to $mode --\n";
26  chmod($filename, $mode);  // change mode of file
27  var_dump( is_readable($filename) );
28  $counter++;
29  clearstatcache();
30}
31
32// delete the temp file
33delete_file($filename);
34
35echo "Done\n";
36?>
37--EXPECT--
38*** Testing is_readable(): basic functionality ***
39-- Changing mode of file to 0 --
40bool(false)
41-- Changing mode of file to 1 --
42bool(false)
43-- Changing mode of file to 2 --
44bool(false)
45-- Changing mode of file to 3 --
46bool(false)
47-- Changing mode of file to 4 --
48bool(false)
49-- Changing mode of file to 5 --
50bool(false)
51-- Changing mode of file to 6 --
52bool(false)
53-- Changing mode of file to 7 --
54bool(false)
55-- Changing mode of file to 8 --
56bool(false)
57-- Changing mode of file to 9 --
58bool(false)
59-- Changing mode of file to 10 --
60bool(false)
61-- Changing mode of file to 11 --
62bool(false)
63-- Changing mode of file to 12 --
64bool(false)
65-- Changing mode of file to 13 --
66bool(false)
67-- Changing mode of file to 14 --
68bool(false)
69-- Changing mode of file to 15 --
70bool(false)
71-- Changing mode of file to 16 --
72bool(false)
73-- Changing mode of file to 17 --
74bool(false)
75-- Changing mode of file to 18 --
76bool(false)
77-- Changing mode of file to 19 --
78bool(false)
79-- Changing mode of file to 20 --
80bool(false)
81-- Changing mode of file to 21 --
82bool(false)
83-- Changing mode of file to 22 --
84bool(false)
85-- Changing mode of file to 23 --
86bool(false)
87-- Changing mode of file to 24 --
88bool(false)
89-- Changing mode of file to 25 --
90bool(false)
91-- Changing mode of file to 26 --
92bool(false)
93-- Changing mode of file to 27 --
94bool(false)
95-- Changing mode of file to 28 --
96bool(false)
97-- Changing mode of file to 29 --
98bool(false)
99-- Changing mode of file to 30 --
100bool(false)
101-- Changing mode of file to 31 --
102bool(false)
103-- Changing mode of file to 32 --
104bool(false)
105-- Changing mode of file to 33 --
106bool(false)
107-- Changing mode of file to 34 --
108bool(false)
109-- Changing mode of file to 35 --
110bool(false)
111-- Changing mode of file to 36 --
112bool(false)
113-- Changing mode of file to 37 --
114bool(false)
115-- Changing mode of file to 38 --
116bool(false)
117-- Changing mode of file to 39 --
118bool(false)
119-- Changing mode of file to 40 --
120bool(false)
121-- Changing mode of file to 41 --
122bool(false)
123-- Changing mode of file to 42 --
124bool(false)
125-- Changing mode of file to 43 --
126bool(false)
127-- Changing mode of file to 44 --
128bool(false)
129-- Changing mode of file to 45 --
130bool(false)
131-- Changing mode of file to 46 --
132bool(false)
133-- Changing mode of file to 47 --
134bool(false)
135-- Changing mode of file to 48 --
136bool(false)
137-- Changing mode of file to 49 --
138bool(false)
139-- Changing mode of file to 50 --
140bool(false)
141-- Changing mode of file to 51 --
142bool(false)
143-- Changing mode of file to 52 --
144bool(false)
145-- Changing mode of file to 53 --
146bool(false)
147-- Changing mode of file to 54 --
148bool(false)
149-- Changing mode of file to 55 --
150bool(false)
151-- Changing mode of file to 56 --
152bool(false)
153-- Changing mode of file to 57 --
154bool(false)
155-- Changing mode of file to 58 --
156bool(false)
157-- Changing mode of file to 59 --
158bool(false)
159-- Changing mode of file to 60 --
160bool(false)
161-- Changing mode of file to 61 --
162bool(false)
163-- Changing mode of file to 62 --
164bool(false)
165-- Changing mode of file to 63 --
166bool(false)
167-- Changing mode of file to 64 --
168bool(false)
169-- Changing mode of file to 65 --
170bool(false)
171-- Changing mode of file to 66 --
172bool(false)
173-- Changing mode of file to 67 --
174bool(false)
175-- Changing mode of file to 68 --
176bool(false)
177-- Changing mode of file to 69 --
178bool(false)
179-- Changing mode of file to 70 --
180bool(false)
181-- Changing mode of file to 71 --
182bool(false)
183-- Changing mode of file to 72 --
184bool(false)
185-- Changing mode of file to 73 --
186bool(false)
187-- Changing mode of file to 74 --
188bool(false)
189-- Changing mode of file to 75 --
190bool(false)
191-- Changing mode of file to 76 --
192bool(false)
193-- Changing mode of file to 77 --
194bool(false)
195-- Changing mode of file to 78 --
196bool(false)
197-- Changing mode of file to 79 --
198bool(false)
199-- Changing mode of file to 80 --
200bool(false)
201-- Changing mode of file to 81 --
202bool(false)
203-- Changing mode of file to 82 --
204bool(false)
205-- Changing mode of file to 83 --
206bool(false)
207-- Changing mode of file to 84 --
208bool(false)
209-- Changing mode of file to 85 --
210bool(false)
211-- Changing mode of file to 86 --
212bool(false)
213-- Changing mode of file to 87 --
214bool(false)
215-- Changing mode of file to 88 --
216bool(false)
217-- Changing mode of file to 89 --
218bool(false)
219-- Changing mode of file to 90 --
220bool(false)
221-- Changing mode of file to 91 --
222bool(false)
223-- Changing mode of file to 92 --
224bool(false)
225-- Changing mode of file to 93 --
226bool(false)
227-- Changing mode of file to 94 --
228bool(false)
229-- Changing mode of file to 95 --
230bool(false)
231-- Changing mode of file to 96 --
232bool(false)
233-- Changing mode of file to 97 --
234bool(false)
235-- Changing mode of file to 98 --
236bool(false)
237-- Changing mode of file to 99 --
238bool(false)
239-- Changing mode of file to 100 --
240bool(false)
241-- Changing mode of file to 101 --
242bool(false)
243-- Changing mode of file to 102 --
244bool(false)
245-- Changing mode of file to 103 --
246bool(false)
247-- Changing mode of file to 104 --
248bool(false)
249-- Changing mode of file to 105 --
250bool(false)
251-- Changing mode of file to 106 --
252bool(false)
253-- Changing mode of file to 107 --
254bool(false)
255-- Changing mode of file to 108 --
256bool(false)
257-- Changing mode of file to 109 --
258bool(false)
259-- Changing mode of file to 110 --
260bool(false)
261-- Changing mode of file to 111 --
262bool(false)
263-- Changing mode of file to 112 --
264bool(false)
265-- Changing mode of file to 113 --
266bool(false)
267-- Changing mode of file to 114 --
268bool(false)
269-- Changing mode of file to 115 --
270bool(false)
271-- Changing mode of file to 116 --
272bool(false)
273-- Changing mode of file to 117 --
274bool(false)
275-- Changing mode of file to 118 --
276bool(false)
277-- Changing mode of file to 119 --
278bool(false)
279-- Changing mode of file to 120 --
280bool(false)
281-- Changing mode of file to 121 --
282bool(false)
283-- Changing mode of file to 122 --
284bool(false)
285-- Changing mode of file to 123 --
286bool(false)
287-- Changing mode of file to 124 --
288bool(false)
289-- Changing mode of file to 125 --
290bool(false)
291-- Changing mode of file to 126 --
292bool(false)
293-- Changing mode of file to 127 --
294bool(false)
295-- Changing mode of file to 128 --
296bool(false)
297-- Changing mode of file to 129 --
298bool(false)
299-- Changing mode of file to 130 --
300bool(false)
301-- Changing mode of file to 131 --
302bool(false)
303-- Changing mode of file to 132 --
304bool(false)
305-- Changing mode of file to 133 --
306bool(false)
307-- Changing mode of file to 134 --
308bool(false)
309-- Changing mode of file to 135 --
310bool(false)
311-- Changing mode of file to 136 --
312bool(false)
313-- Changing mode of file to 137 --
314bool(false)
315-- Changing mode of file to 138 --
316bool(false)
317-- Changing mode of file to 139 --
318bool(false)
319-- Changing mode of file to 140 --
320bool(false)
321-- Changing mode of file to 141 --
322bool(false)
323-- Changing mode of file to 142 --
324bool(false)
325-- Changing mode of file to 143 --
326bool(false)
327-- Changing mode of file to 144 --
328bool(false)
329-- Changing mode of file to 145 --
330bool(false)
331-- Changing mode of file to 146 --
332bool(false)
333-- Changing mode of file to 147 --
334bool(false)
335-- Changing mode of file to 148 --
336bool(false)
337-- Changing mode of file to 149 --
338bool(false)
339-- Changing mode of file to 150 --
340bool(false)
341-- Changing mode of file to 151 --
342bool(false)
343-- Changing mode of file to 152 --
344bool(false)
345-- Changing mode of file to 153 --
346bool(false)
347-- Changing mode of file to 154 --
348bool(false)
349-- Changing mode of file to 155 --
350bool(false)
351-- Changing mode of file to 156 --
352bool(false)
353-- Changing mode of file to 157 --
354bool(false)
355-- Changing mode of file to 158 --
356bool(false)
357-- Changing mode of file to 159 --
358bool(false)
359-- Changing mode of file to 160 --
360bool(false)
361-- Changing mode of file to 161 --
362bool(false)
363-- Changing mode of file to 162 --
364bool(false)
365-- Changing mode of file to 163 --
366bool(false)
367-- Changing mode of file to 164 --
368bool(false)
369-- Changing mode of file to 165 --
370bool(false)
371-- Changing mode of file to 166 --
372bool(false)
373-- Changing mode of file to 167 --
374bool(false)
375-- Changing mode of file to 168 --
376bool(false)
377-- Changing mode of file to 169 --
378bool(false)
379-- Changing mode of file to 170 --
380bool(false)
381-- Changing mode of file to 171 --
382bool(false)
383-- Changing mode of file to 172 --
384bool(false)
385-- Changing mode of file to 173 --
386bool(false)
387-- Changing mode of file to 174 --
388bool(false)
389-- Changing mode of file to 175 --
390bool(false)
391-- Changing mode of file to 176 --
392bool(false)
393-- Changing mode of file to 177 --
394bool(false)
395-- Changing mode of file to 178 --
396bool(false)
397-- Changing mode of file to 179 --
398bool(false)
399-- Changing mode of file to 180 --
400bool(false)
401-- Changing mode of file to 181 --
402bool(false)
403-- Changing mode of file to 182 --
404bool(false)
405-- Changing mode of file to 183 --
406bool(false)
407-- Changing mode of file to 184 --
408bool(false)
409-- Changing mode of file to 185 --
410bool(false)
411-- Changing mode of file to 186 --
412bool(false)
413-- Changing mode of file to 187 --
414bool(false)
415-- Changing mode of file to 188 --
416bool(false)
417-- Changing mode of file to 189 --
418bool(false)
419-- Changing mode of file to 190 --
420bool(false)
421-- Changing mode of file to 191 --
422bool(false)
423-- Changing mode of file to 192 --
424bool(false)
425-- Changing mode of file to 193 --
426bool(false)
427-- Changing mode of file to 194 --
428bool(false)
429-- Changing mode of file to 195 --
430bool(false)
431-- Changing mode of file to 196 --
432bool(false)
433-- Changing mode of file to 197 --
434bool(false)
435-- Changing mode of file to 198 --
436bool(false)
437-- Changing mode of file to 199 --
438bool(false)
439-- Changing mode of file to 200 --
440bool(false)
441-- Changing mode of file to 201 --
442bool(false)
443-- Changing mode of file to 202 --
444bool(false)
445-- Changing mode of file to 203 --
446bool(false)
447-- Changing mode of file to 204 --
448bool(false)
449-- Changing mode of file to 205 --
450bool(false)
451-- Changing mode of file to 206 --
452bool(false)
453-- Changing mode of file to 207 --
454bool(false)
455-- Changing mode of file to 208 --
456bool(false)
457-- Changing mode of file to 209 --
458bool(false)
459-- Changing mode of file to 210 --
460bool(false)
461-- Changing mode of file to 211 --
462bool(false)
463-- Changing mode of file to 212 --
464bool(false)
465-- Changing mode of file to 213 --
466bool(false)
467-- Changing mode of file to 214 --
468bool(false)
469-- Changing mode of file to 215 --
470bool(false)
471-- Changing mode of file to 216 --
472bool(false)
473-- Changing mode of file to 217 --
474bool(false)
475-- Changing mode of file to 218 --
476bool(false)
477-- Changing mode of file to 219 --
478bool(false)
479-- Changing mode of file to 220 --
480bool(false)
481-- Changing mode of file to 221 --
482bool(false)
483-- Changing mode of file to 222 --
484bool(false)
485-- Changing mode of file to 223 --
486bool(false)
487-- Changing mode of file to 224 --
488bool(false)
489-- Changing mode of file to 225 --
490bool(false)
491-- Changing mode of file to 226 --
492bool(false)
493-- Changing mode of file to 227 --
494bool(false)
495-- Changing mode of file to 228 --
496bool(false)
497-- Changing mode of file to 229 --
498bool(false)
499-- Changing mode of file to 230 --
500bool(false)
501-- Changing mode of file to 231 --
502bool(false)
503-- Changing mode of file to 232 --
504bool(false)
505-- Changing mode of file to 233 --
506bool(false)
507-- Changing mode of file to 234 --
508bool(false)
509-- Changing mode of file to 235 --
510bool(false)
511-- Changing mode of file to 236 --
512bool(false)
513-- Changing mode of file to 237 --
514bool(false)
515-- Changing mode of file to 238 --
516bool(false)
517-- Changing mode of file to 239 --
518bool(false)
519-- Changing mode of file to 240 --
520bool(false)
521-- Changing mode of file to 241 --
522bool(false)
523-- Changing mode of file to 242 --
524bool(false)
525-- Changing mode of file to 243 --
526bool(false)
527-- Changing mode of file to 244 --
528bool(false)
529-- Changing mode of file to 245 --
530bool(false)
531-- Changing mode of file to 246 --
532bool(false)
533-- Changing mode of file to 247 --
534bool(false)
535-- Changing mode of file to 248 --
536bool(false)
537-- Changing mode of file to 249 --
538bool(false)
539-- Changing mode of file to 250 --
540bool(false)
541-- Changing mode of file to 251 --
542bool(false)
543-- Changing mode of file to 252 --
544bool(false)
545-- Changing mode of file to 253 --
546bool(false)
547-- Changing mode of file to 254 --
548bool(false)
549-- Changing mode of file to 255 --
550bool(false)
551-- Changing mode of file to 256 --
552bool(true)
553-- Changing mode of file to 257 --
554bool(true)
555-- Changing mode of file to 258 --
556bool(true)
557-- Changing mode of file to 259 --
558bool(true)
559-- Changing mode of file to 260 --
560bool(true)
561-- Changing mode of file to 261 --
562bool(true)
563-- Changing mode of file to 262 --
564bool(true)
565-- Changing mode of file to 263 --
566bool(true)
567-- Changing mode of file to 264 --
568bool(true)
569-- Changing mode of file to 265 --
570bool(true)
571-- Changing mode of file to 266 --
572bool(true)
573-- Changing mode of file to 267 --
574bool(true)
575-- Changing mode of file to 268 --
576bool(true)
577-- Changing mode of file to 269 --
578bool(true)
579-- Changing mode of file to 270 --
580bool(true)
581-- Changing mode of file to 271 --
582bool(true)
583-- Changing mode of file to 272 --
584bool(true)
585-- Changing mode of file to 273 --
586bool(true)
587-- Changing mode of file to 274 --
588bool(true)
589-- Changing mode of file to 275 --
590bool(true)
591-- Changing mode of file to 276 --
592bool(true)
593-- Changing mode of file to 277 --
594bool(true)
595-- Changing mode of file to 278 --
596bool(true)
597-- Changing mode of file to 279 --
598bool(true)
599-- Changing mode of file to 280 --
600bool(true)
601-- Changing mode of file to 281 --
602bool(true)
603-- Changing mode of file to 282 --
604bool(true)
605-- Changing mode of file to 283 --
606bool(true)
607-- Changing mode of file to 284 --
608bool(true)
609-- Changing mode of file to 285 --
610bool(true)
611-- Changing mode of file to 286 --
612bool(true)
613-- Changing mode of file to 287 --
614bool(true)
615-- Changing mode of file to 288 --
616bool(true)
617-- Changing mode of file to 289 --
618bool(true)
619-- Changing mode of file to 290 --
620bool(true)
621-- Changing mode of file to 291 --
622bool(true)
623-- Changing mode of file to 292 --
624bool(true)
625-- Changing mode of file to 293 --
626bool(true)
627-- Changing mode of file to 294 --
628bool(true)
629-- Changing mode of file to 295 --
630bool(true)
631-- Changing mode of file to 296 --
632bool(true)
633-- Changing mode of file to 297 --
634bool(true)
635-- Changing mode of file to 298 --
636bool(true)
637-- Changing mode of file to 299 --
638bool(true)
639-- Changing mode of file to 300 --
640bool(true)
641-- Changing mode of file to 301 --
642bool(true)
643-- Changing mode of file to 302 --
644bool(true)
645-- Changing mode of file to 303 --
646bool(true)
647-- Changing mode of file to 304 --
648bool(true)
649-- Changing mode of file to 305 --
650bool(true)
651-- Changing mode of file to 306 --
652bool(true)
653-- Changing mode of file to 307 --
654bool(true)
655-- Changing mode of file to 308 --
656bool(true)
657-- Changing mode of file to 309 --
658bool(true)
659-- Changing mode of file to 310 --
660bool(true)
661-- Changing mode of file to 311 --
662bool(true)
663-- Changing mode of file to 312 --
664bool(true)
665-- Changing mode of file to 313 --
666bool(true)
667-- Changing mode of file to 314 --
668bool(true)
669-- Changing mode of file to 315 --
670bool(true)
671-- Changing mode of file to 316 --
672bool(true)
673-- Changing mode of file to 317 --
674bool(true)
675-- Changing mode of file to 318 --
676bool(true)
677-- Changing mode of file to 319 --
678bool(true)
679-- Changing mode of file to 320 --
680bool(true)
681-- Changing mode of file to 321 --
682bool(true)
683-- Changing mode of file to 322 --
684bool(true)
685-- Changing mode of file to 323 --
686bool(true)
687-- Changing mode of file to 324 --
688bool(true)
689-- Changing mode of file to 325 --
690bool(true)
691-- Changing mode of file to 326 --
692bool(true)
693-- Changing mode of file to 327 --
694bool(true)
695-- Changing mode of file to 328 --
696bool(true)
697-- Changing mode of file to 329 --
698bool(true)
699-- Changing mode of file to 330 --
700bool(true)
701-- Changing mode of file to 331 --
702bool(true)
703-- Changing mode of file to 332 --
704bool(true)
705-- Changing mode of file to 333 --
706bool(true)
707-- Changing mode of file to 334 --
708bool(true)
709-- Changing mode of file to 335 --
710bool(true)
711-- Changing mode of file to 336 --
712bool(true)
713-- Changing mode of file to 337 --
714bool(true)
715-- Changing mode of file to 338 --
716bool(true)
717-- Changing mode of file to 339 --
718bool(true)
719-- Changing mode of file to 340 --
720bool(true)
721-- Changing mode of file to 341 --
722bool(true)
723-- Changing mode of file to 342 --
724bool(true)
725-- Changing mode of file to 343 --
726bool(true)
727-- Changing mode of file to 344 --
728bool(true)
729-- Changing mode of file to 345 --
730bool(true)
731-- Changing mode of file to 346 --
732bool(true)
733-- Changing mode of file to 347 --
734bool(true)
735-- Changing mode of file to 348 --
736bool(true)
737-- Changing mode of file to 349 --
738bool(true)
739-- Changing mode of file to 350 --
740bool(true)
741-- Changing mode of file to 351 --
742bool(true)
743-- Changing mode of file to 352 --
744bool(true)
745-- Changing mode of file to 353 --
746bool(true)
747-- Changing mode of file to 354 --
748bool(true)
749-- Changing mode of file to 355 --
750bool(true)
751-- Changing mode of file to 356 --
752bool(true)
753-- Changing mode of file to 357 --
754bool(true)
755-- Changing mode of file to 358 --
756bool(true)
757-- Changing mode of file to 359 --
758bool(true)
759-- Changing mode of file to 360 --
760bool(true)
761-- Changing mode of file to 361 --
762bool(true)
763-- Changing mode of file to 362 --
764bool(true)
765-- Changing mode of file to 363 --
766bool(true)
767-- Changing mode of file to 364 --
768bool(true)
769-- Changing mode of file to 365 --
770bool(true)
771-- Changing mode of file to 366 --
772bool(true)
773-- Changing mode of file to 367 --
774bool(true)
775-- Changing mode of file to 368 --
776bool(true)
777-- Changing mode of file to 369 --
778bool(true)
779-- Changing mode of file to 370 --
780bool(true)
781-- Changing mode of file to 371 --
782bool(true)
783-- Changing mode of file to 372 --
784bool(true)
785-- Changing mode of file to 373 --
786bool(true)
787-- Changing mode of file to 374 --
788bool(true)
789-- Changing mode of file to 375 --
790bool(true)
791-- Changing mode of file to 376 --
792bool(true)
793-- Changing mode of file to 377 --
794bool(true)
795-- Changing mode of file to 378 --
796bool(true)
797-- Changing mode of file to 379 --
798bool(true)
799-- Changing mode of file to 380 --
800bool(true)
801-- Changing mode of file to 381 --
802bool(true)
803-- Changing mode of file to 382 --
804bool(true)
805-- Changing mode of file to 383 --
806bool(true)
807-- Changing mode of file to 384 --
808bool(true)
809-- Changing mode of file to 385 --
810bool(true)
811-- Changing mode of file to 386 --
812bool(true)
813-- Changing mode of file to 387 --
814bool(true)
815-- Changing mode of file to 388 --
816bool(true)
817-- Changing mode of file to 389 --
818bool(true)
819-- Changing mode of file to 390 --
820bool(true)
821-- Changing mode of file to 391 --
822bool(true)
823-- Changing mode of file to 392 --
824bool(true)
825-- Changing mode of file to 393 --
826bool(true)
827-- Changing mode of file to 394 --
828bool(true)
829-- Changing mode of file to 395 --
830bool(true)
831-- Changing mode of file to 396 --
832bool(true)
833-- Changing mode of file to 397 --
834bool(true)
835-- Changing mode of file to 398 --
836bool(true)
837-- Changing mode of file to 399 --
838bool(true)
839-- Changing mode of file to 400 --
840bool(true)
841-- Changing mode of file to 401 --
842bool(true)
843-- Changing mode of file to 402 --
844bool(true)
845-- Changing mode of file to 403 --
846bool(true)
847-- Changing mode of file to 404 --
848bool(true)
849-- Changing mode of file to 405 --
850bool(true)
851-- Changing mode of file to 406 --
852bool(true)
853-- Changing mode of file to 407 --
854bool(true)
855-- Changing mode of file to 408 --
856bool(true)
857-- Changing mode of file to 409 --
858bool(true)
859-- Changing mode of file to 410 --
860bool(true)
861-- Changing mode of file to 411 --
862bool(true)
863-- Changing mode of file to 412 --
864bool(true)
865-- Changing mode of file to 413 --
866bool(true)
867-- Changing mode of file to 414 --
868bool(true)
869-- Changing mode of file to 415 --
870bool(true)
871-- Changing mode of file to 416 --
872bool(true)
873-- Changing mode of file to 417 --
874bool(true)
875-- Changing mode of file to 418 --
876bool(true)
877-- Changing mode of file to 419 --
878bool(true)
879-- Changing mode of file to 420 --
880bool(true)
881-- Changing mode of file to 421 --
882bool(true)
883-- Changing mode of file to 422 --
884bool(true)
885-- Changing mode of file to 423 --
886bool(true)
887-- Changing mode of file to 424 --
888bool(true)
889-- Changing mode of file to 425 --
890bool(true)
891-- Changing mode of file to 426 --
892bool(true)
893-- Changing mode of file to 427 --
894bool(true)
895-- Changing mode of file to 428 --
896bool(true)
897-- Changing mode of file to 429 --
898bool(true)
899-- Changing mode of file to 430 --
900bool(true)
901-- Changing mode of file to 431 --
902bool(true)
903-- Changing mode of file to 432 --
904bool(true)
905-- Changing mode of file to 433 --
906bool(true)
907-- Changing mode of file to 434 --
908bool(true)
909-- Changing mode of file to 435 --
910bool(true)
911-- Changing mode of file to 436 --
912bool(true)
913-- Changing mode of file to 437 --
914bool(true)
915-- Changing mode of file to 438 --
916bool(true)
917-- Changing mode of file to 439 --
918bool(true)
919-- Changing mode of file to 440 --
920bool(true)
921-- Changing mode of file to 441 --
922bool(true)
923-- Changing mode of file to 442 --
924bool(true)
925-- Changing mode of file to 443 --
926bool(true)
927-- Changing mode of file to 444 --
928bool(true)
929-- Changing mode of file to 445 --
930bool(true)
931-- Changing mode of file to 446 --
932bool(true)
933-- Changing mode of file to 447 --
934bool(true)
935-- Changing mode of file to 448 --
936bool(true)
937-- Changing mode of file to 449 --
938bool(true)
939-- Changing mode of file to 450 --
940bool(true)
941-- Changing mode of file to 451 --
942bool(true)
943-- Changing mode of file to 452 --
944bool(true)
945-- Changing mode of file to 453 --
946bool(true)
947-- Changing mode of file to 454 --
948bool(true)
949-- Changing mode of file to 455 --
950bool(true)
951-- Changing mode of file to 456 --
952bool(true)
953-- Changing mode of file to 457 --
954bool(true)
955-- Changing mode of file to 458 --
956bool(true)
957-- Changing mode of file to 459 --
958bool(true)
959-- Changing mode of file to 460 --
960bool(true)
961-- Changing mode of file to 461 --
962bool(true)
963-- Changing mode of file to 462 --
964bool(true)
965-- Changing mode of file to 463 --
966bool(true)
967-- Changing mode of file to 464 --
968bool(true)
969-- Changing mode of file to 465 --
970bool(true)
971-- Changing mode of file to 466 --
972bool(true)
973-- Changing mode of file to 467 --
974bool(true)
975-- Changing mode of file to 468 --
976bool(true)
977-- Changing mode of file to 469 --
978bool(true)
979-- Changing mode of file to 470 --
980bool(true)
981-- Changing mode of file to 471 --
982bool(true)
983-- Changing mode of file to 472 --
984bool(true)
985-- Changing mode of file to 473 --
986bool(true)
987-- Changing mode of file to 474 --
988bool(true)
989-- Changing mode of file to 475 --
990bool(true)
991-- Changing mode of file to 476 --
992bool(true)
993-- Changing mode of file to 477 --
994bool(true)
995-- Changing mode of file to 478 --
996bool(true)
997-- Changing mode of file to 479 --
998bool(true)
999-- Changing mode of file to 480 --
1000bool(true)
1001-- Changing mode of file to 481 --
1002bool(true)
1003-- Changing mode of file to 482 --
1004bool(true)
1005-- Changing mode of file to 483 --
1006bool(true)
1007-- Changing mode of file to 484 --
1008bool(true)
1009-- Changing mode of file to 485 --
1010bool(true)
1011-- Changing mode of file to 486 --
1012bool(true)
1013-- Changing mode of file to 487 --
1014bool(true)
1015-- Changing mode of file to 488 --
1016bool(true)
1017-- Changing mode of file to 489 --
1018bool(true)
1019-- Changing mode of file to 490 --
1020bool(true)
1021-- Changing mode of file to 491 --
1022bool(true)
1023-- Changing mode of file to 492 --
1024bool(true)
1025-- Changing mode of file to 493 --
1026bool(true)
1027-- Changing mode of file to 494 --
1028bool(true)
1029-- Changing mode of file to 495 --
1030bool(true)
1031-- Changing mode of file to 496 --
1032bool(true)
1033-- Changing mode of file to 497 --
1034bool(true)
1035-- Changing mode of file to 498 --
1036bool(true)
1037-- Changing mode of file to 499 --
1038bool(true)
1039-- Changing mode of file to 500 --
1040bool(true)
1041-- Changing mode of file to 501 --
1042bool(true)
1043-- Changing mode of file to 502 --
1044bool(true)
1045-- Changing mode of file to 503 --
1046bool(true)
1047-- Changing mode of file to 504 --
1048bool(true)
1049-- Changing mode of file to 505 --
1050bool(true)
1051-- Changing mode of file to 506 --
1052bool(true)
1053-- Changing mode of file to 507 --
1054bool(true)
1055-- Changing mode of file to 508 --
1056bool(true)
1057-- Changing mode of file to 509 --
1058bool(true)
1059-- Changing mode of file to 510 --
1060bool(true)
1061-- Changing mode of file to 511 --
1062bool(true)
1063Done
1064
Full Screen

main.swift

Source: main.swift Github

copy
1//
2//  main.swift
3//  Algorithm
4//
5//  Created by LHMacCoder on 2021/7/5.
6//
7
8import Foundation
9
10//var array = [2,3,5,1,7,44,6,8,456456,768678,2342,56758,24345,7564,-100,-999]
11//print("bubble sort:             \(bubbleSort(array))")
12//print("selectionSort sort:      \(selectionSort(array))")
13//print("heapSort sort:           \(heapSort(array))")
14//print("insertion sort:          \(insertionSort(array))")
15//print("merge sort:              \(mergeSort(array))")
16//print("quick sort:              \(quickSort(array))")
17//print("shell sort:              \(shellSort(array))")
18//
19//var union = UnionFind.init(capacity: 10)
20//print("before union:")
21//print(union!)
22//union?.unionQF(value1: 1, value2: 0)
23//print(union!)
24//union?.unionQF(value1: 1, value2: 2)
25//print(union!)
26//union?.unionQF(value1: 3, value2: 4)
27//print(union!)
28//union?.unionQF(value1: 0, value2: 3)
29//print(union!)
30
31//var unionG = GenericUnionFind<Int>.init()
32//unionG.makeNode(nodeValue: 0)
33//unionG.makeNode(nodeValue: 1)
34//unionG.makeNode(nodeValue: 2)
35//unionG.makeNode(nodeValue: 3)
36//unionG.makeNode(nodeValue: 4)
37//unionG.makeNode(nodeValue: 5)
38//unionG.makeNode(nodeValue: 6)
39//unionG.makeNode(nodeValue: 7)
40//unionG.makeNode(nodeValue: 8)
41//unionG.makeNode(nodeValue: 9)
42//print("before union:")
43//print(unionG)
44//unionG.union(lnv: 1, rnv: 0)
45//print(unionG)
46//unionG.union(lnv: 1, rnv: 2)
47//print(unionG)
48//unionG.union(lnv: 3, rnv: 4)
49//print(unionG)
50//unionG.union(lnv: 0, rnv: 3)
51//print(unionG)
52
53
54
55//let graph = Graph<String, Int>.init()
56//graph.addEdge(from: "V1", to: "V0", weight: 9)
57//graph.addEdge(from: "V1", to: "V2", weight: 3)
58//graph.addEdge(from: "V2", to: "V3", weight: 5)
59//graph.addEdge(from: "V3", to: "V4", weight: 1)
60//graph.addEdge(from: "V2", to: "V0", weight: 2)
61//graph.addEdge(from: "V0", to: "V4", weight: 6)
62//graph.addVertex(vertex: "V5")
63//graph.removeVertex(vertex: "V0")
64//graph.graphPrint()
65//graph.addEdge(from: "a", to: "V1", weight: 9)
66//graph.addEdge(from: "V0", to: "V4", weight: 9)
67//graph.addEdge(from: "V2", to: "V0", weight: 3)
68//graph.addEdge(from: "V1", to: "V2", weight: 5)
69//graph.addEdge(from: "V3", to: "V1", weight: 1)
70//graph.addEdge(from: "V2", to: "V5", weight: 2)
71//graph.addEdge(from: "V2", to: "V4", weight: 6)
72//graph.addEdge(from: "V4", to: "V6", weight: 9)
73//graph.addEdge(from: "V4", to: "V7", weight: 3)
74//graph.addEdge(from: "V5", to: "V3", weight: 5)
75//graph.addEdge(from: "V5", to: "V7", weight: 1)
76//graph.addEdge(from: "V6", to: "V2", weight: 2)
77//graph.addEdge(from: "V6", to: "V1", weight: 6)
78//graph.bfs(vertex: "V0") {
79//    print($0)
80//    return false
81//}
82
83//let graph1 = Graph<Int, Int>.init()
84//graph1.addEdge(from: 0, to: 1, weight: nil)
85//graph1.addEdge(from: 1, to: 0, weight: nil)
86//
87//graph1.addEdge(from: 1, to: 2, weight: nil)
88//graph1.addEdge(from: 2, to: 1, weight: nil)
89//
90//graph1.addEdge(from: 1, to: 3, weight: nil)
91//graph1.addEdge(from: 3, to: 1, weight: nil)
92//
93//graph1.addEdge(from: 1, to: 5, weight: nil)
94//graph1.addEdge(from: 5, to: 1, weight: nil)
95//
96//graph1.addEdge(from: 1, to: 6, weight: nil)
97//graph1.addEdge(from: 6, to: 1, weight: nil)
98//
99//graph1.addEdge(from: 2, to: 4, weight: nil)
100//graph1.addEdge(from: 4, to: 2, weight: nil)
101//
102//graph1.addEdge(from: 3, to: 7, weight: nil)
103//graph1.addEdge(from: 7, to: 3, weight: nil)
104//
105//graph1.dfs(vertex: 1) {
106//    print($0)
107//    return false
108//}
109
110//let graph2 = Graph<String, Int>.init()
111//graph2.addEdge(from: "a", to: "e")
112//graph2.addEdge(from: "a", to: "b")
113//graph2.addEdge(from: "b", to: "e")
114//graph2.addEdge(from: "c", to: "b")
115//graph2.addEdge(from: "d", to: "a")
116//graph2.addEdge(from: "e", to: "c")
117//graph2.addEdge(from: "e", to: "f")
118//graph2.addEdge(from: "f", to: "c")
119//graph2.dfs(vertex: "a") {
120//    print($0)
121//    return false
122//}
123
124//let graph = Graph<String, Int>.init()
125//graph.addEdge(from: "A", to: "B")
126//graph.addEdge(from: "A", to: "D")
127//graph.addEdge(from: "B", to: "F")
128//graph.addEdge(from: "C", to: "B")
129//graph.addEdge(from: "C", to: "F")
130//graph.addEdge(from: "E", to: "A")
131//graph.addEdge(from: "E", to: "B")
132//graph.addEdge(from: "E", to: "F")
133//print(graph.topologicalSort())
134
135
136//let heap = BinaryHeap<Int>.init()
137//heap.add(element: 68)
138//heap.add(element: 72)
139//heap.add(element: 43)
140//heap.add(element: 50)
141//heap.add(element: 38)
142//heap.heapPrint()
143//heap.add(element: 100)
144//heap.heapPrint()
145//let top = heap.replae(element: 1)
146//heap.heapPrint()
147//print(top)
148
149
150//let graph = Graph<Int, Int>.init()
151//graph.addEdge(from: 0, to: 2, weight: 2)
152//graph.addEdge(from: 0, to: 4, weight: 7)
153//graph.addEdge(from: 2, to: 0, weight: 2)
154//graph.addEdge(from: 2, to: 1, weight: 3)
155//graph.addEdge(from: 2, to: 6, weight: 6)
156//graph.addEdge(from: 2, to: 5, weight: 3)
157//graph.addEdge(from: 2, to: 4, weight: 4)
158//graph.addEdge(from: 2, to: 4, weight: 4)
159//graph.addEdge(from: 1, to: 2, weight: 3)
160//graph.addEdge(from: 1, to: 6, weight: 7)
161//graph.addEdge(from: 1, to: 5, weight: 1)
162//graph.addEdge(from: 4, to: 0, weight: 7)
163//graph.addEdge(from: 4, to: 2, weight: 4)
164//graph.addEdge(from: 4, to: 6, weight: 8)
165//graph.addEdge(from: 6, to: 5, weight: 4)
166//graph.addEdge(from: 6, to: 2, weight: 6)
167//graph.addEdge(from: 6, to: 4, weight: 8)
168//graph.addEdge(from: 6, to: 1, weight: 7)
169//graph.addEdge(from: 5, to: 6, weight: 4)
170//graph.addEdge(from: 5, to: 1, weight: 1)
171//graph.addEdge(from: 5, to: 2, weight: 3)
172//graph.addEdge(from: 5, to: 7, weight: 5)
173//graph.addEdge(from: 7, to: 5, weight: 5)
174//graph.addEdge(from: 7, to: 3, weight: 9)
175//graph.addEdge(from: 3, to: 7, weight: 9)
176//print(graph.prim())
177//print(graph.kruskal())
178
179//let graph = Graph<String, Int>.init()
180//graph.addEdge(from: "A", to: "B", weight: 17)
181//graph.addEdge(from: "B", to: "A", weight: 17)
182//graph.addEdge(from: "A", to: "F", weight: 1)
183//graph.addEdge(from: "F", to: "A", weight: 1)
184//graph.addEdge(from: "A", to: "E", weight: 16)
185//graph.addEdge(from: "E", to: "A", weight: 16)
186//graph.addEdge(from: "B", to: "F", weight: 11)
187//graph.addEdge(from: "F", to: "B", weight: 11)
188//graph.addEdge(from: "B", to: "D", weight: 5)
189//graph.addEdge(from: "D", to: "B", weight: 16)
190//graph.addEdge(from: "B", to: "C", weight: 6)
191//graph.addEdge(from: "C", to: "B", weight: 6)
192//graph.addEdge(from: "F", to: "E", weight: 33)
193//graph.addEdge(from: "E", to: "F", weight: 33)
194//graph.addEdge(from: "F", to: "D", weight: 14)
195//graph.addEdge(from: "D", to: "F", weight: 14)
196//graph.addEdge(from: "E", to: "D", weight: 4)
197//graph.addEdge(from: "D", to: "E", weight: 4)
198//graph.addEdge(from: "D", to: "C", weight: 10)
199//graph.addEdge(from: "C", to: "D", weight: 10)
200//print(graph.prim())
201//print(graph.kruskal())
202
203//let graph = Graph<String, Int>.init()
204//graph.addEdge(from: "A", to: "B", weight: 10)
205//graph.addEdge(from: "A", to: "E", weight: 100)
206//graph.addEdge(from: "A", to: "D", weight: 30)
207//graph.addEdge(from: "B", to: "C", weight: 50)
208//graph.addEdge(from: "C", to: "E", weight: 10)
209//graph.addEdge(from: "D", to: "C", weight: 20)
210//graph.addEdge(from: "D", to: "E", weight: 60)
211
212//graph.addEdge(from: "B", to: "A", weight: 10)
213//graph.addEdge(from: "E", to: "A", weight: 100)
214//graph.addEdge(from: "D", to: "A", weight: 30)
215//graph.addEdge(from: "C", to: "B", weight: 50)
216//graph.addEdge(from: "E", to: "C", weight: 10)
217//graph.addEdge(from: "C", to: "D", weight: 20)
218//graph.addEdge(from: "E", to: "D", weight: 60)
219
220//print(graph.dijkstra(vertex: "A", addWeightClosure: {$0 + $1}) ?? 0)
221//print(graph.bellmanFord(beginVertex: "A", beginWeight: 0, addWeightClosure: {$0 + $1}) ?? 0)
222//print(graph.floyd(addWeightClosure: {$0 + $1}))
223
224
225//let tree = BinarySearchTree<Int>.init()
226//let array = [1, 4, 88, 85, 100, 61, 63, 21, 5, 9, 92, 59, 95, 47, 44, 26, 58, 13]
227//for number in array {
228//    tree.add(element: number)
229//}
230//tree.traversalClosure = { (element,stop) -> () in
231//    if element == 61 {
232//        stop = true
233//    }
234//    print(element)
235//}
236//print(tree.isCompleteTree())
237//tree.remove(element: 67)
238//print(tree.inorderTraversal())
239//print(tree.preorderTraversal())
240//tree.remove(element: 57)
241//print(tree.inorderTraversal())
242//print(tree.postorderTraversal())
243
244//let avlTree = AVLTree<Int>.init()
245//let array = [41, 97, 18, 61, 100, 80, 69, 76, 3, 78, 8, 33, 79, 75, 40]
246//for number in array {
247//    avlTree.add(element: number)
248//}
249//avlTree.traversalClosure = {print($0)}
250//avlTree.add(element: 90)
251//print(avlTree.preorderTraversal())
252//print(avlTree.inorderTraversal())
253
254
255//let rbTree = RBTree<Int>.init()
256//let array = [33, 11, 55, 14, 24, 47, 78, 44, 27, 70, 86, 37, 97, 61, 74, 67, 99, 21, 28]
257//for number in array {
258//    rbTree.add(element: number)
259//}
260//rbTree.traversalClosure = { (element,stop) -> () in
261//    print(element)
262//}
263//rbTree.remove(element: 97)
264//rbTree.remove(element: 21)
265//rbTree.remove(element: 28)
266//rbTree.remove(element: 11)
267//
268//print(rbTree.preorderTraversal())
269
270
Full Screen