JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
release public domain / CC0
[wfpl.git] / unit_tests / misc.php
1 <?php
2
3 # This program is in the public domain within the United States. Additionally,
4 # we waive copyright and related rights in the work worldwide through the CC0
5 # 1.0 Universal public domain dedication, which can be found at
6 # http://creativecommons.org/publicdomain/zero/1.0/
7
8
9 # This file contains tests for functions in wfpl/misc.php
10 #
11 # See wfpl/unit_tests.php for details on how to run or create tests
12
13
14 require_once(__DIR__.'/../'.'misc.php');
15
16 function test_ordinalize() {
17         $tests = array(
18                 '', '',
19                 0, "0th",
20                 1, "1st",
21                 2, "2nd",
22                 3, "3rd",
23                 4, "4th",
24                 5, "5th",
25                 6, "6th",
26                 7, "7th",
27                 8, "8th",
28                 9, "9th",
29                 10, "10th",
30                 11, "11th",
31                 12, "12th",
32                 13, "13th",
33                 14, "14th",
34                 15, "15th",
35                 16, "16th",
36                 17, "17th",
37                 18, "18th",
38                 19, "19th",
39                 20, "20th",
40                 21, "21st",
41                 22, "22nd",
42                 23, "23rd",
43                 24, "24th",
44                 25, "25th",
45                 26, "26th",
46                 27, "27th",
47                 111, "111th",
48                 "62", "62nd");
49         for($i = 0; $i < count($tests); $i += 2) {
50                 $arg = $tests[$i];
51                 $correct = $tests[$i + 1];
52                 unit_test_func('ordinalize', $arg, $correct);
53         }
54 }
55
56 function misc_unit_tests_main() {
57         test_ordinalize();
58 }