aboutsummaryrefslogtreecommitdiffstats
path: root/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.9_Date_Objects/15.9.2_The_Date_Constructor_Called_as_a_Function/S15.9.2.1_A1.js
blob: 74b5672255f9350021cb922816cc49c16350edda (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
72
73
74
75
76
77
78
79
80
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * @name: S15.9.2.1_A1;
 * @section: 15.9.2.1;
 * @assertion: When Date is called as a function rather than as a constructor, 
 * it should be "string" representing the current time (UTC);
 * @description: Checking type of returned value;
*/

//CHECK#1
if( typeof Date() !== "string" ) {
  $ERROR('#1: typeof Date() should be "string", actual is '+(typeof Date()));
}

//CHECK#2
if( typeof Date(1) !== "string"  ) {
  $ERROR('#2: typeof Date(1) should be "string", actual is '+(typeof Date(1)));
}

//CHECK#3
if( typeof Date(1970, 1) !== "string"  ) {
  $ERROR('#3: typeof Date(1970, 1) should be "string", actual is '+(typeof Date(1970, 1)));
}

//CHECK#4
if( typeof Date(1970, 1, 1) !== "string"  ) {
  $ERROR('#4: typeof Date(1970, 1, 1) should be "string", actual is '+(typeof Date(1970, 1, 1)));
}

//CHECK#5
if( typeof Date(1970, 1, 1, 1) !== "string"  ) {
  $ERROR('#5: typeof Date(1970, 1, 1, 1) should be "string", actual is '+(typeof Date(1970, 1, 1, 1)));
}

//CHECK#6
if( typeof Date(1970, 1, 1, 1) !== "string"  ) {
  $ERROR('#7: typeof Date(1970, 1, 1, 1) should be "string", actual is '+(typeof Date(1970, 1, 1, 1)));
}

//CHECK#8
if( typeof Date(1970, 1, 1, 1, 0) !== "string"  ) {
  $ERROR('#8: typeof Date(1970, 1, 1, 1, 0) should be "string", actual is '+(typeof Date(1970, 1, 1, 1, 0)));
}

//CHECK#9
if( typeof Date(1970, 1, 1, 1, 0, 0) !== "string"  ) {
  $ERROR('#9: typeof Date(1970, 1, 1, 1, 0, 0) should be "string", actual is '+(typeof Date(1970, 1, 1, 1, 0, 0)));
}

//CHECK#10
if( typeof Date(1970, 1, 1, 1, 0, 0, 0) !== "string"  ) {
  $ERROR('#10: typeof Date(1970, 1, 1, 1, 0, 0, 0) should be "string", actual is '+(typeof Date(1970, 1, 1, 1, 0, 0, 0)));
}

//CHECK#11
if( typeof Date(Number.NaN) !== "string"  ) {
  $ERROR('#11: typeof Date(Number.NaN) should be "string", actual is '+(typeof Date(Number.NaN)));
}

//CHECK#12
if( typeof Date(Number.POSITIVE_INFINITY) !== "string"  ) {
  $ERROR('#12: typeof Date(Number.POSITIVE_INFINITY) should be "string", actual is '+(typeof Date(Number.POSITIVE_INFINITY)));
}

//CHECK#13
if( typeof Date(Number.NEGATIVE_INFINITY) !== "string"  ) {
  $ERROR('#13: typeof Date(Number.NEGATIVE_INFINITY) should be "string", actual is '+(typeof Date(Number.NEGATIVE_INFINITY)));
}

//CHECK#14
if( typeof Date(undefined) !== "string"  ) {
  $ERROR('#14: typeof Date(undefined) should be "string", actual is '+(typeof Date(undefined)));
}

//CHECK#15
if( typeof Date(null) !== "string"  ) {
  $ERROR('#15: typeof Date(null) should be "string", actual is '+(typeof Date(null)));
}