Re: Changes to Testcase generator

From: Date: Tue, 15 Apr 2008 11:59:30 +0000
Subject: Re: Changes to Testcase generator
References: 1 2 3 4  Groups: php.qa 
Request: Send a blank email to php-qa+get-64195@lists.php.net to get a copy of this message
Robin and Josie I've made these updates - they were straightforward but quite a lot of typing. I've tested on a couple of functions and the test cases are produced OK. However, since it was a big update - please would you be able to check it out before I commit? I'll mail you the file. Zoe Robin Fernandes wrote:
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 (#64195) next »