Annotation of embedaddon/php/ext/standard/tests/strings/strtoupper1-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strtoupper() function
3: --SKIPIF--
4: <?php
5: if( (substr(PHP_OS, 0, 3) != "WIN") || (setlocale(LC_CTYPE, "") != "English_United States.1252") )
6: die('skip Run only on Windows with locale as "English_United States.1252"');
7: ?>
8: --FILE--
9: <?php
10: /* Prototype:
11: string strtoupper ( string $string );
12: Description:
13: Returns string with all alphabetic characters converted to uppercase
14: */
15:
16: echo "*** Testing strtoupper() with all 256 chars ***\n";
17: for ($i=0; $i<=255; $i++){
18: $char = chr($i);
19: print(bin2hex($char))." => ".(bin2hex(strtoupper("$char")))."\n";
20: }
21:
22: echo "\n*** Testing strtoupper() with basic strings ***\n";
23: $str = "Mary Had A liTTle LAmb and ShE loveD IT So\n";
24: var_dump(strtoupper($str));
25:
26: echo "\n*** Testing strtoupper() with various strings ***";
27: /* strings to pass strtoupper() */
28: $strings = array (
29: "",
30: "string",
31: "stRINg0234",
32: "1.233.344StrinG12333",
33: "$$$$$$!!!!@@@@@@@ ABCDEF !!!***",
34: "ABCD\0abcdABCD",
35: NULL,
36: TRUE,
37: FALSE,
38: array()
39: );
40:
41: $count = 0;
42: /* loop through to check possible variations */
43: foreach ($strings as $string) {
44: echo "\n-- Iteration $count --\n";
45: var_dump( strtoupper($string) );
46: $count++;
47: }
48:
49: echo "\n*** Testing strtoupper() with two different case strings ***\n";
50: if (strtoupper("HeLLo woRLd") === strtoupper("hEllo WORLD"))
51: echo "strings are same, with Case Insensitive\n";
52: else
53: echo "strings are not same\n";
54:
55: echo "\n*** Testing error conditions ***";
56: var_dump( strtoupper() ); /* Zero arguments */
57: var_dump( strtoupper("a", "b") ); /* Arguments > Expected */
58:
59: echo "*** Done ***";
60: ?>
61: --EXPECTF--
62: *** Testing strtoupper() with all 256 chars ***
63: 00 => 00
64: 01 => 01
65: 02 => 02
66: 03 => 03
67: 04 => 04
68: 05 => 05
69: 06 => 06
70: 07 => 07
71: 08 => 08
72: 09 => 09
73: 0a => 0a
74: 0b => 0b
75: 0c => 0c
76: 0d => 0d
77: 0e => 0e
78: 0f => 0f
79: 10 => 10
80: 11 => 11
81: 12 => 12
82: 13 => 13
83: 14 => 14
84: 15 => 15
85: 16 => 16
86: 17 => 17
87: 18 => 18
88: 19 => 19
89: 1a => 1a
90: 1b => 1b
91: 1c => 1c
92: 1d => 1d
93: 1e => 1e
94: 1f => 1f
95: 20 => 20
96: 21 => 21
97: 22 => 22
98: 23 => 23
99: 24 => 24
100: 25 => 25
101: 26 => 26
102: 27 => 27
103: 28 => 28
104: 29 => 29
105: 2a => 2a
106: 2b => 2b
107: 2c => 2c
108: 2d => 2d
109: 2e => 2e
110: 2f => 2f
111: 30 => 30
112: 31 => 31
113: 32 => 32
114: 33 => 33
115: 34 => 34
116: 35 => 35
117: 36 => 36
118: 37 => 37
119: 38 => 38
120: 39 => 39
121: 3a => 3a
122: 3b => 3b
123: 3c => 3c
124: 3d => 3d
125: 3e => 3e
126: 3f => 3f
127: 40 => 40
128: 41 => 41
129: 42 => 42
130: 43 => 43
131: 44 => 44
132: 45 => 45
133: 46 => 46
134: 47 => 47
135: 48 => 48
136: 49 => 49
137: 4a => 4a
138: 4b => 4b
139: 4c => 4c
140: 4d => 4d
141: 4e => 4e
142: 4f => 4f
143: 50 => 50
144: 51 => 51
145: 52 => 52
146: 53 => 53
147: 54 => 54
148: 55 => 55
149: 56 => 56
150: 57 => 57
151: 58 => 58
152: 59 => 59
153: 5a => 5a
154: 5b => 5b
155: 5c => 5c
156: 5d => 5d
157: 5e => 5e
158: 5f => 5f
159: 60 => 60
160: 61 => 41
161: 62 => 42
162: 63 => 43
163: 64 => 44
164: 65 => 45
165: 66 => 46
166: 67 => 47
167: 68 => 48
168: 69 => 49
169: 6a => 4a
170: 6b => 4b
171: 6c => 4c
172: 6d => 4d
173: 6e => 4e
174: 6f => 4f
175: 70 => 50
176: 71 => 51
177: 72 => 52
178: 73 => 53
179: 74 => 54
180: 75 => 55
181: 76 => 56
182: 77 => 57
183: 78 => 58
184: 79 => 59
185: 7a => 5a
186: 7b => 7b
187: 7c => 7c
188: 7d => 7d
189: 7e => 7e
190: 7f => 7f
191: 80 => 80
192: 81 => 81
193: 82 => 82
194: 83 => 83
195: 84 => 84
196: 85 => 85
197: 86 => 86
198: 87 => 87
199: 88 => 88
200: 89 => 89
201: 8a => 8a
202: 8b => 8b
203: 8c => 8c
204: 8d => 8d
205: 8e => 8e
206: 8f => 8f
207: 90 => 90
208: 91 => 91
209: 92 => 92
210: 93 => 93
211: 94 => 94
212: 95 => 95
213: 96 => 96
214: 97 => 97
215: 98 => 98
216: 99 => 99
217: 9a => 8a
218: 9b => 9b
219: 9c => 8c
220: 9d => 9d
221: 9e => 8e
222: 9f => 9f
223: a0 => a0
224: a1 => a1
225: a2 => a2
226: a3 => a3
227: a4 => a4
228: a5 => a5
229: a6 => a6
230: a7 => a7
231: a8 => a8
232: a9 => a9
233: aa => aa
234: ab => ab
235: ac => ac
236: ad => ad
237: ae => ae
238: af => af
239: b0 => b0
240: b1 => b1
241: b2 => b2
242: b3 => b3
243: b4 => b4
244: b5 => b5
245: b6 => b6
246: b7 => b7
247: b8 => b8
248: b9 => b9
249: ba => ba
250: bb => bb
251: bc => bc
252: bd => bd
253: be => be
254: bf => bf
255: c0 => c0
256: c1 => c1
257: c2 => c2
258: c3 => c3
259: c4 => c4
260: c5 => c5
261: c6 => c6
262: c7 => c7
263: c8 => c8
264: c9 => c9
265: ca => ca
266: cb => cb
267: cc => cc
268: cd => cd
269: ce => ce
270: cf => cf
271: d0 => d0
272: d1 => d1
273: d2 => d2
274: d3 => d3
275: d4 => d4
276: d5 => d5
277: d6 => d6
278: d7 => d7
279: d8 => d8
280: d9 => d9
281: da => da
282: db => db
283: dc => dc
284: dd => dd
285: de => de
286: df => df
287: e0 => c0
288: e1 => c1
289: e2 => c2
290: e3 => c3
291: e4 => c4
292: e5 => c5
293: e6 => c6
294: e7 => c7
295: e8 => c8
296: e9 => c9
297: ea => ca
298: eb => cb
299: ec => cc
300: ed => cd
301: ee => ce
302: ef => cf
303: f0 => d0
304: f1 => d1
305: f2 => d2
306: f3 => d3
307: f4 => d4
308: f5 => d5
309: f6 => d6
310: f7 => f7
311: f8 => d8
312: f9 => d9
313: fa => da
314: fb => db
315: fc => dc
316: fd => dd
317: fe => de
318: ff => 9f
319:
320: *** Testing strtoupper() with basic strings ***
321: string(43) "MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
322: "
323:
324: *** Testing strtoupper() with various strings ***
325: -- Iteration 0 --
326: string(0) ""
327:
328: -- Iteration 1 --
329: string(6) "STRING"
330:
331: -- Iteration 2 --
332: string(10) "STRING0234"
333:
334: -- Iteration 3 --
335: string(20) "1.233.344STRING12333"
336:
337: -- Iteration 4 --
338: string(31) "$$$$$$!!!!@@@@@@@ ABCDEF !!!***"
339:
340: -- Iteration 5 --
341: string(13) "ABCD ABCDABCD"
342:
343: -- Iteration 6 --
344: string(0) ""
345:
346: -- Iteration 7 --
347: string(1) "1"
348:
349: -- Iteration 8 --
350: string(0) ""
351:
352: -- Iteration 9 --
353:
354: Warning: strtoupper() expects parameter 1 to be string, array given in %s on line %d
355: NULL
356:
357: *** Testing strtoupper() with two different case strings ***
358: strings are same, with Case Insensitive
359:
360: *** Testing error conditions ***
361: Warning: strtoupper() expects exactly 1 parameter, 0 given in %s on line %d
362: NULL
363:
364: Warning: strtoupper() expects exactly 1 parameter, 2 given in %s on line %d
365: NULL
366: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>