Annotation of embedaddon/php/ext/ctype/tests/002.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ctype on strings
3: --SKIPIF--
4: <?php require_once('skipif.inc'); ?>
5: --FILE--
6: <?php
7:
8: setlocale(LC_ALL,"C");
9: print "LOCALE is '" . setlocale(LC_ALL,0) . "'\n";
10:
11: function ctype_test_002($function) {
12: $n1 = $n2 = $n3 = 0;
13: // test portable POSIX characters 0..127
14: for ($a=0;$a<128;$a++) {
15: $c = chr($a);
16: if($function($a)) $n1++;
17: if($function("$c$c$c")) $n2++;
18: if($function("1-$c$c$c-x")) $n3++;
19: }
20: print "$function $n1 $n2 $n3\n";
21: }
22:
23: ctype_test_002("ctype_lower");
24: ctype_test_002("ctype_upper");
25: ctype_test_002("ctype_alpha");
26: ctype_test_002("ctype_digit");
27: ctype_test_002("ctype_alnum");
28: ctype_test_002("ctype_cntrl");
29: ctype_test_002("ctype_graph");
30: ctype_test_002("ctype_print");
31: ctype_test_002("ctype_punct");
32: ctype_test_002("ctype_space");
33: ctype_test_002("ctype_xdigit");
34:
35: ?>
36: --EXPECTF--
37: LOCALE is '%s'
38: ctype_lower 26 26 0
39: ctype_upper 26 26 0
40: ctype_alpha 52 52 0
41: ctype_digit 10 10 0
42: ctype_alnum 62 62 0
43: ctype_cntrl 33 33 0
44: ctype_graph 94 94 94
45: ctype_print 95 95 95
46: ctype_punct 32 32 0
47: ctype_space 6 6 0
48: ctype_xdigit 22 22 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>