Annotation of embedaddon/php/ext/ctype/tests/ctype_alpha_variation3.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test ctype_alpha() function : usage variations - different strings
                      3: --SKIPIF--
                      4: <?php require_once('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: /* Prototype  : bool ctype_alpha(mixed $c)
                      8:  * Description: Checks for alphabetic character(s) 
                      9:  * Source code: ext/ctype/ctype.c
                     10:  */
                     11: 
                     12: /*
                     13:  * Pass strings containing different character types to ctype_alpha() to test
                     14:  * which are considered valid alphabetic character only strings
                     15:  */
                     16: 
                     17: echo "*** Testing ctype_alpha() : 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: /*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
                     45: );
                     46: 
                     47: 
                     48: // loop through each element of $values to test behaviour of ctype_alnum()
                     49: $iterator = 1;
                     50: foreach($values as $value) {
                     51:       echo "\n-- Iteration $iterator --\n";
                     52:       var_dump( ctype_alpha($value) );
                     53:       $iterator++;
                     54: };
                     55: 
                     56: setlocale(LC_CTYPE, $orig);
                     57: ?>
                     58: ===DONE===
                     59: --EXPECTF--
                     60: *** Testing ctype_alpha() : usage variations ***
                     61: 
                     62: -- Iteration 1 --
                     63: bool(false)
                     64: 
                     65: -- Iteration 2 --
                     66: bool(false)
                     67: 
                     68: -- Iteration 3 --
                     69: bool(false)
                     70: 
                     71: -- Iteration 4 --
                     72: bool(false)
                     73: 
                     74: -- Iteration 5 --
                     75: bool(true)
                     76: 
                     77: -- Iteration 6 --
                     78: bool(true)
                     79: 
                     80: -- Iteration 7 --
                     81: bool(true)
                     82: 
                     83: -- Iteration 8 --
                     84: bool(false)
                     85: 
                     86: -- Iteration 9 --
                     87: bool(false)
                     88: 
                     89: -- Iteration 10 --
                     90: bool(false)
                     91: 
                     92: -- Iteration 11 --
                     93: bool(false)
                     94: 
                     95: -- Iteration 12 --
                     96: bool(false)
                     97: 
                     98: -- Iteration 13 --
                     99: bool(false)
                    100: 
                    101: -- Iteration 14 --
                    102: bool(false)
                    103: 
                    104: -- Iteration 15 --
                    105: bool(true)
                    106: 
                    107: -- Iteration 16 --
                    108: bool(true)
                    109: 
                    110: -- Iteration 17 --
                    111: bool(false)
                    112: 
                    113: -- Iteration 18 --
                    114: bool(false)
                    115: 
                    116: -- Iteration 19 --
                    117: bool(false)
                    118: 
                    119: -- Iteration 20 --
                    120: bool(false)
                    121: 
                    122: -- Iteration 21 --
                    123: bool(false)
                    124: 
                    125: -- Iteration 22 --
                    126: bool(false)
                    127: 
                    128: -- Iteration 23 --
                    129: bool(false)
                    130: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>