summaryrefslogtreecommitdiff
path: root/test/suite/ch15/15.9/15.9.3/S15.9.3.1_A5_T3.js
blob: fdb6387b400038c7f4fce5fa19c90410a3d07c9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * The [[Value]] property of the newly constructed object
 * is set by following steps:
 * 8. If Result(1) is not NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is
 * 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1)
 * 9. Compute MakeDay(Result(8), Result(2), Result(3))
 * 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7))
 * 11. Compute MakeDate(Result(9), Result(10))
 * 12. Set the [[Value]] property of the newly constructed object to
 * TimeClip(UTC(Result(11)))
 *
 * @path ch15/15.9/15.9.3/S15.9.3.1_A5_T3.js
 * @description 4 arguments, (year, month, date, hours)
 */

$INCLUDE("environment.js");
$INCLUDE("numeric_conversion.js");
$INCLUDE("Date_constants.js");
$INCLUDE("Date_library.js");

if (-2208963600000 !== new Date(1899, 11, 31, 23).valueOf()) {
  $FAIL("#1: Incorrect value of Date");
}

if (-2208960000000 !== new Date(1899, 12, 1, 0).valueOf()) {
  $FAIL("#2: Incorrect value of Date");
}

if (-2208960000000 !== new Date(1900, 0, 1, 0).valueOf()) {
  $FAIL("#3: Incorrect value of Date");
}

if (25200000 !== new Date(1969, 11, 31, 23).valueOf()) {
  $FAIL("#4: Incorrect value of Date");
}

if (28800000 !== new Date(1969, 12, 1, 0).valueOf()) {
  $FAIL("#5: Incorrect value of Date");
}

if (28800000 !== new Date(1970, 0, 1, 0).valueOf()) {
  $FAIL("#6: Incorrect value of Date");
}

if (946710000000 !== new Date(1999, 11, 31, 23).valueOf()) {
  $FAIL("#7: Incorrect value of Date");
}

if (946713600000 !== new Date(1999, 12, 1, 0).valueOf()) {
  $FAIL("#8: Incorrect value of Date");
}

if (946713600000 !== new Date(2000, 0, 1, 0).valueOf()) {
  $FAIL("#9: Incorrect value of Date");
}

if (4102470000000 !== new Date(2099, 11, 31, 23).valueOf()) {
  $FAIL("#10: Incorrect value of Date");
}

if (4102473600000 !== new Date(2099, 12, 1, 0).valueOf()) {
  $FAIL("#11: Incorrect value of Date");
}

if (4102473600000 !== new Date(2100, 0, 1, 0).valueOf()) {
  $FAIL("#12: Incorrect value of Date");
}