(functionNameRoot)
| 218 | } |
| 219 | |
| 220 | function testDateFunctionWithValueRecoverYear(functionNameRoot) |
| 221 | { |
| 222 | var result = true; |
| 223 | var is13Compatible = true; |
| 224 | |
| 225 | var date = new Date(); |
| 226 | var setValue = date["get" + functionNameRoot](); |
| 227 | var fullYears = date.getFullYear() - 1900; |
| 228 | if (setValue != fullYears) { |
| 229 | testFailed("date.get" + functionNameRoot + "() was " + setValue + " instead of " + fullYears); |
| 230 | is13Compatible = false; |
| 231 | } else |
| 232 | testPassed("date.getYear() is compatible to JavaScript 1.3 and later"); |
| 233 | |
| 234 | date.setMilliseconds(Number.NaN); |
| 235 | var setResult = date["set" + functionNameRoot](setValue + 1900); |
| 236 | var getResult = date["get" + functionNameRoot](); |
| 237 | if (getResult != setValue) { |
| 238 | testFailed("date.get" + functionNameRoot + "() was " + getResult + " instead of " + setValue); |
| 239 | result = false; |
| 240 | } |
| 241 | getResult = date.getMilliseconds(); |
| 242 | if (getResult != 0) { |
| 243 | testFailed("date.getMilliseconds() was " + getResult + " instead of 0"); |
| 244 | result = false; |
| 245 | } |
| 246 | getResult = date.getSeconds(); |
| 247 | if (getResult != 0) { |
| 248 | testFailed("date.getSeconds() was " + getResult + " instead of 0"); |
| 249 | result = false; |
| 250 | } |
| 251 | getResult = date.getMinutes(); |
| 252 | if (getResult != 0) { |
| 253 | testFailed("date.getMinutes() was " + getResult + " instead of 0"); |
| 254 | result = false; |
| 255 | } |
| 256 | getResult = date.getHours(); |
| 257 | if (getResult != 0) { |
| 258 | testFailed("date.getHours() was " + getResult + " instead of 0"); |
| 259 | result = false; |
| 260 | } |
| 261 | getResult = date.getDate(); |
| 262 | if (getResult != 1) { |
| 263 | testFailed("date.getDate() was " + getResult + " instead of 1"); |
| 264 | result = false; |
| 265 | } |
| 266 | getResult = date.getMonth(); |
| 267 | if (getResult != 0) { |
| 268 | testFailed("date.getMonth() was " + getResult + " instead of 0"); |
| 269 | result = false; |
| 270 | } |
| 271 | if (result) |
| 272 | testPassed ("recover from NaN date using date.setUTCFullYear()"); |
| 273 | else |
| 274 | testFailed ("recover from NaN date using date.setUTCFullYear()"); |
| 275 | return result && is13Compatible; |
| 276 | } |
| 277 |
no test coverage detected