Annotation of embedaddon/php/ext/standard/tests/strings/strspn_variation11.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strspn() function : usage variations - with varying start and default len args
3: --FILE--
4: <?php
5: /* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
6: * Description: Finds length of initial segment consisting entirely of characters found in mask.
7: If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
8: * Source code: ext/standard/string.c
9: * Alias to functions: none
10: */
11:
12: /*
13: * Testing strspn() : with varying start and default len arguments
14: */
15:
16: echo "*** Testing strspn() : with different start and default len values ***\n";
17:
18: // initialing required variables
19: // defining different strings
20: $strings = array(
21: "",
22: '',
23: "\n",
24: '\n',
25: "hello\tworld\nhello\nworld\n",
26: 'hello\tworld\nhello\nworld\n',
27: "1234hello45world\t123",
28: '1234hello45world\t123',
29: "hello\0world\012",
30: 'hello\0world\012',
31: chr(0).chr(0),
32: chr(0)."hello\0world".chr(0),
33: chr(0).'hello\0world'.chr(0),
34: "hello".chr(0)."world",
35: 'hello'.chr(0).'world',
36: "hello\0\100\xaaaworld",
37: 'hello\0\100\xaaaworld'
38: );
39:
40: // define the array of mask strings
41: $mask_array = array(
42: "",
43: '',
44: "f\n\trelshti \l",
45: 'f\n\trelsthi \l',
46: "\telh",
47: "t\ ",
48: '\telh',
49: "felh\t\ ",
50: " \t",
51: "fhel\t\i\100\xa"
52: );
53:
54: // defining the array for start values
55: $start_array = array(
56: 0,
57: 1,
58: 2,
59: -1,
60: -2,
61: 2147483647, // max positive integer
62: -2147483648, // min negative integer
63: );
64:
65:
66: // loop through each element of the arrays for str, mask and start argument
67: $count = 1;
68: foreach($strings as $str) {
69: echo "\n-- Iteration $count --\n";
70: foreach($mask_array as $mask) {
71: foreach($start_array as $start) {
72: var_dump( strspn($str,$mask,$start) );
73: }
74: }
75: $count++;
76: }
77:
78: echo "Done"
79: ?>
80: --EXPECTF--
81: *** Testing strspn() : with different start and default len values ***
82:
83: -- Iteration 1 --
84: int(0)
85: bool(false)
86: bool(false)
87: int(0)
88: int(0)
89: bool(false)
90: int(0)
91: int(0)
92: bool(false)
93: bool(false)
94: int(0)
95: int(0)
96: bool(false)
97: int(0)
98: int(0)
99: bool(false)
100: bool(false)
101: int(0)
102: int(0)
103: bool(false)
104: int(0)
105: int(0)
106: bool(false)
107: bool(false)
108: int(0)
109: int(0)
110: bool(false)
111: int(0)
112: int(0)
113: bool(false)
114: bool(false)
115: int(0)
116: int(0)
117: bool(false)
118: int(0)
119: int(0)
120: bool(false)
121: bool(false)
122: int(0)
123: int(0)
124: bool(false)
125: int(0)
126: int(0)
127: bool(false)
128: bool(false)
129: int(0)
130: int(0)
131: bool(false)
132: int(0)
133: int(0)
134: bool(false)
135: bool(false)
136: int(0)
137: int(0)
138: bool(false)
139: int(0)
140: int(0)
141: bool(false)
142: bool(false)
143: int(0)
144: int(0)
145: bool(false)
146: int(0)
147: int(0)
148: bool(false)
149: bool(false)
150: int(0)
151: int(0)
152: bool(false)
153: int(0)
154:
155: -- Iteration 2 --
156: int(0)
157: bool(false)
158: bool(false)
159: int(0)
160: int(0)
161: bool(false)
162: int(0)
163: int(0)
164: bool(false)
165: bool(false)
166: int(0)
167: int(0)
168: bool(false)
169: int(0)
170: int(0)
171: bool(false)
172: bool(false)
173: int(0)
174: int(0)
175: bool(false)
176: int(0)
177: int(0)
178: bool(false)
179: bool(false)
180: int(0)
181: int(0)
182: bool(false)
183: int(0)
184: int(0)
185: bool(false)
186: bool(false)
187: int(0)
188: int(0)
189: bool(false)
190: int(0)
191: int(0)
192: bool(false)
193: bool(false)
194: int(0)
195: int(0)
196: bool(false)
197: int(0)
198: int(0)
199: bool(false)
200: bool(false)
201: int(0)
202: int(0)
203: bool(false)
204: int(0)
205: int(0)
206: bool(false)
207: bool(false)
208: int(0)
209: int(0)
210: bool(false)
211: int(0)
212: int(0)
213: bool(false)
214: bool(false)
215: int(0)
216: int(0)
217: bool(false)
218: int(0)
219: int(0)
220: bool(false)
221: bool(false)
222: int(0)
223: int(0)
224: bool(false)
225: int(0)
226:
227: -- Iteration 3 --
228: int(0)
229: int(0)
230: bool(false)
231: int(0)
232: int(0)
233: bool(false)
234: int(0)
235: int(0)
236: int(0)
237: bool(false)
238: int(0)
239: int(0)
240: bool(false)
241: int(0)
242: int(1)
243: int(0)
244: bool(false)
245: int(1)
246: int(1)
247: bool(false)
248: int(1)
249: int(0)
250: int(0)
251: bool(false)
252: int(0)
253: int(0)
254: bool(false)
255: int(0)
256: int(0)
257: int(0)
258: bool(false)
259: int(0)
260: int(0)
261: bool(false)
262: int(0)
263: int(0)
264: int(0)
265: bool(false)
266: int(0)
267: int(0)
268: bool(false)
269: int(0)
270: int(0)
271: int(0)
272: bool(false)
273: int(0)
274: int(0)
275: bool(false)
276: int(0)
277: int(0)
278: int(0)
279: bool(false)
280: int(0)
281: int(0)
282: bool(false)
283: int(0)
284: int(0)
285: int(0)
286: bool(false)
287: int(0)
288: int(0)
289: bool(false)
290: int(0)
291: int(1)
292: int(0)
293: bool(false)
294: int(1)
295: int(1)
296: bool(false)
297: int(1)
298:
299: -- Iteration 4 --
300: int(0)
301: int(0)
302: int(0)
303: int(0)
304: int(0)
305: bool(false)
306: int(0)
307: int(0)
308: int(0)
309: int(0)
310: int(0)
311: int(0)
312: bool(false)
313: int(0)
314: int(1)
315: int(0)
316: int(0)
317: int(0)
318: int(1)
319: bool(false)
320: int(1)
321: int(2)
322: int(1)
323: int(0)
324: int(1)
325: int(2)
326: bool(false)
327: int(2)
328: int(0)
329: int(0)
330: int(0)
331: int(0)
332: int(0)
333: bool(false)
334: int(0)
335: int(1)
336: int(0)
337: int(0)
338: int(0)
339: int(1)
340: bool(false)
341: int(1)
342: int(1)
343: int(0)
344: int(0)
345: int(0)
346: int(1)
347: bool(false)
348: int(1)
349: int(1)
350: int(0)
351: int(0)
352: int(0)
353: int(1)
354: bool(false)
355: int(1)
356: int(0)
357: int(0)
358: int(0)
359: int(0)
360: int(0)
361: bool(false)
362: int(0)
363: int(1)
364: int(0)
365: int(0)
366: int(0)
367: int(1)
368: bool(false)
369: int(1)
370:
371: -- Iteration 5 --
372: int(0)
373: int(0)
374: int(0)
375: int(0)
376: int(0)
377: bool(false)
378: int(0)
379: int(0)
380: int(0)
381: int(0)
382: int(0)
383: int(0)
384: bool(false)
385: int(0)
386: int(4)
387: int(3)
388: int(2)
389: int(1)
390: int(0)
391: bool(false)
392: int(4)
393: int(4)
394: int(3)
395: int(2)
396: int(0)
397: int(0)
398: bool(false)
399: int(4)
400: int(4)
401: int(3)
402: int(2)
403: int(0)
404: int(0)
405: bool(false)
406: int(4)
407: int(0)
408: int(0)
409: int(0)
410: int(0)
411: int(0)
412: bool(false)
413: int(0)
414: int(4)
415: int(3)
416: int(2)
417: int(0)
418: int(0)
419: bool(false)
420: int(4)
421: int(4)
422: int(3)
423: int(2)
424: int(0)
425: int(0)
426: bool(false)
427: int(4)
428: int(0)
429: int(0)
430: int(0)
431: int(0)
432: int(0)
433: bool(false)
434: int(0)
435: int(4)
436: int(3)
437: int(2)
438: int(1)
439: int(0)
440: bool(false)
441: int(4)
442:
443: -- Iteration 6 --
444: int(0)
445: int(0)
446: int(0)
447: int(0)
448: int(0)
449: bool(false)
450: int(0)
451: int(0)
452: int(0)
453: int(0)
454: int(0)
455: int(0)
456: bool(false)
457: int(0)
458: int(4)
459: int(3)
460: int(2)
461: int(0)
462: int(1)
463: bool(false)
464: int(4)
465: int(4)
466: int(3)
467: int(2)
468: int(1)
469: int(2)
470: bool(false)
471: int(4)
472: int(4)
473: int(3)
474: int(2)
475: int(0)
476: int(0)
477: bool(false)
478: int(4)
479: int(0)
480: int(0)
481: int(0)
482: int(0)
483: int(1)
484: bool(false)
485: int(0)
486: int(4)
487: int(3)
488: int(2)
489: int(0)
490: int(1)
491: bool(false)
492: int(4)
493: int(4)
494: int(3)
495: int(2)
496: int(0)
497: int(1)
498: bool(false)
499: int(4)
500: int(0)
501: int(0)
502: int(0)
503: int(0)
504: int(0)
505: bool(false)
506: int(0)
507: int(4)
508: int(3)
509: int(2)
510: int(0)
511: int(1)
512: bool(false)
513: int(4)
514:
515: -- Iteration 7 --
516: int(0)
517: int(0)
518: int(0)
519: int(0)
520: int(0)
521: bool(false)
522: int(0)
523: int(0)
524: int(0)
525: int(0)
526: int(0)
527: int(0)
528: bool(false)
529: int(0)
530: int(0)
531: int(0)
532: int(0)
533: int(0)
534: int(0)
535: bool(false)
536: int(0)
537: int(0)
538: int(0)
539: int(0)
540: int(0)
541: int(0)
542: bool(false)
543: int(0)
544: int(0)
545: int(0)
546: int(0)
547: int(0)
548: int(0)
549: bool(false)
550: int(0)
551: int(0)
552: int(0)
553: int(0)
554: int(0)
555: int(0)
556: bool(false)
557: int(0)
558: int(0)
559: int(0)
560: int(0)
561: int(0)
562: int(0)
563: bool(false)
564: int(0)
565: int(0)
566: int(0)
567: int(0)
568: int(0)
569: int(0)
570: bool(false)
571: int(0)
572: int(0)
573: int(0)
574: int(0)
575: int(0)
576: int(0)
577: bool(false)
578: int(0)
579: int(0)
580: int(0)
581: int(0)
582: int(0)
583: int(0)
584: bool(false)
585: int(0)
586:
587: -- Iteration 8 --
588: int(0)
589: int(0)
590: int(0)
591: int(0)
592: int(0)
593: bool(false)
594: int(0)
595: int(0)
596: int(0)
597: int(0)
598: int(0)
599: int(0)
600: bool(false)
601: int(0)
602: int(0)
603: int(0)
604: int(0)
605: int(0)
606: int(0)
607: bool(false)
608: int(0)
609: int(0)
610: int(0)
611: int(0)
612: int(0)
613: int(0)
614: bool(false)
615: int(0)
616: int(0)
617: int(0)
618: int(0)
619: int(0)
620: int(0)
621: bool(false)
622: int(0)
623: int(0)
624: int(0)
625: int(0)
626: int(0)
627: int(0)
628: bool(false)
629: int(0)
630: int(0)
631: int(0)
632: int(0)
633: int(0)
634: int(0)
635: bool(false)
636: int(0)
637: int(0)
638: int(0)
639: int(0)
640: int(0)
641: int(0)
642: bool(false)
643: int(0)
644: int(0)
645: int(0)
646: int(0)
647: int(0)
648: int(0)
649: bool(false)
650: int(0)
651: int(0)
652: int(0)
653: int(0)
654: int(0)
655: int(0)
656: bool(false)
657: int(0)
658:
659: -- Iteration 9 --
660: int(0)
661: int(0)
662: int(0)
663: int(0)
664: int(0)
665: bool(false)
666: int(0)
667: int(0)
668: int(0)
669: int(0)
670: int(0)
671: int(0)
672: bool(false)
673: int(0)
674: int(4)
675: int(3)
676: int(2)
677: int(1)
678: int(0)
679: bool(false)
680: int(4)
681: int(4)
682: int(3)
683: int(2)
684: int(0)
685: int(0)
686: bool(false)
687: int(4)
688: int(4)
689: int(3)
690: int(2)
691: int(0)
692: int(0)
693: bool(false)
694: int(4)
695: int(0)
696: int(0)
697: int(0)
698: int(0)
699: int(0)
700: bool(false)
701: int(0)
702: int(4)
703: int(3)
704: int(2)
705: int(0)
706: int(0)
707: bool(false)
708: int(4)
709: int(4)
710: int(3)
711: int(2)
712: int(0)
713: int(0)
714: bool(false)
715: int(4)
716: int(0)
717: int(0)
718: int(0)
719: int(0)
720: int(0)
721: bool(false)
722: int(0)
723: int(4)
724: int(3)
725: int(2)
726: int(1)
727: int(0)
728: bool(false)
729: int(4)
730:
731: -- Iteration 10 --
732: int(0)
733: int(0)
734: int(0)
735: int(0)
736: int(0)
737: bool(false)
738: int(0)
739: int(0)
740: int(0)
741: int(0)
742: int(0)
743: int(0)
744: bool(false)
745: int(0)
746: int(4)
747: int(3)
748: int(2)
749: int(0)
750: int(0)
751: bool(false)
752: int(4)
753: int(4)
754: int(3)
755: int(2)
756: int(0)
757: int(0)
758: bool(false)
759: int(4)
760: int(4)
761: int(3)
762: int(2)
763: int(0)
764: int(0)
765: bool(false)
766: int(4)
767: int(0)
768: int(0)
769: int(0)
770: int(0)
771: int(0)
772: bool(false)
773: int(0)
774: int(4)
775: int(3)
776: int(2)
777: int(0)
778: int(0)
779: bool(false)
780: int(4)
781: int(4)
782: int(3)
783: int(2)
784: int(0)
785: int(0)
786: bool(false)
787: int(4)
788: int(0)
789: int(0)
790: int(0)
791: int(0)
792: int(0)
793: bool(false)
794: int(0)
795: int(4)
796: int(3)
797: int(2)
798: int(0)
799: int(0)
800: bool(false)
801: int(4)
802:
803: -- Iteration 11 --
804: int(0)
805: int(0)
806: int(0)
807: int(0)
808: int(0)
809: bool(false)
810: int(0)
811: int(0)
812: int(0)
813: int(0)
814: int(0)
815: int(0)
816: bool(false)
817: int(0)
818: int(0)
819: int(0)
820: int(0)
821: int(0)
822: int(0)
823: bool(false)
824: int(0)
825: int(0)
826: int(0)
827: int(0)
828: int(0)
829: int(0)
830: bool(false)
831: int(0)
832: int(0)
833: int(0)
834: int(0)
835: int(0)
836: int(0)
837: bool(false)
838: int(0)
839: int(0)
840: int(0)
841: int(0)
842: int(0)
843: int(0)
844: bool(false)
845: int(0)
846: int(0)
847: int(0)
848: int(0)
849: int(0)
850: int(0)
851: bool(false)
852: int(0)
853: int(0)
854: int(0)
855: int(0)
856: int(0)
857: int(0)
858: bool(false)
859: int(0)
860: int(0)
861: int(0)
862: int(0)
863: int(0)
864: int(0)
865: bool(false)
866: int(0)
867: int(0)
868: int(0)
869: int(0)
870: int(0)
871: int(0)
872: bool(false)
873: int(0)
874:
875: -- Iteration 12 --
876: int(0)
877: int(0)
878: int(0)
879: int(0)
880: int(0)
881: bool(false)
882: int(0)
883: int(0)
884: int(0)
885: int(0)
886: int(0)
887: int(0)
888: bool(false)
889: int(0)
890: int(0)
891: int(4)
892: int(3)
893: int(0)
894: int(0)
895: bool(false)
896: int(0)
897: int(0)
898: int(4)
899: int(3)
900: int(0)
901: int(0)
902: bool(false)
903: int(0)
904: int(0)
905: int(4)
906: int(3)
907: int(0)
908: int(0)
909: bool(false)
910: int(0)
911: int(0)
912: int(0)
913: int(0)
914: int(0)
915: int(0)
916: bool(false)
917: int(0)
918: int(0)
919: int(4)
920: int(3)
921: int(0)
922: int(0)
923: bool(false)
924: int(0)
925: int(0)
926: int(4)
927: int(3)
928: int(0)
929: int(0)
930: bool(false)
931: int(0)
932: int(0)
933: int(0)
934: int(0)
935: int(0)
936: int(0)
937: bool(false)
938: int(0)
939: int(0)
940: int(4)
941: int(3)
942: int(0)
943: int(0)
944: bool(false)
945: int(0)
946:
947: -- Iteration 13 --
948: int(0)
949: int(0)
950: int(0)
951: int(0)
952: int(0)
953: bool(false)
954: int(0)
955: int(0)
956: int(0)
957: int(0)
958: int(0)
959: int(0)
960: bool(false)
961: int(0)
962: int(0)
963: int(4)
964: int(3)
965: int(0)
966: int(0)
967: bool(false)
968: int(0)
969: int(0)
970: int(4)
971: int(3)
972: int(0)
973: int(0)
974: bool(false)
975: int(0)
976: int(0)
977: int(4)
978: int(3)
979: int(0)
980: int(0)
981: bool(false)
982: int(0)
983: int(0)
984: int(0)
985: int(0)
986: int(0)
987: int(0)
988: bool(false)
989: int(0)
990: int(0)
991: int(4)
992: int(3)
993: int(0)
994: int(0)
995: bool(false)
996: int(0)
997: int(0)
998: int(4)
999: int(3)
1000: int(0)
1001: int(0)
1002: bool(false)
1003: int(0)
1004: int(0)
1005: int(0)
1006: int(0)
1007: int(0)
1008: int(0)
1009: bool(false)
1010: int(0)
1011: int(0)
1012: int(4)
1013: int(3)
1014: int(0)
1015: int(0)
1016: bool(false)
1017: int(0)
1018:
1019: -- Iteration 14 --
1020: int(0)
1021: int(0)
1022: int(0)
1023: int(0)
1024: int(0)
1025: bool(false)
1026: int(0)
1027: int(0)
1028: int(0)
1029: int(0)
1030: int(0)
1031: int(0)
1032: bool(false)
1033: int(0)
1034: int(4)
1035: int(3)
1036: int(2)
1037: int(0)
1038: int(1)
1039: bool(false)
1040: int(4)
1041: int(4)
1042: int(3)
1043: int(2)
1044: int(0)
1045: int(1)
1046: bool(false)
1047: int(4)
1048: int(4)
1049: int(3)
1050: int(2)
1051: int(0)
1052: int(1)
1053: bool(false)
1054: int(4)
1055: int(0)
1056: int(0)
1057: int(0)
1058: int(0)
1059: int(0)
1060: bool(false)
1061: int(0)
1062: int(4)
1063: int(3)
1064: int(2)
1065: int(0)
1066: int(1)
1067: bool(false)
1068: int(4)
1069: int(4)
1070: int(3)
1071: int(2)
1072: int(0)
1073: int(1)
1074: bool(false)
1075: int(4)
1076: int(0)
1077: int(0)
1078: int(0)
1079: int(0)
1080: int(0)
1081: bool(false)
1082: int(0)
1083: int(4)
1084: int(3)
1085: int(2)
1086: int(0)
1087: int(1)
1088: bool(false)
1089: int(4)
1090:
1091: -- Iteration 15 --
1092: int(0)
1093: int(0)
1094: int(0)
1095: int(0)
1096: int(0)
1097: bool(false)
1098: int(0)
1099: int(0)
1100: int(0)
1101: int(0)
1102: int(0)
1103: int(0)
1104: bool(false)
1105: int(0)
1106: int(4)
1107: int(3)
1108: int(2)
1109: int(0)
1110: int(1)
1111: bool(false)
1112: int(4)
1113: int(4)
1114: int(3)
1115: int(2)
1116: int(0)
1117: int(1)
1118: bool(false)
1119: int(4)
1120: int(4)
1121: int(3)
1122: int(2)
1123: int(0)
1124: int(1)
1125: bool(false)
1126: int(4)
1127: int(0)
1128: int(0)
1129: int(0)
1130: int(0)
1131: int(0)
1132: bool(false)
1133: int(0)
1134: int(4)
1135: int(3)
1136: int(2)
1137: int(0)
1138: int(1)
1139: bool(false)
1140: int(4)
1141: int(4)
1142: int(3)
1143: int(2)
1144: int(0)
1145: int(1)
1146: bool(false)
1147: int(4)
1148: int(0)
1149: int(0)
1150: int(0)
1151: int(0)
1152: int(0)
1153: bool(false)
1154: int(0)
1155: int(4)
1156: int(3)
1157: int(2)
1158: int(0)
1159: int(1)
1160: bool(false)
1161: int(4)
1162:
1163: -- Iteration 16 --
1164: int(0)
1165: int(0)
1166: int(0)
1167: int(0)
1168: int(0)
1169: bool(false)
1170: int(0)
1171: int(0)
1172: int(0)
1173: int(0)
1174: int(0)
1175: int(0)
1176: bool(false)
1177: int(0)
1178: int(4)
1179: int(3)
1180: int(2)
1181: int(0)
1182: int(1)
1183: bool(false)
1184: int(4)
1185: int(4)
1186: int(3)
1187: int(2)
1188: int(0)
1189: int(1)
1190: bool(false)
1191: int(4)
1192: int(4)
1193: int(3)
1194: int(2)
1195: int(0)
1196: int(1)
1197: bool(false)
1198: int(4)
1199: int(0)
1200: int(0)
1201: int(0)
1202: int(0)
1203: int(0)
1204: bool(false)
1205: int(0)
1206: int(4)
1207: int(3)
1208: int(2)
1209: int(0)
1210: int(1)
1211: bool(false)
1212: int(4)
1213: int(4)
1214: int(3)
1215: int(2)
1216: int(0)
1217: int(1)
1218: bool(false)
1219: int(4)
1220: int(0)
1221: int(0)
1222: int(0)
1223: int(0)
1224: int(0)
1225: bool(false)
1226: int(0)
1227: int(4)
1228: int(3)
1229: int(2)
1230: int(0)
1231: int(1)
1232: bool(false)
1233: int(4)
1234:
1235: -- Iteration 17 --
1236: int(0)
1237: int(0)
1238: int(0)
1239: int(0)
1240: int(0)
1241: bool(false)
1242: int(0)
1243: int(0)
1244: int(0)
1245: int(0)
1246: int(0)
1247: int(0)
1248: bool(false)
1249: int(0)
1250: int(4)
1251: int(3)
1252: int(2)
1253: int(0)
1254: int(1)
1255: bool(false)
1256: int(4)
1257: int(4)
1258: int(3)
1259: int(2)
1260: int(0)
1261: int(1)
1262: bool(false)
1263: int(4)
1264: int(4)
1265: int(3)
1266: int(2)
1267: int(0)
1268: int(1)
1269: bool(false)
1270: int(4)
1271: int(0)
1272: int(0)
1273: int(0)
1274: int(0)
1275: int(0)
1276: bool(false)
1277: int(0)
1278: int(4)
1279: int(3)
1280: int(2)
1281: int(0)
1282: int(1)
1283: bool(false)
1284: int(4)
1285: int(4)
1286: int(3)
1287: int(2)
1288: int(0)
1289: int(1)
1290: bool(false)
1291: int(4)
1292: int(0)
1293: int(0)
1294: int(0)
1295: int(0)
1296: int(0)
1297: bool(false)
1298: int(0)
1299: int(4)
1300: int(3)
1301: int(2)
1302: int(0)
1303: int(1)
1304: bool(false)
1305: int(4)
1306: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>