QML_RUNTIME_TESTING should be disabled by default.
[profile/ivi/qtdeclarative.git] / tests / auto / qml / parserstress / tests / ecma / Expressions / 11.4.3.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 = '11.4.3.js';
40
41 /**
42    File Name:          typeof_1.js
43    ECMA Section:       11.4.3 typeof operator
44    Description:        typeof evaluates unary expressions:
45    undefined   "undefined"
46    null        "object"
47    Boolean     "boolean"
48    Number      "number"
49    String      "string"
50    Object      "object" [native, doesn't implement Call]
51    Object      "function" [native, implements [Call]]
52    Object      implementation dependent
53    [not sure how to test this]
54    Author:             christine@netscape.com
55    Date:               june 30, 1997
56
57 */
58
59 var SECTION = "11.4.3";
60
61 var VERSION = "ECMA_1";
62 startTest();
63 var TITLE   = " The typeof operator";
64 writeHeaderToLog( SECTION + " "+ TITLE);
65
66 new TestCase( SECTION,     "typeof(void(0))",              "undefined",        typeof(void(0)) );
67 new TestCase( SECTION,     "typeof(null)",                 "object",           typeof(null) );
68 new TestCase( SECTION,     "typeof(true)",                 "boolean",          typeof(true) );
69 new TestCase( SECTION,     "typeof(false)",                "boolean",          typeof(false) );
70 new TestCase( SECTION,     "typeof(new Boolean())",        "object",           typeof(new Boolean()) );
71 new TestCase( SECTION,     "typeof(new Boolean(true))",    "object",           typeof(new Boolean(true)) );
72 new TestCase( SECTION,     "typeof(Boolean())",            "boolean",          typeof(Boolean()) );
73 new TestCase( SECTION,     "typeof(Boolean(false))",       "boolean",          typeof(Boolean(false)) );
74 new TestCase( SECTION,     "typeof(Boolean(true))",        "boolean",          typeof(Boolean(true)) );
75 new TestCase( SECTION,     "typeof(NaN)",                  "number",           typeof(Number.NaN) );
76 new TestCase( SECTION,     "typeof(Infinity)",             "number",           typeof(Number.POSITIVE_INFINITY) );
77 new TestCase( SECTION,     "typeof(-Infinity)",            "number",           typeof(Number.NEGATIVE_INFINITY) );
78 new TestCase( SECTION,     "typeof(Math.PI)",              "number",           typeof(Math.PI) );
79 new TestCase( SECTION,     "typeof(0)",                    "number",           typeof(0) );
80 new TestCase( SECTION,     "typeof(1)",                    "number",           typeof(1) );
81 new TestCase( SECTION,     "typeof(-1)",                   "number",           typeof(-1) );
82 new TestCase( SECTION,     "typeof('0')",                  "string",           typeof("0") );
83 new TestCase( SECTION,     "typeof(Number())",             "number",           typeof(Number()) );
84 new TestCase( SECTION,     "typeof(Number(0))",            "number",           typeof(Number(0)) );
85 new TestCase( SECTION,     "typeof(Number(1))",            "number",           typeof(Number(1)) );
86 new TestCase( SECTION,     "typeof(Nubmer(-1))",           "number",           typeof(Number(-1)) );
87 new TestCase( SECTION,     "typeof(new Number())",         "object",           typeof(new Number()) );
88 new TestCase( SECTION,     "typeof(new Number(0))",        "object",           typeof(new Number(0)) );
89 new TestCase( SECTION,     "typeof(new Number(1))",        "object",           typeof(new Number(1)) );
90
91 // Math does not implement [[Construct]] or [[Call]] so its type is object.
92
93 new TestCase( SECTION,     "typeof(Math)",                 "object",         typeof(Math) );
94
95 new TestCase( SECTION,     "typeof(Number.prototype.toString)", "function",    typeof(Number.prototype.toString) );
96
97 new TestCase( SECTION,     "typeof('a string')",           "string",           typeof("a string") );
98 new TestCase( SECTION,     "typeof('')",                   "string",           typeof("") );
99 new TestCase( SECTION,     "typeof(new Date())",           "object",           typeof(new Date()) );
100 new TestCase( SECTION,     "typeof(new Array(1,2,3))",     "object",           typeof(new Array(1,2,3)) );
101 new TestCase( SECTION,     "typeof(new String('string object'))",  "object",   typeof(new String("string object")) );
102 new TestCase( SECTION,     "typeof(String('string primitive'))",    "string",  typeof(String("string primitive")) );
103 new TestCase( SECTION,     "typeof(['array', 'of', 'strings'])",   "object",   typeof(["array", "of", "strings"]) );
104 new TestCase( SECTION,     "typeof(new Function())",                "function",     typeof( new Function() ) );
105 new TestCase( SECTION,     "typeof(parseInt)",                      "function",     typeof( parseInt ) );
106 new TestCase( SECTION,     "typeof(test)",                          "function",     typeof( test ) );
107 new TestCase( SECTION,     "typeof(String.fromCharCode)",           "function",     typeof( String.fromCharCode )  );
108
109
110 test();
111