Annotation of embedaddon/php/ext/standard/tests/strings/strncmp_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test strncmp() function : error conditions 
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : int strncmp ( string $str1, string $str2, int $len );
        !             6:  * Description: Binary safe case-sensitive string comparison of the first n characters
        !             7:  * Source code: Zend/zend_builtin_functions.c
        !             8: */
        !             9: 
        !            10: /* Test strncmp() function with more/less number of args and invalid args */
        !            11: 
        !            12: echo "*** Testing strncmp() function: error conditions ***\n";
        !            13: $str1 = 'string_val';
        !            14: $str2 = 'string_val';
        !            15: $len = 10;
        !            16: $extra_arg = 10;
        !            17: 
        !            18: var_dump( strncmp() );  //Zero argument
        !            19: var_dump( strncmp($str1) );  //One argument, less than expected no. of args
        !            20: var_dump( strncmp($str1, $str2) );  //Two arguments, less than expected no. of args
        !            21: var_dump( strncmp($str1, $str2, $len, $extra_arg) );  //Four arguments, greater than expected no. of args
        !            22: 
        !            23: /* Invalid argument for $len */
        !            24: $len = -10;
        !            25: var_dump( strncmp($str1, $str2, $len) );
        !            26: echo "*** Done ***\n";
        !            27: ?>
        !            28: --EXPECTF--
        !            29: *** Testing strncmp() function: error conditions ***
        !            30: 
        !            31: Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d
        !            32: NULL
        !            33: 
        !            34: Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d
        !            35: NULL
        !            36: 
        !            37: Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
        !            38: NULL
        !            39: 
        !            40: Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d
        !            41: NULL
        !            42: 
        !            43: Warning: Length must be greater than or equal to 0 in %s on line %d
        !            44: bool(false)
        !            45: *** Done ***

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