Rename QDeclarative symbols to QQuick and QQml
[profile/ivi/qtdeclarative.git] / tests / auto / qml / parserstress / tests / ecma / Date / 15.9.5.5.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is Mozilla Communicator client code, released
16  * March 31, 1998.
17  *
18  * The Initial Developer of the Original Code is
19  * Netscape Communications Corporation.
20  * Portions created by the Initial Developer are Copyright (C) 1998
21  * the Initial Developer. All Rights Reserved.
22  *
23  * Contributor(s):
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39 gTestfile = '15.9.5.5.js';
40
41 /**
42    File Name:          15.9.5.5.js
43    ECMA Section:       15.9.5.5
44    Description:        Date.prototype.getYear
45
46    This function is specified here for backwards compatibility only. The
47    function getFullYear is much to be preferred for nearly all purposes,
48    because it avoids the "year 2000 problem."
49
50    1.  Let t be this time value.
51    2.  If t is NaN, return NaN.
52    3.  Return YearFromTime(LocalTime(t)) 1900.
53
54    Author:             christine@netscape.com
55    Date:               12 november 1997
56 */
57
58 var SECTION = "15.9.5.5";
59 var VERSION = "ECMA_1";
60 startTest();
61 var TITLE   = "Date.prototype.getYear()";
62
63 writeHeaderToLog( SECTION + " "+ TITLE);
64
65 addTestCase( TIME_NOW );
66 addTestCase( TIME_0000 );
67 addTestCase( TIME_1970 );
68 addTestCase( TIME_1900 );
69 addTestCase( TIME_2000 );
70 addTestCase( UTC_FEB_29_2000 );
71
72 new TestCase( SECTION,
73               "(new Date(NaN)).getYear()",
74               NaN,
75               (new Date(NaN)).getYear() );
76
77 new TestCase( SECTION,
78               "Date.prototype.getYear.length",
79               0,
80               Date.prototype.getYear.length );
81
82 test();
83
84 function addTestCase( t ) {
85   new TestCase( SECTION,
86                 "(new Date("+t+")).getYear()",
87                 GetYear(YearFromTime(LocalTime(t))),
88                 (new Date(t)).getYear() );
89
90   new TestCase( SECTION,
91                 "(new Date("+(t+1)+")).getYear()",
92                 GetYear(YearFromTime(LocalTime(t+1))),
93                 (new Date(t+1)).getYear() );
94
95   new TestCase( SECTION,
96                 "(new Date("+(t-1)+")).getYear()",
97                 GetYear(YearFromTime(LocalTime(t-1))),
98                 (new Date(t-1)).getYear() );
99
100   new TestCase( SECTION,
101                 "(new Date("+(t-TZ_ADJUST)+")).getYear()",
102                 GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
103                 (new Date(t-TZ_ADJUST)).getYear() );
104
105   new TestCase( SECTION,
106                 "(new Date("+(t+TZ_ADJUST)+")).getYear()",
107                 GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
108                 (new Date(t+TZ_ADJUST)).getYear() );
109 }
110 function GetYear( year ) {
111   return year - 1900;
112 }