Annotation of embedaddon/php/ext/ctype/tests/ctype_digit_variation3.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ctype_digit() function : usage variations - different strings
3: --SKIPIF--
4: <?php require_once('skipif.inc'); ?>
5: --FILE--
6: <?php
7: /* Prototype : bool ctype_digit(mixed $c)
8: * Description: Checks for numeric character(s)
9: * Source code: ext/ctype/ctype.c
10: */
11:
12: /*
13: * Pass strings containing different character types to ctype_digit() to test
14: * which are considered valid decimal digit only strings
15: */
16:
17: echo "*** Testing ctype_digit() : 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: ")speci@! ch@r$(",
34: '@!$*',
35: "0",
36: /*15*/ "3",
37: "9",
38: "1234",
39: "7890",
40: "0677",
41: /*20*/ '0',
42: '3',
43: '9',
44: '1234',
45: '7890',
46: /*25*/ "123abc",
47: "abc123",
48: "123\r\t",
49: "123 ",
50: " 123",
51: /*30*/ "123E4",
52: /*31*/ "0x3F",
53: );
54:
55: $iterator = 1;
56: foreach($values as $value) {
57: echo "\n-- Iteration $iterator --\n";
58: var_dump( ctype_digit($value) );
59: $iterator++;
60: };
61:
62: setlocale(LC_CTYPE, $orig);
63: ?>
64: ===DONE===
65: --EXPECTF--
66: *** Testing ctype_digit() : usage variations ***
67:
68: -- Iteration 1 --
69: bool(false)
70:
71: -- Iteration 2 --
72: bool(false)
73:
74: -- Iteration 3 --
75: bool(false)
76:
77: -- Iteration 4 --
78: bool(false)
79:
80: -- Iteration 5 --
81: bool(false)
82:
83: -- Iteration 6 --
84: bool(false)
85:
86: -- Iteration 7 --
87: bool(false)
88:
89: -- Iteration 8 --
90: bool(false)
91:
92: -- Iteration 9 --
93: bool(false)
94:
95: -- Iteration 10 --
96: bool(false)
97:
98: -- Iteration 11 --
99: bool(true)
100:
101: -- Iteration 12 --
102: bool(false)
103:
104: -- Iteration 13 --
105: bool(false)
106:
107: -- Iteration 14 --
108: bool(true)
109:
110: -- Iteration 15 --
111: bool(true)
112:
113: -- Iteration 16 --
114: bool(true)
115:
116: -- Iteration 17 --
117: bool(true)
118:
119: -- Iteration 18 --
120: bool(true)
121:
122: -- Iteration 19 --
123: bool(true)
124:
125: -- Iteration 20 --
126: bool(true)
127:
128: -- Iteration 21 --
129: bool(true)
130:
131: -- Iteration 22 --
132: bool(true)
133:
134: -- Iteration 23 --
135: bool(true)
136:
137: -- Iteration 24 --
138: bool(true)
139:
140: -- Iteration 25 --
141: bool(false)
142:
143: -- Iteration 26 --
144: bool(false)
145:
146: -- Iteration 27 --
147: bool(false)
148:
149: -- Iteration 28 --
150: bool(false)
151:
152: -- Iteration 29 --
153: bool(false)
154:
155: -- Iteration 30 --
156: bool(false)
157:
158: -- Iteration 31 --
159: bool(false)
160: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>