~loic.molinari/+junk/qtdeclarative-shadereffectsource-changes

« back to all changes in this revision

Viewing changes to tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-1.js

  • Committer: Loïc Molinari
  • Date: 2012-04-21 17:59:51 UTC
  • Revision ID: loic.molinari@canonical.com-20120421175951-bqx68caaf5zrp76l
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 = '11.2.1-1.js';
 
40
 
 
41
/**
 
42
   File Name:          11.2.1-1.js
 
43
   ECMA Section:       11.2.1 Property Accessors
 
44
   Description:
 
45
 
 
46
   Properties are accessed by name, using either the dot notation:
 
47
   MemberExpression . Identifier
 
48
   CallExpression . Identifier
 
49
 
 
50
   or the bracket notation:    MemberExpression [ Expression ]
 
51
   CallExpression [ Expression ]
 
52
 
 
53
   The dot notation is explained by the following syntactic conversion:
 
54
   MemberExpression . Identifier
 
55
   is identical in its behavior to
 
56
   MemberExpression [ <identifier-string> ]
 
57
   and similarly
 
58
   CallExpression . Identifier
 
59
   is identical in its behavior to
 
60
   CallExpression [ <identifier-string> ]
 
61
   where <identifier-string> is a string literal containing the same sequence
 
62
   of characters as the Identifier.
 
63
 
 
64
   The production MemberExpression : MemberExpression [ Expression ] is
 
65
   evaluated as follows:
 
66
 
 
67
   1.  Evaluate MemberExpression.
 
68
   2.  Call GetValue(Result(1)).
 
69
   3.  Evaluate Expression.
 
70
   4.  Call GetValue(Result(3)).
 
71
   5.  Call ToObject(Result(2)).
 
72
   6.  Call ToString(Result(4)).
 
73
   7.  Return a value of type Reference whose base object is Result(5) and
 
74
   whose property name is Result(6).
 
75
 
 
76
   The production CallExpression : CallExpression [ Expression ] is evaluated
 
77
   in exactly the same manner, except that the contained CallExpression is
 
78
   evaluated in step 1.
 
79
 
 
80
   Author:             christine@netscape.com
 
81
   Date:               12 november 1997
 
82
*/
 
83
var SECTION = "11.2.1-1";
 
84
var VERSION = "ECMA_1";
 
85
startTest();
 
86
var TITLE   = "Property Accessors";
 
87
writeHeaderToLog( SECTION + " "+TITLE );
 
88
 
 
89
// go through all Native Function objects, methods, and properties and get their typeof.
 
90
 
 
91
var PROPERTY = new Array();
 
92
var p = 0;
 
93
 
 
94
// properties and functions of the global object
 
95
 
 
96
PROPERTY[p++] = new Property( "this",   "NaN",          "number" );
 
97
PROPERTY[p++] = new Property( "this",   "Infinity",     "number" );
 
98
PROPERTY[p++] = new Property( "this",   "eval",         "function" );
 
99
PROPERTY[p++] = new Property( "this",   "parseInt",     "function" );
 
100
PROPERTY[p++] = new Property( "this",   "parseFloat",   "function" );
 
101
PROPERTY[p++] = new Property( "this",   "escape",       "function" );
 
102
PROPERTY[p++] = new Property( "this",   "unescape",     "function" );
 
103
PROPERTY[p++] = new Property( "this",   "isNaN",        "function" );
 
104
PROPERTY[p++] = new Property( "this",   "isFinite",     "function" );
 
105
PROPERTY[p++] = new Property( "this",   "Object",       "function" );
 
106
PROPERTY[p++] = new Property( "this",   "Number",       "function" );
 
107
PROPERTY[p++] = new Property( "this",   "Function",     "function" );
 
108
PROPERTY[p++] = new Property( "this",   "Array",        "function" );
 
109
PROPERTY[p++] = new Property( "this",   "String",       "function" );
 
110
PROPERTY[p++] = new Property( "this",   "Boolean",      "function" );
 
111
PROPERTY[p++] = new Property( "this",   "Date",         "function" );
 
112
PROPERTY[p++] = new Property( "this",   "Math",         "object" );
 
113
 
 
114
// properties and  methods of Object objects
 
115
 
 
116
PROPERTY[p++] = new Property( "Object", "prototype",    "object" );
 
117
PROPERTY[p++] = new Property( "Object", "toString",     "function" );
 
118
PROPERTY[p++] = new Property( "Object", "valueOf",      "function" );
 
119
PROPERTY[p++] = new Property( "Object", "constructor",  "function" );
 
120
 
 
121
// properties of the Function object
 
122
 
 
123
PROPERTY[p++] = new Property( "Function",   "prototype",    "function" );
 
124
PROPERTY[p++] = new Property( "Function.prototype",   "toString",     "function" );
 
125
PROPERTY[p++] = new Property( "Function.prototype",   "length",       "number" );
 
126
PROPERTY[p++] = new Property( "Function.prototype",   "valueOf",      "function" );
 
127
 
 
128
Function.prototype.myProperty = "hi";
 
