michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 15.5.3.2-1.js michael@0: ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) michael@0: Description: Return a string value containing as many characters michael@0: as the number of arguments. Each argument specifies michael@0: one character of the resulting string, with the first michael@0: argument specifying the first character, and so on, michael@0: from left to right. An argument is converted to a michael@0: character by applying the operation ToUint16_t and michael@0: regarding the resulting 16bit integeras the Unicode michael@0: encoding of a character. If no arguments are supplied, michael@0: the result is the empty string. michael@0: michael@0: This test covers Basic Latin (range U+0020 - U+007F) michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 2 october 1997 michael@0: */ michael@0: michael@0: var SECTION = "15.5.3.2-1"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "String.fromCharCode()"; michael@0: michael@0: new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode ); michael@0: new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode ); michael@0: new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") ); michael@0: new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) ); michael@0: michael@0: new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) ); michael@0: new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) ); michael@0: // new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) ); michael@0: michael@0: test();