Re: Changes to Testcase generator

From: Date: Mon, 14 Apr 2008 14:08:00 +0000
Subject: Re: Changes to Testcase generator
References: 1 2 3  Groups: php.qa 
Request: Send a blank email to php-qa+get-64180@lists.php.net to get a copy of this message
Josie, Zoë, On 13/04/2008, Josie Messa <jdmessa@googlemail.com> wrote: > On Sun, Apr 13, 2008 at 12:00 PM, zoe <zoe.slattery@googlemail.com> wrote: > > > > I'm using the following for generic (numbered variations, i.e. > > > array_diff_variation1.phpt) variation tests: > > > http://www.pastebin.ca/979401 > > > > > > > > Yes - this looks good and I will do it. That's a really good suggestion. Here's a version with a few more enhancements. http://www.pastebin.ca/984649 The additions to Josie's version are: - Keyed values with a quick description that is echoed on each iteration (rather than just the iteration number). - Added a mixed case string. - Added an instance of a class with no __toString() handler. - Use a custom error handler so the script doesn't die when trying to cast said object to string. :) Also, I'd like to suggest removing the $fp (resource) variable... at least when the function is expecting an integer. The reason is that the resource ID isn't predictable, making it difficult to write a test that will catch all cases. Consider this example: <?php $fp = fopen(__FILE__, 'r'); var_dump(strpos('hello', 'o', $fp)); ?> ---> If $fp's resource ID is less than 5, the output is: int(4) ---> If $fp's resource ID is equal to 5, the output is: bool(false) ---> If $fp's resource ID is greater than 5, the output is: Warning: strpos(): Offset not contained in string in %s on line 3 bool(false) Regards, Robin

« previous php.qa (#64180) next »