Annotation of embedaddon/php/ext/ctype/tests/ctype_cntrl_variation3.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ctype_cntrl() function : usage variations - Different strings
3: --SKIPIF--
4: <?php require_once('skipif.inc'); ?>
5: --FILE--
6: <?php
7: /* Prototype : bool ctype_cntrl(mixed $c)
8: * Description: Checks for control character(s)
9: * Source code: ext/ctype/ctype.c
10: */
11:
12: /*
13: * Pass strings containing different character types to ctype_cntrl() to test
14: * which are considered valid control character only strings
15: */
16:
17: echo "*** Testing ctype_cntrl() : usage variations ***\n";
18:
19: $orig = setlocale(LC_CTYPE, "C");
20:
21: $values = array(
22: /*1*/ "This string contains just letters and spaces", // Simple string
23: "but this one contains some numbers too 123+456 = 678", // Mixed string
24: "",
25: " ",
26: /*5*/ "a",
27: "ABCXYZ",
28: "abcxyz",
29: "ABCXYZ123DEF456",
30: "abczyz123DEF456",
31: /*10*/ "\r\n",
32: "123",
33: "03F", // hexadecimal 'digits'
34: ")speci@! ch@r$(",
35: '@!$*',
36: /*15*/ 'ABC',
37: 'abc',
38: 'ABC123',
39: 'abc123',
40: 'abc123\n',
41: /*20*/ 'abc 123',
42: '',
43: ' ',
44: base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
45: "\n",
46: /*25*/ "\r",
47: "\t",
48: "0xD",
49: "0xA",
50: "0xE",
51: /*30*/ "\t\r\n",
52: );
53:
54:
55: // loop through each element of $values to test behaviour of ctype_cntrl()
56: $iterator = 1;
57: foreach($values as $value) {
58: echo "\n-- Iteration $iterator --\n";
59: var_dump( ctype_cntrl($value) );
60: $iterator++;
61: };
62:
63: setlocale(LC_CTYPE, $orig);
64: ?>
65: ===DONE===
66: --EXPECTF--
67: *** Testing ctype_cntrl() : usage variations ***
68:
69: -- Iteration 1 --
70: bool(false)
71:
72: -- Iteration 2 --
73: bool(false)
74:
75: -- Iteration 3 --
76: bool(false)
77:
78: -- Iteration 4 --
79: bool(false)
80:
81: -- Iteration 5 --
82: bool(false)
83:
84: -- Iteration 6 --
85: bool(false)
86:
87: -- Iteration 7 --
88: bool(false)
89:
90: -- Iteration 8 --
91: bool(false)
92:
93: -- Iteration 9 --
94: bool(false)
95:
96: -- Iteration 10 --
97: bool(true)
98:
99: -- Iteration 11 --
100: bool(false)
101:
102: -- Iteration 12 --
103: bool(false)
104:
105: -- Iteration 13 --
106: bool(false)
107:
108: -- Iteration 14 --
109: bool(false)
110:
111: -- Iteration 15 --
112: bool(false)
113:
114: -- Iteration 16 --
115: bool(false)
116:
117: -- Iteration 17 --
118: bool(false)
119:
120: -- Iteration 18 --
121: bool(false)
122:
123: -- Iteration 19 --
124: bool(false)
125:
126: -- Iteration 20 --
127: bool(false)
128:
129: -- Iteration 21 --
130: bool(false)
131:
132: -- Iteration 22 --
133: bool(false)
134:
135: -- Iteration 23 --
136: bool(false)
137:
138: -- Iteration 24 --
139: bool(true)
140:
141: -- Iteration 25 --
142: bool(true)
143:
144: -- Iteration 26 --
145: bool(true)
146:
147: -- Iteration 27 --
148: bool(false)
149:
150: -- Iteration 28 --
151: bool(false)
152:
153: -- Iteration 29 --
154: bool(false)
155:
156: -- Iteration 30 --
157: bool(true)
158: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>