| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use warnings; |
| 4 | use strict; |
| 5 | use Test::Inter; |
| 6 | $::ti = new Test::Inter $0; |
| 7 | require "tests-dm5.pl"; |
| 8 | |
| 9 | Date_Init("TZ=EST"); |
| 10 | Date_Init("Language=French","DateFormat=US","Internal=0"); |
| 11 | Date_Init("ForceDate=1997-03-08-12:30:00"); |
| 12 | |
| 13 | my($currS,$currMN,$currH,$currD,$currM,$currY)=("00","30","12","08","03","1997"); |
| 14 | |
| 15 | my $today ="$currY$currM$currD$currH:$currMN:$currS"; |
| 16 | my $yesterday ="$currY$currM". $currD-1 ."$currH:$currMN:$currS"; |
| 17 | my $tomorrow ="$currY$currM". $currD+1 ."$currH:$currMN:$currS"; |
| 18 | |
| 19 | my $tests=" |
| 20 | |
| 21 | aujourd'hui => $today |
| 22 | |
| 23 | maintenant => $today |
| 24 | |
| 25 | hier => $yesterday |
| 26 | |
| 27 | demain => $tomorrow |
| 28 | |
| 29 | 'dernier mar en Juin 96' => 1996062500:00:00 |
| 30 | |
| 31 | 'dernier mar de Juin' => 1997062400:00:00 |
| 32 | |
| 33 | 'premier mar de Juin 1996' => 1996060400:00:00 |
| 34 | |
| 35 | 'premier mar de Juin' => 1997060300:00:00 |
| 36 | |
| 37 | '3e mardi de Juin 96' => 1996061800:00:00 |
| 38 | |
| 39 | '3e mardi de Juin 96 a 12:00' => 1996061812:00:00 |
| 40 | |
| 41 | '3e mardi de Juin 96 a 10:30 du matin' => 1996061810:30:00 |
| 42 | |
| 43 | '3e mardi de Juin 96 a 10:30 du soir' => 1996061822:30:00 |
| 44 | |
| 45 | |
| 46 | 'DeC 10 65' => 1965121000:00:00 |
| 47 | |
| 48 | 'DeC 10 1965' => 1965121000:00:00 |
| 49 | |
| 50 | 'Decembre 10 65' => 1965121000:00:00 |
| 51 | |
| 52 | 'Decembre 10 1965' => 1965121000:00:00 |
| 53 | |
| 54 | 'Decembre10 1965' => 1965121000:00:00 |
| 55 | |
| 56 | 'Decembre10 1965 12:00' => 1965121012:00:00 |
| 57 | |
| 58 | 'Decembre-10-1965 12:00' => 1965121012:00:00 |
| 59 | |
| 60 | Decembre/10/1965/12:00 => 1965121012:00:00 |
| 61 | |
| 62 | Decembre/10/12:00 => 1997121012:00:00 |
| 63 | |
| 64 | '12:00Decembre10 1965' => 1965121012:00:00 |
| 65 | |
| 66 | '12:00 Decembre10 1965' => 1965121012:00:00 |
| 67 | |
| 68 | 12:00-Decembre-10-1965 => 1965121012:00:00 |
| 69 | |
| 70 | '12:00 Decembre-10-1965' => 1965121012:00:00 |
| 71 | |
| 72 | '10 DeC 65' => 1965121000:00:00 |
| 73 | |
| 74 | '10 DeC 1965' => 1965121000:00:00 |
| 75 | |
| 76 | '10 Decembre 65' => 1965121000:00:00 |
| 77 | |
| 78 | '10 Decembre 1965' => 1965121000:00:00 |
| 79 | |
| 80 | 10DeC65 => 1965121000:00:00 |
| 81 | |
| 82 | 10DeC1965 => 1965121000:00:00 |
| 83 | |
| 84 | 10Decembre65 => 1965121000:00:00 |
| 85 | |
| 86 | '10Decembre 1965' => 1965121000:00:00 |
| 87 | |
| 88 | 'DeC 10 4:50' => ${currY}121004:50:00 |
| 89 | |
| 90 | 'Decembre 10 4:50' => ${currY}121004:50:00 |
| 91 | |
| 92 | 'DeC 10 4:50:40' => ${currY}121004:50:40 |
| 93 | |
| 94 | 'Decembre 10 4:50:42' => ${currY}121004:50:42 |
| 95 | |
| 96 | '10 DeC 4:50' => ${currY}121004:50:00 |
| 97 | |
| 98 | '10 Decembre 4:50' => ${currY}121004:50:00 |
| 99 | |
| 100 | '10DeC 4:50' => ${currY}121004:50:00 |
| 101 | |
| 102 | '10Decembre 4:50' => ${currY}121004:50:00 |
| 103 | |
| 104 | '10 DeC 4:50:51' => ${currY}121004:50:51 |
| 105 | |
| 106 | '10 Decembre 4:50:52' => ${currY}121004:50:52 |
| 107 | |
| 108 | '10DeC 4:50:53' => ${currY}121004:50:53 |
| 109 | |
| 110 | '10Decembre 4:50:54' => ${currY}121004:50:54 |
| 111 | |
| 112 | '10Decembre95 4:50:54' => 1995121004:50:54 |
| 113 | |
| 114 | 'Dec10/65 4:50:53' => 1965121004:50:53 |
| 115 | |
| 116 | 'Dec101965 4:50:53' => 1965121004:50:53 |
| 117 | |
| 118 | '4:50 DeC 10' => ${currY}121004:50:00 |
| 119 | |
| 120 | '4:50 Decembre 10' => ${currY}121004:50:00 |
| 121 | |
| 122 | '4:50:40 DeC 10' => ${currY}121004:50:40 |
| 123 | |
| 124 | '4:50:42 Decembre 10' => ${currY}121004:50:42 |
| 125 | |
| 126 | '4:50 10 DeC' => ${currY}121004:50:00 |
| 127 | |
| 128 | '4:50 10 Decembre' => ${currY}121004:50:00 |
| 129 | |
| 130 | '4:50 10DeC' => ${currY}121004:50:00 |
| 131 | |
| 132 | '4:50 10Decembre' => ${currY}121004:50:00 |
| 133 | |
| 134 | '4:50:51 10 DeC' => ${currY}121004:50:51 |
| 135 | |
| 136 | '4:50:52 10 Decembre' => ${currY}121004:50:52 |
| 137 | |
| 138 | '4:50:53 10DeC' => ${currY}121004:50:53 |
| 139 | |
| 140 | '4:50:54 10Decembre' => ${currY}121004:50:54 |
| 141 | |
| 142 | 4:50:54Decembre10 => ${currY}121004:50:54 |
| 143 | |
| 144 | 4:50:54Decembre10/65 => 1965121004:50:54 |
| 145 | |
| 146 | 'DeC 1 5:30' => ${currY}120105:30:00 |
| 147 | |
| 148 | 'DeC 10 05:30' => ${currY}121005:30:00 |
| 149 | |
| 150 | 'DeC 10 05:30:11' => ${currY}121005:30:11 |
| 151 | |
| 152 | 'DeC 1 65' => 1965120100:00:00 |
| 153 | |
| 154 | 'DeC 1 1965' => 1965120100:00:00 |
| 155 | |
| 156 | 'Decembre 1 5:30' => ${currY}120105:30:00 |
| 157 | |
| 158 | 'Decembre 10 05:30' => ${currY}121005:30:00 |
| 159 | |
| 160 | 'Decembre 10 05h30:12' => ${currY}121005:30:12 |
| 161 | |
| 162 | 'Decembre 1 65' => 1965120100:00:00 |
| 163 | |
| 164 | 'Decembre 1 1965' => 1965120100:00:00 |
| 165 | |
| 166 | '5:30 DeC 1' => ${currY}120105:30:00 |
| 167 | |
| 168 | '05:30 DeC 10' => ${currY}121005:30:00 |
| 169 | |
| 170 | '05:30:11 DeC 10' => ${currY}121005:30:11 |
| 171 | |
| 172 | '5:30 Decembre 1' => ${currY}120105:30:00 |
| 173 | |
| 174 | '05:30 Decembre 10' => ${currY}121005:30:00 |
| 175 | |
| 176 | '05:30:12 du matin Decembre 10' => ${currY}121005:30:12 |
| 177 | |
| 178 | '05:30:12 du soir Decembre 10' => ${currY}121017:30:12 |
| 179 | |
| 180 | '1 DeC 65' => 1965120100:00:00 |
| 181 | |
| 182 | '1 DeC 1965' => 1965120100:00:00 |
| 183 | |
| 184 | '1 Decembre 65' => 1965120100:00:00 |
| 185 | |
| 186 | '1 Decembre 1965' => 1965120100:00:00 |
| 187 | |
| 188 | '12 1 65' => 1965120100:00:00 |
| 189 | |
| 190 | '12 1 1965' => 1965120100:00:00 |
| 191 | |
| 192 | '2 29 92' => 1992022900:00:00 |
| 193 | |
| 194 | '2 29 90' => '' |
| 195 | |
| 196 | '1er DeC 65' => 1965120100:00:00 |
| 197 | |
| 198 | 'DeC premier 1965' => 1965120100:00:00 |
| 199 | "; |
| 200 | |
| 201 | $::ti->tests(func => \&ParseDate, |
| 202 | tests => $tests); |
| 203 | $::ti->done_testing(); |
| 204 | |
| 205 | #Local Variables: |
| 206 | #mode: cperl |
| 207 | #indent-tabs-mode: nil |
| 208 | #cperl-indent-level: 3 |
| 209 | #cperl-continued-statement-offset: 2 |
| 210 | #cperl-continued-brace-offset: 0 |
| 211 | #cperl-brace-offset: 0 |
| 212 | #cperl-brace-imaginary-offset: 0 |
| 213 | #cperl-label-offset: 0 |
| 214 | #End: |