js/src/tests/ecma/String/15.5.4.5-4.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/String/15.5.4.5-4.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     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.4.5-4.js
    1.12 +   ECMA Section:       15.5.4.5 String.prototype.charCodeAt(pos)
    1.13 +
    1.14 +   Description:        Returns a nonnegative integer less than 2^16.
    1.15 +
    1.16 +   Author:             christine@netscape.com
    1.17 +   Date:               28 october 1997
    1.18 +
    1.19 +*/
    1.20 +var VERSION = "0697";
    1.21 +startTest();
    1.22 +var SECTION = "15.5.4.5-4";
    1.23 +
    1.24 +writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" );
    1.25 +
    1.26 +var MAXCHARCODE = Math.pow(2,16);
    1.27 +var item=0, CHARCODE;
    1.28 +
    1.29 +for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) {
    1.30 +  new TestCase( SECTION,
    1.31 +		"(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
    1.32 +		CHARCODE,
    1.33 +		(String.fromCharCode(CHARCODE)).charCodeAt(0) );
    1.34 +}
    1.35 +for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) {
    1.36 +  new TestCase( SECTION,
    1.37 +		"(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
    1.38 +		CHARCODE,
    1.39 +		(String.fromCharCode(CHARCODE)).charCodeAt(0) );
    1.40 +}
    1.41 +
    1.42 +new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535,     (String.fromCharCode(65535)).charCodeAt(0) );
    1.43 +
    1.44 +test();

mercurial