129
 
 
130
PROPERTY[p++] = new Property( "Function.prototype",   "myProperty",   "string" );
 
131
 
 
132
// properties of the Array object
 
133
PROPERTY[p++] = new Property( "Array",      "prototype",    "object" );
 
134
PROPERTY[p++] = new Property( "Array",      "length",       "number" );
 
135
PROPERTY[p++] = new Property( "Array.prototype",      "constructor",  "function" );
 
136
PROPERTY[p++] = new Property( "Array.prototype",      "toString",     "function" );
 
137
PROPERTY[p++] = new Property( "Array.prototype",      "join",         "function" );
 
138
PROPERTY[p++] = new Property( "Array.prototype",      "reverse",      "function" );
 
139
PROPERTY[p++] = new Property( "Array.prototype",      "sort",         "function" );
 
140
 
 
141
// properties of the String object
 
142
PROPERTY[p++] = new Property( "String",     "prototype",    "object" );
 
143
PROPERTY[p++] = new Property( "String",     "fromCharCode", "function" );
 
144
PROPERTY[p++] = new Property( "String.prototype",     "toString",     "function" );
 
145
PROPERTY[p++] = new Property( "String.prototype",     "constructor",  "function" );
 
146
PROPERTY[p++] = new Property( "String.prototype",     "valueOf",      "function" );
 
147
PROPERTY[p++] = new Property( "String.prototype",     "charAt",       "function" );
 
148
PROPERTY[p++] = new Property( "String.prototype",     "charCodeAt",   "function" );
 
149
PROPERTY[p++] = new Property( "String.prototype",     "indexOf",      "function" );
 
150
PROPERTY[p++] = new Property( "String.prototype",     "lastIndexOf",  "function" );
 
151
PROPERTY[p++] = new Property( "String.prototype",     "split",        "function" );
 
152
PROPERTY[p++] = new Property( "String.prototype",     "substring",    "function" );
 
153
PROPERTY[p++] = new Property( "String.prototype",     "toLowerCase",  "function" );
 
154
PROPERTY[p++] = new Property( "String.prototype",     "toUpperCase",  "function" );
 
155
PROPERTY[p++] = new Property( "String.prototype",     "length",       "number" );
 
156
 
 
157
// properties of the Boolean object
 
158
PROPERTY[p++] = new Property( "Boolean",    "prototype",    "object" );
 
159
PROPERTY[p++] = new Property( "Boolean",    "constructor",  "function" );
 
160
PROPERTY[p++] = new Property( "Boolean.prototype",    "valueOf",      "function" );
 
161
PROPERTY[p++] = new Property( "Boolean.prototype",    "toString",     "function" );
 
162
 
 
163
// properties of the Number object
 
164
 
 
165
PROPERTY[p++] = new Property( "Number",     "MAX_VALUE",    "number" );
 
166
PROPERTY[p++] = new Property( "Number",     "MIN_VALUE",    "number" );
 
167
PROPERTY[p++] = new Property( "Number",     "NaN",          "number" );
 
168
PROPERTY[p++] = new Property( "Number",     "NEGATIVE_INFINITY",    "number" );
 
169
PROPERTY[p++] = new Property( "Number",     "POSITIVE_INFINITY",    "number" );
 
170
PROPERTY[p++] = new Property( "Number.prototype",     "toString",     "function" );
 
171
PROPERTY[p++] = new Property( "Number.prototype",     "constructor",  "function" );
 
172
PROPERTY[p++] = new Property( "Number.prototype",     "valueOf",        "function" );
 
173
 
 
174
// properties of the Math Object.
 
175
PROPERTY[p++] = new Property( "Math",   "E",        "number" );
 
176
PROPERTY[p++] = new Property( "Math",   "LN10",     "number" );
 
177
PROPERTY[p++] = new Property( "Math",   "LN2",      "number" );
 
178
PROPERTY[p++] = new Property( "Math",   "LOG2E",    "number" );
 
179
PROPERTY[p++] = new Property( "Math",   "LOG10E",   "number" );
 
180
PROPERTY[p++] = new Property( "Math",   "PI",       "number" );
 
181
PROPERTY[p++] = new Property( "Math",   "SQRT1_2",  "number" );
 
182
PROPERTY[p++] = new Property( "Math",   "SQRT2",    "number" );
 
183
PROPERTY[p++] = new Property( "Math",   "abs",      "function" );
 
184
PROPERTY[p++] = new Property( "Math",   "acos",     "function" );
 
185
PROPERTY[p++] = new Property( "Math",   "asin",     "function" );
 
186
PROPERTY[p++] = new Property( "Math",   "atan",     "function" );
 
187
PROPERTY[p++] = new Property( "Math",   "atan2",    "function" );
 
188
PROPERTY[p++] = new Property( "Math",   "ceil",     "function" );
 
189
PROPERTY[p++] = new Property( "Math",   "cos",      "function" );
 
190
PROPERTY[p++] = new Property( "Math",   "exp",      "function" );
 
191
PROPERTY[p++] = new Property( "Math",   "floor",    "function" );
 
