1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/String/15.5.3.2-1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,156 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: 15.5.3.2-1.js 1.12 + ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) 1.13 + Description: Return a string value containing as many characters 1.14 + as the number of arguments. Each argument specifies 1.15 + one character of the resulting string, with the first 1.16 + argument specifying the first character, and so on, 1.17 + from left to right. An argument is converted to a 1.18 + character by applying the operation ToUint16_t and 1.19 + regarding the resulting 16bit integeras the Unicode 1.20 + encoding of a character. If no arguments are supplied, 1.21 + the result is the empty string. 1.22 + 1.23 + This test covers Basic Latin (range U+0020 - U+007F) 1.24 + 1.25 + Author: christine@netscape.com 1.26 + Date: 2 october 1997 1.27 +*/ 1.28 + 1.29 +var SECTION = "15.5.3.2-1"; 1.30 +var VERSION = "ECMA_1"; 1.31 +startTest(); 1.32 +var TITLE = "String.fromCharCode()"; 1.33 + 1.34 +new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode ); 1.35 +new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode ); 1.36 +new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") ); 1.37 +new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length ); 1.38 + 1.39 +new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() ); 1.40 +new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) ); 1.41 +new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) ); 1.42 +new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) ); 1.43 +new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) ); 1.44 +new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) ); 1.45 +new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) ); 1.46 +new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) ); 1.47 +new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) ); 1.48 +new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) ); 1.49 +new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) ); 1.50 +new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) ); 1.51 +new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) ); 1.52 +new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) ); 1.53 +new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) ); 1.54 +new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) ); 1.55 +new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) ); 1.56 + 1.57 +new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) ); 1.58 +new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) ); 1.59 +new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) ); 1.60 +new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) ); 1.61 +new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) ); 1.62 +new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) ); 1.63 +new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) ); 1.64 +new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) ); 1.65 +new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) ); 1.66 +new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) ); 1.67 +new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) ); 1.68 +new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) ); 1.69 +new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) ); 1.70 +new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) ); 1.71 +new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) ); 1.72 +new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) ); 1.73 + 1.74 +new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); 1.75 +new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); 1.76 +new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); 1.77 +new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); 1.78 +new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); 1.79 +new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); 1.80 +new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); 1.81 +new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); 1.82 +new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); 1.83 +new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); 1.84 +new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); 1.85 +new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); 1.86 +new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); 1.87 +new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); 1.88 +new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); 1.89 +new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); 1.90 + 1.91 +new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); 1.92 +new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); 1.93 +new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); 1.94 +new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); 1.95 +new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); 1.96 +new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); 1.97 +new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); 1.98 +new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); 1.99 +new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); 1.100 +new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); 1.101 +new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); 1.102 +new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); 1.103 +new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); 1.104 +new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); 1.105 +new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); 1.106 +new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); 1.107 + 1.108 +new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) ); 1.109 +new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) ); 1.110 +new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) ); 1.111 +new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) ); 1.112 +new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) ); 1.113 +new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) ); 1.114 +new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) ); 1.115 +new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) ); 1.116 +new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) ); 1.117 +new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) ); 1.118 +new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) ); 1.119 +new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) ); 1.120 +new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) ); 1.121 +new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) ); 1.122 +new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) ); 1.123 +new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) ); 1.124 + 1.125 +new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) ); 1.126 +new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) ); 1.127 +new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) ); 1.128 +new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) ); 1.129 +new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) ); 1.130 +new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) ); 1.131 +new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) ); 1.132 +new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) ); 1.133 +new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) ); 1.134 +new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) ); 1.135 +new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) ); 1.136 +new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) ); 1.137 +new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) ); 1.138 +new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) ); 1.139 +new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) ); 1.140 +new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) ); 1.141 + 1.142 +new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) ); 1.143 +new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) ); 1.144 +new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) ); 1.145 +new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) ); 1.146 +new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) ); 1.147 +new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) ); 1.148 +new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) ); 1.149 +new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) ); 1.150 +new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) ); 1.151 +new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) ); 1.152 +new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) ); 1.153 +new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) ); 1.154 +new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) ); 1.155 +new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) ); 1.156 +new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) ); 1.157 +// new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) ); 1.158 + 1.159 +test();