diff options
-rw-r--r-- | ext/ctype/tests/002.phpt | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/ext/ctype/tests/002.phpt b/ext/ctype/tests/002.phpt index 8ccc1c7f75..f002b3b933 100644 --- a/ext/ctype/tests/002.phpt +++ b/ext/ctype/tests/002.phpt @@ -6,17 +6,22 @@ ctype on strings --GET-- --FILE-- <?php - setlocale(LC_ALL,"C"); - function ctype_test_002($function) { - $n=0; $m=0; - for($a=0;$a<256;$a++) { - $c = chr($a); - if($function("$c$c$c")) $n++; - if($function("1-$c$c$c-x")) $m++; - } - echo "$function $n $m\n"; - } +setlocale(LC_ALL,"C"); +print "LOCALE is '" . setlocale(LC_ALL,0) . "'\n"; + +function ctype_test_002($function) { + $n1 = $n2 = $n3 = 0; + // test portable POSIX characters 0..127 + for ($a=0;$a<128;$a++) { + $c = chr($a); + if($function($a)) $n1++; + if($function("$c$c$c")) $n2++; + if($function("1-$c$c$c-x")) $n3++; + } + print "$function $n1 $n2 $n3\n"; +} + ctype_test_002("ctype_lower"); ctype_test_002("ctype_upper"); ctype_test_002("ctype_alpha"); @@ -28,16 +33,18 @@ ctype_test_002("ctype_print"); ctype_test_002("ctype_punct"); ctype_test_002("ctype_space"); ctype_test_002("ctype_xdigit"); + ?> --EXPECT-- -ctype_lower 26 0 -ctype_upper 26 0 -ctype_alpha 52 0 -ctype_digit 10 0 -ctype_alnum 62 0 -ctype_cntrl 33 0 -ctype_graph 94 94 -ctype_print 95 95 -ctype_punct 32 0 -ctype_space 6 0 -ctype_xdigit 22 0 +LOCALE is 'C' +ctype_lower 26 26 0 +ctype_upper 26 26 0 +ctype_alpha 52 52 0 +ctype_digit 10 10 0 +ctype_alnum 62 62 0 +ctype_cntrl 33 33 0 +ctype_graph 94 94 94 +ctype_print 95 95 95 +ctype_punct 32 32 0 +ctype_space 6 6 0 +ctype_xdigit 22 22 0 |