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