Annotation of embedaddon/php/ext/standard/tests/strings/strncasecmp_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strncasecmp() function: usage variations - case-sensitivity
3: --FILE--
4: <?php
5: /* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
6: * Description: Binary safe case-insensitive string comparison of the first n characters
7: * Source code: Zend/zend_builtin_functions.c
8: */
9:
10: /* Test strncasecmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
11:
12: echo "*** Test strncasecmp() function: with alphabets ***\n";
13: echo "-- Passing upper-case letters for 'str1' --\n";
14: for($ASCII = 65; $ASCII <= 90; $ASCII++) {
15: var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase letter with corresponding uppercase letter; exp: int(0)
16: var_dump( strncasecmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing uppercase letter with corresponding lowercase letter; exp: int(0)
17: }
18:
19: echo "\n-- Passing lower-case letters for 'str1' --\n";
20: for($ASCII = 97; $ASCII <= 122; $ASCII++) {
21: var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase letter with corresponding lowercase letter; exp: int(0)
22: var_dump( strncasecmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing lowercase letter with corresponding uppercase letter; exp: int(0)
23: }
24: echo "*** Done ***\n";
25: ?>
26: --EXPECTF--
27: *** Test strncasecmp() function: with alphabets ***
28: -- Passing upper-case letters for 'str1' --
29: int(0)
30: int(0)
31: int(0)
32: int(0)
33: int(0)
34: int(0)
35: int(0)
36: int(0)
37: int(0)
38: int(0)
39: int(0)
40: int(0)
41: int(0)
42: int(0)
43: int(0)
44: int(0)
45: int(0)
46: int(0)
47: int(0)
48: int(0)
49: int(0)
50: int(0)
51: int(0)
52: int(0)
53: int(0)
54: int(0)
55: int(0)
56: int(0)
57: int(0)
58: int(0)
59: int(0)
60: int(0)
61: int(0)
62: int(0)
63: int(0)
64: int(0)
65: int(0)
66: int(0)
67: int(0)
68: int(0)
69: int(0)
70: int(0)
71: int(0)
72: int(0)
73: int(0)
74: int(0)
75: int(0)
76: int(0)
77: int(0)
78: int(0)
79: int(0)
80: int(0)
81:
82: -- Passing lower-case letters for 'str1' --
83: int(0)
84: int(0)
85: int(0)
86: int(0)
87: int(0)
88: int(0)
89: int(0)
90: int(0)
91: int(0)
92: int(0)
93: int(0)
94: int(0)
95: int(0)
96: int(0)
97: int(0)
98: int(0)
99: int(0)
100: int(0)
101: int(0)
102: int(0)
103: int(0)
104: int(0)
105: int(0)
106: int(0)
107: int(0)
108: int(0)
109: int(0)
110: int(0)
111: int(0)
112: int(0)
113: int(0)
114: int(0)
115: int(0)
116: int(0)
117: int(0)
118: int(0)
119: int(0)
120: int(0)
121: int(0)
122: int(0)
123: int(0)
124: int(0)
125: int(0)
126: int(0)
127: int(0)
128: int(0)
129: int(0)
130: int(0)
131: int(0)
132: int(0)
133: int(0)
134: int(0)
135: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>