X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=unit_tests%2Fmisc.php;h=1125ed1005df703ee1de7cc6240a66bf3ce2f6c6;hb=cc3a6b27d3a041f1a8f351df2941b705191aadee;hp=05826494362f13e38578b79a4ef9dcb6e52fd809;hpb=f920d084acbf8c53c996a6fee26530a41e7e0559;p=wfpl.git diff --git a/unit_tests/misc.php b/unit_tests/misc.php index 0582649..1125ed1 100644 --- a/unit_tests/misc.php +++ b/unit_tests/misc.php @@ -23,34 +23,46 @@ require_once('code/wfpl/misc.php'); -# returns number of errors function test_ordinalize() { - $errors = 0; - $tests = array( '', '', 0, "0th", 1, "1st", 2, "2nd", 3, "3rd", + 4, "4th", + 5, "5th", + 6, "6th", + 7, "7th", + 8, "8th", + 9, "9th", + 10, "10th", + 11, "11th", + 12, "12th", + 13, "13th", + 14, "14th", + 15, "15th", + 16, "16th", + 17, "17th", + 18, "18th", + 19, "19th", + 20, "20th", + 21, "21st", + 22, "22nd", + 23, "23rd", + 24, "24th", + 25, "25th", + 26, "26th", + 27, "27th", 111, "111th", "62", "62nd"); for($i = 0; $i < count($tests); $i += 2) { $arg = $tests[$i]; $correct = $tests[$i + 1]; - $ret = ordinalize($arg); - if($ret !== $correct) { - message("ordinalize($arg) returned \"$ret\" instead of \"$correct\""); - $errors += 1; - } + unit_test_func('ordinalize', $arg, $correct); } - - return $errors; } -# returns number of errors function misc_unit_tests_main() { - $errors = 0; - $errors += test_ordinalize(); - return $errors; + test_ordinalize(); }