php-src/ext/standard/tests/math/srand_error.phpt

33 lines
773 B
Plaintext
Raw Normal View History

2008-02-06 08:39:23 +00:00
--TEST--
Test srand() function : error conditions - incorrect number of args
2008-02-06 08:39:23 +00:00
--FILE--
<?php
/* Prototype : void srand ([ int $seed ] )
* Description: Seed the random number generator.
* Source code: ext/standard/rand.c
*/
/*
* Pass incorrect number of arguments to srand() to test behaviour
*/
echo "*** Testing srand() : error conditions ***\n";
var_dump(srand(500, true));
var_dump(srand("fivehundred"));
var_dump(srand("500ABC"));
2008-02-06 08:39:23 +00:00
?>
===Done===
2008-02-06 08:39:23 +00:00
--EXPECTF--
*** Testing srand() : error conditions ***
Warning: srand() expects at most 1 parameter, 2 given in %s on line %d
2008-02-06 08:39:23 +00:00
NULL
Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
2008-02-06 08:39:23 +00:00
NULL
Notice: A non well formed numeric value encountered in %s on line %d
NULL
===Done===