summaryrefslogtreecommitdiff
path: root/external/contributions/Google/sputnik_conformance_modified/15_Native/15.9_Date_Objects/15.9.3_The_Date_Constructor/S15.9.3.1_A6_T4.js
blob: 1c02d0aa748c364a9001ea61af8ed12bb8081056 (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
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * @name: S15.9.3.1_A6_T4;
 * @section: 15.9.3.1;
 * @assertion: The [[Value]] property of the newly constructed object 
 * with supplied "undefined" argument should be NaN;
 * @description: 5 arguments, (year, month, date, hours, minutes);
 */

function DateValue(year, month, date, hours, minutes, seconds, ms){
  return new Date(year, month, date, hours, minutes, seconds, ms).valueOf();
}

if (!isNaN(DateValue(1899, 11, 31, 23, 59))) {
  $FAIL("#1: The value should be NaN");
}

if (!isNaN(DateValue(1899, 12, 1, 0, 0))) {
  $FAIL("#2: The value should be NaN");
}

if (!isNaN(DateValue(1900, 0, 1, 0, 0))) {
  $FAIL("#3: The value should be NaN");
}

if (!isNaN(DateValue(1969, 11, 31, 23, 59))) {
  $FAIL("#4: The value should be NaN");
}

if (!isNaN(DateValue(1969, 12, 1, 0, 0))) {
  $FAIL("#5: The value should be NaN");
}

if (!isNaN(DateValue(1970, 0, 1, 0, 0))) {
  $FAIL("#6: The value should be NaN");
}

if (!isNaN(DateValue(1999, 11, 31, 23, 59))) {
  $FAIL("#7: The value should be NaN");
}

if (!isNaN(DateValue(1999, 12, 1, 0, 0))) {
  $FAIL("#8: The value should be NaN");
}

if (!isNaN(DateValue(2000, 0, 1, 0, 0))) {
  $FAIL("#9: The value should be NaN");
}

if (!isNaN(DateValue(2099, 11, 31, 23, 59))) {
  $FAIL("#10: The value should be NaN");
}

if (!isNaN(DateValue(2099, 12, 1, 0, 0))) {
  $FAIL("#11: The value should be NaN");
}

if (!isNaN(DateValue(2100, 0, 1, 0, 0))) {
  $FAIL("#12: The value should be NaN");
}