192
PROPERTY[p++] = new Property( "Math",   "log",      "function" );
 
193
PROPERTY[p++] = new Property( "Math",   "max",      "function" );
 
194
PROPERTY[p++] = new Property( "Math",   "min",      "function" );
 
195
PROPERTY[p++] = new Property( "Math",   "pow",      "function" );
 
196
PROPERTY[p++] = new Property( "Math",   "random",   "function" );
 
197
PROPERTY[p++] = new Property( "Math",   "round",    "function" );
 
198
PROPERTY[p++] = new Property( "Math",   "sin",      "function" );
 
199
PROPERTY[p++] = new Property( "Math",   "sqrt",     "function" );
 
200
PROPERTY[p++] = new Property( "Math",   "tan",      "function" );
 
201
 
 
202
// properties of the Date object
 
203
PROPERTY[p++] = new Property( "Date",   "parse",        "function" );
 
204
PROPERTY[p++] = new Property( "Date",   "prototype",    "object" );
 
205
PROPERTY[p++] = new Property( "Date",   "UTC",          "function" );
 
206
PROPERTY[p++] = new Property( "Date.prototype",   "constructor",    "function" );
 
207
PROPERTY[p++] = new Property( "Date.prototype",   "toString",       "function" );
 
208
PROPERTY[p++] = new Property( "Date.prototype",   "valueOf",        "function" );
 
209
PROPERTY[p++] = new Property( "Date.prototype",   "getTime",        "function" );
 
210
PROPERTY[p++] = new Property( "Date.prototype",   "getYear",        "function" );
 
211
PROPERTY[p++] = new Property( "Date.prototype",   "getFullYear",    "function" );
 
212
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCFullYear", "function" );
 
213
PROPERTY[p++] = new Property( "Date.prototype",   "getMonth",       "function" );
 
214
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCMonth",    "function" );
 
215
PROPERTY[p++] = new Property( "Date.prototype",   "getDate",        "function" );
 
216
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCDate",     "function" );
 
217
PROPERTY[p++] = new Property( "Date.prototype",   "getDay",         "function" );
 
218
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCDay",      "function" );
 
219
PROPERTY[p++] = new Property( "Date.prototype",   "getHours",       "function" );
 
220
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCHours",    "function" );
 
221
PROPERTY[p++] = new Property( "Date.prototype",   "getMinutes",     "function" );
 
222
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCMinutes",  "function" );
 
223
PROPERTY[p++] = new Property( "Date.prototype",   "getSeconds",     "function" );
 
224
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCSeconds",  "function" );
 
225
PROPERTY[p++] = new Property( "Date.prototype",   "getMilliseconds","function" );
 
226
PROPERTY[p++] = new Property( "Date.prototype",   "getUTCMilliseconds", "function" );
 
227
PROPERTY[p++] = new Property( "Date.prototype",   "setTime",        "function" );
 
228
PROPERTY[p++] = new Property( "Date.prototype",   "setMilliseconds","function" );
 
229
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCMilliseconds", "function" );
 
230
PROPERTY[p++] = new Property( "Date.prototype",   "setSeconds",     "function" );
 
231
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCSeconds",  "function" );
 
232
PROPERTY[p++] = new Property( "Date.prototype",   "setMinutes",     "function" );
 
233
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCMinutes",  "function" );
 
234
PROPERTY[p++] = new Property( "Date.prototype",   "setHours",       "function" );
 
235
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCHours",    "function" );
 
236
PROPERTY[p++] = new Property( "Date.prototype",   "setDate",        "function" );
 
237
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCDate",     "function" );
 
238
PROPERTY[p++] = new Property( "Date.prototype",   "setMonth",       "function" );
 
239
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCMonth",    "function" );
 
240
PROPERTY[p++] = new Property( "Date.prototype",   "setFullYear",    "function" );
 
241
PROPERTY[p++] = new Property( "Date.prototype",   "setUTCFullYear", "function" );
 
242
PROPERTY[p++] = new Property( "Date.prototype",   "setYear",        "function" );
 
243
PROPERTY[p++] = new Property( "Date.prototype",   "toLocaleString", "function" );
 
244
PROPERTY[p++] = new Property( "Date.prototype",   "toUTCString",    "function" );
 
245
PROPERTY[p++] = new Property( "Date.prototype",   "toGMTString",    "function" );
 
246
 
 
247
for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
 
248
  RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name );
 
249
 
 
250
  new TestCase( SECTION,
 
251
                "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name,
 
252
                PROPERTY[i].type,
 
253
                RESULT );
 
254
 
 
255
  RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']");
 
256
 
 
257
  new TestCase( SECTION,
 
258
                "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']",
 
259
                PROPERTY[i].type,
 
260
                RESULT );
 
261
}
 
262
 
 
263
test();
 
264
 
 
265
function MyObject( arg0, arg1, arg2, arg3, arg4 ) {
 
266
  this.name   = arg0;
 
267
}
 
268
function Property( object, name, type ) {
 
269
  this.object = object;
 
270
  this.name = name;
 
271
  this.type = type;
 
272
}