1
by Loïc Molinari
Initial import |
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.5.3.2-1.js'; |
|
40 |
||
41 |
/**
|
|
42 |
File Name: 15.5.3.2-1.js
|
|
43 |
ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
|
|
44 |
Description: Return a string value containing as many characters
|
|
45 |
as the number of arguments. Each argument specifies
|
|
46 |
one character of the resulting string, with the first
|
|
47 |
argument specifying the first character, and so on,
|
|
48 |
from left to right. An argument is converted to a
|
|
49 |
character by applying the operation ToUint16 and
|
|
50 |
regarding the resulting 16bit integeras the Unicode
|
|
51 |
encoding of a character. If no arguments are supplied,
|
|
52 |
the result is the empty string.
|
|
53 |
||
54 |
This test covers Basic Latin (range U+0020 - U+007F)
|
|
55 |
||
56 |
Author: christine@netscape.com
|
|
57 |
Date: 2 october 1997
|
|
58 |
*/
|
|
59 |
||
60 |
var SECTION = "15.5.3.2-1"; |
|
61 |
var VERSION = "ECMA_1"; |
|
62 |
startTest(); |
|
63 |
var TITLE = "String.fromCharCode()"; |
|
64 |
||
65 |
new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode ); |
|
66 |
new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode ); |
|
67 |
new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") ); |
|
68 |
new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length ); |
|
69 |
||
70 |
new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() ); |
|
71 |
new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) ); |
|
72 |
new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) ); |
|
73 |
new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) ); |
|
74 |
new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) ); |
|
75 |
new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) ); |
|
76 |
new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) ); |
|
77 |
new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) ); |
|
78 |
new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) ); |
|
79 |
new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) ); |
|
80 |
new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) ); |
|
81 |
new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) ); |
|
82 |
new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) ); |
|
83 |
new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) ); |
|
84 |
new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) ); |
|
85 |
new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) ); |
|
86 |
new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) ); |
|
87 |
||
88 |
new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) ); |
|
89 |
new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) ); |
|
90 |
new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) ); |
|
91 |
new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) ); |
|
92 |
new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) ); |
|
93 |
new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) ); |
|
94 |
new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) ); |
|
95 |
new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) ); |
|
96 |
new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) ); |
|
97 |
new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) ); |
|
98 |
new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) ); |
|
99 |
new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) ); |
|
100 |
new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) ); |
|
101 |
new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) ); |
|
102 |
new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) ); |
|
103 |
new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) ); |
|
104 |
||
105 |
new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); |
|
106 |
new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); |
|
107 |
new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); |
|
108 |
new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); |
|
109 |
new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); |
|
110 |
new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); |
|
111 |
new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); |
|
112 |
new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); |
|
113 |
new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); |
|
114 |
new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); |
|
115 |
new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); |
|
116 |
new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); |
|
117 |
new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); |
|
118 |
new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); |
|
119 |
new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); |
|
120 |
new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); |
|
121 |
||
122 |
new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); |
|
123 |
new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); |
|
124 |
new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); |
|
125 |
new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); |
|
126 |
new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); |
|
127 |
new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); |
|
128 |
new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); |
|
129 |
new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); |
|
130 |
new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); |
|
131 |
new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); |
|
132 |
new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); |
|
133 |
new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); |
|
134 |
new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); |
|
135 |
new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); |
|
136 |
new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); |
|
137 |
new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); |
|
138 |
||
139 |
new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) ); |
|
140 |
new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) ); |
|
141 |
new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) ); |
|
142 |
new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) ); |
|
143 |
new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) ); |
|
144 |
new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) ); |
|
145 |
new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) ); |
|
146 |
new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) ); |
|
147 |
new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) ); |
|
148 |
new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) ); |
|
149 |
new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) ); |
|
150 |
new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) ); |
|
151 |
new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) ); |
|
152 |
new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) ); |
|
153 |
new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) ); |
|
154 |
new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) ); |
|
155 |
||
156 |
new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) ); |
|
157 |
new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) ); |
|
158 |
new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) ); |
|
159 |
new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) ); |
|
160 |
new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) ); |
|
161 |
new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) ); |
|
162 |
new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) ); |
|
163 |
new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) ); |
|
164 |
new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) ); |
|
165 |
new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) ); |
|
166 |
new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) ); |
|
167 |
new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) ); |
|
168 |
new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) ); |
|
169 |
new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) ); |
|
170 |
new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) ); |
|
171 |
new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) ); |
|
172 |
||
173 |
new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) ); |
|
174 |
new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) ); |
|
175 |
new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) ); |
|
176 |
new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) ); |
|
177 |
new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) ); |
|
178 |
new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) ); |
|
179 |
new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) ); |
|
180 |
new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) ); |
|
181 |
new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) ); |
|
182 |
new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) ); |
|
183 |
new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) ); |
|
184 |
new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) ); |
|
185 |
new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) ); |
|
186 |
new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) ); |
|
187 |
new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) ); |
|
188 |
// new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) );
|
|
189 |
||
190 |
test(); |