<?php
-# Copyright (C) 2009 Jason Woofenden
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This program is in the public domain within the United States. Additionally,
+# we waive copyright and related rights in the work worldwide through the CC0
+# 1.0 Universal public domain dedication, which can be found at
+# http://creativecommons.org/publicdomain/zero/1.0/
-# This file contains tests for functions in code/wfpl/misc.php
+# This file contains tests for functions in wfpl/misc.php
#
-# See code/wfpl/unit_tests.php for details on how to run or create tests
+# See wfpl/unit_tests.php for details on how to run or create tests
-require_once('code/wfpl/misc.php');
+require_once(__DIR__.'/../'.'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();
}