similar_text() testcase
| From: | Vilerage | Date: | Sat, 26 Apr 2008 08:33:37 +0000 |
| Subject: | similar_text() testcase | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-64225@lists.php.net to get a copy of this message | ||
Hi, this is my first attempt at writing a testcase, an autogenerated one for similar_text. It's fairly straightforward, and I've tested it against the only setup I have available -- PHP 5.3 (got it from snaps -- 200804260630 )running on Debian Linux (2.6.24 -- AMD64 SMP)
Anyhow, here goes:
--TEST--
Test similar_text() function : basic functionality
--FILE--
<?php
/* Prototype : int similar_text(string str1, string str2 [, float percent])
* Description: Calculates the similarity between two strings
* Source code: ext/standard/string.c
* Alias to functions:
*/
echo "*** Testing similar_text() : basic functionality ***\n";
// Initialise all required variables
$str1 = 'Foobar123';
$str2 = 'fooBar456';
// Calling similar_text() with all possible arguments
var_dump( similar_text($str1, $str2, $percent) );
var_dump( $percent );
// Calling similar_text() with mandatory arguments
var_dump( similar_text($str1, $str2) );
?>
===DONE===
--EXPECTF--
*** Testing similar_text() : basic functionality ***
int(4)
float(44.444444444444)
int(4)
===DONE===