diff options
author | Steve Block <steveblock@google.com> | 2011-05-06 11:45:16 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-12 13:44:10 +0100 |
commit | cad810f21b803229eb11403f9209855525a25d57 (patch) | |
tree | 29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /Source/JavaScriptCore/tests | |
parent | 121b0cf4517156d0ac5111caf9830c51b69bae8f (diff) | |
download | external_webkit-cad810f21b803229eb11403f9209855525a25d57.zip external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2 |
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'Source/JavaScriptCore/tests')
1174 files changed, 180625 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm b/Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm new file mode 100644 index 0000000..3caee45 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm @@ -0,0 +1,754 @@ +#--------------------------------------------------------------------- +package Getopt::Mixed; +# +# Copyright 1995 Christopher J. Madsen +# +# Author: Christopher J. Madsen <ac608@yfn.ysu.edu> +# Created: 1 Jan 1995 +# Version: $Revision: 1.8 $ ($Date: 1996/02/09 00:05:00 $) +# Note that RCS revision 1.23 => $Getopt::Mixed::VERSION = "1.023" +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Perl; see the file COPYING. If not, write to the +# Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Process both single-character and extended options +#--------------------------------------------------------------------- + +require 5.000; +use Carp; + +require Exporter; +@ISA = qw(Exporter); +@EXPORT = (); +@EXPORT_OK = qw(abortMsg getOptions nextOption); + +#===================================================================== +# Package Global Variables: + +BEGIN +{ + # The permissible settings for $order: + $REQUIRE_ORDER = 0; + $PERMUTE = 1; + $RETURN_IN_ORDER = 2; + + # Regular expressions: + $intRegexp = '^[-+]?\d+$'; # Match an integer + $floatRegexp = '^[-+]?(\d*\.?\d+|\d+\.)$'; # Match a real number + $typeChars = 'sif'; # Match type characters + + # Convert RCS revision number (must be main branch) to d.ddd format: + ' $Revision: 1.8 $ ' =~ / (\d+)\.(\d{1,3}) / + or die "Invalid version number"; + $VERSION = sprintf("%d.%03d",$1,$2); +} # end BEGIN + +#===================================================================== +# Subroutines: +#--------------------------------------------------------------------- +# Initialize the option processor: +# +# You should set any customization variables *after* calling init. +# +# For a description of option declarations, see the documentation at +# the end of this file. +# +# Input: +# List of option declarations (separated by whitespace) +# If the first argument is entirely non-alphanumeric characters +# with no whitespace, it is the characters that start options. + +sub init +{ + undef %options; + my($opt,$type); + + $ignoreCase = 1; # Ignore case by default + $optionStart = "-"; # Dash is the default option starter + + # If the first argument is entirely non-alphanumeric characters + # with no whitespace, it is the desired value for $optionStart: + $optionStart = shift @_ if $_[0] =~ /^[^a-z0-9\s]+$/i; + + foreach $group (@_) { + # Ignore case unless there are upper-case options: + $ignoreCase = 0 if $group =~ /[A-Z]/; + foreach $option (split(/\s+/,$group)) { + croak "Invalid option declaration `$option'" + unless $option =~ /^([^=:>]+)([=:][$typeChars]|>[^=:>]+)?$/o; + $opt = $1; + $type = $2 || ""; + if ($type =~ /^>(.*)$/) { + $type = $1; + croak "Invalid synonym `$option'" + if (not defined $options{$type} + or $options{$type} =~ /^[^:=]/); + } # end if synonym + $options{$opt} = $type; + } # end foreach option + } # end foreach group + + # Handle POSIX compliancy: + if (defined $ENV{"POSIXLY_CORRECT"}) { + $order = $REQUIRE_ORDER; + } else { + $order = $PERMUTE; + } + + $optionEnd = 0; + $badOption = \&badOption; + $checkArg = \&checkArg; +} # end init + +#--------------------------------------------------------------------- +# Clean up when we're done: +# +# This just releases the memory used by the %options hash. +# +# If 'help' was defined as an option, a new hash with just 'help' is +# created, in case the program calls abortMsg. + +sub cleanup +{ + my $help = defined($options{'help'}); + undef %options; + $options{'help'} = "" if $help; +} # end cleanup + +#--------------------------------------------------------------------- +# Abort program with message: +# +# Prints program name and arguments to STDERR +# If --help is an option, prints message saying 'Try --help' +# Exits with code 1 + +sub abortMsg +{ + my $name = $0; + $name =~ s|^.+[\\/]||; # Remove any directories from name + print STDERR $name,": ",@_,"\n"; + print STDERR "Try `$name --help' for more information.\n" + if defined $options{"help"}; + exit 1; +} # end abortMsg + +#--------------------------------------------------------------------- +# Standard function for handling bad options: +# +# Prints an error message and exits. +# +# You can override this by setting $Getopt::Mixed::badOption to a +# function reference. +# +# Input: +# Index into @ARGV +# The option that caused the error +# An optional string describing the problem +# Currently, this can be +# undef The option was not recognized +# 'ambiguous' The option could match several long options +# +# Note: +# The option has already been removed from @ARGV. To put it back, +# you can say: +# splice(@ARGV,$_[0],0,$_[1]); +# +# If your function returns, it should return whatever you want +# nextOption to return. + +sub badOption +{ + my ($index, $option, $problem) = @_; + + $problem = 'unrecognized' unless $problem; + + abortMsg("$problem option `$option'"); +} # end badOption + +#--------------------------------------------------------------------- +# Make sure we have the proper argument for this option: +# +# You can override this by setting $Getopt::Mixed::checkArg to a +# function reference. +# +# Input: +# $i: Position of argument in @ARGV +# $value: The text appended to the option (undef if no text) +# $option: The pretty name of the option (as the user typed it) +# $type: The type of the option +# +# Returns: +# The value of the option's argument + +sub checkArg +{ + my ($i,$value,$option,$type) = @_; + + abortMsg("option `$option' does not take an argument") + if (not $type and defined $value); + + if ($type =~ /^=/) { + # An argument is required for this option: + $value = splice(@ARGV,$i,1) unless defined $value; + abortMsg("option `$option' requires an argument") + unless defined $value; + } + + if ($type =~ /i$/) { + abortMsg("option `$option' requires integer argument") + if (defined $value and $value !~ /$intRegexp/o); + } + elsif ($type =~ /f$/) { + abortMsg("option `$option' requires numeric argument") + if (defined $value and $value !~ /$floatRegexp/o); + } + elsif ($type =~ /^[=:]/ and ref($checkType)) { + $value = &$checkType($i,$value,$option,$type); + } + + $value = "" if not defined $value and $type =~ /^:/; + + $value; +} # end checkArg + +#--------------------------------------------------------------------- +# Find a match for an incomplete long option: +# +# Input: +# The option text to match +# +# Returns: +# The option that matched, or +# undef, if no option matched, or +# (undef, 'ambiguous'), if multiple options matched + +sub findMatch +{ + my $opt = shift; + + $opt =~ s/-/[^-]*-/g; + $opt .= ".*"; + + my @matches = grep(/^$opt$/, keys %options); + + return undef if $#matches < 0; + return $matches[0] if $#matches == 0; + + $opt = $matches[0]; + $opt = $options{$opt} if $options{$opt} =~ /^[^=:]/; + + foreach (@matches) { + return (undef, 'ambiguous') + unless $_ eq $opt or $options{$_} eq $opt; + } + + $opt; +} # end findMatch + +#--------------------------------------------------------------------- +# Return the next option: +# +# Returns a list of 3 elements: (OPTION, VALUE, PRETTYNAME), where +# OPTION is the name of the option, +# VALUE is its argument, and +# PRETTYNAME is the option as the user entered it. +# Returns the null list if there are no more options to process +# +# If $order is $RETURN_IN_ORDER, and this is a normal argument (not an +# option), OPTION will be the null string, VALUE will be the argument, +# and PRETTYNAME will be undefined. + +sub nextOption +{ + return () if $#ARGV < 0; # No more arguments + + if ($optionEnd) { + # We aren't processing any more options: + return ("", shift @ARGV) if $order == $RETURN_IN_ORDER; + return (); + } + + # Find the next option: + my $i = 0; + while (length($ARGV[$i]) < 2 or + index($optionStart,substr($ARGV[$i],0,1)) < 0) { + return () if $order == $REQUIRE_ORDER; + return ("", shift @ARGV) if $order == $RETURN_IN_ORDER; + ++$i; + return () if $i > $#ARGV; + } # end while + + # Process the option: + my($option,$opt,$value,$optType,$prettyOpt); + $option = $ARGV[$i]; + if (substr($option,0,1) eq substr($option,1,1)) { + # If the option start character is repeated, it's a long option: + splice @ARGV,$i,1; + if (length($option) == 2) { + # A double dash by itself marks the end of the options: + $optionEnd = 1; # Don't process any more options + return nextOption(); + } # end if bare double dash + $opt = substr($option,2); + if ($opt =~ /^([^=]+)=(.*)$/) { + $opt = $1; + $value = $2; + } # end if option is followed by value + $opt =~ tr/A-Z/a-z/ if $ignoreCase; + $prettyOpt = substr($option,0,2) . $opt; + my $problem; + ($opt, $problem) = findMatch($opt) + unless defined $options{$opt} and length($opt) > 1; + return &$badOption($i,$option,$problem) unless $opt; + $optType = $options{$opt}; + if ($optType =~ /^[^:=]/) { + $opt = $optType; + $optType = $options{$opt}; + } + $value = &$checkArg($i,$value,$prettyOpt,$optType); + } # end if long option + else { + # It's a short option: + $opt = substr($option,1,1); + $opt =~ tr/A-Z/a-z/ if $ignoreCase; + return &$badOption($i,$option) unless defined $options{$opt}; + $optType = $options{$opt}; + if ($optType =~ /^[^:=]/) { + $opt = $optType; + $optType = $options{$opt}; + } + if (length($option) == 2 or $optType) { + # This is the last option in the group, so remove the group: + splice(@ARGV,$i,1); + } else { + # Just remove this option from the group: + substr($ARGV[$i],1,1) = ""; + } + if ($optType) { + $value = (length($option) > 2) ? substr($option,2) : undef; + $value =~ s/^=// if $value; # Allow either -d3 or -d=3 + } # end if option takes an argument + $prettyOpt = substr($option,0,2); + $value = &$checkArg($i,$value,$prettyOpt,$optType); + } # end else short option + ($opt,$value,$prettyOpt); +} # end nextOption + +#--------------------------------------------------------------------- +# Get options: +# +# Input: +# The same as for init() +# If no parameters are supplied, init() is NOT called. This allows +# you to call init() yourself and then change the configuration +# variables. +# +# Output Variables: +# Sets $opt_X for each `-X' option encountered. +# +# Note that if --apple is a synonym for -a, then --apple will cause +# $opt_a to be set, not $opt_apple. + +sub getOptions +{ + &init if $#_ >= 0; # Pass arguments (if any) on to init + + # If you want to use $RETURN_IN_ORDER, you have to call + # nextOption yourself; getOptions doesn't support it: + $order = $PERMUTE if $order == $RETURN_IN_ORDER; + + my ($option,$value,$package); + + $package = (caller)[0]; + + while (($option, $value) = nextOption()) { + $option =~ s/\W/_/g; # Make a legal Perl identifier + $value = 1 unless defined $value; + eval("\$" . $package . '::opt_' . $option . ' = $value;'); + } # end while + + cleanup(); +} # end getOptions + +#===================================================================== +# Package return value: + +$VERSION; + +__END__ + +=head1 NAME + +Getopt::Mixed - getopt processing with both long and short options + +=head1 SYNOPSIS + + use Getopt::Mixed; + Getopt::Mixed::getOptions(...option-descriptions...); + ...examine $opt_* variables... + +or + + use Getopt::Mixed "nextOption"; + Getopt::Mixed::init(...option-descriptions...); + while (($option, $value) = nextOption()) { + ...process option... + } + Getopt::Mixed::cleanup(); + +=head1 DESCRIPTION + +This package is my response to the standard modules Getopt::Std and +Getopt::Long. C<Std> doesn't support long options, and C<Long> +doesn't support short options. I wanted both, since long options are +easier to remember and short options are faster to type. + +This package is intended to be the "Getopt-to-end-all-Getop's". It +combines (I hope) flexibility and simplicity. It supports both short +options (introduced by C<->) and long options (introduced by C<-->). +Short options which do not take an argument can be grouped together. +Short options which do take an argument must be the last option in +their group, because everything following the option will be +considered to be its argument. + +There are two methods for using Getopt::Mixed: the simple method and +the flexible method. Both methods use the same format for option +descriptions. + +=head2 Option Descriptions + +The option-description arguments required by C<init> and C<getOptions> +are strings composed of individual option descriptions. Several +option descriptions can appear in the same string if they are +separated by whitespace. + +Each description consists of the option name and an optional trailing +argument specifier. Option names may consist of any characters but +whitespace, C<=>, C<:>, and C<E<gt>>. + +Values for argument specifiers are: + + <none> option does not take an argument + =s :s option takes a mandatory (=) or optional (:) string argument + =i :i option takes a mandatory (=) or optional (:) integer argument + =f :f option takes a mandatory (=) or optional (:) real number argument + >new option is a synonym for option `new' + +The C<E<gt>> specifier is not really an argument specifier. It +defines an option as being a synonym for another option. For example, +"a=i apples>a" would define B<-a> as an option that requires an +integer argument and B<--apples> as a synonym for B<-a>. Only one +level of synonyms is supported, and the root option must be listed +first. For example, "apples>a a=i" and "a=i apples>a oranges>apples" +are illegal; use "a=i apples>a oranges>a" if that's what you want. + +For example, in the option description: + "a b=i c:s apple baker>b charlie:s" + -a and --apple do not take arguments + -b takes a mandatory integer argument + --baker is a synonym for -b + -c and --charlie take an optional string argument + +If the first argument to C<init> or C<getOptions> is entirely +non-alphanumeric characters with no whitespace, it represents the +characters which can begin options. + +=head2 User Interface + +From the user's perspective, short options are introduced by a dash +(C<->) and long options are introduced by a double dash (C<-->). +Short options may be combined ("-a -b" can be written "-ab"), but an +option that takes an argument must be the last one in its group, +because anything following it is considered part of the argument. A +double dash by itself marks the end of the options; all arguments +following it are treated as normal arguments, not options. A single +dash by itself is treated as a normal argument, I<not> an option. + +Long options may be abbreviated. An option B<--all-the-time> could be +abbreviated B<--all>, B<--a--tim>, or even B<--a>. Note that B<--time> +would not work; the abbreviation must start at the beginning of the +option name. If an abbreviation is ambiguous, an error message will +be printed. + +In the following examples, B<-i> and B<--int> take integer arguments, +B<-f> and B<--float> take floating point arguments, and B<-s> and +B<--string> take string arguments. All other options do not take an +argument. + + -i24 -f24.5 -sHello + -i=24 --int=-27 -f=24.5 --float=0.27 -s=Hello --string=Hello + +If the argument is required, it can also be separated by whitespace: + + -i 24 --int -27 -f 24.5 --float 0.27 -s Hello --string Hello + +Note that if the option is followed by C<=>, whatever follows the C<=> +I<is> the argument, even if it's the null string. In the example + + -i= 24 -f= 24.5 -s= Hello + +B<-i> and B<-f> will cause an error, because the null string is not a +number, but B<-s> is perfectly legal; its argument is the null string, +not "Hello". + +Remember that optional arguments I<cannot> be separated from the +option by whitespace. + +=head2 The Simple Method + +The simple method is + + use Getopt::Mixed; + Getopt::Mixed::getOptions(...option-descriptions...); + +You then examine the C<$opt_*> variables to find out what options were +specified and the C<@ARGV> array to see what arguments are left. + +If B<-a> is an option that doesn't take an argument, then C<$opt_a> +will be set to 1 if the option is present, or left undefined if the +option is not present. + +If B<-b> is an option that takes an argument, then C<$opt_b> will be +set to the value of the argument if the option is present, or left +undefined if the option is not present. If the argument is optional +but not supplied, C<$opt_b> will be set to the null string. + +Note that even if you specify that an option I<requires> a string +argument, you can still get the null string (if the user specifically +enters it). If the option requires a numeric argument, you will never +get the null string (because it isn't a number). + +When converting the option name to a Perl identifier, any non-word +characters in the name will be converted to underscores (C<_>). + +If the same option occurs more than once, only the last occurrence +will be recorded. If that's not acceptable, you'll have to use the +flexible method instead. + +=head2 The Flexible Method + +The flexible method is + + use Getopt::Mixed "nextOption"; + Getopt::Mixed::init(...option-descriptions...); + while (($option, $value, $pretty) = nextOption()) { + ...process option... + } + Getopt::Mixed::cleanup(); + +This lets you process arguments one at a time. You can then handle +repeated options any way you want to. It also lets you see option +names with non-alphanumeric characters without any translation. This +is also the only method that lets you find out what order the options +and other arguments were in. + +First, you call Getopt::Mixed::init with the option descriptions. +Then, you keep calling nextOption until it returns an empty list. +Finally, you call Getopt::Mixed::cleanup when you're done. The +remaining (non-option) arguments will be found in @ARGV. + +Each call to nextOption returns a list of the next option, its value, +and the option as the user typed it. The value will be undefined if +the option does not take an argument. The option is stripped of its +starter (e.g., you get "a" and "foo", not "-a" or "--foo"). If you +want to print an error message, use the third element, which does +include the option starter. + +=head1 OTHER FUNCTIONS + +Getopt::Mixed provides one other function you can use. C<abortMsg> +prints its arguments on STDERR, plus your program's name and a +newline. It then exits with status 1. For example, if F<foo.pl> +calls C<abortMsg> like this: + + Getopt::Mixed::abortMsg("Error"); + +The output will be: + + foo.pl: Error + +=head1 CUSTOMIZATION + +There are several customization variables you can set. All of these +variables should be set I<after> calling Getopt::Mixed::init and +I<before> calling nextOption. + +If you set any of these variables, you I<must> check the version +number first. The easiest way to do this is like this: + + use Getopt::Mixed 1.006; + +If you are using the simple method, and you want to set these +variables, you'll need to call init before calling getOptions, like +this: + + use Getopt::Mixed 1.006; + Getopt::Mixed::init(...option-descriptions...); + ...set configuration variables... + Getopt::Mixed::getOptions(); # IMPORTANT: no parameters + +=over 4 + +=item $order + +$order can be set to $REQUIRE_ORDER, $PERMUTE, or $RETURN_IN_ORDER. +The default is $REQUIRE_ORDER if the environment variable +POSIXLY_CORRECT has been set, $PERMUTE otherwise. + +$REQUIRE_ORDER means that no options can follow the first argument +which isn't an option. + +$PERMUTE means that all options are treated as if they preceded all +other arguments. + +$RETURN_IN_ORDER means that all arguments maintain their ordering. +When nextOption is called, and the next argument is not an option, it +returns the null string as the option and the argument as the value. +nextOption never returns the null list until all the arguments have +been processed. + +=item $ignoreCase + +Ignore case when matching options. Default is 1 unless the option +descriptions contain an upper-case letter. + +=item $optionStart + +A string of characters that can start options. Default is "-". + +=item $badOption + +A reference to a function that is called when an unrecognized option +is encountered. The function receives three arguments. $_[0] is the +position in @ARGV where the option came from. $_[1] is the option as +the user typed it (including the option start character). $_[2] is +either undef or a string describing the reason the option was not +recognized (Currently, the only possible value is 'ambiguous', for a +long option with several possible matches). The option has already +been removed from @ARGV. To put it back, you can say: + + splice(@ARGV,$_[0],0,$_[1]); + +The function can do anything you want to @ARGV. It should return +whatever you want nextOption to return. + +The default is a function that prints an error message and exits the +program. + +=item $checkArg + +A reference to a function that is called to make sure the argument +type is correct. The function receives four arguments. $_[0] is the +position in @ARGV where the option came from. $_[1] is the text +following the option, or undefined if there was no text following the +option. $_[2] is the name of the option as the user typed it +(including the option start character), suitable for error messages. +$_[3] is the argument type specifier. + +The function can do anything you want to @ARGV. It should return +the value for this option. + +The default is a function that prints an error message and exits the +program if the argument is not the right type for the option. You can +also adjust the behavior of the default function by changing +$intRegexp or $floatRegexp. + +=item $intRegexp + +A regular expression that matches an integer. Default is +'^[-+]?\d+$', which matches a string of digits preceded by an +optional sign. Unlike the other configuration variables, this cannot +be changed after nextOption is called, because the pattern is compiled +only once. + +=item $floatRegexp + +A regular expression that matches a floating point number. Default is +'^[-+]?(\d*\.?\d+|\d+\.)$', which matches the following formats: +"123", "123.", "123.45", and ".123" (plus an optional sign). It does +not match exponential notation. Unlike the other configuration +variables, this cannot be changed after nextOption is called, because +the pattern is compiled only once. + +=item $typeChars + +A string of the characters which are legal argument types. The +default is 'sif', for String, Integer, and Floating point arguments. +The string should consist only of letters. Upper case letters are +discouraged, since this will hamper the case-folding of options. If +you change this, you should set $checkType to a function that will +check arguments of your new type. Unlike the other configuration +variables, this must be set I<before> calling init(), and cannot be +changed afterwards. + +=item $checkType + +If you add new types to $typeChars, you should set this to a function +which will check arguments of the new types. + +=back + +=head1 BUGS + +=over 4 + +=item * + +This document should be expanded. + +=item * + +A long option must be at least two characters long. Sorry. + +=item * + +The C<!> argument specifier of Getopt::Long is not supported, but you +could have options B<--foo> and B<--nofoo> and then do something like: + + $opt_foo = 0 if $opt_nofoo; + +=item * + +The C<@> argument specifier of Getopt::Long is not supported. If you +want your values pushed into an array, you'll have to use nextOption +and do it yourself. + +=back + +=head1 LICENSE + +Getopt::Mixed is distributed under the terms of the GNU General Public +License as published by the Free Software Foundation; either version +2, or (at your option) any later version. + +This means it is distributed in the hope that it will be useful, but +I<without any warranty>; without even the implied warranty of +I<merchantability> or I<fitness for a particular purpose>. See the +GNU General Public License for more details. + +Since Perl scripts are only compiled at runtime, and simply calling +Getopt::Mixed does I<not> bring your program under the GPL, the only +real restriction is that you can't use Getopt::Mixed in an +binary-only distribution produced with C<dump> (unless you also +provide source code). + +=head1 AUTHOR + +Christopher J. Madsen E<lt>F<ac608@yfn.ysu.edu>E<gt> + +Thanks are also due to Andreas Koenig for helping Getopt::Mixed +conform to the standards for Perl modules and for answering a bunch of +questions. Any remaining deficiencies are my fault. + +=cut diff --git a/Source/JavaScriptCore/tests/mozilla/Makefile b/Source/JavaScriptCore/tests/mozilla/Makefile new file mode 100644 index 0000000..21cfc6f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/Makefile @@ -0,0 +1,3 @@ +testmenu: + exec perl mklistpage.pl > menubody.html + cat menuhead.html menubody.html menufoot.html > menu.html diff --git a/Source/JavaScriptCore/tests/mozilla/README-jsDriver.html b/Source/JavaScriptCore/tests/mozilla/README-jsDriver.html new file mode 100644 index 0000000..57e4c24 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/README-jsDriver.html @@ -0,0 +1,344 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>jsDriver.pl</title> + </head> + + <body bgcolor="white"> + <h1 align="right">jsDriver.pl</h1> + + <dl> + <dt><b>NAME</b></dt> + <dd> + <b>jsDriver.pl</b> - execute JavaScript programs in various shells in + batch or single mode, reporting on failures encountered. + <br> + <br> + + <dt><b>SYNOPSIS</b></dt> + <dd> + <table> + <tr> + <td align="right" valign="top"> + <code> + <b>jsDriver.pl</b> + </code> + </td> + <td> + <code> + [-hkt] [-b BUGURL] [-c CLASSPATH] [-f OUTFILE] + [-j JAVAPATH] [-l TESTLIST ...] [-L NEGLIST ...] [-p TESTPATH] + [-s SHELLPATH] [-u LXRURL] [--help] [--confail] [--trace] + [--classpath=CLASSPATH] [--file=OUTFILE] [--javapath=JAVAPATH] + [--list=TESTLIST] [--neglist=TESTLIST] [--testpath=TESTPATH] + [--shellpath=SHELLPATH] [--lxrurl=LXRURL] {-e ENGINETYPE | + --engine=ENGINETYPE} + </code> + </td> + </tr> + </table> + <br> + <br> + + <dt><b>DESCRIPTION</b></dt> + <dd> + <b>jsDriver.pl</b> is normally used to run a series of tests against + one of the JavaScript shells. These tests are expected to be laid out + in a directory structure exactly three levels deep. The first level + is considered the <b>root</b> of the tests, subdirectories under the + <b>root</b> represent <b>Test Suites</b> and generally mark broad + categories such as <i>ECMA Level 1</i> or <i>Live Connect 3</i>. Under the + <b>Test Suites</b> are the <b>Test Categories</b>, which divide the + <b>Test Suite</b> into smaller categories, such as <i>Execution Contexts</i> + or <i>Lexical Rules</i>. Testcases are located under the + <B>Test Categories</b> as normal JavaScript (*.js) files. + <p> + If a file named <b>shell.js</b> exists in either the + <b>Test Suite</b> or the <b>Test Category</b> directory, it is + loaded into the shell before the testcase. If <b>shell.js</b> + exists in both directories, the version in the <b>Test Suite</b> + directory is loaded <i>first</i>, giving the version associated with + the <b>Test Category</b> the ability to override functions previously + declared. You can use this to + create functions and variables common to an entire suite or category. + <p> + Testcases can report failures back to <b>jsDriver.pl</b> in one of + two ways. The most common is to write a line of text containing + the word <code>FAILED!</code> to <b>STDOUT</b> or <b>STDERR</b>. + When the engine encounters a matching line, the test is marked as + failed, and any line containing <code>FAILED!</code> is displayed in + the failure report. The second way a test case can report failure is + to return an unexpected exit code. By default, <b>jsDriver.pl</b> + expects all test cases to return exit code 0, although a test + can output a line containing <code>EXPECT EXIT <i>n</i></code> where + <i>n</i> is the exit code the driver should expect to see. Testcases + can return a nonzero exit code by calling the shell function + <code>quit(<i>n</i>)</code> where <code><i>n</i></code> is the + code to exit with. The various JavaScript shells report + non-zero exit codes under the following conditions: + + <center> + <table border="1"> + <tr> + <th>Reason</th> + <th>Exit Code</th> + </tr> + <tr> + <td> + Engine initialization failure. + </td> + <td> + 1 + </td> + </tr> + <tr> + <td> + Invalid argument on command line. + </td> + <td> + 2 + </td> + </tr> + <tr> + <td> + Runtime error (uncaught exception) encountered. + </td> + <td> + 3 + </td> + </tr> + <tr> + <td> + File argument specified on command line not found. + </td> + <td> + 4 + </td> + </tr> + <tr> + <td> + Reserved for future use. + </td> + <td> + 5-9 + </td> + </tr> + </table> + </center> + <br> + <br> + + <dt><b>OPTIONS</b></dt> + <dd> + <dl> + <dt><b>-b URL, --bugurl=URL</b></dt> + <dd> + Bugzilla URL. When a testcase writes a line in the format + <code>BUGNUMBER <i>n</i></code> to <b>STDOUT</b> or <b>STDERR</b>, + <b>jsDriver.pl</b> interprets <code><i>n</i></code> as a bugnumber + in the <a href="http://bugzilla.mozilla.org">BugZilla</a> bug + tracking system. In the event that a testcase which has specified + a bugnumber fails, a hyperlink to the BugZilla database + will be included in the output by prefixing the bugnumber with the + URL specified here. By default, URL is assumed to be + "http://bugzilla.mozilla.org/show_bug.cgi?id=". + <br> + <br> + <a name="classpath"></a> + <dt><b>-c PATH, --classpath=PATH</b></dt> + <dd> + Classpath to pass the the Java Virtual Machine. When running tests + against the <b>Rhino</b> engine, PATH will be passed in as the value + to an argument named "-classpath". If your particular JVM + does not support this option, it is recommended you specify your + class path via an environment setting. Refer to your JVM + documentation for more details about CLASSPATH. + <br> + <br> + <dt><b>-e TYPE ..., --engine=TYPE ...</b></dt> + <dd> + Required. Type of engine(s) to run the tests against. TYPE can be + one or more of the following values: + <center> + <table border="1"> + <tr> + <th>TYPE</th> + <th>Engine</th> + </tr> + <tr> + <td>lcopt</td> + <td>LiveConnect, optimized</td> + </tr> + <tr> + <td>lcdebug</td> + <td>LiveConnect, debug</td> + </tr> + <tr> + <td>rhino</td> + <td>Rhino compiled mode</td> + </tr> + <tr> + <td>rhinoi</td> + <td>Rhino interpreted mode</td> + </tr> + <tr> + <td>rhinoms</td> + <td>Rhino compiled mode for the Microsoft VM (jview)</td> + </tr> + <tr> + <td>rhinomsi</td> + <td>Rhino interpreted mode for the Microsoft VM (jview)</td> + </tr> + <tr> + <td>smopt</td> + <td>Spider-Monkey, optimized</td> + </tr> + <tr> + <td>smdebug</td> + <td>Spider-Monkey, debug</td> + </tr> + <tr> + <td>xpcshell</td> + <td>XPConnect shell</td> + </tr> + </table> + </center> + <br> + <br> + <dt><b>-f FILE, --file=FILE</b></dt> + <dd> + Generate html output to the HTML file named by FILE. By default, + a filename will be generated using a combination of the engine type + and a date/time stamp, in the format: + <code>results-<i><engine-type></i>-<i><date-stamp></i>.html</code> + <br> + <br> + <dt><b>-h, --help</b></dt> + <dd> + Prints usage information. + <br> + <br> + <dt><b>-j PATH, --javapath=PATH</b></dt> + <dd> + Set the location of the Java Virtual Machine to use when running + tests against the <b>Rhino</b> engine. This can be used to test + against multiple JVMs on the same system. + <br> + <br> + <dt><b>-k, --confail</b></dt> + <dd> + Log failures to the console. This will show any failures, as they + occur, on <b>STDERR</b> in addition to creating the HTML results + file. This can be useful for times when it may be + counter-productive to load an HTML version of the results each time + a test is re-run. + <br> + <br> + <dt><b>-l FILE ..., --list=FILE ...</b></dt> + <dd> + Specify a list of tests to execute. FILE can be a plain text file + containing a list of testcases to execute, a subdirectory + in which to + <a href="http://www.instantweb.com/~foldoc/foldoc.cgi?query=grovel">grovel</a> + for tests, or a single testcase to execute. Any number of FILE + specifiers may follow this option. The driver uses the fact that a + valid testcase should be a file ending in .js to make the distinction + between a file containing a list of tests and an actual testcase. + <br> + <br> + <dt><b>-L FILE ..., --neglist=FILE ...</b></dt> + <dd> + Specify a list of tests to skip. FILE has the same meaning as in + the <b>-l</b> option. This option is evaluated after + <b>all</b> <b>-l</b> and <b>--list</b> options, allowing a user + to subtract a single testcase, a directory of testcases, or a + collection of unrelated testcases from the execution list. + <br> + <br> + <dt><b>-p PATH, --testpath=PATH</b></dt> + <dd> + Directory holding the "Test Suite" subdirectories. By + default this is ./ + <br> + <br> + <dt><b>-s PATH, --shellpath=PATH</b></dt> + <dd> + Directory holding the JavaScript shell. This can be used to override + the automatic shell location <b>jsDriver.pl</b> performs based on + you OS and engine type. For Non <b>Rhino</b> engines, this + includes the name of the executable as well as the path. In + <b>Rhino</b>, this path will be appended to your + <a href="#classpath">CLASSPATH</a>. For the + <b>SpiderMonkey</b> shells, this value defaults to + ../src/<Platform-and-buildtype-specific-directory>/[js|jsshell], + for the + <b>LiveConnect</b> shells, + ../src/liveconnect/src/<Platform-and-buildtype-specific-directory>/lschell + and for the <b>xpcshell</b> the default is the value of your + <code>MOZILLA_FIVE_HOME</code> environment variable. There is no + default (as it is usually not needed) for the <b>Rhino</b> shell. + <br> + <br> + <dt><b>-t, --trace</b></dt> + <dd> + Trace execution of <b>jsDriver.pl</b>. This option is primarily + used for debugging of the script itself, but if you are interested in + seeing the actual command being run, or generally like gobs of + useless information, you may find it entertaining. + <br> + <br> + <dt><b>-u URL, --lxrurl=URL</b></dt> + <dd> + Failures listed in the HTML results will be hyperlinked to the + lxr source available online by prefixing the test path and + name with this URL. By default, URL is + http://lxr.mozilla.org/mozilla/source/js/tests/ + <br> + <br> + + </dl> + <dt><b>SEE ALSO</b></dt> + <dd> + <a href="http://lxr.mozilla.org/mozilla/source/js/tests/jsDriver.pl">jsDriver.pl</a>, + <a href="http://lxr.mozilla.org/mozilla/source/js/tests/mklistpage.pl">mklistpage.pl</a>, + <a href="http://www.mozilla.org/js/">http://www.mozilla.org/js/</a>, + <a href="http://www.mozilla.org/js/tests/library.html">http://www.mozilla.org/js/tests/library.html</a> + <br> + <br> + + <dt><b>REQUIREMENTS</b></dt> + <dd> + <b>jsDriver.pl</b> requires the + <a href="http://search.cpan.org/search?module=Getopt::Mixed">Getopt::Mixed</a> + perl package, available from <a href="http://www.cpan.org">cpan.org</a>. + <br> + <br> + <dt><b>EXAMPLES</b></dt> + <dd> + <code>perl jsDriver.pl -e smdebug -L lc*</code><br> + Executes all tests EXCEPT the liveconnect tests against the + SpiderMonkey debug shell, writing the results + to the default result file. (NOTE: Unix shells take care of wildcard + expansion, turning <code>lc*</code> into <code>lc2 lc3</code>. Under + a DOS shell, you must explicitly list the directories.) + <p> + <code>perl jsDriver.pl -e rhino -L rhino-n.tests</code><br> + Executes all tests EXCEPT those listed in the + <code>rhino-n.tests</code> file. + <p> + <code>perl -I/home/rginda/perl/lib/ jsDriver.pl -e lcopt -l lc2 + lc3 -f lcresults.html -k</code><br> + Executes ONLY the tests under the <code>lc2</code> and <code>lc3</code> + directories against the LiveConnect shell. Results will be written to + the file <code>lcresults.html</code> <b>AND</b> the console. The + <code>-I</code> option tells perl to look for modules in the + <code>/home/rginda/perl/lib</code> directory (in addition to the + usual places), useful if you do not have root access to install new + modules on the system. + </dl> + <hr> + Author: Robert Ginda<br> + Currently maintained by <i><a href="mailto:pschwartau@netscape.com">Phil Schwartau</a> </i><br> +<!-- Created: Thu Dec 2 19:08:05 PST 1999 --> + </body> +</html> diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js new file mode 100644 index 0000000..c5c3178 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js @@ -0,0 +1,126 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4-1.js + ECMA Section: 15.4 Array Objects + + Description: Every Array object has a length property whose value + is always an integer with positive sign and less than + Math.pow(2,32). + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array Objects"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]", + "hi", + eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length", + (Math.pow(2,32)-1), + eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]", + "hi", + eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length", + (Math.pow(2,32)-2), + eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length") + ); + + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]", + "hi", + eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length", + (Math.pow(2,31)-1), + eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length") + ); + + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]", + "hi", + eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length", + (Math.pow(2,31)), + eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length") + ); + + + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]", + "hi", + eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length", + (Math.pow(2,31)+1), + eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length") + ); + + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]", + "hi", + eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]") + ); + array[item++] = new TestCase( SECTION, + "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length", + (Math.pow(2,30)-1), + eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length") + ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js new file mode 100644 index 0000000..ca046e6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4-2.js + ECMA Section: 15.4 Array Objects + + Description: Whenever a property is added whose name is an array + index, the length property is changed, if necessary, + to be one more than the numeric value of that array + index; and whenever the length property is changed, + every property whose name is an array index whose value + is not smaller than the new length is automatically + deleted. This constraint applies only to the Array + object itself, and is unaffected by length or array + index properties that may be inherited from its + prototype. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.4-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array Objects"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length", Math.pow(2,16)+1, eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") ); + + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length", Math.pow(2,30)-1, eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") ); + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length", Math.pow(2,30), eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") ); + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length", Math.pow(2,30)+1, eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") ); + + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length", Math.pow(2,31)-1, eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") ); + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length", Math.pow(2,31), eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") ); + array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length", Math.pow(2,31)+1, eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") ); + + array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)", "0,1", eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") ); + array[item++] = new TestCase( SECTION, "var arr = new Array(0,1); arr.length = 3; String(arr)", "0,1,", eval("var arr = new Array(0,1); arr.length = 3; String(arr)") ); +// array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); delete arr[0]; arr.length", 5, eval("var arr = new Array(0,1,2,3,4,5); delete arr[0]; arr.length") ); +// array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); delete arr[6]; arr.length", 5, eval("var arr = new Array(0,1,2,3,4,5); delete arr[6]; arr.length") ); + + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js new file mode 100644 index 0000000..315aa2c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js @@ -0,0 +1,88 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.1.1.js + ECMA Section: 15.4.1 Array( item0, item1,... ) + + Description: When Array is called as a function rather than as a + constructor, it creates and initializes a new array + object. Thus, the function call Array(...) is + equivalent to the object creation new Array(...) with + the same arguments. + + An array is created and returned as if by the expression + new Array( item0, item1, ... ). + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.1.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function ToUint32( n ) { + n = Number( n ); + if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY || + n == Number.NEGATIVE_INFINITY ) { + return 0; + } + var sign = n < 0 ? -1 : 1; + + return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32); +} + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof Array(1,2)", "object", typeof Array(1,2) ); + array[item++] = new TestCase( SECTION, "(Array(1,2)).toString", Array.prototype.toString, (Array(1,2)).toString ); + array[item++] = new TestCase( SECTION, + "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()", + "[object Array]", + eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") ); + + + array[item++] = new TestCase( SECTION, "(Array(1,2)).length", 2, (Array(1,2)).length ); + array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); arr[0]", 1, eval("var arr = (Array(1,2)); arr[0]") ); + array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); arr[1]", 2, eval("var arr = (Array(1,2)); arr[1]") ); + array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); String(arr)", "1,2", eval("var arr = (Array(1,2)); String(arr)") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js new file mode 100644 index 0000000..29352e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.1.2.js + ECMA Section: 15.4.1.2 Array(len) + + Description: When Array is called as a function rather than as a + constructor, it creates and initializes a new array + object. Thus, the function call Array(...) is + equivalent to the object creationi new Array(...) with + the same arguments. + + An array is created and returned as if by the + expression new Array(len). + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.1.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array Constructor Called as a Function: Array(len)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "(Array()).length", 0, (Array()).length ); + array[item++] = new TestCase( SECTION, "(Array(0)).length", 0, (Array(0)).length ); + array[item++] = new TestCase( SECTION, "(Array(1)).length", 1, (Array(1)).length ); + array[item++] = new TestCase( SECTION, "(Array(10)).length", 10, (Array(10)).length ); + array[item++] = new TestCase( SECTION, "(Array('1')).length", 1, (Array('1')).length ); + array[item++] = new TestCase( SECTION, "(Array(1000)).length", 1000, (Array(1000)).length ); + array[item++] = new TestCase( SECTION, "(Array('1000')).length", 1, (Array('1000')).length ); + array[item++] = new TestCase( SECTION, "(Array(4294967295)).length", ToUint32(4294967295), (Array(4294967295)).length ); + array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31)-1)).length", ToUint32(Math.pow(2,31)-1), (Array(Math.pow(2,31)-1)).length ); + array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31))).length", ToUint32(Math.pow(2,31)), (Array(Math.pow(2,31))).length ); + array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31)+1)).length", ToUint32(Math.pow(2,31)+1), (Array(Math.pow(2,31)+1)).length ); + array[item++] = new TestCase( SECTION, "(Array('8589934592')).length", 1, (Array("8589934592")).length ); + array[item++] = new TestCase( SECTION, "(Array('4294967296')).length", 1, (Array("4294967296")).length ); + array[item++] = new TestCase( SECTION, "(Array(1073741823)).length", ToUint32(1073741823), (Array(1073741823)).length ); + array[item++] = new TestCase( SECTION, "(Array(1073741824)).length", ToUint32(1073741824), (Array(1073741824)).length ); + array[item++] = new TestCase( SECTION, "(Array('a string')).length", 1, (Array("a string")).length ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js new file mode 100644 index 0000000..4c3393e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.1.3.js + ECMA Section: 15.4.1.3 Array() + + Description: When Array is called as a function rather than as a + constructor, it creates and initializes a new array + object. Thus, the function call Array(...) is + equivalent to the object creationi new Array(...) with + the same arguments. + + An array is created and returned as if by the + expression new Array(len). + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.1.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array Constructor Called as a Function: Array()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "typeof Array()", + "object", + typeof Array() ); + + array[item++] = new TestCase( SECTION, + "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()", + "[object Array]", + eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") ); + + array[item++] = new TestCase( SECTION, + "(Array()).length", + 0, ( + Array()).length ); + + array[item++] = new TestCase( SECTION, + "Array().toString()", + "", + Array().toString() ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js new file mode 100644 index 0000000..5640584 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js @@ -0,0 +1,133 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.1.js + ECMA Section: 15.4.1 The Array Constructor Called as a Function + + Description: When Array is called as a function rather than as a + constructor, it creates and initializes a new array + object. Thus, the function call Array(...) is + equivalent to the object creationi new Array(...) with + the same arguments. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "Array() +''", + "", + Array() +"" ); + + array[item++] = new TestCase( SECTION, + "typeof Array()", + "object", + typeof Array() ); + + array[item++] = new TestCase( SECTION, + "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()", + "[object Array]", + eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") ); + + array[item++] = new TestCase( SECTION, + "var arr = Array(); arr.toString == Array.prototype.toString", + true, + eval("var arr = Array(); arr.toString == Array.prototype.toString") ); + + array[item++] = new TestCase( SECTION, + "Array().length", + 0, + Array().length ); + + + array[item++] = new TestCase( SECTION, + "Array(1,2,3) +''", + "1,2,3", + Array(1,2,3) +"" ); + + array[item++] = new TestCase( SECTION, + "typeof Array(1,2,3)", + "object", + typeof Array(1,2,3) ); + + array[item++] = new TestCase( SECTION, + "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()", + "[object Array]", + eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") ); + + array[item++] = new TestCase( SECTION, + "var arr = Array(1,2,3); arr.toString == Array.prototype.toString", + true, + eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") ); + + array[item++] = new TestCase( SECTION, + "Array(1,2,3).length", + 3, + Array(1,2,3).length ); + + array[item++] = new TestCase( SECTION, + "typeof Array(12345)", + "object", + typeof Array(12345) ); + + array[item++] = new TestCase( SECTION, + "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()", + "[object Array]", + eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") ); + + array[item++] = new TestCase( SECTION, + "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString", + true, + eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") ); + + array[item++] = new TestCase( SECTION, + "Array(12345).length", + 12345, + Array(12345).length ); + + return ( array ); +} +function test() { + for (tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js new file mode 100644 index 0000000..4c1c0c6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js @@ -0,0 +1,92 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.2.1-1.js + ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) + Description: This description only applies of the constructor is + given two or more arguments. + + The [[Prototype]] property of the newly constructed + object is set to the original Array prototype object, + the one that is the initial value of Array.prototype + (15.4.3.1). + + The [[Class]] property of the newly constructed object + is set to "Array". + + The length property of the newly constructed object is + set to the number of arguments. + + The 0 property of the newly constructed object is set + to item0... in general, for as many arguments as there + are, the k property of the newly constructed object is + set to argument k, where the first argument is + considered to be argument number 0. + + This file tests the typeof the newly constructed object. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.2.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof new Array(1,2)", "object", typeof new Array(1,2) ); + array[item++] = new TestCase( SECTION, "(new Array(1,2)).toString", Array.prototype.toString, (new Array(1,2)).toString ); + array[item++] = new TestCase( SECTION, + "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()", + "[object Array]", + eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") ); + + array[item++] = new TestCase( SECTION, "(new Array(1,2)).length", 2, (new Array(1,2)).length ); + array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); arr[0]", 1, eval("var arr = (new Array(1,2)); arr[0]") ); + array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); arr[1]", 2, eval("var arr = (new Array(1,2)); arr[1]") ); + array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); String(arr)", "1,2", eval("var arr = (new Array(1,2)); String(arr)") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js new file mode 100644 index 0000000..d5a65de --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.2.1-2.js + ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) + Description: This description only applies of the constructor is + given two or more arguments. + + The [[Prototype]] property of the newly constructed + object is set to the original Array prototype object, + the one that is the initial value of Array.prototype + (15.4.3.1). + + The [[Class]] property of the newly constructed object + is set to "Array". + + The length property of the newly constructed object is + set to the number of arguments. + + The 0 property of the newly constructed object is set + to item0... in general, for as many arguments as there + are, the k property of the newly constructed object is + set to argument k, where the first argument is + considered to be argument number 0. + + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.2.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + + var TEST_STRING = "new Array("; + var ARGUMENTS = "" + var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32); + + for ( var index = 0; index < TEST_LENGTH; index++ ) { + ARGUMENTS += index; + ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ","; + } + + TEST_STRING += ARGUMENTS + ")"; + + TEST_ARRAY = eval( TEST_STRING ); + + for ( item = 0; item < TEST_LENGTH; item++ ) { + array[item] = new TestCase( SECTION, "["+item+"]", item, TEST_ARRAY[item] ); + } + + array[item++ ] = new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js new file mode 100644 index 0000000..b299183 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js @@ -0,0 +1,112 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.2.1-3.js + ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) + Description: This description only applies of the constructor is + given two or more arguments. + + The [[Prototype]] property of the newly constructed + object is set to the original Array prototype object, + the one that is the initial value of Array.prototype + (15.4.3.1). + + The [[Class]] property of the newly constructed object + is set to "Array". + + The length property of the newly constructed object is + set to the number of arguments. + + The 0 property of the newly constructed object is set + to item0... in general, for as many arguments as there + are, the k property of the newly constructed object is + set to argument k, where the first argument is + considered to be argument number 0. + + This test stresses the number of arguments presented to + the Array constructor. Should support up to Math.pow + (2,32) arguments, since that is the maximum length of an + ECMAScript array. + + ***Change TEST_LENGTH to Math.pow(2,32) when larger array + lengths are supported. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.2.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + + var TEST_STRING = "new Array("; + var ARGUMENTS = "" + var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32); + + for ( var index = 0; index < TEST_LENGTH; index++ ) { + ARGUMENTS += index; + ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ","; + } + + TEST_STRING += ARGUMENTS + ")"; + + TEST_ARRAY = eval( TEST_STRING ); + + for ( item = 0; item < TEST_LENGTH; item++ ) { + array[item] = new TestCase( SECTION, "TEST_ARRAY["+item+"]", item, TEST_ARRAY[item] ); + } + + array[item++] = new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" ); + array[item++] = new TestCase( SECTION, "TEST_ARRAY.toString", Array.prototype.toString, TEST_ARRAY.toString ); + array[item++] = new TestCase( SECTION, "TEST_ARRAY.join", Array.prototype.join, TEST_ARRAY.join ); + array[item++] = new TestCase( SECTION, "TEST_ARRAY.sort", Array.prototype.sort, TEST_ARRAY.sort ); + array[item++] = new TestCase( SECTION, "TEST_ARRAY.reverse", Array.prototype.reverse, TEST_ARRAY.reverse ); + array[item++] = new TestCase( SECTION, "TEST_ARRAY.length", TEST_LENGTH, TEST_ARRAY.length ); + array[item++] = new TestCase( SECTION, + "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()", + "[object Array]", + eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js new file mode 100644 index 0000000..a2e41ef --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js @@ -0,0 +1,124 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.2.2-1.js + ECMA Section: 15.4.2.2 new Array(len) + + Description: This description only applies of the constructor is + given two or more arguments. + + The [[Prototype]] property of the newly constructed + object is set to the original Array prototype object, + the one that is the initial value of Array.prototype(0) + (15.4.3.1). + + The [[Class]] property of the newly constructed object + is set to "Array". + + If the argument len is a number, then the length + property of the newly constructed object is set to + ToUint32(len). + + If the argument len is not a number, then the length + property of the newly constructed object is set to 1 + and the 0 property of the newly constructed object is + set to len. + + This file tests cases where len is a number. + + The cases in this test need to be updated since the + ToUint32 description has changed. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.2.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor: new Array( len )"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "new Array(0)", "", (new Array(0)).toString() ); + array[item++] = new TestCase( SECTION, "typeof new Array(0)", "object", (typeof new Array(0)) ); + array[item++] = new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length ); + array[item++] = new TestCase( SECTION, "(new Array(0)).toString", Array.prototype.toString, (new Array(0)).toString ); + + array[item++] = new TestCase( SECTION, "new Array(1)", "", (new Array(1)).toString() ); + array[item++] = new TestCase( SECTION, "new Array(1).length", 1, (new Array(1)).length ); + array[item++] = new TestCase( SECTION, "(new Array(1)).toString", Array.prototype.toString, (new Array(1)).toString ); + + array[item++] = new TestCase( SECTION, "(new Array(-0)).length", 0, (new Array(-0)).length ); + array[item++] = new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length ); + + array[item++] = new TestCase( SECTION, "(new Array(10)).length", 10, (new Array(10)).length ); + array[item++] = new TestCase( SECTION, "(new Array('1')).length", 1, (new Array('1')).length ); + array[item++] = new TestCase( SECTION, "(new Array(1000)).length", 1000, (new Array(1000)).length ); + array[item++] = new TestCase( SECTION, "(new Array('1000')).length", 1, (new Array('1000')).length ); + + array[item++] = new TestCase( SECTION, "(new Array(4294967295)).length", ToUint32(4294967295), (new Array(4294967295)).length ); + + array[item++] = new TestCase( SECTION, "(new Array('8589934592')).length", 1, (new Array("8589934592")).length ); + array[item++] = new TestCase( SECTION, "(new Array('4294967296')).length", 1, (new Array("4294967296")).length ); + array[item++] = new TestCase( SECTION, "(new Array(1073741824)).length", ToUint32(1073741824), (new Array(1073741824)).length ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js new file mode 100644 index 0000000..c360702 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js @@ -0,0 +1,89 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.2.2-2.js + ECMA Section: 15.4.2.2 new Array(len) + + Description: This description only applies of the constructor is + given two or more arguments. + + The [[Prototype]] property of the newly constructed + object is set to the original Array prototype object, + the one that is the initial value of Array.prototype(0) + (15.4.3.1). + + The [[Class]] property of the newly constructed object + is set to "Array". + + If the argument len is a number, then the length + property of the newly constructed object is set to + ToUint32(len). + + If the argument len is not a number, then the length + property of the newly constructed object is set to 1 + and the 0 property of the newly constructed object is + set to len. + + This file tests length of the newly constructed array + when len is not a number. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.2.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor: new Array( len )"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "(new Array(new Number(1073741823))).length", 1, (new Array(new Number(1073741823))).length ); + array[item++] = new TestCase( SECTION, "(new Array(new Number(0))).length", 1, (new Array(new Number(0))).length ); + array[item++] = new TestCase( SECTION, "(new Array(new Number(1000))).length", 1, (new Array(new Number(1000))).length ); + array[item++] = new TestCase( SECTION, "(new Array('mozilla, larryzilla, curlyzilla')).length", 1, (new Array('mozilla, larryzilla, curlyzilla')).length ); + array[item++] = new TestCase( SECTION, "(new Array(true)).length", 1, (new Array(true)).length ); + array[item++] = new TestCase( SECTION, "(new Array(false)).length", 1, (new Array(false)).length); + array[item++] = new TestCase( SECTION, "(new Array(new Boolean(true)).length", 1, (new Array(new Boolean(true))).length ); + array[item++] = new TestCase( SECTION, "(new Array(new Boolean(false)).length", 1, (new Array(new Boolean(false))).length ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js new file mode 100644 index 0000000..2ddd31b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.2.3.js + ECMA Section: 15.4.2.3 new Array() + Description: The [[Prototype]] property of the newly constructed + object is set to the origianl Array prototype object, + the one that is the initial value of Array.prototype. + The [[Class]] property of the new object is set to + "Array". The length of the object is set to 0. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.2.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Array Constructor: new Array()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "new Array() +''", "", (new Array()) +"" ); + array[item++] = new TestCase( SECTION, "typeof new Array()", "object", (typeof new Array()) ); + array[item++] = new TestCase( SECTION, + "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()", + "[object Array]", + eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") ); + + array[item++] = new TestCase( SECTION, "(new Array()).length", 0, (new Array()).length ); + array[item++] = new TestCase( SECTION, "(new Array()).toString == Array.prototype.toString", true, (new Array()).toString == Array.prototype.toString ); + array[item++] = new TestCase( SECTION, "(new Array()).join == Array.prototype.join", true, (new Array()).join == Array.prototype.join ); + array[item++] = new TestCase( SECTION, "(new Array()).reverse == Array.prototype.reverse", true, (new Array()).reverse == Array.prototype.reverse ); + array[item++] = new TestCase( SECTION, "(new Array()).sort == Array.prototype.sort", true, (new Array()).sort == Array.prototype.sort ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js new file mode 100644 index 0000000..994ce5e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.3.1-1.js + ECMA Section: 15.4.3.1 Array.prototype + Description: The initial value of Array.prototype is the built-in + Array prototype object (15.4.4). + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.3.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + var ARRAY_PROTO = Array.prototype; + + array[item++] = new TestCase( SECTION, "var props = ''; for ( p in Array ) { props += p } props", "", eval("var props = ''; for ( p in Array ) { props += p } props") ); + + array[item++] = new TestCase( SECTION, "Array.prototype = null; Array.prototype", ARRAY_PROTO, eval("Array.prototype = null; Array.prototype") ); + + array[item++] = new TestCase( SECTION, "delete Array.prototype", false, delete Array.prototype ); + array[item++] = new TestCase( SECTION, "delete Array.prototype; Array.prototype", ARRAY_PROTO, eval("delete Array.prototype; Array.prototype") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js new file mode 100644 index 0000000..43c2b4c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js @@ -0,0 +1,57 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.3.2.js + ECMA Section: 15.4.3.2 Array.length + Description: The length property is 1. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.3.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.length"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Array.length", 1, Array.length ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js new file mode 100644 index 0000000..b44c6cb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.3.js + ECMA Section: 15.4.3 Properties of the Array Constructor + Description: The value of the internal [[Prototype]] property of the + Array constructor is the Function prototype object. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.3"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "Properties of the Array Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ ); + + return ( array ); +} +function test() { + for (tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js new file mode 100644 index 0000000..4b46136 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js @@ -0,0 +1,57 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.1.js + ECMA Section: 15.4.4.1 Array.prototype.constructor + Description: The initial value of Array.prototype.constructor + is the built-in Array constructor. + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.prototype.constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Array.prototype.constructor == Array", true, Array.prototype.constructor == Array); + return ( array ); +} +function test() { + for (tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js new file mode 100644 index 0000000..9565798 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.2.js + ECMA Section: 15.4.4.2 Array.prototype.toString() + Description: The elements of this object are converted to strings + and these strings are then concatenated, separated by + comma characters. The result is the same as if the + built-in join method were invoiked for this object + with no argument. + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.4.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Array.prototype.toString.length", 0, Array.prototype.toString.length ); + + array[item++] = new TestCase( SECTION, "(new Array()).toString()", "", (new Array()).toString() ); + array[item++] = new TestCase( SECTION, "(new Array(2)).toString()", ",", (new Array(2)).toString() ); + array[item++] = new TestCase( SECTION, "(new Array(0,1)).toString()", "0,1", (new Array(0,1)).toString() ); + array[item++] = new TestCase( SECTION, "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()", "NaN,Infinity,-Infinity", (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() ); + + array[item++] = new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() ); + array[item++] = new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() ); + + var EXPECT_STRING = ""; + var MYARR = new Array(); + + for ( var i = -50; i < 50; i+= 0.25 ) { + MYARR[MYARR.length] = i; + EXPECT_STRING += i +","; + } + + EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 ); + + array[item++] = new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() ); + + + return ( array ); +} +function test() { + for ( tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js new file mode 100644 index 0000000..63ec5b0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js @@ -0,0 +1,159 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.3-1.js + ECMA Section: 15.4.4.3-1 Array.prototype.join() + Description: The elements of this object are converted to strings and + these strings are then concatenated, separated by comma + characters. The result is the same as if the built-in join + method were invoiked for this object with no argument. + Author: christine@netscape.com, pschwartau@netscape.com + Date: 07 October 1997 + Modified: 14 July 2002 + Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285 + ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join() + Step 3: If |separator| is |undefined|, let |separator| + be the single-character string "," +* +*/ + + var SECTION = "15.4.4.3-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Array.prototype.join()"); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var ARR_PROTOTYPE = Array.prototype; + + array[item++] = new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length ); + array[item++] = new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length ); + array[item++] = new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") ); + + // case where array length is 0 + + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(); TEST_ARRAY.join()", + "", + eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") ); + + // array length is 0, but spearator is specified + + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')", + "", + eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") ); + + // length is greater than 0, separator is supplied + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')", + "&&true&false&123&[object Object]&true", + eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") ); + + // length is greater than 0, separator is empty string + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')", + "truefalse123[object Object]true", + eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") ); + // length is greater than 0, separator is undefined + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)", + ",,true,false,123,[object Object],true", + eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") ); + + // length is greater than 0, separator is not supplied + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()", + ",,true,false,123,[object Object],true", + eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") ); + + // separator is a control character + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')", + unescape("%u000B%u000Btrue%u000Bfalse%u000B123%u000B[object Object]%u000Btrue"), + eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") ); + + // length of array is 1 + array[item++] = new TestCase( SECTION, + "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')", + "true", + eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") ); + + + SEPARATOR = "\t" + TEST_LENGTH = 100; + TEST_STRING = ""; + ARGUMENTS = ""; + TEST_RESULT = ""; + + for ( var index = 0; index < TEST_LENGTH; index++ ) { + ARGUMENTS += index; + ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ","; + + TEST_RESULT += index; + TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR; + } + + TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" ); + + array[item++] = new TestCase( SECTION, "TEST_ARRAY.join("+SEPARATOR+")", TEST_RESULT, TEST_ARRAY.join( SEPARATOR ) ); + + array[item++] = new TestCase( SECTION, "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()", + "true,false,,,1e+21,1e-7", + (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() ); + + // this is not an Array object + array[item++] = new TestCase( SECTION, + "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')", + "true:false:111:0.5:1230000:NaN::", + eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") ); + + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = eval(this.array[i]); + } + this.join = Array.prototype.join; + this.getClass = Object.prototype.toString; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js new file mode 100644 index 0000000..c8e7422 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js @@ -0,0 +1,272 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.3-1.js + ECMA Section: 15.4.4.3-1 Array.prototype.reverse() + Description: + + The elements of the array are rearranged so as to reverse their order. + This object is returned as the result of the call. + + 1. Call the [[Get]] method of this object with argument "length". + 2. Call ToUint32(Result(1)). + 3. Compute floor(Result(2)/2). + 4. Let k be 0. + 5. If k equals Result(3), return this object. + 6. Compute Result(2)k1. + 7. Call ToString(k). + 8. ToString(Result(6)). + 9. Call the [[Get]] method of this object with argument Result(7). + 10. Call the [[Get]] method of this object with argument Result(8). + 11. If this object has a property named by Result(8), go to step 12; but + if this object has no property named by Result(8), then go to either + step 12 or step 14, depending on the implementation. + 12. Call the [[Put]] method of this object with arguments Result(7) and + Result(10). + 13. Go to step 15. + 14. Call the [[Delete]] method on this object, providing Result(7) as the + name of the property to delete. + 15. If this object has a property named by Result(7), go to step 16; but if + this object has no property named by Result(7), then go to either step 16 + or step 18, depending on the implementation. + 16. Call the [[Put]] method of this object with arguments Result(8) and + Result(9). + 17. Go to step 19. + 18. Call the [[Delete]] method on this object, providing Result(8) as the + name of the property to delete. + 19. Increase k by 1. + 20. Go to step 5. + +Note that the reverse function is intentionally generic; it does not require +that its this value be an Array object. Therefore it can be transferred to other +kinds of objects for use as a method. Whether the reverse function can be applied +successfully to a host object is implementation dependent. + + Note: Array.prototype.reverse allows some flexibility in implementation + regarding array indices that have not been populated. This test covers the + cases in which unpopulated indices are not deleted, since the JavaScript + implementation does not delete uninitialzed indices. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.4.4.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var BUGNUMBER="123724"; + + writeHeaderToLog( SECTION + " Array.prototype.reverse()"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var ARR_PROTOTYPE = Array.prototype; + + testcases[testcases.length] = new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length ); + testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length ); + testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") ); + + // length of array is 0 + testcases[testcases.length] = new TestCase( SECTION, + "var A = new Array(); A.reverse(); A.length", + 0, + eval("var A = new Array(); A.reverse(); A.length") ); + + // length of array is 1 + var A = new Array(true); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( SECTION, + "var A = new Array(true); A.reverse(); A.length", + R.length, + eval("var A = new Array(true); A.reverse(); A.length") ); + CheckItems( R, A ); + + // length of array is 2 + var S = "var A = new Array( true,false )"; + eval(S); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( + SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + + CheckItems( R, A ); + + // length of array is 3 + var S = "var A = new Array( true,false,null )"; + eval(S); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + CheckItems( R, A ); + + // length of array is 4 + var S = "var A = new Array( true,false,null,void 0 )"; + eval(S); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + CheckItems( R, A ); + + + // some array indexes have not been set + var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'"; + eval(S); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + CheckItems( R, A ); + + + var OBJECT_OBJECT = new Object(); + var FUNCTION_OBJECT = new Function( 'return this' ); + var BOOLEAN_OBJECT = new Boolean; + var DATE_OBJECT = new Date(0); + var STRING_OBJECT = new String('howdy'); + var NUMBER_OBJECT = new Number(Math.PI); + var ARRAY_OBJECT= new Array(1000); + + var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+ + "ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'"; + + var S = "var A = new Array("+args+")"; + eval(S); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + CheckItems( R, A ); + + var limit = 1000; + var args = ""; + for (var i = 0; i < limit; i++ ) { + args += i +""; + if ( i + 1 < limit ) { + args += ","; + } + } + + var S = "var A = new Array("+args+")"; + eval(S); + var R = Reverse(A); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + CheckItems( R, A ); + + var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )"; + eval(S); + var R = Reverse( A ); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.reverse(); A.length", + R.length, + eval( S + "; A.reverse(); A.length") ); + CheckItems( R, A ); + + return ( testcases ); +} +function CheckItems( R, A ) { + for ( var i = 0; i < R.length; i++ ) { + testcases[testcases.length] = new TestCase( + SECTION, + "A["+i+ "]", + R[i], + A[i] ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = eval(this.array[i]); + } + this.join = Array.prototype.reverse; + this.getClass = Object.prototype.toString; +} +function Reverse( array ) { + var r2 = array.length; + var k = 0; + var r3 = Math.floor( r2/2 ); + if ( r3 == k ) { + return array; + } + + for ( k = 0; k < r3; k++ ) { + var r6 = r2 - k - 1; +// var r7 = String( k ); + var r7 = k; + var r8 = String( r6 ); + + var r9 = array[r7]; + var r10 = array[r8]; + + array[r7] = r10; + array[r8] = r9; + } + + return array; +} +function Iterate( array ) { + for ( var i = 0; i < array.length; i++ ) { +// print( i+": "+ array[String(i)] ); + } +} + +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = this.array[i]; + } + this.reverse = Array.prototype.reverse; + this.getClass = Object.prototype.toString; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js new file mode 100644 index 0000000..1d0d850 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js @@ -0,0 +1,163 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.3-1.js + ECMA Section: 15.4.4.3-1 Array.prototype.reverse() + Description: + + The elements of the array are rearranged so as to reverse their order. + This object is returned as the result of the call. + + 1. Call the [[Get]] method of this object with argument "length". + 2. Call ToUint32(Result(1)). + 3. Compute floor(Result(2)/2). + 4. Let k be 0. + 5. If k equals Result(3), return this object. + 6. Compute Result(2)k1. + 7. Call ToString(k). + 8. ToString(Result(6)). + 9. Call the [[Get]] method of this object with argument Result(7). + 10. Call the [[Get]] method of this object with argument Result(8). + 11. If this object has a property named by Result(8), go to step 12; but + if this object has no property named by Result(8), then go to either + step 12 or step 14, depending on the implementation. + 12. Call the [[Put]] method of this object with arguments Result(7) and + Result(10). + 13. Go to step 15. + 14. Call the [[Delete]] method on this object, providing Result(7) as the + name of the property to delete. + 15. If this object has a property named by Result(7), go to step 16; but if + this object has no property named by Result(7), then go to either step 16 + or step 18, depending on the implementation. + 16. Call the [[Put]] method of this object with arguments Result(8) and + Result(9). + 17. Go to step 19. + 18. Call the [[Delete]] method on this object, providing Result(8) as the + name of the property to delete. + 19. Increase k by 1. + 20. Go to step 5. + +Note that the reverse function is intentionally generic; it does not require +that its this value be an Array object. Therefore it can be transferred to other +kinds of objects for use as a method. Whether the reverse function can be applied +successfully to a host object is implementation dependent. + + Note: Array.prototype.reverse allows some flexibility in implementation + regarding array indices that have not been populated. This test covers the + cases in which unpopulated indices are not deleted, since the JavaScript + implementation does not delete uninitialzed indices. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.4.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = new Array(); + + writeHeaderToLog( SECTION + " Array.prototype.reverse()"); + + getTestCases(); + test(); + +function getTestCases() { + var ARR_PROTOTYPE = Array.prototype; + + testcases[testcases.length] = new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length ); + testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length ); + testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") ); + + // length of array is 0 + testcases[testcases.length] = new TestCase( SECTION, + "var A = new Array(); A.reverse(); A.length", + 0, + eval("var A = new Array(); A.reverse(); A.length") ); + return ( testcases ); +} +function CheckItems( R, A ) { + for ( var i = 0; i < R.length; i++ ) { + testcases[testcases.length] = new TestCase( + SECTION, + "A["+i+ "]", + R[i], + A[i] ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = eval(this.array[i]); + } + this.join = Array.prototype.reverse; + this.getClass = Object.prototype.toString; +} +function Reverse( array ) { + var r2 = array.length; + var k = 0; + var r3 = Math.floor( r2/2 ); + if ( r3 == k ) { + return array; + } + + for ( k = 0; k < r3; k++ ) { + var r6 = r2 - k - 1; +// var r7 = String( k ); + var r7 = k; + var r8 = String( r6 ); + + var r9 = array[r7]; + var r10 = array[r8]; + + array[r7] = r10; + array[r8] = r9; + } + + return array; +} +function Iterate( array ) { + for ( var i = 0; i < array.length; i++ ) { +// print( i+": "+ array[String(i)] ); + } +} + +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = this.array[i]; + } + this.reverse = Array.prototype.reverse; + this.getClass = Object.prototype.toString; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js new file mode 100644 index 0000000..0a759c3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js @@ -0,0 +1,223 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.5.js + ECMA Section: Array.prototype.sort(comparefn) + Description: + + This test file tests cases in which the compare function is not supplied. + + The elements of this array are sorted. The sort is not necessarily stable. + If comparefn is provided, it should be a function that accepts two arguments + x and y and returns a negative value if x < y, zero if x = y, or a positive + value if x > y. + + 1. Call the [[Get]] method of this object with argument "length". + 2. Call ToUint32(Result(1)). + 1. Perform an implementation-dependent sequence of calls to the + [[Get]] , [[Put]], and [[Delete]] methods of this object and + toSortCompare (described below), where the first argument for each call + to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less + than Result(2) and where the arguments for calls to SortCompare are + results of previous calls to the [[Get]] method. After this sequence + is complete, this object must have the following two properties. + (1) There must be some mathematical permutation of the nonnegative + integers less than Result(2), such that for every nonnegative integer + j less than Result(2), if property old[j] existed, then new[(j)] is + exactly the same value as old[j],. but if property old[j] did not exist, + then new[(j)] either does not exist or exists with value undefined. + (2) If comparefn is not supplied or is a consistent comparison + function for the elements of this array, then for all nonnegative + integers j and k, each less than Result(2), if old[j] compares less + than old[k] (see SortCompare below), then (j) < (k). Here we use the + notation old[j] to refer to the hypothetical result of calling the [ + [Get]] method of this object with argument j before this step is + executed, and the notation new[j] to refer to the hypothetical result + of calling the [[Get]] method of this object with argument j after this + step has been completely executed. A function is a consistent + comparison function for a set of values if (a) for any two of those + values (possibly the same value) considered as an ordered pair, it + always returns the same value when given that pair of values as its + two arguments, and the result of applying ToNumber to this value is + not NaN; (b) when considered as a relation, where the pair (x, y) is + considered to be in the relation if and only if applying the function + to x and y and then applying ToNumber to the result produces a + negative value, this relation is a partial order; and (c) when + considered as a different relation, where the pair (x, y) is considered + to be in the relation if and only if applying the function to x and y + and then applying ToNumber to the result produces a zero value (of either + sign), this relation is an equivalence relation. In this context, the + phrase "x compares less than y" means applying Result(2) to x and y and + then applying ToNumber to the result produces a negative value. + 3.Return this object. + + When the SortCompare operator is called with two arguments x and y, the following steps are taken: + 1.If x and y are both undefined, return +0. + 2.If x is undefined, return 1. + 3.If y is undefined, return 1. + 4.If the argument comparefn was not provided in the call to sort, go to step 7. + 5.Call comparefn with arguments x and y. + 6.Return Result(5). + 7.Call ToString(x). + 8.Call ToString(y). + 9.If Result(7) < Result(8), return 1. + 10.If Result(7) > Result(8), return 1. + 11.Return +0. + +Note that, because undefined always compared greater than any other value, undefined and nonexistent +property values always sort to the end of the result. It is implementation-dependent whether or not such +properties will exist or not at the end of the array when the sort is concluded. + +Note that the sort function is intentionally generic; it does not require that its this value be an Array object. +Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be +applied successfully to a host object is implementation dependent . + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + + var SECTION = "15.4.4.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.prototype.sort(comparefn)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var S = new Array(); + var item = 0; + + // array is empty. + S[item++] = "var A = new Array()"; + + // array contains one item + S[item++] = "var A = new Array( true )"; + + // length of array is 2 + S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )"; + + S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0"; + + S[item] = "var A = new Array( "; + + var limit = 0x0061; + for ( var i = 0x007A; i >= limit; i-- ) { + S[item] += "\'"+ String.fromCharCode(i) +"\'" ; + if ( i > limit ) { + S[item] += ","; + } + } + + S[item] += ")"; + + item++; + + for ( var i = 0; i < S.length; i++ ) { + CheckItems( S[i] ); + } +} +function CheckItems( S ) { + eval( S ); + var E = Sort( A ); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.sort(); A.length", + E.length, + eval( S + "; A.sort(); A.length") ); + + for ( var i = 0; i < E.length; i++ ) { + testcases[testcases.length] = new TestCase( + SECTION, + "A["+i+ "].toString()", + E[i] +"", + A[i] +""); + + if ( A[i] == void 0 && typeof A[i] == "undefined" ) { + testcases[testcases.length] = new TestCase( + SECTION, + "typeof A["+i+ "]", + typeof E[i], + typeof A[i] ); + } + } +} +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = eval(this.array[i]); + } + this.sort = Array.prototype.sort; + this.getClass = Object.prototype.toString; +} +function Sort( a ) { + for ( i = 0; i < a.length; i++ ) { + for ( j = i+1; j < a.length; j++ ) { + var lo = a[i]; + var hi = a[j]; + var c = Compare( lo, hi ); + if ( c == 1 ) { + a[i] = hi; + a[j] = lo; + } + } + } + return a; +} +function Compare( x, y ) { + if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) { + return +0; + } + if ( x == void 0 && typeof x == "undefined" ) { + return 1; + } + if ( y == void 0 && typeof y == "undefined" ) { + return -1; + } + x = String(x); + y = String(y); + if ( x < y ) { + return -1; + } + if ( x > y ) { + return 1; + } + return 0; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js new file mode 100644 index 0000000..23e1eac --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js @@ -0,0 +1,224 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.5-2.js + ECMA Section: Array.prototype.sort(comparefn) + Description: + + This test file tests cases in which the compare function is supplied. + In this cases, the sort creates a reverse sort. + + The elements of this array are sorted. The sort is not necessarily stable. + If comparefn is provided, it should be a function that accepts two arguments + x and y and returns a negative value if x < y, zero if x = y, or a positive + value if x > y. + + 1. Call the [[Get]] method of this object with argument "length". + 2. Call ToUint32(Result(1)). + 1. Perform an implementation-dependent sequence of calls to the + [[Get]] , [[Put]], and [[Delete]] methods of this object and + toSortCompare (described below), where the first argument for each call + to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less + than Result(2) and where the arguments for calls to SortCompare are + results of previous calls to the [[Get]] method. After this sequence + is complete, this object must have the following two properties. + (1) There must be some mathematical permutation of the nonnegative + integers less than Result(2), such that for every nonnegative integer + j less than Result(2), if property old[j] existed, then new[(j)] is + exactly the same value as old[j],. but if property old[j] did not exist, + then new[(j)] either does not exist or exists with value undefined. + (2) If comparefn is not supplied or is a consistent comparison + function for the elements of this array, then for all nonnegative + integers j and k, each less than Result(2), if old[j] compares less + than old[k] (see SortCompare below), then (j) < (k). Here we use the + notation old[j] to refer to the hypothetical result of calling the [ + [Get]] method of this object with argument j before this step is + executed, and the notation new[j] to refer to the hypothetical result + of calling the [[Get]] method of this object with argument j after this + step has been completely executed. A function is a consistent + comparison function for a set of values if (a) for any two of those + values (possibly the same value) considered as an ordered pair, it + always returns the same value when given that pair of values as its + two arguments, and the result of applying ToNumber to this value is + not NaN; (b) when considered as a relation, where the pair (x, y) is + considered to be in the relation if and only if applying the function + to x and y and then applying ToNumber to the result produces a + negative value, this relation is a partial order; and (c) when + considered as a different relation, where the pair (x, y) is considered + to be in the relation if and only if applying the function to x and y + and then applying ToNumber to the result produces a zero value (of either + sign), this relation is an equivalence relation. In this context, the + phrase "x compares less than y" means applying Result(2) to x and y and + then applying ToNumber to the result produces a negative value. + 3.Return this object. + + When the SortCompare operator is called with two arguments x and y, the following steps are taken: + 1.If x and y are both undefined, return +0. + 2.If x is undefined, return 1. + 3.If y is undefined, return 1. + 4.If the argument comparefn was not provided in the call to sort, go to step 7. + 5.Call comparefn with arguments x and y. + 6.Return Result(5). + 7.Call ToString(x). + 8.Call ToString(y). + 9.If Result(7) < Result(8), return 1. + 10.If Result(7) > Result(8), return 1. + 11.Return +0. + +Note that, because undefined always compared greater than any other value, undefined and nonexistent +property values always sort to the end of the result. It is implementation-dependent whether or not such +properties will exist or not at the end of the array when the sort is concluded. + +Note that the sort function is intentionally generic; it does not require that its this value be an Array object. +Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be +applied successfully to a host object is implementation dependent . + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + + var SECTION = "15.4.4.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.prototype.sort(comparefn)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var S = new Array(); + var item = 0; + + // array is empty. + S[item++] = "var A = new Array()"; + + // array contains one item + S[item++] = "var A = new Array( true )"; + + // length of array is 2 + S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )"; + + S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0"; + + S[item] = "var A = new Array( "; + + var limit = 0x0061; + for ( var i = 0x007A; i >= limit; i-- ) { + S[item] += "\'"+ String.fromCharCode(i) +"\'" ; + if ( i > limit ) { + S[item] += ","; + } + } + + S[item] += ")"; + + for ( var i = 0; i < S.length; i++ ) { + CheckItems( S[i] ); + } + +} +function CheckItems( S ) { + eval( S ); + var E = Sort( A ); + + testcases[testcases.length] = new TestCase( SECTION, + S +"; A.sort(Compare); A.length", + E.length, + eval( S + "; A.sort(Compare); A.length") ); + + for ( var i = 0; i < E.length; i++ ) { + testcases[testcases.length] = new TestCase( + SECTION, + "A["+i+ "].toString()", + E[i] +"", + A[i] +""); + + if ( A[i] == void 0 && typeof A[i] == "undefined" ) { + testcases[testcases.length] = new TestCase( + SECTION, + "typeof A["+i+ "]", + typeof E[i], + typeof A[i] ); + } + } +} +function Object_1( value ) { + this.array = value.split(","); + this.length = this.array.length; + for ( var i = 0; i < this.length; i++ ) { + this[i] = eval(this.array[i]); + } + this.sort = Array.prototype.sort; + this.getClass = Object.prototype.toString; +} +function Sort( a ) { + var r1 = a.length; + for ( i = 0; i < a.length; i++ ) { + for ( j = i+1; j < a.length; j++ ) { + var lo = a[i]; + var hi = a[j]; + var c = Compare( lo, hi ); + if ( c == 1 ) { + a[i] = hi; + a[j] = lo; + } + } + } + return a; +} +function Compare( x, y ) { + if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) { + return +0; + } + if ( x == void 0 && typeof x == "undefined" ) { + return 1; + } + if ( y == void 0 && typeof y == "undefined" ) { + return -1; + } + x = String(x); + y = String(y); + if ( x < y ) { + return 1; + } + if ( x > y ) { + return -1; + } + return 0; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js new file mode 100644 index 0000000..47bbe5d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js @@ -0,0 +1,181 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.5-3.js + ECMA Section: Array.prototype.sort(comparefn) + Description: + + This is a regression test for + http://scopus/bugsplat/show_bug.cgi?id=117144 + + Verify that sort is successfull, even if the sort compare function returns + a very large negative or positive value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + + var SECTION = "15.4.4.5-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.prototype.sort(comparefn)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + var array = new Array(); + + array[array.length] = new Date( TIME_2000 * Math.PI ); + array[array.length] = new Date( TIME_2000 * 10 ); + array[array.length] = new Date( TIME_1900 + TIME_1900 ); + array[array.length] = new Date(0); + array[array.length] = new Date( TIME_2000 ); + array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 ); + array[array.length] = new Date( TIME_1900 * Math.PI ); + array[array.length] = new Date( TIME_1900 * 10 ); + array[array.length] = new Date( TIME_1900 ); + array[array.length] = new Date( TIME_2000 + TIME_2000 ); + array[array.length] = new Date( 1899, 0, 1 ); + array[array.length] = new Date( 2000, 1, 29 ); + array[array.length] = new Date( 2000, 0, 1 ); + array[array.length] = new Date( 1999, 11, 31 ); + + var testarr1 = new Array() + clone( array, testarr1 ); + testarr1.sort( comparefn1 ); + + var testarr2 = new Array() + clone( array, testarr2 ); + testarr2.sort( comparefn2 ); + + testarr3 = new Array(); + clone( array, testarr3 ); + testarr3.sort( comparefn3 ); + + // when there's no sort function, sort sorts by the toString value of Date. + + var testarr4 = new Array() + clone( array, testarr4 ); + testarr4.sort(); + + var realarr = new Array(); + clone( array, realarr ); + realarr.sort( realsort ); + + var stringarr = new Array(); + clone( array, stringarr ); + stringarr.sort( stringsort ); + + for ( var i = 0, tc = 0; i < array.length; i++, tc++) { + testcases[tc] = new TestCase( + SECTION, + "testarr1["+i+"]", + realarr[i], + testarr1[i] ); + } + + for ( var i=0; i < array.length; i++, tc++) { + testcases[tc] = new TestCase( + SECTION, + "testarr2["+i+"]", + realarr[i], + testarr2[i] ); + } + + for ( var i=0; i < array.length; i++, tc++) { + testcases[tc] = new TestCase( + SECTION, + "testarr3["+i+"]", + realarr[i], + testarr3[i] ); + } + + for ( var i=0; i < array.length; i++, tc++) { + testcases[tc] = new TestCase( + SECTION, + "testarr4["+i+"]", + stringarr[i].toString(), + testarr4[i].toString() ); + } + +} +function comparefn1( x, y ) { + return x - y; +} +function comparefn2( x, y ) { + return x.valueOf() - y.valueOf(); +} +function realsort( x, y ) { + return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) ); +} +function comparefn3( x, y ) { + return ( +x == +y ? 0 : ( x > y ? 1 : -1 ) ); +} +function clone( source, target ) { + for (i = 0; i < source.length; i++ ) { + target[i] = source[i]; + } +} +function stringsort( x, y ) { + for ( var i = 0; i < x.toString().length; i++ ) { + var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i); + if ( d > 0 ) { + return 1; + } else { + if ( d < 0 ) { + return -1; + } else { + continue; + } + } + + var d = x.length - y.length; + + if ( d > 0 ) { + return 1; + } else { + if ( d < 0 ) { + return -1; + } + } + } + return 0; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js new file mode 100644 index 0000000..4197dfb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.4.js + ECMA Section: 15.4.4 Properties of the Array Prototype Object + Description: The value of the internal [[Prototype]] property of + the Array prototype object is the Object prototype + object. + + Note that the Array prototype object is itself an + array; it has a length property (whose initial value + is (0) and the special [[Put]] method. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.4.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Array Prototype Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + +// these testcases are ECMA_2 +// array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ ); +// array[item++] = new TestCase( SECTION, "Array.__proto__.valueOf == Object.__proto__.valueOf", true, (Array.__proto__.valueOf == Object.__proto__.valueOf) ); + + array[item++] = new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length ); + +// verify that prototype object is an Array object. + array[item++] = new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype ); + + array[item++] = new TestCase( SECTION, + "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()", + "[object Array]", + eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js new file mode 100644 index 0000000..e57408b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js @@ -0,0 +1,172 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.5.1-1.js + ECMA Section: [[ Put]] (P, V) + Description: + Array objects use a variation of the [[Put]] method used for other native + ECMAScript objects (section 8.6.2.2). + + Assume A is an Array object and P is a string. + + When the [[Put]] method of A is called with property P and value V, the + following steps are taken: + + 1. Call the [[CanPut]] method of A with name P. + 2. If Result(1) is false, return. + 3. If A doesn't have a property with name P, go to step 7. + 4. If P is "length", go to step 12. + 5. Set the value of property P of A to V. + 6. Go to step 8. + 7. Create a property with name P, set its value to V and give it empty + attributes. + 8. If P is not an array index, return. + 9. If A itself has a property (not an inherited property) named "length", + andToUint32(P) is less than the value of the length property of A, then + return. + 10. Change (or set) the value of the length property of A to ToUint32(P)+1. + 11. Return. + 12. Compute ToUint32(V). + 13. For every integer k that is less than the value of the length property + of A but not less than Result(12), if A itself has a property (not an + inherited property) named ToString(k), then delete that property. + 14. Set the value of property P of A to Result(12). + 15. Return. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.4.5.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array [[Put]] (P, V)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + + var item = 0; + + // P is "length" + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.length = 1000; A.length", + 1000, + eval("var A = new Array(); A.length = 1000; A.length") ); + + // A has Property P, and P is not length or an array index + array[item++] = new TestCase( SECTION, + "var A = new Array(1000); A.name = 'name of this array'; A.name", + 'name of this array', + eval("var A = new Array(1000); A.name = 'name of this array'; A.name") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(1000); A.name = 'name of this array'; A.length", + 1000, + eval("var A = new Array(1000); A.name = 'name of this array'; A.length") ); + + + // A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the + // value of length + + array[item++] = new TestCase( SECTION, + "var A = new Array(1000); A[123] = 'hola'; A[123]", + 'hola', + eval("var A = new Array(1000); A[123] = 'hola'; A[123]") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(1000); A[123] = 'hola'; A.length", + 1000, + eval("var A = new Array(1000); A[123] = 'hola'; A.length") ); + + + for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) { + TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'"; + if ( i < 0x00FF - 1 ) { + TEST_STRING += ","; + } else { + TEST_STRING += ");" + } + } + + var LENGTH = 0x00ff - 0x0020; + + array[item++] = new TestCase( SECTION, + TEST_STRING +" A[150] = 'hello'; A[150]", + 'hello', + eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) ); + + array[item++] = new TestCase( SECTION, + TEST_STRING +" A[150] = 'hello'; A[150]", + LENGTH, + eval( TEST_STRING + " A[150] = 'hello'; A.length" ) ); + + // A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the + // value of length + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A[123] = true; A.length", + 124, + eval("var A = new Array(); A[123] = true; A.length") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length", + 16, + eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") ); + + for ( var i = 0; i < A.length; i++, item++ ) { + array[item] = new TestCase( SECTION, + "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]", + (i <= 10) ? i : ( i == 15 ? '15' : void 0 ), + A[i] ); + } + // P is not an array index, and P is not "length" + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.join.length = 4; A.join.length", + 1, + eval("var A = new Array(); A.join.length = 4; A.join.length") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.join.length = 4; A.length", + 0, + eval("var A = new Array(); A.join.length = 4; A.length") ); + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js new file mode 100644 index 0000000..08b4721 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js @@ -0,0 +1,150 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.5.1-2.js + ECMA Section: [[ Put]] (P, V) + Description: + Array objects use a variation of the [[Put]] method used for other native + ECMAScript objects (section 8.6.2.2). + + Assume A is an Array object and P is a string. + + When the [[Put]] method of A is called with property P and value V, the + following steps are taken: + + 1. Call the [[CanPut]] method of A with name P. + 2. If Result(1) is false, return. + 3. If A doesn't have a property with name P, go to step 7. + 4. If P is "length", go to step 12. + 5. Set the value of property P of A to V. + 6. Go to step 8. + 7. Create a property with name P, set its value to V and give it empty + attributes. + 8. If P is not an array index, return. + 9. If A itself has a property (not an inherited property) named "length", + andToUint32(P) is less than the value of the length property of A, then + return. + 10. Change (or set) the value of the length property of A to ToUint32(P)+1. + 11. Return. + 12. Compute ToUint32(V). + 13. For every integer k that is less than the value of the length property + of A but not less than Result(12), if A itself has a property (not an + inherited property) named ToString(k), then delete that property. + 14. Set the value of property P of A to Result(12). + 15. Return. + + + These are testcases from Waldemar, detailed in + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552 + + Author: christine@netscape.com + Date: 15 June 1998 +*/ + + var SECTION = "15.4.5.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array [[Put]] (P,V)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var a = new Array(); + + AddCase( "3.00", "three" ); + AddCase( "00010", "eight" ); + AddCase( "37xyz", "thirty-five" ); + AddCase("5000000000", 5) + AddCase( "-2", -3 ); + + testcases[tc++] = new TestCase( SECTION, + "a[10]", + void 0, + a[10] ); + + testcases[tc++] = new TestCase( SECTION, + "a[3]", + void 0, + a[3] ); + + a[4] = "four"; + + testcases[tc++] = new TestCase( SECTION, + "a[4] = \"four\"; a[4]", + "four", + a[4] ); + + testcases[tc++] = new TestCase( SECTION, + "a[\"4\"]", + "four", + a["4"] ); + + testcases[tc++] = new TestCase( SECTION, + "a[\"4.00\"]", + void 0, + a["4.00"] ); + + testcases[tc++] = new TestCase( SECTION, + "a.length", + 5, + a.length ); + + + a["5000000000"] = 5; + + testcases[tc++] = new TestCase( SECTION, + "a[\"5000000000\"] = 5; a.length", + 5, + a.length ); + + testcases[tc++] = new TestCase( SECTION, + "a[\"-2\"] = -3; a.length", + 5, + a.length ); + + test(); + +function AddCase ( arg, value ) { + + a[arg] = value; + + testcases[tc++] = new TestCase( SECTION, + "a[\"" + arg + "\"] = "+ value +"; a.length", + 0, + a.length ); +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js new file mode 100644 index 0000000..069ae57 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js @@ -0,0 +1,93 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.5.2-1.js + ECMA Section: Array.length + Description: + 15.4.5.2 length + The length property of this Array object is always numerically greater + than the name of every property whose name is an array index. + + The length property has the attributes { DontEnum, DontDelete }. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.4.5.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.length"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.length", + 0, + eval("var A = new Array(); A.length") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length", + Math.pow(2,32)-1, + eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.length = 123; A.length", + 123, + eval("var A = new Array(); A.length = 123; A.length") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS", + "", + eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") ); + + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.length = 123; delete A.length", + false , + eval("var A = new Array(); A.length = 123; delete A.length") ); + + array[item++] = new TestCase( SECTION, + "var A = new Array(); A.length = 123; delete A.length; A.length", + 123, + eval("var A = new Array(); A.length = 123; delete A.length; A.length") ); + return array; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js new file mode 100644 index 0000000..9d65b2c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js @@ -0,0 +1,123 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.4.5.2-2.js + ECMA Section: Array.length + Description: + 15.4.5.2 length + The length property of this Array object is always numerically greater + than the name of every property whose name is an array index. + + The length property has the attributes { DontEnum, DontDelete }. + + This test verifies that the Array.length property is not Read Only. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.4.5.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Array.length"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) ); + + addCase( new Array(), 0, 1, 1 ); + + addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 ); + addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) ); + addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) ); + addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) ) + + // some tests where array is not empty + // array is populated with strings + for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) { + arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" ); + + } +// print(i +":"+arg); + + var a = eval( "new Array("+arg+")" ); + + addCase( a, i, i, i ); + addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true ); + addCase( a, Math.pow(2,12)+5, 0, 0, true ); + + test(); + +function addCase( object, old_len, set_len, new_len, checkitems ) { + object.length = set_len; + + testcases[testcases.length] = new TestCase( SECTION, + "array = new Array("+ old_len+"); array.length = " + set_len + + "; array.length", + new_len, + object.length ); + + if ( checkitems ) { + // verify that items between old and newlen are all undefined + if ( new_len < old_len ) { + var passed = true; + for ( var i = new_len; i < old_len; i++ ) { + if ( object[i] != void 0 ) { + passed = false; + } + } + testcases[testcases.length] = new TestCase( SECTION, + "verify that array items have been deleted", + true, + passed ); + } + if ( new_len > old_len ) { + var passed = true; + for ( var i = old_len; i < new_len; i++ ) { + if ( object[i] != void 0 ) { + passed = false; + } + } + testcases[testcases.length] = new TestCase( SECTION, + "verify that new items are undefined", + true, + passed ); + } + } + +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js new file mode 100644 index 0000000..762b06d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.1.js + ECMA Section: 15.6.1 The Boolean Function + 15.6.1.1 Boolean( value ) + 15.6.1.2 Boolean () + Description: Boolean( value ) should return a Boolean value + not a Boolean object) computed by + Boolean.toBooleanValue( value) + + 15.6.1.2 Boolean() returns false + + Author: christine@netscape.com + Date: 27 jun 1997 + + + Data File Fields: + VALUE Argument passed to the Boolean function + TYPE typeof VALUE (not used, but helpful in understanding + the data file) + E_RETURN Expected return value of Boolean( VALUE ) +*/ + var SECTION = "15.6.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); + array[item++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); + array[item++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); + array[item++] = new TestCase( SECTION, "Boolean('1')", true, Boolean("1") ); + array[item++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); + array[item++] = new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") ); + array[item++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); + array[item++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); + + array[item++] = new TestCase( SECTION, "Boolean('true')", true, Boolean("true") ); + array[item++] = new TestCase( SECTION, "Boolean('false')", true, Boolean("false") ); + array[item++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); + + array[item++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) ); + array[item++] = new TestCase( SECTION, "Boolean()", false, Boolean() ); +// array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js new file mode 100644 index 0000000..2d4e142 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js @@ -0,0 +1,160 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.2.js + ECMA Section: 15.6.2 The Boolean Constructor + 15.6.2.1 new Boolean( value ) + 15.6.2.2 new Boolean() + + This test verifies that the Boolean constructor + initializes a new object (typeof should return + "object"). The prototype of the new object should + be Boolean.prototype. The value of the object + should be ToBoolean( value ) (a boolean value). + + Description: + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) ); + array[item++] = new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) ); + array[item++] = new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) ); + array[item++] = new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) ); + array[item++] = new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') ); + array[item++] = new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') ); + array[item++] = new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') ); + array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) ); + array[item++] = new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) ); + array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); + array[item++] = new TestCase( "15.6.2.2", + "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() ); + array[item++] = new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js new file mode 100644 index 0000000..c3897e4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-1.js + ECMA Section: 15.6.3 Boolean.prototype + + Description: The initial value of Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the DontEnum property of Boolean.prototype + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var str='';for ( p in Boolean ) { str += p } str;", + "", + eval("var str='';for ( p in Boolean ) { str += p } str;") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js new file mode 100644 index 0000000..0ff248a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-2.js + ECMA Section: 15.6.3.1 Boolean.prototype + + Description: The initial valu eof Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the DontDelete property of Boolean.prototype + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "delete( Boolean.prototype)", + false, + delete( Boolean.prototype) ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js new file mode 100644 index 0000000..5ba5c95 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-3.js + ECMA Section: 15.6.3.1 Boolean.prototype + + Description: The initial valu eof Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the DontDelete property of Boolean.prototype + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "delete( Boolean.prototype); Boolean.prototype", + Boolean.prototype, + eval("delete( Boolean.prototype); Boolean.prototype") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js new file mode 100644 index 0000000..56972e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-4.js + ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object + + Description: The initial value of Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the ReadOnly property of Boolean.prototype + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + var SECTION = "15.6.3.1-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var BOOL_PROTO = Boolean.prototype; + + array[item++] = new TestCase( SECTION, + "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO", + true, + eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") ); + + array[item++] = new TestCase( SECTION, + "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null", + false, + eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") ); + + return ( array ); +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js new file mode 100644 index 0000000..fb3605c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js @@ -0,0 +1,61 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-5.js + ECMA Section: 15.6.3.1 Boolean.prototype + Description: + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var VERSION = "ECMA_2"; + startTest(); + var SECTION = "15.6.3.1-5"; + var TITLE = "Boolean.prototype" + + writeHeaderToLog( SECTION + " " + TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js new file mode 100644 index 0000000..55614f5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1.js + ECMA Section: 15.6.3.1 Boolean.prototype + + Description: The initial valu eof Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + It has the internal [[Call]] and [[Construct]] + properties (not tested), and the length property. + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + + var SECTION = "15.6.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); + array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js new file mode 100644 index 0000000..0e9a252 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.js + ECMA Section: 15.6.3 Properties of the Boolean Constructor + + Description: The value of the internal prototype property is + the Function prototype object. + + It has the internal [[Call]] and [[Construct]] + properties, and the length property. + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "Properties of the Boolean Constructor" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype ); + array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js new file mode 100644 index 0000000..e40d71a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4-1.js + ECMA Section: 15.6.4 Properties of the Boolean Prototype Object + + Description: + The Boolean prototype object is itself a Boolean object (its [[Class]] is + "Boolean") whose value is false. + + The value of the internal [[Prototype]] property of the Boolean prototype object + is the Object prototype object (15.2.3.1). + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + + + var VERSION = "ECMA_1" + startTest(); + var SECTION = "15.6.4-1"; + + writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) ); + array[item++] = new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) ); + array[item++] = new TestCase( SECTION, + "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", + "[object Boolean]", + eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); + array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); + + return ( array ); +} + +function test() { + for (tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js new file mode 100644 index 0000000..760272e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4-2.js + ECMA Section: 15.6.4 Properties of the Boolean Prototype Object + + Description: + The Boolean prototype object is itself a Boolean object (its [[Class]] is + "Boolean") whose value is false. + + The value of the internal [[Prototype]] property of the Boolean prototype object + is the Object prototype object (15.2.3.1). + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + + + var VERSION = "ECMA_2" + startTest(); + var SECTION = "15.6.4-2"; + + writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); + + return ( array ); +} + +function test() { + for (tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js new file mode 100644 index 0000000..848b1f4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.1.js + ECMA Section: 15.6.4.1 Boolean.prototype.constructor + + Description: The initial value of Boolean.prototype.constructor + is the built-in Boolean constructor. + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + var SECTION = "15.6.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.constructor" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "( Boolean.prototype.constructor == Boolean )", + true , + (Boolean.prototype.constructor == Boolean) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js new file mode 100644 index 0000000..85514fd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2.js + ECMA Section: 15.6.4.2-1 Boolean.prototype.toString() + Description: If this boolean value is true, then the string "true" + is returned; otherwise this boolean value must be false, + and the string "false" is returned. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() ); + + array[item++] = new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() ); + + array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js new file mode 100644 index 0000000..d46c49b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2-2.js + ECMA Section: 15.6.4.2 Boolean.prototype.toString() + Description: Returns this boolean value. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()", + "false", + "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" ); + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()", + "true", + "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()" ); + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()", + "false", + "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" ); + return ( array ); + +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js new file mode 100644 index 0000000..faf0a94 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2-3.js + ECMA Section: 15.6.4.2 Boolean.prototype.toString() + Description: Returns this boolean value. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + + var SECTION = "15.6.4.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") ); + array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js new file mode 100644 index 0000000..a86ba51 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2-4.js + ECMA Section: 15.6.4.2 Boolean.prototype.toString() + Description: Returns this boolean value. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.2-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()"; + writeHeaderToLog( SECTION +" "+ TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()", + "error", + "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js new file mode 100644 index 0000000..3589197 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js @@ -0,0 +1,91 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() ); + + array[item++] = new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() ); + + array[item++] = new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() ); + + array[item++] = new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js new file mode 100644 index 0000000..f1bc83d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3-2.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") ); + array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js new file mode 100644 index 0000000..f19c168 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3-3.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.3-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()", + true, + eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js new file mode 100644 index 0000000..fe7b17c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3-4.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + var SECTION = "15.6.4.3-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()", + "error", + "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js new file mode 100644 index 0000000..67b9a1b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() ); + + array[item++] = new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() ); + + array[item++] = new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() ); + + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); + + return ( array ); +} + +function test( array ) { + var passed = true; + + writeHeaderToLog("15.8.6.4.3 Properties of the Boolean Object: valueOf"); + + for ( i = 0; i < array.length; i++ ) { + + array[i].passed = writeTestCaseResult( + array[i].expect, + array[i].actual, + "( "+ array[i].description +" ).valueOf() = "+ array[i].actual ); + + array[i].reason += ( array[i].passed ) ? "" : "wrong value "; + + passed = ( array[i].passed ) ? passed : false; + + } + + stopTest(); + + // all tests must return a boolean value + return ( array ); +} + +// for TCMS, the testcases array must be global. + var testcases = getTestCases(); + +// all tests must call a function that returns a boolean value + test( testcases ); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js new file mode 100644 index 0000000..44d12c1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.js + ECMA Section: Properties of the Boolean Prototype Object + Description: + The Boolean prototype object is itself a Boolean object (its [[Class]] is " + Boolean") whose value is false. + + The value of the internal [[Prototype]] property of the Boolean prototype + object is the Object prototype object (15.2.3.1). + + In following descriptions of functions that are properties of the Boolean + prototype object, the phrase "this Boolean object" refers to the object that + is the this value for the invocation of the function; it is an error if + this does not refer to an object for which the value of the internal + [[Class]] property is "Boolean". Also, the phrase "this boolean value" + refers to the boolean value represented by this Boolean object, that is, + the value of the internal [[Value]] property of this Boolean object. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.6.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Boolean Prototype Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "Boolean.prototype == false", + true, + Boolean.prototype == false ); + + testcases[tc++] = new TestCase( SECTION, + "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", + "[object Boolean]", + eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js new file mode 100644 index 0000000..4d936af --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.1.1-1.js + ECMA Section: 15.9.1.1 Time Range + Description: + - leap seconds are ignored + - assume 86400000 ms / day + - numbers range fom +/- 9,007,199,254,740,991 + - ms precision for any instant that is within + approximately +/-285,616 years from 1 jan 1970 + UTC + - range of times supported is -100,000,000 days + to 100,000,000 days from 1 jan 1970 12:00 am + - time supported is 8.64e5*10e8 milliseconds from + 1 jan 1970 UTC (+/-273972.6027397 years) + + - this test generates its own data -- it does not + read data from a file. + Author: christine@netscape.com + Date: 7 july 1997 + + Static variables: + FOUR_HUNDRED_YEARS + +*/ + +function test() { + writeHeaderToLog("15.8.1.1 Time Range"); + + for ( M_SECS = 0, CURRENT_YEAR = 1970; + M_SECS < 8640000000000000; + tc++, M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) { + + testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS)).getUTCFullYear() ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + if ( ! testcases[tc].passed ) { + testcases[tc].reason = "wrong year value"; + } + } + + stopTest(); + + return ( testcases ); +} + +// every one hundred years contains: +// 24 years with 366 days +// +// every four hundred years contains: +// 97 years with 366 days +// 303 years with 365 days +// +// 86400000*365*97 = 3067372800000 +// +86400000*366*303 = + 9555408000000 +// = 1.26227808e+13 + var FOUR_HUNDRED_YEARS = 1.26227808e+13; + var SECTION = "15.9.1.1-1"; + var tc = 0; + var testcases = new Array(); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js new file mode 100644 index 0000000..c66ce38 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js @@ -0,0 +1,82 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.1.1-2.js + ECMA Section: 15.9.1.1 Time Range + Description: + - leap seconds are ignored + - assume 86400000 ms / day + - numbers range fom +/- 9,007,199,254,740,991 + - ms precision for any instant that is within + approximately +/-285,616 years from 1 jan 1970 + UTC + - range of times supported is -100,000,000 days + to 100,000,000 days from 1 jan 1970 12:00 am + - time supported is 8.64e5*10e8 milliseconds from + 1 jan 1970 UTC (+/-273972.6027397 years) + Author: christine@netscape.com + Date: 9 july 1997 +*/ + +function test() { + + writeHeaderToLog("15.8.1.1 Time Range"); + + for ( M_SECS = 0, CURRENT_YEAR = 1970; + M_SECS > -8640000000000000; + tc++, M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) { + + testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS )).getUTCFullYear() ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description + " = " + + testcases[tc].actual ); + + if ( ! testcases[tc].passed ) { + testcases[tc].reason = "wrong year value"; + } + } + + stopTest(); + + return ( testcases ); +} + // every one hundred years contains: + // 24 years with 366 days + // + // every four hundred years contains: + // 97 years with 366 days + // 303 years with 365 days + // + // 86400000*366*97 = 3067372800000 + // +86400000*365*303 = + 9555408000000 + // = 1.26227808e+13 + + var FOUR_HUNDRED_YEARS = 1.26227808e+13; + var SECTION = "15.9.1.1-2"; + var tc = 0; + var testcases = new Array(); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js new file mode 100644 index 0000000..3545806 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js @@ -0,0 +1,108 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.1.js + ECMA Section: 15.9.2.1 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds, ms ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.2.1"; + var TITLE = "Date Constructor used as a function"; + var TYPEOF = "string"; + var TOLERANCE = 1000; + + writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " + + "Date( year, month, date, hours, minutes, seconds, ms )" ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var TODAY = new Date(); + + // Dates around 1970 + + array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59,999)", (new Date()).toString(), Date(1969,11,31,15,59,59,999)) + array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0,0)) + array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,0,1)) + + // Dates around 2000 + array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59,999)", (new Date()).toString(), Date(1999,11,15,59,59,999)); + array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0,0)); + array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59,999)", (new Date()).toString(), Date(1999,11,31,23,59,59,999) ); + array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,0,1) ); + + // Dates around 1900 + + array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59,999)", (new Date()).toString(), Date(1899,11,31,23,59,59,999)); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0,0)); + + // Dates around feb 29, 2000 + + array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0,0)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59,999)", (new Date()).toString(), Date( 2000,1,28,23,59,59,999)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0,0)); + + // Dates around jan 1, 2005 + array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59,999)", (new Date()).toString(), Date(2004,11,31,23,59,59,999)); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0,0)); + + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59,999)", (new Date()).toString(), Date(2031,11,31,23,59,59,999)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0,0)); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js new file mode 100644 index 0000000..8ad5694 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.2.js + ECMA Section: 15.9.2.2 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + var VERSION = 9706; + startTest(); + var SECTION = "15.9.2.2"; + var TOLERANCE = 100; + var TITLE = "The Date Constructor Called as a Function"; + + writeHeaderToLog(SECTION+" "+TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Dates around 1970 + + array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59)", (new Date()).toString(), Date(1969,11,31,15,59,59)) + array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0)) + array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,1)) +/* + // Dates around 2000 + array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59)); + array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0)); + array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) ); + array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) ); + + // Dates around 1900 + + array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0)); + + // Dates around feb 29, 2000 + + array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0)); + + // Dates around jan 1, 2005 + array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0)); + + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js new file mode 100644 index 0000000..5baaf53 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.2.js + ECMA Section: 15.9.2.2 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + var VERSION = 9706; + startTest(); + var SECTION = "15.9.2.2"; + var TOLERANCE = 100; + var TITLE = "The Date Constructor Called as a Function"; + + writeHeaderToLog(SECTION+" "+TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Dates around 2000 + array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59)); + array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0)); + array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) ); + array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) ); + +/* + // Dates around 1900 + + array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0)); + + // Dates around feb 29, 2000 + + array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0)); + + // Dates around jan 1, 2005 + array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0)); + + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js new file mode 100644 index 0000000..59255e2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js @@ -0,0 +1,92 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.2.js + ECMA Section: 15.9.2.2 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + var VERSION = 9706; + startTest(); + var SECTION = "15.9.2.2"; + var TOLERANCE = 100; + var TITLE = "The Date Constructor Called as a Function"; + + writeHeaderToLog(SECTION+" "+TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Dates around 1900 + + array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0)); + +/* + // Dates around feb 29, 2000 + + array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0)); + + // Dates around jan 1, 2005 + array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0)); + + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js new file mode 100644 index 0000000..b63bb3e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.2.js + ECMA Section: 15.9.2.2 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + var VERSION = 9706; + startTest(); + var SECTION = "15.9.2.2"; + var TOLERANCE = 100; + var TITLE = "The Date Constructor Called as a Function"; + + writeHeaderToLog(SECTION+" "+TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Dates around feb 29, 2000 + + array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59)); + array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0)); + +/* + // Dates around jan 1, 2005 + array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0)); + + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js new file mode 100644 index 0000000..5422682 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.2.js + ECMA Section: 15.9.2.2 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + var VERSION = 9706; + startTest(); + var SECTION = "15.9.2.2"; + var TOLERANCE = 100; + var TITLE = "The Date Constructor Called as a Function"; + + writeHeaderToLog(SECTION+" "+TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Dates around jan 1, 2005 + array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0)); +/* + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js new file mode 100644 index 0000000..8e269d0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.2.2.js + ECMA Section: 15.9.2.2 Date constructor used as a function + Date( year, month, date, hours, minutes, seconds ) + Description: The arguments are accepted, but are completely ignored. + A string is created and returned as if by the + expression (new Date()).toString(). + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + var VERSION = 9706; + startTest(); + var SECTION = "15.9.2.2"; + var TOLERANCE = 100; + var TITLE = "The Date Constructor Called as a Function"; + + writeHeaderToLog(SECTION+" "+TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Dates around jan 1, 2032 + array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); + array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); + array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js new file mode 100644 index 0000000..3090055 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js @@ -0,0 +1,274 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.9.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + getTestCases(); + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = TZ_PST * msPerHour; + + // Dates around 1970 + + addNewTestCase( new Date( 1969,11,31,15,59,59,999), + "new Date( 1969,11,31,15,59,59,999)", + [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] ); + + addNewTestCase( new Date( 1969,11,31,23,59,59,999), + "new Date( 1969,11,31,23,59,59,999)", + [TIME_1970-TZ_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] ); + + addNewTestCase( new Date( 1970,0,1,0,0,0,0), + "new Date( 1970,0,1,0,0,0,0)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date( 1969,11,31,16,0,0,0), + "new Date( 1969,11,31,16,0,0,0)", + [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date(1969,12,1,0,0,0,0), + "new Date(1969,12,1,0,0,0,0)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date(1969,11,32,0,0,0,0), + "new Date(1969,11,32,0,0,0,0)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date(1969,11,31,24,0,0,0), + "new Date(1969,11,31,24,0,0,0)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date(1969,11,31,23,60,0,0), + "new Date(1969,11,31,23,60,0,0)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date(1969,11,31,23,59,60,0), + "new Date(1969,11,31,23,59,60,0)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date(1969,11,31,23,59,59,1000), + "new Date(1969,11,31,23,59,59,1000)", + [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + // Dates around 2000 + + addNewTestCase( new Date( 1999,11,31,15,59,59,999), + "new Date( 1999,11,31,15,59,59,999)", + [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); + + addNewTestCase( new Date( 1999,11,31,16,0,0,0), + "new Date( 1999,11,31,16,0,0,0)", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); + + addNewTestCase( new Date( 1999,11,31,23,59,59,999), + "new Date( 1999,11,31,23,59,59,999)", + [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); + + addNewTestCase( new Date( 2000,0,1,0,0,0,0), + "new Date( 2000,0,1,0,0,0,0)", + [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date( 2000,0,1,0,0,0,1), + "new Date( 2000,0,1,0,0,0,1)", + [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] ); + + // Dates around 29 Feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay ); + + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,28,24,0,0,0), + "new Date(2000,1,28,24,0,0,0)", + [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0,0), + "new Date(1899,11,31,16,0,0,0)", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59,999), + "new Date(1899,11,31,15,59,59,999)", + [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); + + addNewTestCase( new Date(1899,11,31,23,59,59,999), + "new Date(1899,11,31,23,59,59,999)", + [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,0), + "new Date(1900,0,1,0,0,0,0)", + [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,1), + "new Date(1900,0,1,0,0,0,1)", + [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); + + // Dates around 2005 + + var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); + +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings test case + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js new file mode 100644 index 0000000..13d0ab6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js @@ -0,0 +1,231 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.9.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + getTestCases(); + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = TZ_PST * msPerHour; + + // Dates around 2000 + + addNewTestCase( new Date( 1999,11,31,15,59,59,999), + "new Date( 1999,11,31,15,59,59,999)", + [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); + + addNewTestCase( new Date( 1999,11,31,16,0,0,0), + "new Date( 1999,11,31,16,0,0,0)", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); + + addNewTestCase( new Date( 1999,11,31,23,59,59,999), + "new Date( 1999,11,31,23,59,59,999)", + [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); + + addNewTestCase( new Date( 2000,0,1,0,0,0,0), + "new Date( 2000,0,1,0,0,0,0)", + [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date( 2000,0,1,0,0,0,1), + "new Date( 2000,0,1,0,0,0,1)", + [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] ); +/* + // Dates around 29 Feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay ); + + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,28,24,0,0,0), + "new Date(2000,1,28,24,0,0,0)", + [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0,0), + "new Date(1899,11,31,16,0,0,0)", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59,999), + "new Date(1899,11,31,15,59,59,999)", + [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); + + addNewTestCase( new Date(1899,11,31,23,59,59,999), + "new Date(1899,11,31,23,59,59,999)", + [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,0), + "new Date(1900,0,1,0,0,0,0)", + [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,1), + "new Date(1900,0,1,0,0,0,1)", + [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); + + // Dates around 2005 + + var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings test case + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js new file mode 100644 index 0000000..ced3027 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js @@ -0,0 +1,209 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.9.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + getTestCases(); + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = TZ_PST * msPerHour; + + // Dates around 29 Feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay ); + + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,28,24,0,0,0), + "new Date(2000,1,28,24,0,0,0)", + [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); +/* + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0,0), + "new Date(1899,11,31,16,0,0,0)", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59,999), + "new Date(1899,11,31,15,59,59,999)", + [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); + + addNewTestCase( new Date(1899,11,31,23,59,59,999), + "new Date(1899,11,31,23,59,59,999)", + [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,0), + "new Date(1900,0,1,0,0,0,0)", + [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,1), + "new Date(1900,0,1,0,0,0,1)", + [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); + + // Dates around 2005 + + var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings test case + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js new file mode 100644 index 0000000..0f18b12 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js @@ -0,0 +1,193 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.9.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + getTestCases(); + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = TZ_PST * msPerHour; + + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0,0), + "new Date(1899,11,31,16,0,0,0)", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59,999), + "new Date(1899,11,31,15,59,59,999)", + [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); + + addNewTestCase( new Date(1899,11,31,23,59,59,999), + "new Date(1899,11,31,23,59,59,999)", + [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,0), + "new Date(1900,0,1,0,0,0,0)", + [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0,1), + "new Date(1900,0,1,0,0,0,1)", + [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); +/* + // Dates around 2005 + + var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings test case + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js new file mode 100644 index 0000000..0b7d436 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js @@ -0,0 +1,170 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.9.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + getTestCases(); + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = TZ_PST * msPerHour; + + // Dates around 2005 + + var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings test case + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js new file mode 100644 index 0000000..718d314 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js @@ -0,0 +1,241 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + +// for TCMS, the testcases array must be global. + var SECTION = "15.9.3.1"; + var TITLE = "Date( year, month, date, hours, minutes, seconds )"; + + writeHeaderToLog( SECTION+" " +TITLE ); + + var testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns an array of TestCase object + test(); + +function getTestCases( ) { + + // Dates around 1970 + + addNewTestCase( new Date( 1969,11,31,15,59,59), + "new Date( 1969,11,31,15,59,59)", + [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] ); + + addNewTestCase( new Date( 1969,11,31,16,0,0), + "new Date( 1969,11,31,16,0,0)", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date( 1969,11,31,23,59,59), + "new Date( 1969,11,31,23,59,59)", + [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] ); + + addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0), + "new Date( 1970, 0, 1, 0, 0, 0)", + [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date( 1969,11,31,16,0,0), + "new Date( 1969,11,31,16,0,0)", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); +/* + // Dates around 2000 + + addNewTestCase( new Date( 1999,11,31,15,59,59), + "new Date( 1999,11,31,15,59,59)", + [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] ); + + addNewTestCase( new Date( 1999,11,31,16,0,0), + "new Date( 1999,11,31,16,0,0)", + [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); + + addNewTestCase( new Date( 2000,0,1,0,0,0), + "new Date( 2000,0,1,0,0,0)", + [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0), + "new Date(1899,11,31,16,0,0)", + [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59), + "new Date(1899,11,31,15,59,59)", + [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0), + "new Date(1900,0,1,0,0,0)", + [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,1), + "new Date(1900,0,1,0,0,1)", + [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] ); + + var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; + + // Dates around Feb 29, 2000 + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,24,0,0,0), + "new Date(2000,1,29,24,0,0,0)", + [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] ); + + // Dates around Jan 1, 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004); + var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings Time + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); + +} + +function test() { + for( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js new file mode 100644 index 0000000..b110f52 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js @@ -0,0 +1,219 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + +// for TCMS, the testcases array must be global. + var SECTION = "15.9.3.1"; + var TITLE = "Date( year, month, date, hours, minutes, seconds )"; + + writeHeaderToLog( SECTION+" " +TITLE ); + + var testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns an array of TestCase object + test(); + +function getTestCases( ) { + + // Dates around 2000 + + addNewTestCase( new Date( 1999,11,31,15,59,59), + "new Date( 1999,11,31,15,59,59)", + [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] ); + + addNewTestCase( new Date( 1999,11,31,16,0,0), + "new Date( 1999,11,31,16,0,0)", + [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); + + addNewTestCase( new Date( 2000,0,1,0,0,0), + "new Date( 2000,0,1,0,0,0)", + [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); +/* + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0), + "new Date(1899,11,31,16,0,0)", + [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59), + "new Date(1899,11,31,15,59,59)", + [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0), + "new Date(1900,0,1,0,0,0)", + [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,1), + "new Date(1900,0,1,0,0,1)", + [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] ); + + var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; + + // Dates around Feb 29, 2000 + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,24,0,0,0), + "new Date(2000,1,29,24,0,0,0)", + [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] ); + + // Dates around Jan 1, 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004); + var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings Time + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); + +} + +function test() { + for( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js new file mode 100644 index 0000000..9e57730 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js @@ -0,0 +1,205 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + +// for TCMS, the testcases array must be global. + var SECTION = "15.9.3.1"; + var TITLE = "Date( year, month, date, hours, minutes, seconds )"; + + writeHeaderToLog( SECTION+" " +TITLE ); + + var testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns an array of TestCase object + test(); + +function getTestCases( ) { + + // Dates around 1900 + + addNewTestCase( new Date(1899,11,31,16,0,0), + "new Date(1899,11,31,16,0,0)", + [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(1899,11,31,15,59,59), + "new Date(1899,11,31,15,59,59)", + [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,0), + "new Date(1900,0,1,0,0,0)", + [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date(1900,0,1,0,0,1), + "new Date(1900,0,1,0,0,1)", + [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] ); +/* + var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; + + // Dates around Feb 29, 2000 + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,24,0,0,0), + "new Date(2000,1,29,24,0,0,0)", + [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] ); + + // Dates around Jan 1, 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004); + var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings Time + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); + +} + +function test() { + for( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js new file mode 100644 index 0000000..6b6b0c4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js @@ -0,0 +1,188 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + +// for TCMS, the testcases array must be global. + var SECTION = "15.9.3.1"; + var TITLE = "Date( year, month, date, hours, minutes, seconds )"; + + writeHeaderToLog( SECTION+" " +TITLE ); + + var testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns an array of TestCase object + test(); + +function getTestCases( ) { + + + var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; + + // Dates around Feb 29, 2000 + addNewTestCase( new Date(2000,1,28,16,0,0,0), + "new Date(2000,1,28,16,0,0,0)", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,0,0,0,0), + "new Date(2000,1,29,0,0,0,0)", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date(2000,1,29,24,0,0,0), + "new Date(2000,1,29,24,0,0,0)", + [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] ); +/* + // Dates around Jan 1, 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004); + var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings Time + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); + +} + +function test() { + for( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js new file mode 100644 index 0000000..798320b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js @@ -0,0 +1,170 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.1.js + ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial value of Date.prototype. + + The [[Class]] property of the newly constructed object + is set as follows: + 1. Call ToNumber(year) + 2. Call ToNumber(month) + 3. Call ToNumber(date) + 4. Call ToNumber(hours) + 5. Call ToNumber(minutes) + 6. Call ToNumber(seconds) + 7. Call ToNumber(ms) + 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= + 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, + Result(8) is Result(1) + 9. Compute MakeDay(Result(8), Result(2), Result(3) + 10. Compute MakeTime(Result(4), Result(5), Result(6), + Result(7) + 11. Compute MakeDate(Result(9), Result(10)) + 12. Set the [[Value]] property of the newly constructed + object to TimeClip(UTC(Result(11))). + + + This tests the returned value of a newly constructed + Date object. + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + +// for TCMS, the testcases array must be global. + var SECTION = "15.9.3.1"; + var TITLE = "Date( year, month, date, hours, minutes, seconds )"; + + writeHeaderToLog( SECTION+" " +TITLE ); + + var testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns an array of TestCase object + test(); + +function getTestCases( ) { + + // Dates around Jan 1, 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004); + var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; + + addNewTestCase( new Date(2005,0,1,0,0,0,0), + "new Date(2005,0,1,0,0,0,0)", + [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(2004,11,31,16,0,0,0), + "new Date(2004,11,31,16,0,0,0)", + [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + // Daylight Savings Time + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(1998,3,5,1,59,59,999), + "new Date(1998,3,5,1,59,59,999)", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(1998,3,5,2,0,0,0), + "new Date(1998,3,5,2,0,0,0)", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(1998,9,25,1,59,59,999), + "new Date(1998,9,25,1,59,59,999)", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(1998,9,25,2,0,0,0), + "new Date(1998,9,25,2,0,0,0)", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); + +} + +function test() { + for( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + return testcases; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js new file mode 100644 index 0000000..644f37c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js @@ -0,0 +1,300 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.8.js + ECMA Section: 15.9.3.8 The Date Constructor + new Date( value ) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial valiue of Date.prototype. + + The [[Class]] property of the newly constructed object is + set to "Date". + + The [[Value]] property of the newly constructed object is + set as follows: + + 1. Call ToPrimitive(value) + 2. If Type( Result(1) ) is String, then go to step 5. + 3. Let V be ToNumber( Result(1) ). + 4. Set the [[Value]] property of the newly constructed + object to TimeClip(V) and return. + 5. Parse Result(1) as a date, in exactly the same manner + as for the parse method. Let V be the time value for + this date. + 6. Go to step 4. + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.3.8"; + var TYPEOF = "object"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + +// for TCMS, the testcases array must be global. + var tc= 0; + var TITLE = "Date constructor: new Date( value )"; + var SECTION = "15.9.3.8"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION +" " + TITLE ); + + testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns a boolean value + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = -TZ_PST * msPerHour; + + + // Dates around 1970 + addNewTestCase( new Date(0), + "new Date(0)", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date(1), + "new Date(1)", + [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] ); + + addNewTestCase( new Date(true), + "new Date(true)", + [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] ); + + addNewTestCase( new Date(false), + "new Date(false)", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(0)).toString() ), + "new Date(\""+ (new Date(0)).toString()+"\" )", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); +/* +// addNewTestCase( "new Date(\""+ (new Date(0)).toLocaleString()+"\")", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date((new Date(0)).toUTCString()), + "new Date(\""+ (new Date(0)).toUTCString()+"\" )", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date((new Date(1)).toString()), + "new Date(\""+ (new Date(1)).toString()+"\" )", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date( TZ_ADJUST ), + "new Date(" + TZ_ADJUST+")", + [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()), + "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")", + [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + +// addNewTestCase( "new Date(\""+ (new Date(TZ_ADJUST)).toLocaleString()+"\")",[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ), + "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")", + [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + // Dates around 2000 + + addNewTestCase( new Date(TIME_2000+TZ_ADJUST), + "new Date(" +(TIME_2000+TZ_ADJUST)+")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(TIME_2000), + "new Date(" +TIME_2000+")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()), + "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date((new Date(TIME_2000)).toString()), + "new Date(\"" +(new Date(TIME_2000)).toString()+"\")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + +// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); +// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()), + "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()), + "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + // Dates around Feb 29, 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST; + + addNewTestCase( new Date(UTC_FEB_29_2000), + "new Date("+UTC_FEB_29_2000+")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(PST_FEB_29_2000), + "new Date("+PST_FEB_29_2000+")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + +// Parsing toLocaleString() is not guaranteed by ECMA. +// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + // Dates around 1900 + + var PST_1900 = TIME_1900 + 8*msPerHour; + + addNewTestCase( new Date( TIME_1900 ), + "new Date("+TIME_1900+")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(PST_1900), + "new Date("+PST_1900+")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), + "new Date(\""+(new Date(TIME_1900)).toString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toString() ), + "new Date(\""+(new Date(PST_1900 )).toString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), + "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), + "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + +// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(DST_START_1998-1), + "new Date("+(DST_START_1998-1)+")", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(DST_START_1998), + "new Date("+DST_START_1998+")", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(DST_END_1998-1), + "new Date("+(DST_END_1998-1)+")", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(DST_END_1998), + "new Date("+DST_END_1998+")", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray, 'msMode'); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js new file mode 100644 index 0000000..4cfcb04 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js @@ -0,0 +1,275 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.8.js + ECMA Section: 15.9.3.8 The Date Constructor + new Date( value ) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial valiue of Date.prototype. + + The [[Class]] property of the newly constructed object is + set to "Date". + + The [[Value]] property of the newly constructed object is + set as follows: + + 1. Call ToPrimitive(value) + 2. If Type( Result(1) ) is String, then go to step 5. + 3. Let V be ToNumber( Result(1) ). + 4. Set the [[Value]] property of the newly constructed + object to TimeClip(V) and return. + 5. Parse Result(1) as a date, in exactly the same manner + as for the parse method. Let V be the time value for + this date. + 6. Go to step 4. + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.3.8"; + var TYPEOF = "object"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + +// for TCMS, the testcases array must be global. + var tc= 0; + var TITLE = "Date constructor: new Date( value )"; + var SECTION = "15.9.3.8"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION +" " + TITLE ); + + testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns a boolean value + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = -TZ_PST * msPerHour; + + addNewTestCase( new Date((new Date(0)).toUTCString()), + "new Date(\""+ (new Date(0)).toUTCString()+"\" )", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date((new Date(1)).toString()), + "new Date(\""+ (new Date(1)).toString()+"\" )", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date( TZ_ADJUST ), + "new Date(" + TZ_ADJUST+")", + [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()), + "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")", + [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + + addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ), + "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")", + [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); +/* + // Dates around 2000 + + addNewTestCase( new Date(TIME_2000+TZ_ADJUST), + "new Date(" +(TIME_2000+TZ_ADJUST)+")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(TIME_2000), + "new Date(" +TIME_2000+")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()), + "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date((new Date(TIME_2000)).toString()), + "new Date(\"" +(new Date(TIME_2000)).toString()+"\")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + +// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); +// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()), + "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()), + "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + // Dates around Feb 29, 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST; + + addNewTestCase( new Date(UTC_FEB_29_2000), + "new Date("+UTC_FEB_29_2000+")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(PST_FEB_29_2000), + "new Date("+PST_FEB_29_2000+")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + +// Parsing toLocaleString() is not guaranteed by ECMA. +// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + // Dates around 1900 + + var PST_1900 = TIME_1900 + 8*msPerHour; + + addNewTestCase( new Date( TIME_1900 ), + "new Date("+TIME_1900+")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(PST_1900), + "new Date("+PST_1900+")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), + "new Date(\""+(new Date(TIME_1900)).toString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toString() ), + "new Date(\""+(new Date(PST_1900 )).toString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), + "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), + "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + +// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(DST_START_1998-1), + "new Date("+(DST_START_1998-1)+")", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(DST_START_1998), + "new Date("+DST_START_1998+")", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(DST_END_1998-1), + "new Date("+(DST_END_1998-1)+")", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(DST_END_1998), + "new Date("+DST_END_1998+")", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray, 'msMode'); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js new file mode 100644 index 0000000..aaf430d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js @@ -0,0 +1,253 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.8.js + ECMA Section: 15.9.3.8 The Date Constructor + new Date( value ) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial valiue of Date.prototype. + + The [[Class]] property of the newly constructed object is + set to "Date". + + The [[Value]] property of the newly constructed object is + set as follows: + + 1. Call ToPrimitive(value) + 2. If Type( Result(1) ) is String, then go to step 5. + 3. Let V be ToNumber( Result(1) ). + 4. Set the [[Value]] property of the newly constructed + object to TimeClip(V) and return. + 5. Parse Result(1) as a date, in exactly the same manner + as for the parse method. Let V be the time value for + this date. + 6. Go to step 4. + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.3.8"; + var TYPEOF = "object"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + +// for TCMS, the testcases array must be global. + var tc= 0; + var TITLE = "Date constructor: new Date( value )"; + var SECTION = "15.9.3.8"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION +" " + TITLE ); + + testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns a boolean value + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = -TZ_PST * msPerHour; + + + // Dates around 2000 + + addNewTestCase( new Date(TIME_2000+TZ_ADJUST), + "new Date(" +(TIME_2000+TZ_ADJUST)+")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date(TIME_2000), + "new Date(" +TIME_2000+")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()), + "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date((new Date(TIME_2000)).toString()), + "new Date(\"" +(new Date(TIME_2000)).toString()+"\")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + + + addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()), + "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")", + [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()), + "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")", + [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); +/* + // Dates around Feb 29, 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST; + + addNewTestCase( new Date(UTC_FEB_29_2000), + "new Date("+UTC_FEB_29_2000+")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(PST_FEB_29_2000), + "new Date("+PST_FEB_29_2000+")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + +// Parsing toLocaleString() is not guaranteed by ECMA. +// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + // Dates around 1900 + + var PST_1900 = TIME_1900 + 8*msPerHour; + + addNewTestCase( new Date( TIME_1900 ), + "new Date("+TIME_1900+")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(PST_1900), + "new Date("+PST_1900+")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), + "new Date(\""+(new Date(TIME_1900)).toString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toString() ), + "new Date(\""+(new Date(PST_1900 )).toString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), + "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), + "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + +// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(DST_START_1998-1), + "new Date("+(DST_START_1998-1)+")", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(DST_START_1998), + "new Date("+DST_START_1998+")", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(DST_END_1998-1), + "new Date("+(DST_END_1998-1)+")", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(DST_END_1998), + "new Date("+DST_END_1998+")", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray, 'msMode'); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js new file mode 100644 index 0000000..c25bda8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js @@ -0,0 +1,222 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.8.js + ECMA Section: 15.9.3.8 The Date Constructor + new Date( value ) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial valiue of Date.prototype. + + The [[Class]] property of the newly constructed object is + set to "Date". + + The [[Value]] property of the newly constructed object is + set as follows: + + 1. Call ToPrimitive(value) + 2. If Type( Result(1) ) is String, then go to step 5. + 3. Let V be ToNumber( Result(1) ). + 4. Set the [[Value]] property of the newly constructed + object to TimeClip(V) and return. + 5. Parse Result(1) as a date, in exactly the same manner + as for the parse method. Let V be the time value for + this date. + 6. Go to step 4. + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.3.8"; + var TYPEOF = "object"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + +// for TCMS, the testcases array must be global. + var tc= 0; + var TITLE = "Date constructor: new Date( value )"; + var SECTION = "15.9.3.8"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION +" " + TITLE ); + + testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns a boolean value + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = -TZ_PST * msPerHour; + + // Dates around Feb 29, 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST; + + addNewTestCase( new Date(UTC_FEB_29_2000), + "new Date("+UTC_FEB_29_2000+")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date(PST_FEB_29_2000), + "new Date("+PST_FEB_29_2000+")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); + + + addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")", + [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ), + "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")", + [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); +/* + // Dates around 1900 + + var PST_1900 = TIME_1900 + 8*msPerHour; + + addNewTestCase( new Date( TIME_1900 ), + "new Date("+TIME_1900+")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(PST_1900), + "new Date("+PST_1900+")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), + "new Date(\""+(new Date(TIME_1900)).toString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toString() ), + "new Date(\""+(new Date(PST_1900 )).toString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), + "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), + "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + +// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); +// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); +*/ +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(DST_START_1998-1), + "new Date("+(DST_START_1998-1)+")", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(DST_START_1998), + "new Date("+DST_START_1998+")", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(DST_END_1998-1), + "new Date("+(DST_END_1998-1)+")", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(DST_END_1998), + "new Date("+DST_END_1998+")", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray, 'msMode'); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js new file mode 100644 index 0000000..00b3b47 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js @@ -0,0 +1,190 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.3.8.js + ECMA Section: 15.9.3.8 The Date Constructor + new Date( value ) + Description: The [[Prototype]] property of the newly constructed + object is set to the original Date prototype object, + the one that is the initial valiue of Date.prototype. + + The [[Class]] property of the newly constructed object is + set to "Date". + + The [[Value]] property of the newly constructed object is + set as follows: + + 1. Call ToPrimitive(value) + 2. If Type( Result(1) ) is String, then go to step 5. + 3. Let V be ToNumber( Result(1) ). + 4. Set the [[Value]] property of the newly constructed + object to TimeClip(V) and return. + 5. Parse Result(1) as a date, in exactly the same manner + as for the parse method. Let V be the time value for + this date. + 6. Go to step 4. + + Author: christine@netscape.com + Date: 28 october 1997 + Version: 9706 + +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.3.8"; + var TYPEOF = "object"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + + +// for TCMS, the testcases array must be global. + var tc= 0; + var TITLE = "Date constructor: new Date( value )"; + var SECTION = "15.9.3.8"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION +" " + TITLE ); + + testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns a boolean value + test(); + +function getTestCases( ) { + // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - + var TZ_ADJUST = -TZ_PST * msPerHour; + + + // Dates around 1900 + + var PST_1900 = TIME_1900 + 8*msPerHour; + + addNewTestCase( new Date( TIME_1900 ), + "new Date("+TIME_1900+")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(PST_1900), + "new Date("+PST_1900+")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), + "new Date(\""+(new Date(TIME_1900)).toString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toString() ), + "new Date(\""+(new Date(PST_1900 )).toString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + + addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), + "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", + [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), + "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", + [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + +/* + This test case is incorrect. Need to fix the DaylightSavings functions in + shell.js for this to work properly. + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + addNewTestCase( new Date(DST_START_1998-1), + "new Date("+(DST_START_1998-1)+")", + [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] ); + + addNewTestCase( new Date(DST_START_1998), + "new Date("+DST_START_1998+")", + [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]); + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addNewTestCase ( new Date(DST_END_1998-1), + "new Date("+(DST_END_1998-1)+")", + [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] ); + + addNewTestCase ( new Date(DST_END_1998), + "new Date("+DST_END_1998+")", + [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] ); +*/ +} + +function addNewTestCase( DateCase, DateString, ResultArray ) { + //adjust hard-coded ResultArray for tester's timezone instead of PST + adjustResultArray(ResultArray, 'msMode'); + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +} + +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js new file mode 100644 index 0000000..2fa4cbf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js @@ -0,0 +1,63 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: + * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088 + * Description: Date parsing gets 12:30 AM wrong. + * New behavior: + * js> d = new Date('1/1/1999 13:30 AM') + * Invalid Date + * js> d = new Date('1/1/1999 13:30 PM') + * Invalid Date + * js> d = new Date('1/1/1999 12:30 AM') + * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999 + * js> d = new Date('1/1/1999 12:30 PM') + * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999 + * Author: christine@netscape.com + */ + + var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section) + var VERSION = "ECMA"; // Version of JavaScript or ECMA + var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description + var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + AddTestCase( "new Date('1/1/1999 12:30 AM').toString()", + new Date(1999,0,1,0,30).toString(), + new Date('1/1/1999 12:30 AM').toString() ); + + AddTestCase( "new Date('1/1/1999 12:30 PM').toString()", + new Date( 1999,0,1,12,30 ).toString(), + new Date('1/1/1999 12:30 PM').toString() ); + + AddTestCase( "new Date('1/1/1999 13:30 AM')", + "Invalid Date", + new Date('1/1/1999 13:30 AM').toString() ); + + + AddTestCase( "new Date('1/1/1999 13:30 PM')", + "Invalid Date", + new Date('1/1/1999 13:30 PM').toString() ); + + test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js new file mode 100644 index 0000000..5fd15ba --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js @@ -0,0 +1,213 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.4.2.js + ECMA Section: 15.9.4.2 Date.parse() + Description: The parse() function applies the to ToString() operator + to its argument and interprets the resulting string as + a date. It returns a number, the UTC time value + corresponding to the date. + + The string may be interpreted as a local time, a UTC + time, or a time in some other time zone, depending on + the contents of the string. + + (need to test strings containing stuff with the time + zone specified, and verify that parse() returns the + correct GMT time) + + so for any Date object x, all of these things should + be equal: + + value tested in function: + x.valueOf() test_value() + Date.parse(x.toString()) test_tostring() + Date.parse(x.toGMTString()) test_togmt() + + Date.parse(x.toLocaleString()) is not required to + produce the same number value as the preceeding three + expressions. in general the value produced by + Date.parse is implementation dependent when given any + string value that could not be produced in that + implementation by the toString or toGMTString method. + + value tested in function: + Date.parse( x.toLocaleString()) test_tolocale() + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.9.4.2"; + var TITLE = "Date.parse()"; + + var TIME = 0; + var UTC_YEAR = 1; + var UTC_MONTH = 2; + var UTC_DATE = 3; + var UTC_DAY = 4; + var UTC_HOURS = 5; + var UTC_MINUTES = 6; + var UTC_SECONDS = 7; + var UTC_MS = 8; + + var YEAR = 9; + var MONTH = 10; + var DATE = 11; + var DAY = 12; + var HOURS = 13; + var MINUTES = 14; + var SECONDS = 15; + var MS = 16; + var TYPEOF = "object"; + +// for TCMS, the testcases array must be global. + writeHeaderToLog("15.9.4.2 Date.parse()" ); + var tc= 0; + testcases = new Array(); + getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + + // Dates around 1970 + + addNewTestCase( new Date(0), + "new Date(0)", + [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); + + addNewTestCase( new Date(-1), + "new Date(-1)", + [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] ); + addNewTestCase( new Date(28799999), + "new Date(28799999)", + [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] ); + addNewTestCase( new Date(28800000), + "new Date(28800000)", + [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); + + // Dates around 2000 + + addNewTestCase( new Date(946684799999), + "new Date(946684799999)", + [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); + addNewTestCase( new Date(946713599999), + "new Date(946713599999)", + [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); + addNewTestCase( new Date(946684800000), + "new Date(946684800000)", + [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); + addNewTestCase( new Date(946713600000), + "new Date(946713600000)", + [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); + + // Dates around 1900 + + addNewTestCase( new Date(-2208988800000), + "new Date(-2208988800000)", + [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); + + addNewTestCase( new Date(-2208988800001), + "new Date(-2208988800001)", + [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); + + addNewTestCase( new Date(-2208960000001), + "new Date(-2208960000001)", + [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] ); + addNewTestCase( new Date(-2208960000000), + "new Date(-2208960000000)", + [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); + addNewTestCase( new Date(-2208959999999), + "new Date(-2208959999999)", + [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); + + // Dates around Feb 29, 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; + addNewTestCase( new Date(UTC_FEB_29_2000), + "new Date(" + UTC_FEB_29_2000 +")", + [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); + addNewTestCase( new Date(PST_FEB_29_2000), + "new Date(" + PST_FEB_29_2000 +")", + [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]); + + // Dates around Jan 1 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; + + addNewTestCase( new Date(UTC_JAN_1_2005), + "new Date("+ UTC_JAN_1_2005 +")", + [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); + addNewTestCase( new Date(PST_JAN_1_2005), + "new Date("+ PST_JAN_1_2005 +")", + [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); + +} +function addNewTestCase( DateCase, DateString, ResultArray ) { + DateCase = DateCase; + + item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); + testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) ); + testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) ); +/* + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() z inutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); +*/ +} +function test() { + for( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js new file mode 100644 index 0000000..e56f971 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js @@ -0,0 +1,209 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + + + var testcases = new Array(); + var SECTION = "15.9.4.3"; + var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )"; + + getTestCases(); + test(); + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} + +function utc( year, month, date, hours, minutes, seconds, ms ) { + d = new MyDate(); + d.year = Number(year); + + if (month) + d.month = Number(month); + if (date) + d.date = Number(date); + if (hours) + d.hours = Number(hours); + if (minutes) + d.minutes = Number(minutes); + if (seconds) + d.seconds = Number(seconds); + if (ms) + d.ms = Number(ms); + + if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) { + d.year = 1900 + ToInteger(d.year); + } + + if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) || + isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) { + d.year = Number.NaN; + d.month = Number.NaN; + d.date = Number.NaN; + d.hours = Number.NaN; + d.minutes = Number.NaN; + d.seconds = Number.NaN; + d.ms = Number.NaN; + d.value = Number.NaN; + d.time = Number.NaN; + d.day =Number.NaN; + return d; + } + + d.day = MakeDay( d.year, d.month, d.date ); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = (TimeClip( MakeDate(d.day,d.time))); + + return d; +} + +function UTCTime( t ) { + sign = ( t < 0 ) ? -1 : 1; + return ( (t +(TZ_DIFF*msPerHour)) ); +} + +function getTestCases() { + + // Dates around 1970 + + addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0), + "Date.UTC( 1970,0,1,0,0,0,0)", + utc(1970,0,1,0,0,0,0) ); + + addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999), + "Date.UTC( 1969,11,31,23,59,59,999)", + utc(1969,11,31,23,59,59,999) ); + addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999), + "Date.UTC( 1972,1,29,23,59,59,999)", + utc(1972,1,29,23,59,59,999) ); + addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999), + "Date.UTC( 1972,2,1,23,59,59,999)", + utc(1972,2,1,23,59,59,999) ); + addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999), + "Date.UTC( 1968,1,29,23,59,59,999)", + utc(1968,1,29,23,59,59,999) ); + addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999), + "Date.UTC( 1968,2,1,23,59,59,999)", + utc(1968,2,1,23,59,59,999) ); + addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0), + "Date.UTC( 1969,0,1,0,0,0,0)", + utc(1969,0,1,0,0,0,0) ); + addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000), + "Date.UTC( 1969,11,31,23,59,59,1000)", + utc(1970,0,1,0,0,0,0) ); + addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999), + "Date.UTC( 1969,Number.NaN,31,23,59,59,999)", + utc(1969,Number.NaN,31,23,59,59,999) ); + + // Dates around 2000 + + addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999), + "Date.UTC( 1999,11,31,23,59,59,999)", + utc(1999,11,31,23,59,59,999) ); + addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0), + "Date.UTC( 2000,0,1,0,0,0,0)", + utc(2000,0,1,0,0,0,0) ); + + // Dates around 1900 + addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999), + "Date.UTC( 1899,11,31,23,59,59,999)", + utc(1899,11,31,23,59,59,999) ); + addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0), + "Date.UTC( 1900,0,1,0,0,0,0)", + utc(1900,0,1,0,0,0,0) ); + addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0), + "Date.UTC( 1973,0,1,0,0,0,0)", + utc(1973,0,1,0,0,0,0) ); + addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111), + "Date.UTC( 1776,6,4,12,36,13,111)", + utc(1776,6,4,12,36,13,111) ); + addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123), + "Date.UTC( 2525,9,18,15,30,1,123)", + utc(2525,9,18,15,30,1,123) ); + + // Dates around 29 Feb 2000 + + addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ), + "Date.UTC( 2000,1,29,0,0,0,0 )", + utc(2000,1,29,0,0,0,0) ); + addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ), + "Date.UTC( 2000,1,29,8,0,0,0 )", + utc(2000,1,29,8,0,0,0) ); + + // Dates around 1 Jan 2005 + + addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ), + "Date.UTC( 2005,0,1,0,0,0,0 )", + utc(2005,0,1,0,0,0,0) ); + addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ), + "Date.UTC( 2004,11,31,16,0,0,0 )", + utc(2004,11,31,16,0,0,0) ); +} + +function addNewTestCase( DateCase, DateString, ExpectDate) { + DateCase = DateCase; + + item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase ); + testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase ); +/* + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ExpectDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ExpectDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ExpectDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ExpectDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ExpectDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ExpectDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ExpectDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ExpectDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ExpectDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ExpectDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ExpectDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ExpectDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ExpectDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ExpectDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ExpectDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ExpectDate.ms, DateCase.getMilliseconds() ); +*/ +} +function test() { + for( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = " + + testcases[tc].actual ); + } + + stopTest(); + return testcases; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js new file mode 100644 index 0000000..d605896 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js @@ -0,0 +1,59 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.1.js + ECMA Section: 15.9.5.1 Date.prototype.constructor + Description: + The initial value of Date.prototype.constructor is the built-in Date + constructor. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.constructor == Date", + true, + Date.prototype.constructor == Date ); + test(); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js new file mode 100644 index 0000000..f13e9d7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js @@ -0,0 +1,115 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + +/* + // We don't use |now| because it fails every night at midnight. + // The test is more reproducable if we use concrete times. + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); +*/ + addTestCase( UTC_JAN_1_2005 ); +/* + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js new file mode 100644 index 0000000..1d8060d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( DST_START_1998+1 ); +/* + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js new file mode 100644 index 0000000..752b114 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( DST_END_1998 ); +/* + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js new file mode 100644 index 0000000..587b023 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( DST_END_1998-1 ); +/* + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js new file mode 100644 index 0000000..bf9027a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( DST_END_1998+1 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js new file mode 100644 index 0000000..a775643 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js @@ -0,0 +1,110 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( TIME_YEAR_0 ); +/* + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js new file mode 100644 index 0000000..56fee4b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js @@ -0,0 +1,109 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( TIME_1970 ); +/* + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js new file mode 100644 index 0000000..1f22d11 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js @@ -0,0 +1,107 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( TIME_1900 ); +/* + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js new file mode 100644 index 0000000..4e7c80a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js @@ -0,0 +1,107 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( TIME_2000 ); +/* + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js new file mode 100644 index 0000000..6408622 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js @@ -0,0 +1,106 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( UTC_FEB_29_2000 ); +/* + addTestCase( UTC_JAN_1_2005 ); + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js new file mode 100644 index 0000000..d1741e3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( UTC_JAN_1_2005 ); +/* + addTestCase( DST_START_1998 ); + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js new file mode 100644 index 0000000..3ef0398 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js @@ -0,0 +1,104 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( DST_START_1998 ); +/* + addTestCase( DST_START_1998-1 ); + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js new file mode 100644 index 0000000..1d8325c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js @@ -0,0 +1,103 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.10.js + ECMA Section: 15.9.5.10 + Description: Date.prototype.getDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return DateFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + // some daylight savings time cases + + var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour ) + + var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour ); + + addTestCase( DST_START_1998-1 ); +/* + addTestCase( DST_START_1998+1 ); + addTestCase( DST_END_1998 ); + addTestCase( DST_END_1998-1 ); + addTestCase( DST_END_1998+1 ); +*/ + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDate()", + NaN, + (new Date(NaN)).getDate() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDate.length", + 0, + Date.prototype.getDate.length ); + test(); +function addTestCase( t ) { + for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDate()", + DateFromTime(LocalTime(t)), + (new Date(t)).getDate() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js new file mode 100644 index 0000000..9b425e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11.js + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + addTestCase( now ); + + test() + +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js new file mode 100644 index 0000000..ed946ea --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11 + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + + addTestCase( TIME_YEAR_0 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js new file mode 100644 index 0000000..f596a83 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11.js + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + addTestCase( TIME_1970 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js new file mode 100644 index 0000000..3b9d480 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11.js + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + addTestCase( TIME_1900 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7* msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js new file mode 100644 index 0000000..d76f392 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11.js + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + addTestCase( TIME_2000 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js new file mode 100644 index 0000000..7cb0509 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11.js + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay ); + + addTestCase( UTC_FEB_29_2000 ); + test(); +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js new file mode 100644 index 0000000..08eb7f6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.11.js + ECMA Section: 15.9.5.11 + Description: Date.prototype.getUTCDate + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 1.Return DateFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDate()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_JAN_1_2005 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 11; m++ ) { + t += TimeInMonth(m); + + for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) { + t += d; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDate()", + DateFromTime((t)), + (new Date(t)).getUTCDate() ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCDate()", + DateFromTime((t+1)), + (new Date(t+1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCDate()", + DateFromTime((t-1)), + (new Date(t-1)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getUTCDate() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()", + DateFromTime((t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getUTCDate() ); +*/ + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js new file mode 100644 index 0000000..8dcf1a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js @@ -0,0 +1,110 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + +/* + // We don't use |now| because it fails every night at midnight. + // The test is more reproducable if we use concrete times. + addTestCase( now ); + + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); +*/ + addTestCase( UTC_JAN_1_2005 ); +/* + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js new file mode 100644 index 0000000..dd58cb0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js @@ -0,0 +1,104 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_YEAR_0 ); +/* + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js new file mode 100644 index 0000000..6212458 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js @@ -0,0 +1,103 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_1970 ); +/* + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js new file mode 100644 index 0000000..e7bde15 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_1900 ); +/* + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js new file mode 100644 index 0000000..796187a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_2000 ); +/* + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js new file mode 100644 index 0000000..1aa0a1d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_FEB_29_2000 ); +/* + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js new file mode 100644 index 0000000..c638614 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12.js + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_JAN_1_2005 ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); +*/ + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js new file mode 100644 index 0000000..54260ca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.12 + ECMA Section: 15.9.5.12 + Description: Date.prototype.getDay + + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getDay()", + NaN, + (new Date(NaN)).getDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getDay.length", + 0, + Date.prototype.getDay.length ); + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getDay()", + WeekDay(LocalTime(t)), + (new Date(t)).getDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js new file mode 100644 index 0000000..06bd92e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + addTestCase( now ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js new file mode 100644 index 0000000..bec562c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13 + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + + addTestCase( TIME_YEAR_0 ); + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js new file mode 100644 index 0000000..6124d86 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + addTestCase( TIME_1970 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js new file mode 100644 index 0000000..37fd989 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + addTestCase( TIME_1900 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js new file mode 100644 index 0000000..2af2e9e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + addTestCase( TIME_2000 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js new file mode 100644 index 0000000..ce5e335 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + addTestCase( UTC_FEB_29_2000 ); + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js new file mode 100644 index 0000000..2870bc5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_JAN_1_2005 ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js new file mode 100644 index 0000000..703483e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.13.js + ECMA Section: 15.9.5.13 + Description: Date.prototype.getUTCDay + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return WeekDay(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCDay()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCDay()", + NaN, + (new Date(NaN)).getUTCDay() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCDay.length", + 0, + Date.prototype.getUTCDay.length ); + + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + t += TimeInMonth(m); + + for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) { + t += d; + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCDay()", + WeekDay((t)), + (new Date(t)).getUTCDay() ); + } + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js new file mode 100644 index 0000000..4d95ada --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.14.js + ECMA Section: 15.9.5.14 + Description: Date.prototype.getHours + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return HourFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.14"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getHours()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getHours()", + NaN, + (new Date(NaN)).getHours() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getHours.length", + 0, + Date.prototype.getHours.length ); + test(); +function addTestCase( t ) { + for ( h = 0; h < 24; h+=4 ) { + t += msPerHour; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getHours()", + HourFromTime((LocalTime(t))), + (new Date(t)).getHours() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js new file mode 100644 index 0000000..de4a132 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.15.js + ECMA Section: 15.9.5.15 + Description: Date.prototype.getUTCHours + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return HourFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.15"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCHours()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCHours()", + NaN, + (new Date(NaN)).getUTCHours() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCHours.length", + 0, + Date.prototype.getUTCHours.length ); + test(); +function addTestCase( t ) { + for ( h = 0; h < 24; h+=3 ) { + t += msPerHour; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCHours()", + HourFromTime((t)), + (new Date(t)).getUTCHours() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js new file mode 100644 index 0000000..2a02370 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.16.js + ECMA Section: 15.9.5.16 + Description: Date.prototype.getMinutes + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return MinFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.16"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getMinutes()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getMinutes()", + NaN, + (new Date(NaN)).getMinutes() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getMinutes.length", + 0, + Date.prototype.getMinutes.length ); + test(); +function addTestCase( t ) { + for ( m = 0; m <= 60; m+=10 ) { + t += msPerMinute; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getMinutes()", + MinFromTime((LocalTime(t))), + (new Date(t)).getMinutes() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js new file mode 100644 index 0000000..0afaa7b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.17.js + ECMA Section: 15.9.5.17 + Description: Date.prototype.getUTCMinutes + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return MinFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.17"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMinutes()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCMinutes()", + NaN, + (new Date(NaN)).getUTCMinutes() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCMinutes.length", + 0, + Date.prototype.getUTCMinutes.length ); + test(); +function addTestCase( t ) { + for ( m = 0; m <= 60; m+=10 ) { + t += msPerMinute; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMinutes()", + MinFromTime(t), + (new Date(t)).getUTCMinutes() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js new file mode 100644 index 0000000..1537683 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.18.js + ECMA Section: 15.9.5.18 + Description: Date.prototype.getSeconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return SecFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.18"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getSeconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getSeconds()", + NaN, + (new Date(NaN)).getSeconds() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getSeconds.length", + 0, + Date.prototype.getSeconds.length ); + test(); +function addTestCase( t ) { + for ( m = 0; m <= 60; m+=10 ) { + t += 1000; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getSeconds()", + SecFromTime(LocalTime(t)), + (new Date(t)).getSeconds() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js new file mode 100644 index 0000000..91f2a0a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.19.js + ECMA Section: 15.9.5.19 + Description: Date.prototype.getUTCSeconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return SecFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.19"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCSeconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCSeconds()", + NaN, + (new Date(NaN)).getUTCSeconds() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCSeconds.length", + 0, + Date.prototype.getUTCSeconds.length ); + test(); +function addTestCase( t ) { + for ( m = 0; m <= 60; m+=10 ) { + t += 1000; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCSeconds()", + SecFromTime(t), + (new Date(t)).getUTCSeconds() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js new file mode 100644 index 0000000..bb0fb02 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js @@ -0,0 +1,152 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.2.js + ECMA Section: 15.9.5.2 Date.prototype.toString + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the Date in a + convenient, human-readable form in the current time zone. + + The toString function is not generic; it generates a runtime error if its + this value is not a Date object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.toString.length", + 0, + Date.prototype.toString.length ); + + var now = new Date(); + + // can't test the content of the string, but can verify that the string is + // parsable by Date.parse + + testcases[tc++] = new TestCase( SECTION, + "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", + true, + Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); + + testcases[tc++] = new TestCase( SECTION, + "typeof now.toString()", + "string", + typeof now.toString() ); + // 1970 + + TZ_ADJUST = TZ_DIFF * msPerHour; + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date(0)).toString() )", + 0, + Date.parse( (new Date(0)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", + TZ_ADJUST, + Date.parse( (new Date(TZ_ADJUST)).toString() ) ) + + // 1900 + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_1900+")).toString() )", + TIME_1900, + Date.parse( (new Date(TIME_1900)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", + TIME_1900 -TZ_ADJUST, + Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ) + + // 2000 + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_2000+")).toString() )", + TIME_2000, + Date.parse( (new Date(TIME_2000)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", + TIME_2000 -TZ_ADJUST, + Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ) + + // 29 Feb 2000 + + var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )", + UTC_29_FEB_2000, + Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )", + UTC_29_FEB_2000-1000, + Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) ) + + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )", + UTC_29_FEB_2000-TZ_ADJUST, + Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) ) + // 2O05 + + var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )", + UTC_1_JAN_2005, + Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )", + UTC_1_JAN_2005-1000, + Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )", + UTC_1_JAN_2005-TZ_ADJUST, + Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) ) + + test(); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js new file mode 100644 index 0000000..8044dd8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.2-2.js + ECMA Section: 15.9.5.2 Date.prototype.toString + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the Date in a + convenient, human-readable form in the current time zone. + + The toString function is not generic; it generates a runtime error if its + this value is not a Date object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + + This verifies that calling toString on an object that is not a string + generates a runtime error. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var OBJ = new MyObject( new Date(0) ); + + testcases[tc++] = new TestCase( SECTION, + "var OBJ = new MyObject( new Date(0) ); OBJ.toString()", + "error", + OBJ.toString() ); + test(); + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = Date.prototype.toString; + return this; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js new file mode 100644 index 0000000..bb0fb02 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js @@ -0,0 +1,152 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.2.js + ECMA Section: 15.9.5.2 Date.prototype.toString + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the Date in a + convenient, human-readable form in the current time zone. + + The toString function is not generic; it generates a runtime error if its + this value is not a Date object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.toString.length", + 0, + Date.prototype.toString.length ); + + var now = new Date(); + + // can't test the content of the string, but can verify that the string is + // parsable by Date.parse + + testcases[tc++] = new TestCase( SECTION, + "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", + true, + Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); + + testcases[tc++] = new TestCase( SECTION, + "typeof now.toString()", + "string", + typeof now.toString() ); + // 1970 + + TZ_ADJUST = TZ_DIFF * msPerHour; + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date(0)).toString() )", + 0, + Date.parse( (new Date(0)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", + TZ_ADJUST, + Date.parse( (new Date(TZ_ADJUST)).toString() ) ) + + // 1900 + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_1900+")).toString() )", + TIME_1900, + Date.parse( (new Date(TIME_1900)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", + TIME_1900 -TZ_ADJUST, + Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ) + + // 2000 + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_2000+")).toString() )", + TIME_2000, + Date.parse( (new Date(TIME_2000)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", + TIME_2000 -TZ_ADJUST, + Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ) + + // 29 Feb 2000 + + var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )", + UTC_29_FEB_2000, + Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )", + UTC_29_FEB_2000-1000, + Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) ) + + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )", + UTC_29_FEB_2000-TZ_ADJUST, + Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) ) + // 2O05 + + var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )", + UTC_1_JAN_2005, + Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )", + UTC_1_JAN_2005-1000, + Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) ) + + testcases[tc++] = new TestCase( SECTION, + "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )", + UTC_1_JAN_2005-TZ_ADJUST, + Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) ) + + test(); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js new file mode 100644 index 0000000..3ef81f2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.20.js + ECMA Section: 15.9.5.20 + Description: Date.prototype.getMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.20"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getMilliseconds()", + NaN, + (new Date(NaN)).getMilliseconds() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getMilliseconds.length", + 0, + Date.prototype.getMilliseconds.length ); + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getMilliseconds()", + msFromTime(LocalTime(t)), + (new Date(t)).getMilliseconds() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js new file mode 100644 index 0000000..eb89ba4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); +/* + addTestCase( TIME_YEAR_0 ); + + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCMilliseconds()", + NaN, + (new Date(NaN)).getUTCMilliseconds() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCMilliseconds.length", + 0, + Date.prototype.getUTCMilliseconds.length ); +*/ + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js new file mode 100644 index 0000000..5a70d47 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_YEAR_0 ); +/* + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCMilliseconds()", + NaN, + (new Date(NaN)).getUTCMilliseconds() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCMilliseconds.length", + 0, + Date.prototype.getUTCMilliseconds.length ); +*/ + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js new file mode 100644 index 0000000..bfd80c8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_1970 ); + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js new file mode 100644 index 0000000..3f0e4e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_1900 ); + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js new file mode 100644 index 0000000..2ef6e21 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_2000 ); + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js new file mode 100644 index 0000000..3973472 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_FEB_29_2000 ); + + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js new file mode 100644 index 0000000..e50aa04 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_JAN_1_2005 ); + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js new file mode 100644 index 0000000..b23dfc3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.21.js + ECMA Section: 15.9.5.21 + Description: Date.prototype.getUTCMilliseconds + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.21"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMilliseconds()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCMilliseconds()", + NaN, + (new Date(NaN)).getUTCMilliseconds() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCMilliseconds.length", + 0, + Date.prototype.getUTCMilliseconds.length ); + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMilliseconds()", + msFromTime(t), + (new Date(t)).getUTCMilliseconds() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js new file mode 100644 index 0000000..cd84a9b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + +// addTestCase( now ); + + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); + + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js new file mode 100644 index 0000000..e516135 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_YEAR_0 ); +/* + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); +*/ + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js new file mode 100644 index 0000000..371cbc2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_1970 ); +/* + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); +*/ + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js new file mode 100644 index 0000000..1c63441 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_1900 ); +/* + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); +*/ + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js new file mode 100644 index 0000000..3f20ea4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( TIME_2000 ); +/* + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); +*/ + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js new file mode 100644 index 0000000..0aee4a0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_FEB_29_2000 ); +/* + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); +*/ + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js new file mode 100644 index 0000000..2d6ecfc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js @@ -0,0 +1,93 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( UTC_JAN_1_2005 ); +/* + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); +*/ + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js new file mode 100644 index 0000000..f7d6520 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.22.js + ECMA Section: 15.9.5.22 + Description: Date.prototype.getTimezoneOffset + + Returns the difference between local time and UTC time in minutes. + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.22"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTimezoneOffset()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getTimezoneOffset()", + NaN, + (new Date(NaN)).getTimezoneOffset() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getTimezoneOffset.length", + 0, + Date.prototype.getTimezoneOffset.length ); + test(); +function addTestCase( t ) { + for ( m = 0; m <= 1000; m+=100 ) { + t++; + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getTimezoneOffset()", + (t - LocalTime(t)) / msPerMinute, + (new Date(t)).getTimezoneOffset() ); + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js new file mode 100644 index 0000000..3a74450 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js @@ -0,0 +1,157 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + + var testcases = new Array(); + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( 0, 0 ); +/* + addTestCase( now, -2208988800000 ); + addTestCase( now, -86400000 ); + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, -2208988800000 ); + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, 0 ); + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js new file mode 100644 index 0000000..406123b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js @@ -0,0 +1,156 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + + var testcases = new Array(); + + getTestCases(); + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, -2208988800000 ); +/* + addTestCase( now, -86400000 ); + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, -2208988800000 ); + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, 0 ); + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js new file mode 100644 index 0000000..377edd5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js @@ -0,0 +1,155 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, -86400000 ); +/* + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, -2208988800000 ); + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, 0 ); + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js new file mode 100644 index 0000000..b0820c0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js @@ -0,0 +1,153 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + + var testcases = new Array(); + getTestCases(); + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, 946684800000 ); +/* + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, -2208988800000 ); + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, 0 ); + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js new file mode 100644 index 0000000..058a7c7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js @@ -0,0 +1,150 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, -2208988800000 ); +/* + addTestCase( now, 946684800000 ); + + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, 0 ); + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js new file mode 100644 index 0000000..135e808 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js @@ -0,0 +1,148 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-14"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, 946684800000 ); +/* + // this daylight savings case fails -- need to fix date test functions +// addTestCase( now, -69609600000 ); + addTestCase( now, 0 ); + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js new file mode 100644 index 0000000..0f4e587 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js @@ -0,0 +1,144 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, 0 ); +/* + addTestCase( now, String( TIME_1900 ) ); + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js new file mode 100644 index 0000000..7390eb5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js @@ -0,0 +1,143 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, String( TIME_1900 ) ); +/* + addTestCase( now, String( TZ_DIFF* msPerHour ) ); + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js new file mode 100644 index 0000000..0ac866e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js @@ -0,0 +1,142 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, String( TZ_DIFF* msPerHour ) ); +/* + addTestCase( now, String( TIME_2000 ) ); +*/ +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js new file mode 100644 index 0000000..902f411 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js @@ -0,0 +1,139 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-1.js + ECMA Section: 15.9.5.23 Date.prototype.setTime(time) + Description: + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.9.5.23-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function getTestCases() { + var now = "now"; + addTestCase( now, String( TIME_2000 ) ); +} + +function addTestCase( startTime, setTime ) { + if ( startTime == "now" ) { + DateCase = new Date(); + } else { + DateCase = new Date( startTime ); + } + + DateCase.setTime( setTime ); + var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; + var UTCDate = UTCDateFromTime ( Number(setTime) ); + var LocalDate = LocalDateFromTime( Number(setTime) ); + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + return (d); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js new file mode 100644 index 0000000..e471514 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + test_times = new Array( now, TIME_1970, TIME_1900, TIME_2000 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(now), test_times[j] ); + } + + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).setTime()", + NaN, + (new Date(NaN)).setTime() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.setTime.length", + 1, + Date.prototype.setTime.length ); + test(); +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js new file mode 100644 index 0000000..44fffdf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-3-n.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var MYDATE = new MyDate(TIME_1970); + + testcases[tc++] = new TestCase( SECTION, + "MYDATE.setTime(TIME_2000)", + "error", + MYDATE.setTime(TIME_2000) ); + +function MyDate(value) { + this.value = value; + this.setTime = Date.prototype.setTime; + return this; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js new file mode 100644 index 0000000..633bbf6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000, + UTC_FEB_29_2000, UTC_JAN_1_2005 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(TIME_YEAR_0), test_times[j] ); + } + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).setTime()", + NaN, + (new Date(NaN)).setTime() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.setTime.length", + 1, + Date.prototype.setTime.length ); + test(); + +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js new file mode 100644 index 0000000..ab8d9a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000, + UTC_FEB_29_2000, UTC_JAN_1_2005 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(TIME_1970), test_times[j] ); + } + + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).setTime()", + NaN, + (new Date(NaN)).setTime() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.setTime.length", + 1, + Date.prototype.setTime.length ); + test(); +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js new file mode 100644 index 0000000..3f0c3f7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000, + UTC_FEB_29_2000, UTC_JAN_1_2005 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(TIME_1900), test_times[j] ); + } + + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).setTime()", + NaN, + (new Date(NaN)).setTime() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.setTime.length", + 1, + Date.prototype.setTime.length ); + test(); +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js new file mode 100644 index 0000000..328642f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000, + UTC_FEB_29_2000, UTC_JAN_1_2005 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(TIME_2000), test_times[j] ); + } + + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).setTime()", + NaN, + (new Date(NaN)).setTime() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.setTime.length", + 1, + Date.prototype.setTime.length ); + test(); +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js new file mode 100644 index 0000000..4b9fbb3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000, + UTC_FEB_29_2000, UTC_JAN_1_2005 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(UTC_FEB_29_2000), test_times[j] ); + } + + test(); +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js new file mode 100644 index 0000000..cbf8f18 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js @@ -0,0 +1,112 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.23-2.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.23-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.setTime()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000, + UTC_FEB_29_2000, UTC_JAN_1_2005 ); + + + for ( var j = 0; j < test_times.length; j++ ) { + addTestCase( new Date(UTC_JAN_1_2005), test_times[j] ); + } + + test(); +function addTestCase( d, t ) { + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+t+")", + t, + d.setTime(t) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1.1)+")", + TimeClip(t+1.1), + d.setTime(t+1.1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+1)+")", + t+1, + d.setTime(t+1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-1)+")", + t-1, + d.setTime(t-1) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", + t-TZ_ADJUST, + d.setTime(t-TZ_ADJUST) ); + + testcases[tc++] = new TestCase( SECTION, + "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", + t+TZ_ADJUST, + d.setTime(t+TZ_ADJUST) ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js new file mode 100644 index 0000000..4e7a4fb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js @@ -0,0 +1,151 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, 0 ); +/* + addTestCase( 0, -86400000 ); + addTestCase( 0, -2208988800000 ); + addTestCase( 0, 946684800000 ); + +// This test case is incorrect. Need to fix the DaylightSavings functions in +// shell.js for this to work properly. +// addTestCase( 0, -69609600000 ); +// addTestCase( 0, "-69609600000" ); + + addTestCase( 0, "0" ); + addTestCase( 0, "-2208988800000" ); + addTestCase( 0, "-86400000" ); + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js new file mode 100644 index 0000000..8995cf2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js @@ -0,0 +1,150 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, -86400000 ); +/* + addTestCase( 0, -2208988800000 ); + addTestCase( 0, 946684800000 ); + +// This test case is incorrect. Need to fix the DaylightSavings functions in +// shell.js for this to work properly. +// addTestCase( 0, -69609600000 ); +// addTestCase( 0, "-69609600000" ); + + addTestCase( 0, "0" ); + addTestCase( 0, "-2208988800000" ); + addTestCase( 0, "-86400000" ); + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js new file mode 100644 index 0000000..788fc80 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js @@ -0,0 +1,149 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, -2208988800000 ); +/* + addTestCase( 0, 946684800000 ); + +// This test case is incorrect. Need to fix the DaylightSavings functions in +// shell.js for this to work properly. +// addTestCase( 0, -69609600000 ); +// addTestCase( 0, "-69609600000" ); + + addTestCase( 0, "0" ); + addTestCase( 0, "-2208988800000" ); + addTestCase( 0, "-86400000" ); + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js new file mode 100644 index 0000000..b003de4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js @@ -0,0 +1,148 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, 946684800000 ); +/* + +// This test case is incorrect. Need to fix the DaylightSavings functions in +// shell.js for this to work properly. +// addTestCase( 0, -69609600000 ); +// addTestCase( 0, "-69609600000" ); + + addTestCase( 0, "0" ); + addTestCase( 0, "-2208988800000" ); + addTestCase( 0, "-86400000" ); + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js new file mode 100644 index 0000000..ccfadc0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js @@ -0,0 +1,141 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, "0" ); +/* + addTestCase( 0, "-2208988800000" ); + addTestCase( 0, "-86400000" ); + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js new file mode 100644 index 0000000..cd2d9d1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js @@ -0,0 +1,140 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, "-2208988800000" ); +/* + addTestCase( 0, "-86400000" ); + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js new file mode 100644 index 0000000..8e5846e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js @@ -0,0 +1,139 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + addTestCase( 0, "-86400000" ); +/* + addTestCase( 0, "946684800000" ); +*/ +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js new file mode 100644 index 0000000..956bc9d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js @@ -0,0 +1,135 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.24-1.js + ECMA Section: 15.9.5.24 Date.prototype.setTime(time) + Description: + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var TITLE = "Date.prototype.setTime" + var SECTION = "15.9.5.24-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addTestCase( 0, "946684800000" ); +} +function addTestCase( startms, newms ) { + + var DateCase = new Date( startms ); + DateCase.setMilliseconds( newms ); + var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; + var UTCDate = UTCDateFromTime( Number(newms) ); + var LocalDate = LocalDateFromTime( Number(newms) ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js new file mode 100644 index 0000000..65cecdc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js @@ -0,0 +1,190 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.25-1.js + ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms) + Description: + 1. Let t be this time value. + 2. Call ToNumber(ms). + 3. Compute MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), Result(2)). + 4. Compute MakeDate(Day(t), Result(3)). + 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). + 6. Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.25-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,0)), + LocalDateFromTime(SetUTCMilliseconds(0,0)) ); + addNewTestCase( 28800000,999, + "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(28800000,999)), + LocalDateFromTime(SetUTCMilliseconds(28800000,999)) ); + addNewTestCase( 28800000,-28800000, + "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(-28800000);TDATE", + UTCDateFromTime(SetUTCMilliseconds(28800000,-28800000)), + LocalDateFromTime(SetUTCMilliseconds(28800000,-28800000)) ); + addNewTestCase( 946684800000,1234567, + "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(1234567);TDATE", + UTCDateFromTime(SetUTCMilliseconds(946684800000,1234567)), + LocalDateFromTime(SetUTCMilliseconds(946684800000,1234567)) ); + addNewTestCase( 946684800000, 123456789, + "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(946684800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(946684800000,123456789)) ); + + addNewTestCase( -2208988800000,123456789, + "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( -2208988800000,123456, + "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( -2208988800000,-123456, + "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( 0,-999, + "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +/* + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(0);TEST_DATE", UTCDateFromTime(0), LocalDateFromTime(0) ); +// addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-2208988800000);TEST_DATE", UTCDateFromTime(-2208988800000), LocalDateFromTime(-2208988800000) ); + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-86400000);TEST_DATE", UTCDateFromTime(-86400000), LocalDateFromTime(-86400000) ); + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(946684800000);TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) ); + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-69609600000);TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) ); + + + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('0');TEST_DATE", UTCDateFromTime(0), LocalDateFromTime(0) ); +// addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-2208988800000');TEST_DATE", UTCDateFromTime(-2208988800000), LocalDateFromTime(-2208988800000) ); + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-86400000');TEST_DATE", UTCDateFromTime(-86400000), LocalDateFromTime(-86400000) ); + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('946684800000');TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) ); + addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-69609600000');TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) ); +*/ +} +function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) { + DateCase = new Date(initialTime); + DateCase.setUTCMilliseconds(ms); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} + +function SetUTCMilliseconds( T, MS ) { + T = Number( T ); + TIME = MakeTime( HourFromTime(T), + MinFromTime(T), + SecFromTime(T), + MS ); + return( MakeDate( Day(T), TIME )); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js new file mode 100644 index 0000000..58f70ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js @@ -0,0 +1,203 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** File Name: 15.9.5.26-1.js + ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms]) + Description: + + If ms is not specified, this behaves as if ms were specified with the + value getMilliseconds( ). + + 1. Let t be the result of LocalTime(this time value). + 2. Call ToNumber(sec). + 3. If ms is not specified, compute msFromTime(t); otherwise, call + ToNumber(ms). + 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), + Result(3)). + 5. Compute UTC(MakeDate(Day(t), Result(4))). + 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). + 7. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.26-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )"); + + var testcases = new Array(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 0, 0, + "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE", + UTCDateFromTime(SetSeconds(0,0,0)), + LocalDateFromTime(SetSeconds(0,0,0)) ); + + addNewTestCase( 28800000,59,999, + "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE", + UTCDateFromTime(SetSeconds(28800000,59,999)), + LocalDateFromTime(SetSeconds(28800000,59,999)) ); + + addNewTestCase( 28800000,999,999, + "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE", + UTCDateFromTime(SetSeconds(28800000,999,999)), + LocalDateFromTime(SetSeconds(28800000,999,999)) ); + + addNewTestCase( 28800000,999, void 0, + "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE", + UTCDateFromTime(SetSeconds(28800000,999,0)), + LocalDateFromTime(SetSeconds(28800000,999,0)) ); + + addNewTestCase( 28800000,-28800, void 0, + "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE", + UTCDateFromTime(SetSeconds(28800000,-28800)), + LocalDateFromTime(SetSeconds(28800000,-28800)) ); + + addNewTestCase( 946684800000,1234567,void 0, + "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE", + UTCDateFromTime(SetSeconds(946684800000,1234567)), + LocalDateFromTime(SetSeconds(946684800000,1234567)) ); + + addNewTestCase( -2208988800000,59,999, + "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE", + UTCDateFromTime(SetSeconds(-2208988800000,59,999)), + LocalDateFromTime(SetSeconds(-2208988800000,59,999)) ); + +/* + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +*/ +} +function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) { + DateCase = new Date( startTime ); + if ( ms != void 0 ) { + DateCase.setSeconds( sec, ms ); + } else { + DateCase.setSeconds( sec ); + } + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetSeconds( t, s, m ) { + var MS = ( m == void 0 ) ? msFromTime(t) : Number( m ); + var TIME = LocalTime( t ); + var SEC = Number(s); + var RESULT4 = MakeTime( HourFromTime( TIME ), + MinFromTime( TIME ), + SEC, + MS ); + var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4)); + return ( TimeClip(UTC_TIME) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js new file mode 100644 index 0000000..38cd843 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js @@ -0,0 +1,202 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.27-1.js + ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms]) + Description: + + If ms is not specified, this behaves as if ms were specified with the + value getUTCMilliseconds( ). + + 1. Let t be this time value. + 2. Call ToNumber(sec). + 3. If ms is not specified, compute msFromTime(t); otherwise, call + ToNumber(ms) + 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3)) + 5. Compute MakeDate(Day(t), Result(4)). + 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). + 7. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.27-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE", + UTCDateFromTime(SetUTCSeconds(0,0,0)), + LocalDateFromTime(SetUTCSeconds(0,0,0)) ); + + addNewTestCase( 28800000,59,999, + "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE", + UTCDateFromTime(SetUTCSeconds(28800000,59,999)), + LocalDateFromTime(SetUTCSeconds(28800000,59,999)) ); + + addNewTestCase( 28800000,999,999, + "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE", + UTCDateFromTime(SetUTCSeconds(28800000,999,999)), + LocalDateFromTime(SetUTCSeconds(28800000,999,999)) ); + + addNewTestCase( 28800000, 999, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE", + UTCDateFromTime(SetUTCSeconds(28800000,999,0)), + LocalDateFromTime(SetUTCSeconds(28800000,999,0)) ); + + addNewTestCase( 28800000, -28800, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE", + UTCDateFromTime(SetUTCSeconds(28800000,-28800)), + LocalDateFromTime(SetUTCSeconds(28800000,-28800)) ); + + addNewTestCase( 946684800000, 1234567, void 0, + "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE", + UTCDateFromTime(SetUTCSeconds(946684800000,1234567)), + LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) ); + + addNewTestCase( -2208988800000,59,999, + "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE", + UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)), + LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) ); +/* + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +*/ +} +function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) { + DateCase = new Date( startTime ); + if ( ms == void 0) { + DateCase.setSeconds( sec ); + } else { + DateCase.setSeconds( sec, ms ); + } + + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} + +function SetUTCSeconds( t, s, m ) { + var TIME = t; + var SEC = Number(s); + var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m ); + var RESULT4 = MakeTime( HourFromTime( TIME ), + MinFromTime( TIME ), + SEC, + MS ); + return ( TimeClip(MakeDate(Day(TIME), RESULT4)) ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js new file mode 100644 index 0000000..8fd97d1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js @@ -0,0 +1,216 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.28-1.js + ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] ) + Description: + If sec is not specified, this behaves as if sec were specified with the + value getSeconds ( ). + + If ms is not specified, this behaves as if ms were specified with the + value getMilliseconds( ). + + 1. Let t be the result of LocalTime(this time value). + 2. Call ToNumber(min). + 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). + 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). + 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Day(t), Result(5))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.28-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 0, void 0, void 0, + "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE", + UTCDateFromTime(SetMinutes(0,0,0,0)), + LocalDateFromTime(SetMinutes(0,0,0,0)) ); + + addNewTestCase( 28800000, 59, 59, void 0, + "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE", + UTCDateFromTime(SetMinutes(28800000,59,59)), + LocalDateFromTime(SetMinutes(28800000,59,59)) ); + + addNewTestCase( 28800000, 59, 59, 999, + "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE", + UTCDateFromTime(SetMinutes(28800000,59,59,999)), + LocalDateFromTime(SetMinutes(28800000,59,59,999)) ); + + addNewTestCase( 28800000, 59, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE", + UTCDateFromTime(SetMinutes(28800000,59,0)), + LocalDateFromTime(SetMinutes(28800000,59,0)) ); + + addNewTestCase( 28800000, -480, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE", + UTCDateFromTime(SetMinutes(28800000,-480)), + LocalDateFromTime(SetMinutes(28800000,-480)) ); + + addNewTestCase( 946684800000, 1234567, void 0, void 0, + "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE", + UTCDateFromTime(SetMinutes(946684800000,1234567)), + LocalDateFromTime(SetMinutes(946684800000,1234567)) ); + + addNewTestCase( -2208988800000,59, 59, void 0, + "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE", + UTCDateFromTime(SetMinutes(-2208988800000,59,59)), + LocalDateFromTime(SetMinutes(-2208988800000,59,59)) ); + + addNewTestCase( -2208988800000, 59, 59, 999, + "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE", + UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)), + LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) ); +/* + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +*/ + +} +function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) { + DateCase = new Date( time ); + + if ( sec == void 0 ) { + DateCase.setMinutes( min ); + } else { + if ( ms == void 0 ) { + DateCase.setMinutes( min, sec ); + } else { + DateCase.setMinutes( min, sec, ms ); + } + } + + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} + +function SetMinutes( t, min, sec, ms ) { + var TIME = LocalTime(t); + var MIN = Number(min); + var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); + var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); + var RESULT5 = MakeTime( HourFromTime( TIME ), + MIN, + SEC, + MS ); + return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js new file mode 100644 index 0000000..0640a74 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js @@ -0,0 +1,210 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.29-1.js + ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] ) + Description: + If sec is not specified, this behaves as if sec were specified with the + value getUTCSeconds ( ). + + If ms is not specified, this behaves as if ms were specified with the value + getUTCMilliseconds( ). + + 1. Let t be this time value. + 2. Call ToNumber(min). + 3. If sec is not specified, compute SecFromTime(t); otherwise, call + ToNumber(sec). + 4. If ms is not specified, compute msFromTime(t); otherwise, call + ToNumber(ms). + 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)). + 6. Compute MakeDate(Day(t), Result(5)). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.29-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 0, void 0, void 0, + "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE", + UTCDateFromTime(SetUTCMinutes(0,0,0,0)), + LocalDateFromTime(SetUTCMinutes(0,0,0,0)) ); + + addNewTestCase( 28800000, 59, 59, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE", + UTCDateFromTime(SetUTCMinutes(28800000,59,59)), + LocalDateFromTime(SetUTCMinutes(28800000,59,59)) ); + + addNewTestCase( 28800000, 59, 59, 999, + "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE", + UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)), + LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) ); + + addNewTestCase( 28800000, 59, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE", + UTCDateFromTime(SetUTCMinutes(28800000,59)), + LocalDateFromTime(SetUTCMinutes(28800000,59)) ); + + addNewTestCase( 28800000, -480, 0, 0, + "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE", + UTCDateFromTime(SetUTCMinutes(28800000,-480)), + LocalDateFromTime(SetUTCMinutes(28800000,-480)) ); + + addNewTestCase( 946684800000, 1234567, void 0, void 0, + "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE", + UTCDateFromTime(SetUTCMinutes(946684800000,1234567)), + LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) ); + + addNewTestCase( -2208988800000, 59, 999, void 0, + "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE", + UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)), + LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) ); +/* + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +*/ + +} +function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) { + var DateCase = new Date( time ); + + if ( sec == void 0 ) { + DateCase.setUTCMinutes( min ); + } else { + if ( ms == void 0 ) { + DateCase.setUTCMinutes( min, sec ); + } else { + DateCase.setUTCMinutes( min, sec, ms ); + } + } + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); +// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCMinutes( t, min, sec, ms ) { + var TIME = t; + var MIN = Number(min); + var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); + var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); + var RESULT5 = MakeTime( HourFromTime( TIME ), + MIN, + SEC, + MS ); + return ( TimeClip(MakeDate(Day(TIME),RESULT5)) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js new file mode 100644 index 0000000..109fc26 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.3-1.js + ECMA Section: 15.9.5.3-1 Date.prototype.valueOf + Description: + + The valueOf function returns a number, which is this time value. + + The valueOf function is not generic; it generates a runtime error if + its this value is not a Date object. Therefore it cannot be transferred + to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.3-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.valueOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var OBJ = new MyObject( new Date(0) ); + + testcases[tc++] = new TestCase( SECTION, + "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()", + "error", + OBJ.valueOf() ); + test(); + +function MyObject( value ) { + this.value = value; + this.valueOf = Date.prototype.valueOf; +// The following line causes an infinte loop +// this.toString = new Function( "return this+\"\";"); + return this; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js new file mode 100644 index 0000000..7698ac1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js @@ -0,0 +1,107 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.3-2.js + ECMA Section: 15.9.5.3-2 Date.prototype.valueOf + Description: + + The valueOf function returns a number, which is this time value. + + The valueOf function is not generic; it generates a runtime error if + its this value is not a Date object. Therefore it cannot be transferred + to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.valueOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var TZ_ADJUST = TZ_DIFF * msPerHour; + var now = (new Date()).valueOf(); + var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_29_FEB_2000 ); + addTestCase( UTC_1_JAN_2005 ); + + test(); + +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+").valueOf()", + t, + (new Date(t)).valueOf() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+").valueOf()", + t+1, + (new Date(t+1)).valueOf() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+").valueOf()", + t-1, + (new Date(t-1)).valueOf() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+").valueOf()", + t-TZ_ADJUST, + (new Date(t-TZ_ADJUST)).valueOf() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+").valueOf()", + t+TZ_ADJUST, + (new Date(t+TZ_ADJUST)).valueOf() ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = Date.prototype.valueOf; + this.toString = new Function( "return this+\"\";"); + return this; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js new file mode 100644 index 0000000..6e6715f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js @@ -0,0 +1,215 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.30-1.js + ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] ) + Description: + If min is not specified, this behaves as if min were specified with the + value getMinutes( ). If sec is not specified, this behaves as if sec were + specified with the value getSeconds ( ). If ms is not specified, this + behaves as if ms were specified with the value getMilliseconds( ). + + 1. Let t be the result of LocalTime(this time value). + 2. Call ToNumber(hour). + 3. If min is not specified, compute MinFromTime(t); otherwise, call + ToNumber(min). + 4. If sec is not specified, compute SecFromTime(t); otherwise, call + ToNumber(sec). + 5. If ms is not specified, compute msFromTime(t); otherwise, call + ToNumber(ms). + 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)). + 7. Compute UTC(MakeDate(Day(t), Result(6))). + 8. Set the [[Value]] property of the this value to TimeClip(Result(7)). + 9. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.30-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0,0,0,0,void 0, + "TDATE = new Date(0);(TDATE).setHours(0);TDATE" ); + + addNewTestCase( 28800000, 23, 59, 999,void 0, + "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" ); + + addNewTestCase( 28800000, 999, 999, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" ); + + addNewTestCase( 28800000,999,0, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" ); + + addNewTestCase( 28800000,-8, void 0, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" ); + + addNewTestCase( 946684800000,8760, void 0, void 0, void 0, + "TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" ); + + addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999, + "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" ); + + addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000, + "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" ); + + +/* + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setHours(59,999);TDATE", + UTCDateFromTime(SetHours(-2208988800000,59,999)), + LocalDateFromTime(SetHours(-2208988800000,59,999)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +*/ + +} +function addNewTestCase( time, hours, min, sec, ms, DateString) { + var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms )); + var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms )); + + var DateCase = new Date( time ); + + if ( min == void 0 ) { + DateCase.setHours( hours ); + } else { + if ( sec == void 0 ) { + DateCase.setHours( hours, min ); + } else { + if ( ms == void 0 ) { + DateCase.setHours( hours, min, sec ); + } else { + DateCase.setHours( hours, min, sec, ms ); + } + } + } + + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.day = WeekDay( t ); + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + + return (d); +} +function SetHours( t, hour, min, sec, ms ) { + var TIME = LocalTime(t); + var HOUR = Number(hour); + var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min); + var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); + var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); + var RESULT6 = MakeTime( HOUR, + MIN, + SEC, + MS ); + var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) ); + return ( TimeClip(UTC_TIME) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js new file mode 100644 index 0000000..b6a2fee --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js @@ -0,0 +1,212 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.31-1.js + ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] ) + Description: + If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ). + If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ). + If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). + + 1.Let t be this time value. + 2.Call ToNumber(hour). + 3.If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min). + 4.If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). + 5.If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). + 6.Compute MakeTime(Result(2), Result(3), Result(4), Result(5)). + 7.Compute MakeDate(Day(t), Result(6)). + 8.Set the [[Value]] property of the this value to TimeClip(Result(7)). + + 1.Return the value of the [[Value]] property of the this value. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.31-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 0, void 0, void 0, void 0, + "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE", + UTCDateFromTime(SetUTCHours(0,0,0,0)), + LocalDateFromTime(SetUTCHours(0,0,0,0)) ); + + addNewTestCase( 28800000, 23, 59, 999, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE", + UTCDateFromTime(SetUTCHours(28800000,23,59,999)), + LocalDateFromTime(SetUTCHours(28800000,23,59,999)) ); + + addNewTestCase( 28800000,999,999, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE", + UTCDateFromTime(SetUTCHours(28800000,999,999)), + LocalDateFromTime(SetUTCHours(28800000,999,999)) ); + + addNewTestCase( 28800000, 999, void 0, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE", + UTCDateFromTime(SetUTCHours(28800000,999,0)), + LocalDateFromTime(SetUTCHours(28800000,999,0)) ); + + addNewTestCase( 28800000, -8670, void 0, void 0, void 0, + "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE", + UTCDateFromTime(SetUTCHours(28800000,-8670)), + LocalDateFromTime(SetUTCHours(28800000,-8670)) ); + + addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0, + "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE", + UTCDateFromTime(SetUTCHours(946684800000,1234567)), + LocalDateFromTime(SetUTCHours(946684800000,1234567)) ); + + addNewTestCase( -2208988800000, 59, 999, void 0, void 0, + "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE", + UTCDateFromTime(SetUTCHours(-2208988800000,59,999)), + LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) ); +/* + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); + + addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", + UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), + LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", + UTCDateFromTime(SetUTCMilliseconds(0,-999)), + LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); +*/ + +} +function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) { + + DateCase = new Date(time); + if ( min == void 0 ) { + DateCase.setUTCHours( hours ); + } else { + if ( sec == void 0 ) { + DateCase.setUTCHours( hours, min ); + } else { + if ( ms == void 0 ) { + DateCase.setUTCHours( hours, min, sec ); + } else { + DateCase.setUTCHours( hours, min, sec, ms ); + } + } + } + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCHours( t, hour, min, sec, ms ) { + var TIME = t; + var HOUR = Number(hour); + var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min); + var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); + var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); + var RESULT6 = MakeTime( HOUR, + MIN, + SEC, + MS ); + return ( TimeClip(MakeDate(Day(TIME), RESULT6)) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js new file mode 100644 index 0000000..eded146 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js @@ -0,0 +1,157 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.32-1.js + ECMA Section: 15.9.5.32 Date.prototype.setDate(date) + Description: + 1. Let t be the result of LocalTime(this time value). + 2. Call ToNumber(date). + 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)). + 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))). + 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). + 6. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.32-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setDate(date) "); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( 0, 1, + "TDATE = new Date(0);(TDATE).setDate(1);TDATE" ); + +/* + addNewTestCase( "TDATE = new Date(86400000);(TDATE).setDate(1);TDATE", + UTCDateFromTime(SetDate(86400000,1)), + LocalDateFromTime(SetDate(86400000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1972)), + LocalDateFromTime(SetUTCFullYear(0,1972)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1968)), + LocalDateFromTime(SetUTCFullYear(0,1968)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1969)), + LocalDateFromTime(SetUTCFullYear(0,1969)) ); +*/ +} +function addNewTestCase( t, d, DateString ) { + var DateCase = new Date( t ); + DateCase.setDate( d ); + + var UTCDate = UTCDateFromTime(SetDate(t, d)); + var LocalDate=LocalDateFromTime(SetDate(t,d)); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} + +function SetDate( t, date ) { + var T = LocalTime( t ); + var DATE = Number( date ); + var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE ); + var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) ); + return ( TimeClip(UTC_DATE) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js new file mode 100644 index 0000000..017d43e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js @@ -0,0 +1,156 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.33-1.js + ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date) + Description: + 1. Let t be this time value. + 2. Call ToNumber(date). + 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)). + 4. Compute MakeDate(Result(3), TimeWithinDay(t)). + 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). + 6. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.33-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) "); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE", + UTCDateFromTime(SetUTCDate(0,31)), + LocalDateFromTime(SetUTCDate(0,31)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE", + UTCDateFromTime(SetUTCDate(0,1)), + LocalDateFromTime(SetUTCDate(0,1)) ); + + addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE", + UTCDateFromTime(SetUTCDate(86400000,1)), + LocalDateFromTime(SetUTCDate(86400000,1)) ); +/* + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1972)), + LocalDateFromTime(SetUTCFullYear(0,1972)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1968)), + LocalDateFromTime(SetUTCFullYear(0,1968)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1969)), + LocalDateFromTime(SetUTCFullYear(0,1969)) ); +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCDate( t, date ) { + var T = t; + var DATE = Number( date ); + var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE ); + return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js new file mode 100644 index 0000000..e042ab9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js @@ -0,0 +1,220 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.34-1.js + ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] ) + Description: + If date is not specified, this behaves as if date were specified with the + value getDate( ). + + 1. Let t be the result of LocalTime(this time value). + 2. Call ToNumber(date). + 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). + 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)). + 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))). + 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). + 7. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.34-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )"); + + var now = (new Date()).valueOf(); + + getFunctionCases(); + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getFunctionCases() { + // some tests for all functions + testcases[testcases.length] = new TestCase( + SECTION, + "Date.prototype.setMonth.length", + 2, + Date.prototype.setMonth.length ); + + testcases[testcases.length] = new TestCase( + SECTION, + "typeof Date.prototype.setMonth", + "function", + typeof Date.prototype.setMonth ); + + +/* + + testcases[testcases.length] = new TestCase( + SECTION, + "delete Date.prototype.setMonth", + false, + delete Date.prototype.setMonth ); +*/ + +} + + +function getTestCases() { + // regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404 + d = new Date(0); + d.setMonth(1,1,1,1,1,1); + + addNewTestCase( + "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE", + UTCDateFromTime(SetMonth(0,1,1)), + LocalDateFromTime(SetMonth(0,1,1)) ); + + + // whatever today is + + addNewTestCase( "TDATE = new Date(now); (TDATE).setMonth(11,31); TDATE", + UTCDateFromTime(SetMonth(now,11,31)), + LocalDateFromTime(SetMonth(now,11,31)) ); + + // 1970 + + addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE", + UTCDateFromTime(SetMonth(0,0,1)), + LocalDateFromTime(SetMonth(0,0,1)) ); + + addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+ + "(TDATE).setMonth(11,31); TDATE", + UTCDateFromTime( SetMonth(TIME_1900,11,31) ), + LocalDateFromTime( SetMonth(TIME_1900,11,31) ) ); + + + + +/* + addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11,23,59,999);TDATE", + UTCDateFromTime(SetMonth(28800000,11,23,59,999)), + LocalDateFromTime(SetMonth(28800000,11,23,59,999)) ); + + addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(99,99);TDATE", + UTCDateFromTime(SetMonth(28800000,99,99)), + LocalDateFromTime(SetMonth(28800000,99,99)) ); + + addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11);TDATE", + UTCDateFromTime(SetMonth(28800000,11,0)), + LocalDateFromTime(SetMonth(28800000,11,0)) ); + + addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(-11);TDATE", + UTCDateFromTime(SetMonth(28800000,-11)), + LocalDateFromTime(SetMonth(28800000,-11)) ); + + // 1900 + +// addNewTestCase( "TDATE = new Date(); (TDATE).setMonth(11,31); TDATE;" +*/ + +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetMonth( t, mon, date ) { + var TIME = LocalTime(t); + var MONTH = Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date ); + var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE ); + return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js new file mode 100644 index 0000000..242c0d8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js @@ -0,0 +1,143 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.35-1.js + ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date]) + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.35-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) "); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE", + UTCDateFromTime(SetUTCMonth(0,0)), + LocalDateFromTime(SetUTCMonth(0,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE", + UTCDateFromTime(SetUTCMonth(0,11)), + LocalDateFromTime(SetUTCMonth(0,11)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE", + UTCDateFromTime(SetUTCMonth(0,3,4)), + LocalDateFromTime(SetUTCMonth(0,3,4)) ); + +} + +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCMonth( t, month, date ) { + var T = t; + var MONTH = Number( month ); + var DATE = ( date == void 0) ? DateFromTime(T) : Number( date ); + + var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE ); + var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T)); + + return ( TimeClip(RESULT5) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js new file mode 100644 index 0000000..f046829 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js @@ -0,0 +1,245 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + + // 1969 + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE", + UTCDateFromTime(SetFullYear(0,1969)), + LocalDateFromTime(SetFullYear(0,1969)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE", + UTCDateFromTime(SetFullYear(0,1969,11)), + LocalDateFromTime(SetFullYear(0,1969,11)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE", + UTCDateFromTime(SetFullYear(0,1969,11,31)), + LocalDateFromTime(SetFullYear(0,1969,11,31)) ); +/* + // 1970 + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE", + UTCDateFromTime(SetFullYear(0,1970)), + LocalDateFromTime(SetFullYear(0,1970)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE", + UTCDateFromTime(SetFullYear(0,1970,0)), + LocalDateFromTime(SetFullYear(0,1970,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,1970,0,1)), + LocalDateFromTime(SetFullYear(0,1970,0,1)) ); + // 1971 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE", + UTCDateFromTime(SetFullYear(0,1971)), + LocalDateFromTime(SetFullYear(0,1971)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE", + UTCDateFromTime(SetFullYear(0,1971,0)), + LocalDateFromTime(SetFullYear(0,1971,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,1971,0,1)), + LocalDateFromTime(SetFullYear(0,1971,0,1)) ); + + // 1999 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE", + UTCDateFromTime(SetFullYear(0,1999)), + LocalDateFromTime(SetFullYear(0,1999)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11)), + LocalDateFromTime(SetFullYear(0,1999,11)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11,31)), + LocalDateFromTime(SetFullYear(0,1999,11,31)) ); + + // 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0)), + LocalDateFromTime(SetFullYear(0,2000,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0,1)), + LocalDateFromTime(SetFullYear(0,2000,0,1)) ); + + // feb 29, 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1)), + LocalDateFromTime(SetFullYear(0,2000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1,29)), + LocalDateFromTime(SetFullYear(0,2000,1,29)) ); + + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js new file mode 100644 index 0000000..1e207ed --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js @@ -0,0 +1,231 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-2"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + // 1970 + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE", + UTCDateFromTime(SetFullYear(0,1970)), + LocalDateFromTime(SetFullYear(0,1970)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE", + UTCDateFromTime(SetFullYear(0,1970,0)), + LocalDateFromTime(SetFullYear(0,1970,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,1970,0,1)), + LocalDateFromTime(SetFullYear(0,1970,0,1)) ); +/* + // 1971 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE", + UTCDateFromTime(SetFullYear(0,1971)), + LocalDateFromTime(SetFullYear(0,1971)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE", + UTCDateFromTime(SetFullYear(0,1971,0)), + LocalDateFromTime(SetFullYear(0,1971,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,1971,0,1)), + LocalDateFromTime(SetFullYear(0,1971,0,1)) ); + + // 1999 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE", + UTCDateFromTime(SetFullYear(0,1999)), + LocalDateFromTime(SetFullYear(0,1999)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11)), + LocalDateFromTime(SetFullYear(0,1999,11)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11,31)), + LocalDateFromTime(SetFullYear(0,1999,11,31)) ); + + // 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0)), + LocalDateFromTime(SetFullYear(0,2000,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0,1)), + LocalDateFromTime(SetFullYear(0,2000,0,1)) ); + + // feb 29, 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1)), + LocalDateFromTime(SetFullYear(0,2000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1,29)), + LocalDateFromTime(SetFullYear(0,2000,1,29)) ); + + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js new file mode 100644 index 0000000..c1e9c81 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js @@ -0,0 +1,218 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + // 1971 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE", + UTCDateFromTime(SetFullYear(0,1971)), + LocalDateFromTime(SetFullYear(0,1971)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE", + UTCDateFromTime(SetFullYear(0,1971,0)), + LocalDateFromTime(SetFullYear(0,1971,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,1971,0,1)), + LocalDateFromTime(SetFullYear(0,1971,0,1)) ); + +/* + // 1999 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE", + UTCDateFromTime(SetFullYear(0,1999)), + LocalDateFromTime(SetFullYear(0,1999)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11)), + LocalDateFromTime(SetFullYear(0,1999,11)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11,31)), + LocalDateFromTime(SetFullYear(0,1999,11,31)) ); + + // 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0)), + LocalDateFromTime(SetFullYear(0,2000,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0,1)), + LocalDateFromTime(SetFullYear(0,2000,0,1)) ); + + // feb 29, 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1)), + LocalDateFromTime(SetFullYear(0,2000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1,29)), + LocalDateFromTime(SetFullYear(0,2000,1,29)) ); + + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js new file mode 100644 index 0000000..4d7f08b0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js @@ -0,0 +1,205 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + // 1999 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE", + UTCDateFromTime(SetFullYear(0,1999)), + LocalDateFromTime(SetFullYear(0,1999)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11)), + LocalDateFromTime(SetFullYear(0,1999,11)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE", + UTCDateFromTime(SetFullYear(0,1999,11,31)), + LocalDateFromTime(SetFullYear(0,1999,11,31)) ); + +/* + // 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0)), + LocalDateFromTime(SetFullYear(0,2000,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0,1)), + LocalDateFromTime(SetFullYear(0,2000,0,1)) ); + + // feb 29, 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1)), + LocalDateFromTime(SetFullYear(0,2000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1,29)), + LocalDateFromTime(SetFullYear(0,2000,1,29)) ); + + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js new file mode 100644 index 0000000..41dc143 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js @@ -0,0 +1,192 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + // 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0)), + LocalDateFromTime(SetFullYear(0,2000,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,0,1)), + LocalDateFromTime(SetFullYear(0,2000,0,1)) ); + +/* + // feb 29, 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1)), + LocalDateFromTime(SetFullYear(0,2000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1,29)), + LocalDateFromTime(SetFullYear(0,2000,1,29)) ); + + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js new file mode 100644 index 0000000..8bed8d2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js @@ -0,0 +1,179 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + // feb 29, 2000 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", + UTCDateFromTime(SetFullYear(0,2000)), + LocalDateFromTime(SetFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1)), + LocalDateFromTime(SetFullYear(0,2000,1)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", + UTCDateFromTime(SetFullYear(0,2000,1,29)), + LocalDateFromTime(SetFullYear(0,2000,1,29)) ); + +/* + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js new file mode 100644 index 0000000..8520844 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js @@ -0,0 +1,164 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.36-1.js + ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getMonth( ). If date is not specified, this behaves as if date were + specified with the value getDate( ). + + 1. Let t be the result of LocalTime(this time value); but if this time + value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added test cases for Year 2000 Compatilibity Testing. + +*/ + var SECTION = "15.9.5.36-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + // Jan 1, 2005 + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", + UTCDateFromTime(SetFullYear(0,2005)), + LocalDateFromTime(SetFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0)), + LocalDateFromTime(SetFullYear(0,2005,0)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", + UTCDateFromTime(SetFullYear(0,2005,0,1)), + LocalDateFromTime(SetFullYear(0,2005,0,1)) ); + +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetFullYear( t, year, mon, date ) { + var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; + var YEAR = Number( year ); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + + var DAY = MakeDay( YEAR, MONTH, DATE ); + var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); + + return ( TimeClip(UTC_DATE) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js new file mode 100644 index 0000000..9eaf49d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js @@ -0,0 +1,235 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.37-1.js + ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getUTCMonth( ). If date is not specified, this behaves as if date + were specified with the value getUTCDate( ). + + 1. Let t be this time value; but if this time value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute MakeDate(Result(5), TimeWithinDay(t)). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added some Year 2000 test cases. +*/ + var SECTION = "15.9.5.37-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + // Dates around 1970 + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1970)), + LocalDateFromTime(SetUTCFullYear(0,1970)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1971)), + LocalDateFromTime(SetUTCFullYear(0,1971)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1972)), + LocalDateFromTime(SetUTCFullYear(0,1972)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1968)), + LocalDateFromTime(SetUTCFullYear(0,1968)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1969)), + LocalDateFromTime(SetUTCFullYear(0,1969)) ); + + addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1969)), + LocalDateFromTime(SetUTCFullYear(0,1969)) ); +/* + // Dates around 2000 + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2000)), + LocalDateFromTime(SetUTCFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2001)), + LocalDateFromTime(SetUTCFullYear(0,2001)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1999)), + LocalDateFromTime(SetUTCFullYear(0,1999)) ); + + // Dates around 29 February 2000 + + var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) + + 31*msPerDay + 28*msPerDay; + + var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour; + + addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+ + "TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)), + LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) ); + + addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+ + "TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)), + LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) ); + + // Dates around 2005 + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2005)), + LocalDateFromTime(SetUTCFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2004)), + LocalDateFromTime(SetUTCFullYear(0,2004)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2006)), + LocalDateFromTime(SetUTCFullYear(0,2006)) ); + + + // Dates around 1900 + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1900)), + LocalDateFromTime(SetUTCFullYear(0,1900)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1899)), + LocalDateFromTime(SetUTCFullYear(0,1899)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1901)), + LocalDateFromTime(SetUTCFullYear(0,1901)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCFullYear( t, year, mon, date ) { + var T = ( t != t ) ? 0 : t; + var YEAR = Number(year); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + var DAY = MakeDay( YEAR, MONTH, DATE ); + + return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js new file mode 100644 index 0000000..ffb8fda --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js @@ -0,0 +1,209 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.37-1.js + ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getUTCMonth( ). If date is not specified, this behaves as if date + were specified with the value getUTCDate( ). + + 1. Let t be this time value; but if this time value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute MakeDate(Result(5), TimeWithinDay(t)). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added some Year 2000 test cases. +*/ + var SECTION = "15.9.5.37-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + // Dates around 2000 + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2000)), + LocalDateFromTime(SetUTCFullYear(0,2000)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2001)), + LocalDateFromTime(SetUTCFullYear(0,2001)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1999)), + LocalDateFromTime(SetUTCFullYear(0,1999)) ); +/* + // Dates around 29 February 2000 + + var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) + + 31*msPerDay + 28*msPerDay; + + var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour; + + addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+ + "TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)), + LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) ); + + addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+ + "TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)), + LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) ); + + // Dates around 2005 + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2005)), + LocalDateFromTime(SetUTCFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2004)), + LocalDateFromTime(SetUTCFullYear(0,2004)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2006)), + LocalDateFromTime(SetUTCFullYear(0,2006)) ); + + + // Dates around 1900 + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1900)), + LocalDateFromTime(SetUTCFullYear(0,1900)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1899)), + LocalDateFromTime(SetUTCFullYear(0,1899)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1901)), + LocalDateFromTime(SetUTCFullYear(0,1901)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCFullYear( t, year, mon, date ) { + var T = ( t != t ) ? 0 : t; + var YEAR = Number(year); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + var DAY = MakeDay( YEAR, MONTH, DATE ); + + return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js new file mode 100644 index 0000000..136ec89 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js @@ -0,0 +1,195 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.37-1.js + ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getUTCMonth( ). If date is not specified, this behaves as if date + were specified with the value getUTCDate( ). + + 1. Let t be this time value; but if this time value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute MakeDate(Result(5), TimeWithinDay(t)). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added some Year 2000 test cases. +*/ + var SECTION = "15.9.5.37-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + + // Dates around 29 February 2000 + + var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) + + 31*msPerDay + 28*msPerDay; + + var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour; + + addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+ + "TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)), + LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) ); + + addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+ + "TDATE.setUTCFullYear(2000);TDATE", + UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)), + LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) ); +/* + // Dates around 2005 + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2005)), + LocalDateFromTime(SetUTCFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2004)), + LocalDateFromTime(SetUTCFullYear(0,2004)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2006)), + LocalDateFromTime(SetUTCFullYear(0,2006)) ); + + + // Dates around 1900 + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1900)), + LocalDateFromTime(SetUTCFullYear(0,1900)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1899)), + LocalDateFromTime(SetUTCFullYear(0,1899)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1901)), + LocalDateFromTime(SetUTCFullYear(0,1901)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCFullYear( t, year, mon, date ) { + var T = ( t != t ) ? 0 : t; + var YEAR = Number(year); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + var DAY = MakeDay( YEAR, MONTH, DATE ); + + return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js new file mode 100644 index 0000000..c7876d1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js @@ -0,0 +1,177 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.37-1.js + ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getUTCMonth( ). If date is not specified, this behaves as if date + were specified with the value getUTCDate( ). + + 1. Let t be this time value; but if this time value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute MakeDate(Result(5), TimeWithinDay(t)). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added some Year 2000 test cases. +*/ + var SECTION = "15.9.5.37-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + // Dates around 2005 + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2005)), + LocalDateFromTime(SetUTCFullYear(0,2005)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2004)), + LocalDateFromTime(SetUTCFullYear(0,2004)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE", + UTCDateFromTime(SetUTCFullYear(0,2006)), + LocalDateFromTime(SetUTCFullYear(0,2006)) ); + +/* + // Dates around 1900 + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1900)), + LocalDateFromTime(SetUTCFullYear(0,1900)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1899)), + LocalDateFromTime(SetUTCFullYear(0,1899)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1901)), + LocalDateFromTime(SetUTCFullYear(0,1901)) ); + +*/ +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCFullYear( t, year, mon, date ) { + var T = ( t != t ) ? 0 : t; + var YEAR = Number(year); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + var DAY = MakeDay( YEAR, MONTH, DATE ); + + return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js new file mode 100644 index 0000000..cee31ed --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js @@ -0,0 +1,160 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.9.5.37-1.js + ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) + Description: + + If mon is not specified, this behaves as if mon were specified with the + value getUTCMonth( ). If date is not specified, this behaves as if date + were specified with the value getUTCDate( ). + + 1. Let t be this time value; but if this time value is NaN, let t be +0. + 2. Call ToNumber(year). + 3. If mon is not specified, compute MonthFromTime(t); otherwise, call + ToNumber(mon). + 4. If date is not specified, compute DateFromTime(t); otherwise, call + ToNumber(date). + 5. Compute MakeDay(Result(2), Result(3), Result(4)). + 6. Compute MakeDate(Result(5), TimeWithinDay(t)). + 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). + 8. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 + + Added some Year 2000 test cases. +*/ + var SECTION = "15.9.5.37-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); + + getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + // Dates around 1900 + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1900)), + LocalDateFromTime(SetUTCFullYear(0,1900)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1899)), + LocalDateFromTime(SetUTCFullYear(0,1899)) ); + + addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", + UTCDateFromTime(SetUTCFullYear(0,1901)), + LocalDateFromTime(SetUTCFullYear(0,1901)) ); +} +function addNewTestCase( DateString, UTCDate, LocalDate) { + DateCase = eval( DateString ); + + var item = testcases.length; + +// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; + + testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); + testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); + + testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); + testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); + testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); + testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); + testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); + + DateCase.toString = Object.prototype.toString; + + testcases[item++] = new TestCase( SECTION, + DateString+".toString=Object.prototype.toString;"+DateString+".toString()", + "[object Date]", + DateCase.toString() ); +} + +function MyDate() { + this.year = 0; + this.month = 0; + this.date = 0; + this.hours = 0; + this.minutes = 0; + this.seconds = 0; + this.ms = 0; +} +function LocalDateFromTime(t) { + t = LocalTime(t); + return ( MyDateFromTime(t) ); +} +function UTCDateFromTime(t) { + return ( MyDateFromTime(t) ); +} +function MyDateFromTime( t ) { + var d = new MyDate(); + d.year = YearFromTime(t); + d.month = MonthFromTime(t); + d.date = DateFromTime(t); + d.hours = HourFromTime(t); + d.minutes = MinFromTime(t); + d.seconds = SecFromTime(t); + d.ms = msFromTime(t); + + d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); + d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); + d.day = WeekDay( d.value ); + + return (d); +} +function SetUTCFullYear( t, year, mon, date ) { + var T = ( t != t ) ? 0 : t; + var YEAR = Number(year); + var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); + var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); + var DAY = MakeDay( YEAR, MONTH, DATE ); + + return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js new file mode 100644 index 0000000..81c3740 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.4-1.js + ECMA Section: 15.9.5.4-1 Date.prototype.getTime + Description: + + 1. If the this value is not an object whose [[Class]] property is "Date", + generate a runtime error. + 2. Return this time value. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.9.5.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTime"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + var now = (new Date()).valueOf(); + var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; + var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_29_FEB_2000 ); + addTestCase( UTC_1_JAN_2005 ); + + test(); + +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+").getTime()", + t, + (new Date(t)).getTime() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+").getTime()", + t+1, + (new Date(t+1)).getTime() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+").getTime()", + t-1, + (new Date(t-1)).getTime() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+").getTime()", + t-TZ_ADJUST, + (new Date(t-TZ_ADJUST)).getTime() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+").getTime()", + t+TZ_ADJUST, + (new Date(t+TZ_ADJUST)).getTime() ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js new file mode 100644 index 0000000..c90559a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.4-2-n.js + ECMA Section: 15.9.5.4-1 Date.prototype.getTime + Description: + + 1. If the this value is not an object whose [[Class]] property is "Date", + generate a runtime error. + 2. Return this time value. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + + var SECTION = "15.9.5.4-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getTime"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var MYDATE = new MyDate( TIME_2000 ); + + testcases[tc++] = new TestCase( SECTION, + "MYDATE.getTime()", + "error", + MYDATE.getTime() ); + +function MyDate( value ) { + this.value = value; + this.getTime = Date.prototype.getTime; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js new file mode 100644 index 0000000..5660c4c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js @@ -0,0 +1,123 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.5.js + ECMA Section: 15.9.5.5 + Description: Date.prototype.getYear + + This function is specified here for backwards compatibility only. The + function getFullYear is much to be preferred for nearly all purposes, + because it avoids the "year 2000 problem." + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return YearFromTime(LocalTime(t)) 1900. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getYear()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getYear()", + NaN, + (new Date(NaN)).getYear() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getYear.length", + 0, + Date.prototype.getYear.length ); + + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getYear()", + GetYear(YearFromTime(LocalTime(t))), + (new Date(t)).getYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getYear()", + GetYear(YearFromTime(LocalTime(t+1))), + (new Date(t+1)).getYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getYear()", + GetYear(YearFromTime(LocalTime(t-1))), + (new Date(t-1)).getYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getYear()", + GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))), + (new Date(t-TZ_ADJUST)).getYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getYear()", + GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))), + (new Date(t+TZ_ADJUST)).getYear() ); +} +function GetYear( year ) { +/* + if ( year >= 1900 && year < 2000 ) { + return year - 1900; + } else { + return year; + } +*/ + return year - 1900; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js new file mode 100644 index 0000000..5a9cf38 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js @@ -0,0 +1,114 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.6.js + ECMA Section: 15.9.5.6 + Description: Date.prototype.getFullYear + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return YearFromTime(LocalTime(t)). + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getFullYear()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getFullYear()", + NaN, + (new Date(NaN)).getFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getFullYear.length", + 0, + Date.prototype.getFullYear.length ); + + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getFullYear()", + YearFromTime(LocalTime(t)), + (new Date(t)).getFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getFullYear()", + YearFromTime(LocalTime(t+1)), + (new Date(t+1)).getFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getFullYear()", + YearFromTime(LocalTime(t-1)), + (new Date(t-1)).getFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getFullYear()", + YearFromTime(LocalTime(t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getFullYear()", + YearFromTime(LocalTime(t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getFullYear() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js new file mode 100644 index 0000000..8a7f5c0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js @@ -0,0 +1,114 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.7.js + ECMA Section: 15.9.5.7 + Description: Date.prototype.getUTCFullYear + + 1.Let t be this time value. + 2.If t is NaN, return NaN. + 3.Return YearFromTime(t). + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCFullYear()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCFullYear()", + NaN, + (new Date(NaN)).getUTCFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCFullYear.length", + 0, + Date.prototype.getUTCFullYear.length ); + + test(); +function addTestCase( t ) { + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCFullYear()", + YearFromTime(t), + (new Date(t)).getUTCFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCFullYear()", + YearFromTime(t+1), + (new Date(t+1)).getUTCFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCFullYear()", + YearFromTime(t-1), + (new Date(t-1)).getUTCFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()", + YearFromTime(t-TZ_ADJUST), + (new Date(t-TZ_ADJUST)).getUTCFullYear() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()", + YearFromTime(t+TZ_ADJUST), + (new Date(t+TZ_ADJUST)).getUTCFullYear() ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js new file mode 100644 index 0000000..038eda9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.8.js + ECMA Section: 15.9.5.8 + Description: Date.prototype.getMonth + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return MonthFromTime(LocalTime(t)). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getMonth()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getMonth()", + NaN, + (new Date(NaN)).getMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getMonth.length", + 0, + Date.prototype.getMonth.length ); + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + + t += TimeInMonth(m); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getMonth()", + MonthFromTime(LocalTime(t)), + (new Date(t)).getMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getMonth()", + MonthFromTime(LocalTime(t+1)), + (new Date(t+1)).getMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getMonth()", + MonthFromTime(LocalTime(t-1)), + (new Date(t-1)).getMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getMonth()", + MonthFromTime(LocalTime(t-TZ_ADJUST)), + (new Date(t-TZ_ADJUST)).getMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getMonth()", + MonthFromTime(LocalTime(t+TZ_ADJUST)), + (new Date(t+TZ_ADJUST)).getMonth() ); + + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js new file mode 100644 index 0000000..9fda4ea --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.9.js + ECMA Section: 15.9.5.9 + Description: Date.prototype.getUTCMonth + + 1. Let t be this time value. + 2. If t is NaN, return NaN. + 3. Return MonthFromTime(t). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5.8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Date.prototype.getUTCMonth()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var TZ_ADJUST = TZ_DIFF * msPerHour; + + // get the current time + var now = (new Date()).valueOf(); + + // get time for 29 feb 2000 + + var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; + + // get time for 1 jan 2005 + + var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ + TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); + + addTestCase( now ); + addTestCase( TIME_YEAR_0 ); + addTestCase( TIME_1970 ); + addTestCase( TIME_1900 ); + addTestCase( TIME_2000 ); + addTestCase( UTC_FEB_29_2000 ); + addTestCase( UTC_JAN_1_2005 ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date(NaN)).getUTCMonth()", + NaN, + (new Date(NaN)).getUTCMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getUTCMonth.length", + 0, + Date.prototype.getUTCMonth.length ); + test(); +function addTestCase( t ) { + for ( var m = 0; m < 12; m++ ) { + + t += TimeInMonth(m); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+t+")).getUTCMonth()", + MonthFromTime(t), + (new Date(t)).getUTCMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+1)+")).getUTCMonth()", + MonthFromTime(t+1), + (new Date(t+1)).getUTCMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-1)+")).getUTCMonth()", + MonthFromTime(t-1), + (new Date(t-1)).getUTCMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()", + MonthFromTime(t-TZ_ADJUST), + (new Date(t-TZ_ADJUST)).getUTCMonth() ); + + testcases[tc++] = new TestCase( SECTION, + "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()", + MonthFromTime(t+TZ_ADJUST), + (new Date(t+TZ_ADJUST)).getUTCMonth() ); + + } +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js new file mode 100644 index 0000000..d7bd303 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.js + ECMA Section: 15.9.5 Properties of the Date prototype object + Description: + + The Date prototype object is itself a Date object (its [[Class]] is + "Date") whose value is NaN. + + The value of the internal [[Prototype]] property of the Date prototype + object is the Object prototype object (15.2.3.1). + + In following descriptions of functions that are properties of the Date + prototype object, the phrase "this Date object" refers to the object that + is the this value for the invocation of the function; it is an error if + this does not refer to an object for which the value of the internal + [[Class]] property is "Date". Also, the phrase "this time value" refers + to the number value for the time represented by this Date object, that is, + the value of the internal [[Value]] property of this Date object. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.9.5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Date Prototype Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + Date.prototype.getClass = Object.prototype.toString; + + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.getClass", + "[object Date]", + Date.prototype.getClass() ); + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.valueOf()", + NaN, + Date.prototype.valueOf() ); + testcases[tc++] = new TestCase( SECTION, + "Date.prototype.__proto__ == Object.prototype", + true, + Date.prototype.__proto__ == Object.prototype ); + test(); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js new file mode 100644 index 0000000..f827cc7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js @@ -0,0 +1,107 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.3-1.js + ECMA Section: 10.1.3 + Description: + + For each formal parameter, as defined in the FormalParameterList, create + a property of the variable object whose name is the Identifier and whose + attributes are determined by the type of code. The values of the + parameters are supplied by the caller. If the caller supplies fewer + parameter values than there are formal parameters, the extra formal + parameters have value undefined. If two or more formal parameters share + the same name, hence the same property, the corresponding property is + given the value that was supplied for the last parameter with this name. + If the value of this last parameter was not supplied by the caller, + the value of the corresponding property is undefined. + + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.1.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Variable Instantiation: Formal Parameters"; + var BUGNUMBER="104191"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var myfun1 = new Function( "a", "a", "return a" ); + var myfun2 = new Function( "a", "b", "a", "return a" ); + + function myfun3(a, b, a) { + return a; + } + + // myfun1, myfun2, myfun3 tostring + + + testcases[tc++] = new TestCase( + SECTION, + String(myfun2) +"; myfun2(2,4,8)", + 8, + myfun2(2,4,8) ); + + testcases[tc++] = new TestCase( + SECTION, + "myfun2(2,4)", + void 0, + myfun2(2,4)); + + testcases[tc++] = new TestCase( + SECTION, + String(myfun3) +"; myfun3(2,4,8)", + 8, + myfun3(2,4,8) ); + + testcases[tc++] = new TestCase( + SECTION, + "myfun3(2,4)", + void 0, + myfun3(2,4) ); + + + + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js new file mode 100644 index 0000000..be75451 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js @@ -0,0 +1,160 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.3.js + ECMA Section: 10.1.3.js Variable Instantiation + Description: + Author: christine@netscape.com + Date: 11 september 1997 +*/ + +var SECTION = "10.1.3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Variable instantiation"; +var BUGNUMBER = "20256"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcases = getTestCases(); + +test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + // overriding a variable or function name with a function should succeed + array[item++] = + new TestCase(SECTION, + "function t() { return \"first\" };" + + "function t() { return \"second\" };t() ", + "second", + eval("function t() { return \"first\" };" + + "function t() { return \"second\" };t()")); + + array[item++] = + new TestCase(SECTION, + "var t; function t(){}; typeof(t)", + "function", + eval("var t; function t(){}; typeof(t)")); + + + // formal parameter tests + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return b; }; t1( 4 );", + void 0, + eval("function t1(a,b) { return b; }; t1( 4 );") ); + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return a; }; t1(4);", + 4, + eval("function t1(a,b) { return a; }; t1(4)")); + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return a; }; t1();", + void 0, + eval("function t1(a,b) { return a; }; t1()")); + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return a; }; t1(1,2,4);", + 1, + eval("function t1(a,b) { return a; }; t1(1,2,4)")); +/* + array[item++] = + new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );", + void 0, + eval("function t1(a,a) { return a; }; t1( 4 )")); + array[item++] = + new TestCase(SECTION, + "function t1(a,a) { return a; }; t1( 1,2 );", + 2, + eval("function t1(a,a) { return a; }; t1( 1,2 )")); +*/ + // variable declarations + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return a; }; t1( false, true );", + false, + eval("function t1(a,b) { return a; }; t1( false, true );")); + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return b; }; t1( false, true );", + true, + eval("function t1(a,b) { return b; }; t1( false, true );")); + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return a+b; }; t1( 4, 2 );", + 6, + eval("function t1(a,b) { return a+b; }; t1( 4, 2 );")); + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { return a+b; }; t1( 4 );", + Number.NaN, + eval("function t1(a,b) { return a+b; }; t1( 4 );")); + + // overriding a function name with a variable should fail + array[item++] = + new TestCase(SECTION, + "function t() { return 'function' };" + + "var t = 'variable'; typeof(t)", + "string", + eval("function t() { return 'function' };" + + "var t = 'variable'; typeof(t)")); + + // function as a constructor + array[item++] = + new TestCase(SECTION, + "function t1(a,b) { var a = b; return a; } t1(1,3);", + 3, + eval("function t1(a, b){ var a = b; return a;}; t1(1,3)")); + array[item++] = + new TestCase(SECTION, + "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a", + 3, + eval("function t2(a,b) { this.a = b; };" + + "x = new t2(1,3); x.a")); + array[item++] = + new TestCase(SECTION, + "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a", + 1, + eval("function t2(a,b) { this.a = a; };" + + "x = new t2(1,3); x.a")); + array[item++] = + new TestCase(SECTION, + "function t2(a,b) { this.a = b; this.b = a; } " + + "x = new t2(1,3);x.a;", + 3, + eval("function t2(a,b) { this.a = b; this.b = a; };" + + "x = new t2(1,3);x.a;")); + array[item++] = + new TestCase(SECTION, + "function t2(a,b) { this.a = b; this.b = a; }" + + "x = new t2(1,3);x.b;", + 1, + eval("function t2(a,b) { this.a = b; this.b = a; };" + + "x = new t2(1,3);x.b;") ); + + return (array); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js new file mode 100644 index 0000000..6390960 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += "( " + INPUT +" )" ; + + with ( MYOBJECT ) { + testcases[tc].actual = eval( INPUT ); + testcases[tc].expect = Math.pow(INPUT,2); + } + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should return square of " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js new file mode 100644 index 0000000..6966acf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js @@ -0,0 +1,94 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-10.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-10"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + var VALUE = 12345; + var MYOBJECT = new Number( VALUE ); + + with ( MYOBJECT ) { + testcases[tc].actual = toString(); + testcases[tc].expect = String(VALUE); + } + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "MYOBJECT.toString()" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js new file mode 100644 index 0000000..b42697a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-2"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += "( "+INPUT +" )" ; + + with ( this ) { + with ( MYOBJECT ) { + testcases[tc].actual = eval( INPUT ); + testcases[tc].expect = Math.pow(INPUT,2); + } + } + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should return square of " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js new file mode 100644 index 0000000..54980af --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-3"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += ( INPUT +"" ); + + with ( MYOBJECT ) { + eval( INPUT ); + } + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js new file mode 100644 index 0000000..88f8241 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += ( INPUT +"" ); + + with ( MYOBJECT ) { + eval( INPUT ); + } + + testcases[tc].actual = eval( INPUT ); + testcases[tc].expect = INPUT; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js new file mode 100644 index 0000000..f03d120 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += ( INPUT +"" ); + + with ( MYOBJECT ) { + eval = null; + } + + testcases[tc].actual = eval( INPUT ); + testcases[tc].expect = INPUT; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js new file mode 100644 index 0000000..def668a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + getTestCases(); + test(); + +function getTestCases() { + testcases[0] = new TestCase( "SECTION", + "with MyObject, eval should be [object Global].eval " ); + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[0].description += ( INPUT +"" ); + + with ( MYOBJECT ) { + ; + } + testcases[0].actual = eval( INPUT ); + testcases[0].expect = INPUT; + +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js new file mode 100644 index 0000000..7f900b5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-7"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += ( INPUT +"" ); + + with ( MYOBJECT ) { + delete( eval ); + testcases[tc].actual = eval( INPUT ); + testcases[tc].expect = INPUT; + } + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js new file mode 100644 index 0000000..288f0ed --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-1.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var INPUT = 2; + testcases[tc].description += ( INPUT +"" ); + + with ( MYOBJECT ) { + eval = new Function ( "x", "return(Math.pow(Number(x),3))" ); + + testcases[tc].actual = eval( INPUT ); + testcases[tc].expect = Math.pow(INPUT,3); + } + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "with MyObject, eval should cube INPUT: " ); + + return ( array ); +} + +function MyObject() { + this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js new file mode 100644 index 0000000..ec72ecd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.4-9.js + ECMA Section: 10.1.4 Scope Chain and Identifier Resolution + Description: + Every execution context has associated with it a scope chain. This is + logically a list of objects that are searched when binding an Identifier. + When control enters an execution context, the scope chain is created and + is populated with an initial set of objects, depending on the type of + code. When control leaves the execution context, the scope chain is + destroyed. + + During execution, the scope chain of the execution context is affected + only by WithStatement. When execution enters a with block, the object + specified in the with statement is added to the front of the scope chain. + When execution leaves a with block, whether normally or via a break or + continue statement, the object is removed from the scope chain. The object + being removed will always be the first object in the scope chain. + + During execution, the syntactic production PrimaryExpression : Identifier + is evaluated using the following algorithm: + + 1. Get the next object in the scope chain. If there isn't one, go to step 5. + 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as + the property. + 3. If Result(2) is true, return a value of type Reference whose base object + is Result(l) and whose property name is the Identifier. + 4. Go to step 1. + 5. Return a value of type Reference whose base object is null and whose + property name is the Identifier. + The result of binding an identifier is always a value of type Reference with + its member name component equal to the identifier string. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.1.4-9"; + var VERSION = "ECMA_2"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + var MYOBJECT = new MyObject(); + var RESULT = "hello"; + + with ( MYOBJECT ) { + NEW_PROPERTY = RESULT; + } + testcases[tc].actual = NEW_PROPERTY; + testcases[tc].expect = RESULT; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "NEW_PROPERTY = " ); + + return ( array ); +} +function MyObject( n ) { + this.__proto__ = Number.prototype; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js new file mode 100644 index 0000000..0cfb7c3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js @@ -0,0 +1,118 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.5-1.js + ECMA Section: 10.1.5 Global Object + Description: + There is a unique global object which is created before control enters + any execution context. Initially the global object has the following + properties: + + Built-in objects such as Math, String, Date, parseInt, etc. These have + attributes { DontEnum }. + + Additional host defined properties. This may include a property whose + value is the global object itself, for example window in HTML. + + As control enters execution contexts, and as ECMAScript code is executed, + additional properties may be added to the global object and the initial + properties may be changed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.5.1-1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Global Ojbect"); + + var testcases = getTestCases(); + + if ( Object == null ) { + testcases[0].reason += " Object == null" ; + } + if ( Function == null ) { + testcases[0].reason += " Function == null"; + } + if ( String == null ) { + testcases[0].reason += " String == null"; + } + if ( Array == null ) { + testcases[0].reason += " Array == null"; + } + if ( Number == null ) { + testcases[0].reason += " Function == null"; + } + if ( Math == null ) { + testcases[0].reason += " Math == null"; + } + if ( Boolean == null ) { + testcases[0].reason += " Boolean == null"; + } + if ( Date == null ) { + testcases[0].reason += " Date == null"; + } +/* + if ( NaN == null ) { + testcases[0].reason += " NaN == null"; + } + if ( Infinity == null ) { + testcases[0].reason += " Infinity == null"; + } +*/ + if ( eval == null ) { + testcases[0].reason += " eval == null"; + } + if ( parseInt == null ) { + testcases[0].reason += " parseInt == null"; + } + + if ( testcases[0].reason != "" ) { + testcases[0].actual = "fail"; + } else { + testcases[0].actual = "pass"; + } + testcases[0].expect = "pass"; + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "Global Code check" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js new file mode 100644 index 0000000..a09c1ae --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 10.1.5-2.js + ECMA Section: 10.1.5 Global Object + Description: + There is a unique global object which is created before control enters + any execution context. Initially the global object has the following + properties: + + Built-in objects such as Math, String, Date, parseInt, etc. These have + attributes { DontEnum }. + + Additional host defined properties. This may include a property whose + value is the global object itself, for example window in HTML. + + As control enters execution contexts, and as ECMAScript code is executed, + additional properties may be added to the global object and the initial + properties may be changed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.5.1-2"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Global Ojbect"); + + var testcases = getTestCases(); + + var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' + + 'if ( Function == null ) { testcases[0].reason += " Function == null"; }' + + 'if ( String == null ) { testcases[0].reason += " String == null"; }' + + 'if ( Array == null ) { testcases[0].reason += " Array == null"; }' + + 'if ( Number == null ) { testcases[0].reason += " Function == null";}' + + 'if ( Math == null ) { testcases[0].reason += " Math == null"; }' + + 'if ( Boolean == null ) { testcases[0].reason += " Boolean == null"; }' + + 'if ( Date == null ) { testcases[0].reason += " Date == null"; }' + + 'if ( eval == null ) { testcases[0].reason += " eval == null"; }' + + 'if ( parseInt == null ) { testcases[0].reason += " parseInt == null"; }' ; + + eval( EVAL_STRING ); + +/* + if ( NaN == null ) { + testcases[0].reason += " NaN == null"; + } + if ( Infinity == null ) { + testcases[0].reason += " Infinity == null"; + } +*/ + + if ( testcases[0].reason != "" ) { + testcases[0].actual = "fail"; + } else { + testcases[0].actual = "pass"; + } + testcases[0].expect = "pass"; + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual + " "+ + testcases[tc].reason ); + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "Eval Code check" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js new file mode 100644 index 0000000..7b0f85f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js @@ -0,0 +1,119 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.5-3.js + ECMA Section: 10.1.5 Global Object + Description: + There is a unique global object which is created before control enters + any execution context. Initially the global object has the following + properties: + + Built-in objects such as Math, String, Date, parseInt, etc. These have + attributes { DontEnum }. + + Additional host defined properties. This may include a property whose + value is the global object itself, for example window in HTML. + + As control enters execution contexts, and as ECMAScript code is executed, + additional properties may be added to the global object and the initial + properties may be changed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.5.1-3"; + var VERSION = "ECMA_1"; + startTest(); + writeHeaderToLog( SECTION + " Global Ojbect"); + + var testcases = getTestCases(); + + test(); + +function test() { + if ( Object == null ) { + testcases[0].reason += " Object == null" ; + } + if ( Function == null ) { + testcases[0].reason += " Function == null"; + } + if ( String == null ) { + testcases[0].reason += " String == null"; + } + if ( Array == null ) { + testcases[0].reason += " Array == null"; + } + if ( Number == null ) { + testcases[0].reason += " Function == null"; + } + if ( Math == null ) { + testcases[0].reason += " Math == null"; + } + if ( Boolean == null ) { + testcases[0].reason += " Boolean == null"; + } + if ( Date == null ) { + testcases[0].reason += " Date == null"; + } +/* + if ( NaN == null ) { + testcases[0].reason += " NaN == null"; + } + if ( Infinity == null ) { + testcases[0].reason += " Infinity == null"; + } +*/ + if ( eval == null ) { + testcases[0].reason += " eval == null"; + } + if ( parseInt == null ) { + testcases[0].reason += " parseInt == null"; + } + + if ( testcases[0].reason != "" ) { + testcases[0].actual = "fail"; + } else { + testcases[0].actual = "pass"; + } + testcases[0].expect = "pass"; + + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "Function Code check" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js new file mode 100644 index 0000000..2954346 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js @@ -0,0 +1,94 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.5-4.js + ECMA Section: 10.1.5 Global Object + Description: + There is a unique global object which is created before control enters + any execution context. Initially the global object has the following + properties: + + Built-in objects such as Math, String, Date, parseInt, etc. These have + attributes { DontEnum }. + + Additional host defined properties. This may include a property whose + value is the global object itself, for example window in HTML. + + As control enters execution contexts, and as ECMAScript code is executed, + additional properties may be added to the global object and the initial + properties may be changed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "10.5.1-4"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Global Ojbect"); + + var testcases = getTestCases(); + + var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' + + 'if ( Function == null ) { testcases[0].reason += " Function == null"; }' + + 'if ( String == null ) { testcases[0].reason += " String == null"; }' + + 'if ( Array == null ) { testcases[0].reason += " Array == null"; }' + + 'if ( Number == null ) { testcases[0].reason += " Function == null";}' + + 'if ( Math == null ) { testcases[0].reason += " Math == null"; }' + + 'if ( Boolean == null ) { testcases[0].reason += " Boolean == null"; }' + + 'if ( Date == null ) { testcases[0].reason += " Date == null"; }' + + 'if ( eval == null ) { testcases[0].reason += " eval == null"; }' + + 'if ( parseInt == null ) { testcases[0].reason += " parseInt == null"; }' ; + + var NEW_FUNCTION = new Function( EVAL_STRING ); + + if ( testcases[0].reason != "" ) { + testcases[0].actual = "fail"; + } else { + testcases[0].actual = "pass"; + } + testcases[0].expect = "pass"; + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual + " "+ + testcases[tc].reason ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "SECTION", "Anonymous Code check" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js new file mode 100644 index 0000000..8224cb2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js @@ -0,0 +1,124 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.6 + ECMA Section: Activation Object + Description: + + If the function object being invoked has an arguments property, let x be + the value of that property; the activation object is also given an internal + property [[OldArguments]] whose initial value is x; otherwise, an arguments + property is created for the function object but the activation object is + not given an [[OldArguments]] property. Next, arguments object described + below (the same one stored in the arguments property of the activation + object) is used as the new value of the arguments property of the function + object. This new value is installed even if the arguments property already + exists and has the ReadOnly attribute (as it will for native Function + objects). (These actions are taken to provide compatibility with a form of + program syntax that is now discouraged: to access the arguments object for + function f within the body of f by using the expression f.arguments. + The recommended way to access the arguments object for function f within + the body of f is simply to refer to the variable arguments.) + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.1.6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Activation Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var arguments = "FAILED!"; + + var ARG_STRING = "value of the argument property"; + + testcases[tc++] = new TestCase( SECTION, + "(new TestObject(0,1,2,3,4,5)).length", + 6, + (new TestObject(0,1,2,3,4,5)).length ); + + for ( i = 0; i < 6; i++ ) { + + testcases[tc++] = new TestCase( SECTION, + "(new TestObject(0,1,2,3,4,5))["+i+"]", + i, + (new TestObject(0,1,2,3,4,5))[i]); + } + + + // The current object already has an arguments property. + + testcases[tc++] = new TestCase( SECTION, + "(new AnotherTestObject(1,2,3)).arguments", + ARG_STRING, + (new AnotherTestObject(1,2,3)).arguments ); + + // The function invoked with [[Call]] + + testcases[tc++] = new TestCase( SECTION, + "TestFunction(1,2,3)", + ARG_STRING, + TestFunction() + '' ); + + + test(); + + + +function Prototype() { + this.arguments = ARG_STRING; +} +function TestObject() { + this.__proto__ = new Prototype(); + return arguments; +} +function AnotherTestObject() { + this.__proto__ = new Prototype(); + return this; +} +function TestFunction() { + arguments = ARG_STRING; + return arguments; +} +function AnotherTestFunction() { + this.__proto__ = new Prototype(); + return this; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js new file mode 100644 index 0000000..28b403f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js @@ -0,0 +1,132 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.8 + ECMA Section: Arguments Object + Description: + + When control enters an execution context for declared function code, + anonymous code, or implementation-supplied code, an arguments object is + created and initialized as follows: + + The [[Prototype]] of the arguments object is to the original Object + prototype object, the one that is the initial value of Object.prototype + (section 15.2.3.1). + + A property is created with name callee and property attributes {DontEnum}. + The initial value of this property is the function object being executed. + This allows anonymous functions to be recursive. + + A property is created with name length and property attributes {DontEnum}. + The initial value of this property is the number of actual parameter values + supplied by the caller. + + For each non-negative integer, iarg, less than the value of the length + property, a property is created with name ToString(iarg) and property + attributes { DontEnum }. The initial value of this property is the value + of the corresponding actual parameter supplied by the caller. The first + actual parameter value corresponds to iarg = 0, the second to iarg = 1 and + so on. In the case when iarg is less than the number of formal parameters + for the function object, this property shares its value with the + corresponding property of the activation object. This means that changing + this property changes the corresponding property of the activation object + and vice versa. The value sharing mechanism depends on the implementation. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.1.8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Arguments Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var ARG_STRING = "value of the argument property"; + + testcases[tc++] = new TestCase( SECTION, + "GetCallee()", + GetCallee, + GetCallee() ); + + var LIMIT = 100; + + for ( var i = 0, args = "" ; i < LIMIT; i++ ) { + args += String(i) + ( i+1 < LIMIT ? "," : "" ); + + } + + var LENGTH = eval( "GetLength("+ args +")" ); + + testcases[tc++] = new TestCase( SECTION, + "GetLength("+args+")", + 100, + LENGTH ); + + var ARGUMENTS = eval( "GetArguments( " +args+")" ); + + for ( var i = 0; i < 100; i++ ) { + testcases[tc++] = new TestCase( SECTION, + "GetArguments("+args+")["+i+"]", + i, + ARGUMENTS[i] ); + } + + test(); + +function TestFunction() { + var arg_proto = arguments.__proto__; +} +function GetCallee() { + var c = arguments.callee; + return c; +} +function GetArguments() { + var a = arguments; + return a; +} +function GetLength() { + var l = arguments.length; + return l; +} + +function AnotherTestFunction() { + this.__proto__ = new Prototype(); + return this; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js new file mode 100644 index 0000000..b4ff578 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js @@ -0,0 +1,117 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.1.8-2 + ECMA Section: Arguments Object + Description: + + When control enters an execution context for declared function code, + anonymous code, or implementation-supplied code, an arguments object is + created and initialized as follows: + + The [[Prototype]] of the arguments object is to the original Object + prototype object, the one that is the initial value of Object.prototype + (section 15.2.3.1). + + A property is created with name callee and property attributes {DontEnum}. + The initial value of this property is the function object being executed. + This allows anonymous functions to be recursive. + + A property is created with name length and property attributes {DontEnum}. + The initial value of this property is the number of actual parameter values + supplied by the caller. + + For each non-negative integer, iarg, less than the value of the length + property, a property is created with name ToString(iarg) and property + attributes { DontEnum }. The initial value of this property is the value + of the corresponding actual parameter supplied by the caller. The first + actual parameter value corresponds to iarg = 0, the second to iarg = 1 and + so on. In the case when iarg is less than the number of formal parameters + for the function object, this property shares its value with the + corresponding property of the activation object. This means that changing + this property changes the corresponding property of the activation object + and vice versa. The value sharing mechanism depends on the implementation. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.1.8-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Arguments Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +// Tests for anonymous functions + + var GetCallee = new Function( "var c = arguments.callee; return c" ); + var GetArguments = new Function( "var a = arguments; return a" ); + var GetLength = new Function( "var l = arguments.length; return l" ); + + var ARG_STRING = "value of the argument property"; + + testcases[tc++] = new TestCase( SECTION, + "GetCallee()", + GetCallee, + GetCallee() ); + + var LIMIT = 100; + + for ( var i = 0, args = "" ; i < LIMIT; i++ ) { + args += String(i) + ( i+1 < LIMIT ? "," : "" ); + + } + + var LENGTH = eval( "GetLength("+ args +")" ); + + testcases[tc++] = new TestCase( SECTION, + "GetLength("+args+")", + 100, + LENGTH ); + + var ARGUMENTS = eval( "GetArguments( " +args+")" ); + + for ( var i = 0; i < 100; i++ ) { + testcases[tc++] = new TestCase( SECTION, + "GetArguments("+args+")["+i+"]", + i, + ARGUMENTS[i] ); + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js new file mode 100644 index 0000000..5e5737b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js @@ -0,0 +1,82 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.2.1.js + ECMA Section: 10.2.1 Global Code + Description: + + The scope chain is created and initialized to contain the global object and + no others. + + Variable instantiation is performed using the global object as the variable + object and using empty property attributes. + + The this value is the global object. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.2.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Global Code"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var THIS = this; + + testcases[tc++] = new TestCase( SECTION, + "this +''", + GLOBAL, + THIS + "" ); + + var GLOBAL_PROPERTIES = new Array(); + var i = 0; + + for ( p in this ) { + GLOBAL_PROPERTIES[i++] = p; + } + + for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, + GLOBAL_PROPERTIES[i] +" == void 0", + false, + eval("GLOBAL_PROPERTIES["+i+"] == void 0")); + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js new file mode 100644 index 0000000..db03ad6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js @@ -0,0 +1,119 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.2.2-1.js + ECMA Section: 10.2.2 Eval Code + Description: + + When control enters an execution context for eval code, the previous + active execution context, referred to as the calling context, is used to + determine the scope chain, the variable object, and the this value. If + there is no calling context, then initializing the scope chain, variable + instantiation, and determination of the this value are performed just as + for global code. + + The scope chain is initialized to contain the same objects, in the same + order, as the calling context's scope chain. This includes objects added + to the calling context's scope chain by WithStatement. + + Variable instantiation is performed using the calling context's variable + object and using empty property attributes. + + The this value is the same as the this value of the calling context. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.2.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Eval Code"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var THIS = eval("this"); + + testcases[tc++] = new TestCase( SECTION, + "this +''", + GLOBAL, + THIS + "" ); + + var GLOBAL_PROPERTIES = new Array(); + var i = 0; + + for ( p in THIS ) { + GLOBAL_PROPERTIES[i++] = p; + } + + for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, + GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]", + true, + eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") ); + } + + // this in eval statements is the same as this value of the calling context + + var RESULT = THIS == this; + + testcases[tc++] = new TestCase( SECTION, + "eval( 'this == THIS' )", + true, + RESULT ); + + var RESULT = THIS +''; + + testcases[tc++] = new TestCase( SECTION, + "eval( 'this + \"\"' )", + GLOBAL, + RESULT ); + + + testcases[tc++] = new TestCase( SECTION, + "eval( 'this == THIS' )", + true, + eval( "this == THIS" ) ); + + testcases[tc++] = new TestCase( SECTION, + "eval( 'this + \"\"' )", + GLOBAL, + eval( "this +''") ); + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js new file mode 100644 index 0000000..c73feff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.2.2-2.js + ECMA Section: 10.2.2 Eval Code + Description: + + When control enters an execution context for eval code, the previous + active execution context, referred to as the calling context, is used to + determine the scope chain, the variable object, and the this value. If + there is no calling context, then initializing the scope chain, variable + instantiation, and determination of the this value are performed just as + for global code. + + The scope chain is initialized to contain the same objects, in the same + order, as the calling context's scope chain. This includes objects added + to the calling context's scope chain by WithStatement. + + Variable instantiation is performed using the calling context's variable + object and using empty property attributes. + + The this value is the same as the this value of the calling context. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.2.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Eval Code"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // Test Objects + + var OBJECT = new MyObject( "hello" ); + var GLOBAL_PROPERTIES = new Array(); + var i = 0; + + for ( p in this ) { + GLOBAL_PROPERTIES[i++] = p; + } + + with ( OBJECT ) { + var THIS = this; + testcases[tc++] = new TestCase( SECTION, "eval( 'this == THIS' )", true, eval("this == THIS") ); + testcases[tc++] = new TestCase( SECTION, "this in a with() block", GLOBAL, this+"" ); + testcases[tc++] = new TestCase( SECTION, "new MyObject('hello').value", "hello", value ); + testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').value)", "hello", eval("value") ); + testcases[tc++] = new TestCase( SECTION, "new MyObject('hello').getClass()", "[object Object]", getClass() ); + testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').getClass())", "[object Object]", eval("getClass()") ); + testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').toString())", "hello", eval("toString()") ); + testcases[tc++] = new TestCase( SECTION, "eval('getClass') == Object.prototype.toString", true, eval("getClass") == Object.prototype.toString ); + + for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, GLOBAL_PROPERTIES[i] + + " == THIS["+GLOBAL_PROPERTIES[i]+"]", true, + eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") ); + } + + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.getClass = Object.prototype.toString; + this.toString = new Function( "return this.value+''" ); + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js new file mode 100644 index 0000000..be1a00f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.2.3-1.js + ECMA Section: 10.2.3 Function and Anonymous Code + Description: + + The scope chain is initialized to contain the activation object followed + by the global object. Variable instantiation is performed using the + activation by the global object. Variable instantiation is performed using + the activation object as the variable object and using property attributes + { DontDelete }. The caller provides the this value. If the this value + provided by the caller is not an object (including the case where it is + null), then the this value is the global object. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.2.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Eval Code"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var o = new MyObject("hello") + + testcases[tc++] = new TestCase( SECTION, + "var o = new MyObject('hello'); o.THIS == x", + true, + o.THIS == o ); + + var o = MyFunction(); + + testcases[tc++] = new TestCase( SECTION, + "var o = MyFunction(); o == this", + true, + o == this ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function MyFunction( value ) { + return this; +} +function MyObject( value ) { + this.THIS = this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js new file mode 100644 index 0000000..084d72f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js @@ -0,0 +1,89 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 10.2.3-2.js + ECMA Section: 10.2.3 Function and Anonymous Code + Description: + + The scope chain is initialized to contain the activation object followed + by the global object. Variable instantiation is performed using the + activation by the global object. Variable instantiation is performed using + the activation object as the variable object and using property attributes + { DontDelete }. The caller provides the this value. If the this value + provided by the caller is not an object (including the case where it is + null), then the this value is the global object. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "10.2.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function and Anonymous Code"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var o = new MyObject("hello") + + testcases[tc++] = new TestCase( SECTION, + "MyFunction(\"PASSED!\")", + "PASSED!", + MyFunction("PASSED!") ); + + var o = MyFunction(); + + testcases[tc++] = new TestCase( SECTION, + "MyOtherFunction(true);", + false, + MyOtherFunction(true) ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function MyFunction( value ) { + var x = value; + delete x; + return x; +} +function MyOtherFunction(value) { + var x = value; + return delete x; +} +function MyObject( value ) { + this.THIS = this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js new file mode 100644 index 0000000..5801961 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js @@ -0,0 +1,135 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.1.1.js + ECMA Section: 11.1.1 The this keyword + Description: + + The this keyword evaluates to the this value of the execution context. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.1.1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " The this keyword"); + + var testcases = new Array(); + var item = 0; + + var GLOBAL_OBJECT = this.toString(); + + // this in global code and eval(this) in global code should return the global object. + + testcases[item++] = new TestCase( SECTION, + "Global Code: this.toString()", + GLOBAL_OBJECT, + this.toString() ); + + testcases[item++] = new TestCase( SECTION, + "Global Code: eval('this.toString()')", + GLOBAL_OBJECT, + eval('this.toString()') ); + + // this in anonymous code called as a function should return the global object. + + testcases[item++] = new TestCase( SECTION, + "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()", + GLOBAL_OBJECT, + eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") ); + + // eval( this ) in anonymous code called as a function should return that function's activation object + + testcases[item++] = new TestCase( SECTION, + "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()", + GLOBAL_OBJECT, + eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") ); + + // this and eval( this ) in anonymous code called as a constructor should return the object + + testcases[item++] = new TestCase( SECTION, + "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()", + "[object Object]", + eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") ); + + testcases[item++] = new TestCase( SECTION, + "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1", + true, + eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") ); + + testcases[item++] = new TestCase( SECTION, + "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()", + "[object Object]", + eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") ); + + testcases[item++] = new TestCase( SECTION, + "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1", + true, + eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") ); + + // this and eval(this) in function code called as a function should return the global object. + testcases[item++] = new TestCase( SECTION, + "Function Code: ReturnThis()", + GLOBAL_OBJECT, + ReturnThis() ); + + testcases[item++] = new TestCase( SECTION, + "Function Code: ReturnEvalThis()", + GLOBAL_OBJECT, + ReturnEvalThis() ); + + // this and eval(this) in function code called as a contructor should return the object. + testcases[item++] = new TestCase( SECTION, + "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()", + "[object Object]", + eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") ); + + testcases[item++] = new TestCase( SECTION, + "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()", + "[object Object]", + eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") ); + + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function ReturnThis() { + return this.toString(); +} +function ReturnEvalThis() { + return( eval("this.toString()") ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js new file mode 100644 index 0000000..c5f6911 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js @@ -0,0 +1,270 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.10-1.js + ECMA Section: 11.10-1 Binary Bitwise Operators: & + Description: + Semantics + + The production A : A @ B, where @ is one of the bitwise operators in the + productions &, ^, | , is evaluated as follows: + + 1. Evaluate A. + 2. Call GetValue(Result(1)). + 3. Evaluate B. + 4. Call GetValue(Result(3)). + 5. Call ToInt32(Result(2)). + 6. Call ToInt32(Result(4)). + 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is + a signed 32 bit integer. + 8. Return Result(7). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.10-1"; + var VERSION = "ECMA_1"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Binary Bitwise Operators: &"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + var shiftexp = 0; + var addexp = 0; + +// for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { + for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) { + shiftexp += Math.pow( 2, shiftpow ); + + for ( addpow = 0; addpow < 33; addpow++ ) { + addexp += Math.pow(2, addpow); + + array[item++] = new TestCase( SECTION, + shiftexp + " & " + addexp, + And( shiftexp, addexp ), + shiftexp & addexp ); + } + } + + return ( array ); +} +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + + } + + return r; +} +function And( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { + result += "1"; + } else { + result += "0"; + } + } + return ToInt32Decimal(result); +} +function Xor( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || + (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") + ) { + result += "1"; + } else { + result += "0"; + } + } + + return ToInt32Decimal(result); +} +function Or( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { + result += "1"; + } else { + result += "0"; + } + } + + return ToInt32Decimal(result); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js new file mode 100644 index 0000000..fc2e10e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js @@ -0,0 +1,269 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.10-2.js + ECMA Section: 11.10-2 Binary Bitwise Operators: | + Description: + Semantics + + The production A : A @ B, where @ is one of the bitwise operators in the + productions &, ^, | , is evaluated as follows: + + 1. Evaluate A. + 2. Call GetValue(Result(1)). + 3. Evaluate B. + 4. Call GetValue(Result(3)). + 5. Call ToInt32(Result(2)). + 6. Call ToInt32(Result(4)). + 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is + a signed 32 bit integer. + 8. Return Result(7). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.10-2"; + var VERSION = "ECMA_1"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Binary Bitwise Operators: |"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + var shiftexp = 0; + var addexp = 0; + + for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { + shiftexp += Math.pow( 2, shiftpow ); + + for ( addpow = 0; addpow < 33; addpow++ ) { + addexp += Math.pow(2, addpow); + + array[item++] = new TestCase( SECTION, + shiftexp + " | " + addexp, + Or( shiftexp, addexp ), + shiftexp | addexp ); + } + } + + return ( array ); +} +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + + } + + return r; +} +function And( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { + result += "1"; + } else { + result += "0"; + } + } + return ToInt32Decimal(result); +} +function Xor( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || + (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") + ) { + result += "1"; + } else { + result += "0"; + } + } + + return ToInt32Decimal(result); +} +function Or( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { + result += "1"; + } else { + result += "0"; + } + } + + return ToInt32Decimal(result); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js new file mode 100644 index 0000000..0d55357 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js @@ -0,0 +1,268 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.10-3.js + ECMA Section: 11.10-3 Binary Bitwise Operators: ^ + Description: + Semantics + + The production A : A @ B, where @ is one of the bitwise operators in the + productions &, ^, | , is evaluated as follows: + + 1. Evaluate A. + 2. Call GetValue(Result(1)). + 3. Evaluate B. + 4. Call GetValue(Result(3)). + 5. Call ToInt32(Result(2)). + 6. Call ToInt32(Result(4)). + 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is + a signed 32 bit integer. + 8. Return Result(7). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.10-3"; + var VERSION = "ECMA_1"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + var shiftexp = 0; + var addexp = 0; + + for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { + shiftexp += Math.pow( 2, shiftpow ); + + for ( addpow = 0; addpow < 33; addpow++ ) { + addexp += Math.pow(2, addpow); + + array[item++] = new TestCase( SECTION, + shiftexp + " ^ " + addexp, + Xor( shiftexp, addexp ), + shiftexp ^ addexp ); + } + } + + return ( array ); +} +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + + } + + return r; +} +function And( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { + result += "1"; + } else { + result += "0"; + } + } + return ToInt32Decimal(result); +} +function Xor( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || + (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") + ) { + result += "1"; + } else { + result += "0"; + } + } + + return ToInt32Decimal(result); +} +function Or( s, a ) { + s = ToInt32( s ); + a = ToInt32( a ); + + var bs = ToInt32BitString( s ); + var ba = ToInt32BitString( a ); + + var result = ""; + + for ( var bit = 0; bit < bs.length; bit++ ) { + if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { + result += "1"; + } else { + result += "0"; + } + } + + return ToInt32Decimal(result); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js new file mode 100644 index 0000000..ae0a263 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.12.js + ECMA Section: 11.12 Conditional Operator + Description: + Logi + + calORExpression ? AssignmentExpression : AssignmentExpression + + Semantics + + The production ConditionalExpression : + LogicalORExpression ? AssignmentExpression : AssignmentExpression + is evaluated as follows: + + 1. Evaluate LogicalORExpression. + 2. Call GetValue(Result(1)). + 3. Call ToBoolean(Result(2)). + 4. If Result(3) is false, go to step 8. + 5. Evaluate the first AssignmentExpression. + 6. Call GetValue(Result(5)). + 7. Return Result(6). + 8. Evaluate the second AssignmentExpression. + 9. Call GetValue(Result(8)). + 10. Return Result(9). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.12"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Conditional operator( ? : )"); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); + array[item++] = new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); + + array[item++] = new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); + array[item++] = new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); + array[item++] = new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); + + array[item++] = new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED")); + + array[item++] = new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js new file mode 100644 index 0000000..05e42dc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.12-2-n.js + ECMA Section: 11.12 + Description: + + The grammar for a ConditionalExpression in ECMAScript is a little bit + different from that in C and Java, which each allow the second + subexpression to be an Expression but restrict the third expression to + be a ConditionalExpression. The motivation for this difference in + ECMAScript is to allow an assignment expression to be governed by either + arm of a conditional and to eliminate the confusing and fairly useless + case of a comma expression as the center expression. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.12-2-n"; + var VERSION = "ECMA_1"; + startTest(); + writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); + + var testcases = new Array(); + + // the following expression should be an error in JS. + + testcases[tc] = new TestCase( SECTION, + "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR", + "error", + "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR" ); + + // get around parse time error by putting expression in an eval statement + + testcases[tc].actual = eval ( testcases[tc].actual ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js new file mode 100644 index 0000000..eb79c16 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.12-3.js + ECMA Section: 11.12 + Description: + + The grammar for a ConditionalExpression in ECMAScript is a little bit + different from that in C and Java, which each allow the second + subexpression to be an Expression but restrict the third expression to + be a ConditionalExpression. The motivation for this difference in + ECMAScript is to allow an assignment expression to be governed by either + arm of a conditional and to eliminate the confusing and fairly useless + case of a comma expression as the center expression. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.12-3"; + var VERSION = "ECMA_1"; + startTest(); + writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); + + var testcases = new Array(); + + // the following expression should NOT be an error in JS. + + testcases[tc] = new TestCase( SECTION, + "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR", + "PASSED", + "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR" ); + + // get around potential parse time error by putting expression in an eval statement + + testcases[tc].actual = eval ( testcases[tc].actual ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js new file mode 100644 index 0000000..017cf4b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.12-4.js + ECMA Section: 11.12 + Description: + + The grammar for a ConditionalExpression in ECMAScript is a little bit + different from that in C and Java, which each allow the second + subexpression to be an Expression but restrict the third expression to + be a ConditionalExpression. The motivation for this difference in + ECMAScript is to allow an assignment expression to be governed by either + arm of a conditional and to eliminate the confusing and fairly useless + case of a comma expression as the center expression. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.12-4"; + var VERSION = "ECMA_1"; + startTest(); + writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); + + var testcases = new Array(); + + // the following expression should NOT be an error in JS. + + testcases[tc] = new TestCase( SECTION, + "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1", + "PASSED", + "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1" ); + + // get around potential parse time error by putting expression in an eval statement + + testcases[tc].actual = eval ( testcases[tc].actual ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js new file mode 100644 index 0000000..537ec28 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.13.1.js + ECMA Section: 11.13.1 Simple assignment + Description: + + 11.13.1 Simple Assignment ( = ) + + The production AssignmentExpression : + LeftHandSideExpression = AssignmentExpression is evaluated as follows: + + 1. Evaluate LeftHandSideExpression. + 2. Evaluate AssignmentExpression. + 3. Call GetValue(Result(2)). + 4. Call PutValue(Result(1), Result(3)). + 5. Return Result(3). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.13.1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Simple Assignment ( = )"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "SOMEVAR = true", true, SOMEVAR = true ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js new file mode 100644 index 0000000..721fb19 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.13.2-1.js + ECMA Section: 11.13.2 Compound Assignment: *= + Description: + + *= /= %= += -= <<= >>= >>>= &= ^= |= + + 11.13.2 Compound assignment ( op= ) + + The production AssignmentExpression : + LeftHandSideExpression @ = AssignmentExpression, where @ represents one of + the operators indicated above, is evaluated as follows: + + 1. Evaluate LeftHandSideExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AssignmentExpression. + 4. Call GetValue(Result(3)). + 5. Apply operator @ to Result(2) and Result(4). + 6. Call PutValue(Result(1), Result(5)). + 7. Return Result(5). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.13.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Compound Assignment: *="); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // NaN cases + + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") ); + + // number cases + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") ); + + // special multiplication cases + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); + + // string cases + array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2", 2550, eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") ); + + // boolean cases + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 *= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 *= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") ); + + // object cases + array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2", 225, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js new file mode 100644 index 0000000..5838acf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js @@ -0,0 +1,136 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.13.2-2js + ECMA Section: 11.13.2 Compound Assignment: /= + Description: + + *= /= %= += -= <<= >>= >>>= &= ^= |= + + 11.13.2 Compound assignment ( op= ) + + The production AssignmentExpression : + LeftHandSideExpression @ = AssignmentExpression, where @ represents one of + the operators indicated above, is evaluated as follows: + + 1. Evaluate LeftHandSideExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AssignmentExpression. + 4. Call GetValue(Result(3)). + 5. Apply operator @ to Result(2) and Result(4). + 6. Call PutValue(Result(1), Result(5)). + 7. Return Result(5). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.13.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Compound Assignment: /="); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // NaN cases + + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") ); + + // number cases + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2", 25.5, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") ); + + // special division cases + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") ); + + // string cases + array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1", 100, eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1", 100, eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") ); +/* + array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") ); + + // boolean cases + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") ); + + // object cases + array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") ); + +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js new file mode 100644 index 0000000..cf151db --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js @@ -0,0 +1,149 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.13.2-4.js + ECMA Section: 11.13.2 Compound Assignment: %= + Description: + + *= /= %= += -= <<= >>= >>>= &= ^= |= + + 11.13.2 Compound assignment ( op= ) + + The production AssignmentExpression : + LeftHandSideExpression @ = AssignmentExpression, where @ represents one of + the operators indicated above, is evaluated as follows: + + 1. Evaluate LeftHandSideExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AssignmentExpression. + 4. Call GetValue(Result(3)). + 5. Apply operator @ to Result(2) and Result(4). + 6. Call PutValue(Result(1), Result(5)). + 7. Return Result(5). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.13.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Compound Assignment: +="); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // If either operand is NaN, result is NaN + + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") ); + + // if the dividend is infinity or the divisor is zero or both, the result is NaN + + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") ); + + // if the dividend is finite and the divisor is an infinity, the result equals the dividend. + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); + + // if the dividend is a zero and the divisor is finite, the result is the same as the dividend + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") ); + + // string cases + array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1", 0, eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") ); +/* + array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") ); + + // boolean cases + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") ); + + // object cases + array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") ); + +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason %= ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js new file mode 100644 index 0000000..edf79a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js @@ -0,0 +1,137 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.13.2-4.js + ECMA Section: 11.13.2 Compound Assignment:+= + Description: + + *= /= %= += -= <<= >>= >>>= &= ^= |= + + 11.13.2 Compound assignment ( op= ) + + The production AssignmentExpression : + LeftHandSideExpression @ = AssignmentExpression, where @ represents one of + the operators indicated above, is evaluated as follows: + + 1. Evaluate LeftHandSideExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AssignmentExpression. + 4. Call GetValue(Result(3)). + 5. Apply operator @ to Result(2) and Result(4). + 6. Call PutValue(Result(1), Result(5)). + 7. Return Result(5). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.13.2-4"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Compound Assignment: +="); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // If either operand is NaN, result is NaN + + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") ); + + // the sum of two Infinities the same sign is the infinity of that sign + // the sum of two Infinities of opposite sign is NaN + + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); + + // the sum of an infinity and a finite value is equal to the infinite operand + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); + + // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0 + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") ); + + // the sum of a zero and a nonzero finite value is eqal to the nonzero operand + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") ); + + // the sum of a zero and a nozero finite value is equal to the nonzero operand. + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") ); + + // the sum of two nonzero finite values of the same magnitude and opposite sign is +0 + array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") ); + +/* + array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") ); + + // boolean cases + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") ); + + // object cases + array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") ); + +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js new file mode 100644 index 0000000..6923bef --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js @@ -0,0 +1,137 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.13.2-5.js + ECMA Section: 11.13.2 Compound Assignment: -= + Description: + + *= /= %= -= -= <<= >>= >>>= &= ^= |= + + 11.13.2 Compound assignment ( op= ) + + The production AssignmentExpression : + LeftHandSideExpression @ = AssignmentExpression, where @ represents one of + the operators indicated above, is evaluated as follows: + + 1. Evaluate LeftHandSideExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AssignmentExpression. + 4. Call GetValue(Result(3)). + 5. Apply operator @ to Result(2) and Result(4). + 6. Call PutValue(Result(1), Result(5)). + 7. Return Result(5). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.13.2-5"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Compound Assignment: -="); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // If either operand is NaN, result is NaN + + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") ); + + // the sum of two Infinities the same sign is the infinity of that sign + // the sum of two Infinities of opposite sign is NaN + + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + + // the sum of an infinity and a finite value is equal to the infinite operand + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); + + // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0 + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") ); + + // the sum of a zero and a nonzero finite value is eqal to the nonzero operand + + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") ); + + // the sum of a zero and a nozero finite value is equal to the nonzero operand. + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") ); + + // the sum of two nonzero finite values of the same magnitude and opposite sign is +0 + array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") ); + +/* + array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") ); + + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") ); + + // boolean cases + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") ); + + // object cases + array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") ); + array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") ); + array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") ); + +*/ + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason -= ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js new file mode 100644 index 0000000..73b4d19 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.12.js + ECMA Section: 11.12 Conditional Operator + Description: + Logi + + calORExpression ? AssignmentExpression : AssignmentExpression + + Semantics + + The production ConditionalExpression : + LogicalORExpression ? AssignmentExpression : AssignmentExpression + is evaluated as follows: + + 1. Evaluate LogicalORExpression. + 2. Call GetValue(Result(1)). + 3. Call ToBoolean(Result(2)). + 4. If Result(3) is false, go to step 8. + 5. Evaluate the first AssignmentExpression. + 6. Call GetValue(Result(5)). + 7. Return Result(6). + 8. Evaluate the second AssignmentExpression. + 9. Call GetValue(Result(8)). + 10. Return Result(9). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.12"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Conditional operator( ? : )"); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); + array[item++] = new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); + + array[item++] = new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); + array[item++] = new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); + array[item++] = new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); + + array[item++] = new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED")); + + array[item++] = new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js new file mode 100644 index 0000000..bd3e8f1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.14-1.js + ECMA Section: 11.14 Comma operator (,) + Description: + Expression : + + AssignmentExpression + Expression , AssignmentExpression + + Semantics + + The production Expression : Expression , AssignmentExpression is evaluated as follows: + + 1. Evaluate Expression. + 2. Call GetValue(Result(1)). + 3. Evaluate AssignmentExpression. + 4. Call GetValue(Result(3)). + 5. Return Result(4). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.14-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Comma operator (,)"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true, false", false, eval("true, false") ); + array[item++] = new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") ); + array[item++] = new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") ); + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js new file mode 100644 index 0000000..6144c9a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js @@ -0,0 +1,268 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.1-1.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Properties are accessed by name, using either the dot notation: + MemberExpression . Identifier + CallExpression . Identifier + + or the bracket notation: MemberExpression [ Expression ] + CallExpression [ Expression ] + + The dot notation is explained by the following syntactic conversion: + MemberExpression . Identifier + is identical in its behavior to + MemberExpression [ <identifier-string> ] + and similarly + CallExpression . Identifier + is identical in its behavior to + CallExpression [ <identifier-string> ] + where <identifier-string> is a string literal containing the same sequence + of characters as the Identifier. + + The production MemberExpression : MemberExpression [ Expression ] is + evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Expression. + 4. Call GetValue(Result(3)). + 5. Call ToObject(Result(2)). + 6. Call ToString(Result(4)). + 7. Return a value of type Reference whose base object is Result(5) and + whose property name is Result(6). + + The production CallExpression : CallExpression [ Expression ] is evaluated + in exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.2.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + var testcases = new Array(); + + // go through all Native Function objects, methods, and properties and get their typeof. + + var PROPERTY = new Array(); + var p = 0; + + // properties and functions of the global object + + PROPERTY[p++] = new Property( "this", "NaN", "number" ); + PROPERTY[p++] = new Property( "this", "Infinity", "number" ); + PROPERTY[p++] = new Property( "this", "eval", "function" ); + PROPERTY[p++] = new Property( "this", "parseInt", "function" ); + PROPERTY[p++] = new Property( "this", "parseFloat", "function" ); + PROPERTY[p++] = new Property( "this", "escape", "function" ); + PROPERTY[p++] = new Property( "this", "unescape", "function" ); + PROPERTY[p++] = new Property( "this", "isNaN", "function" ); + PROPERTY[p++] = new Property( "this", "isFinite", "function" ); + PROPERTY[p++] = new Property( "this", "Object", "function" ); + PROPERTY[p++] = new Property( "this", "Number", "function" ); + PROPERTY[p++] = new Property( "this", "Function", "function" ); + PROPERTY[p++] = new Property( "this", "Array", "function" ); + PROPERTY[p++] = new Property( "this", "String", "function" ); + PROPERTY[p++] = new Property( "this", "Boolean", "function" ); + PROPERTY[p++] = new Property( "this", "Date", "function" ); + PROPERTY[p++] = new Property( "this", "Math", "object" ); + + // properties and methods of Object objects + + PROPERTY[p++] = new Property( "Object", "prototype", "object" ); + PROPERTY[p++] = new Property( "Object", "toString", "function" ); + PROPERTY[p++] = new Property( "Object", "valueOf", "function" ); + PROPERTY[p++] = new Property( "Object", "constructor", "function" ); + + // properties of the Function object + + PROPERTY[p++] = new Property( "Function", "prototype", "function" ); + PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" ); + PROPERTY[p++] = new Property( "Function.prototype", "length", "number" ); + PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" ); + + Function.prototype.myProperty = "hi"; + + PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" ); + + // properties of the Array object + PROPERTY[p++] = new Property( "Array", "prototype", "object" ); + PROPERTY[p++] = new Property( "Array", "length", "number" ); + PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" ); + PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" ); + PROPERTY[p++] = new Property( "Array.prototype", "join", "function" ); + PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" ); + PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" ); + + // properties of the String object + PROPERTY[p++] = new Property( "String", "prototype", "object" ); + PROPERTY[p++] = new Property( "String", "fromCharCode", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "toString", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "split", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "substring", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" ); + PROPERTY[p++] = new Property( "String.prototype", "length", "number" ); + + // properties of the Boolean object + PROPERTY[p++] = new Property( "Boolean", "prototype", "object" ); + PROPERTY[p++] = new Property( "Boolean", "constructor", "function" ); + PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" ); + PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" ); + + // properties of the Number object + + PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" ); + PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" ); + PROPERTY[p++] = new Property( "Number", "NaN", "number" ); + PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" ); + PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" ); + PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" ); + PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" ); + PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" ); + + // properties of the Math Object. + PROPERTY[p++] = new Property( "Math", "E", "number" ); + PROPERTY[p++] = new Property( "Math", "LN10", "number" ); + PROPERTY[p++] = new Property( "Math", "LN2", "number" ); + PROPERTY[p++] = new Property( "Math", "LOG2E", "number" ); + PROPERTY[p++] = new Property( "Math", "LOG10E", "number" ); + PROPERTY[p++] = new Property( "Math", "PI", "number" ); + PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" ); + PROPERTY[p++] = new Property( "Math", "SQRT2", "number" ); + PROPERTY[p++] = new Property( "Math", "abs", "function" ); + PROPERTY[p++] = new Property( "Math", "acos", "function" ); + PROPERTY[p++] = new Property( "Math", "asin", "function" ); + PROPERTY[p++] = new Property( "Math", "atan", "function" ); + PROPERTY[p++] = new Property( "Math", "atan2", "function" ); + PROPERTY[p++] = new Property( "Math", "ceil", "function" ); + PROPERTY[p++] = new Property( "Math", "cos", "function" ); + PROPERTY[p++] = new Property( "Math", "exp", "function" ); + PROPERTY[p++] = new Property( "Math", "floor", "function" ); + PROPERTY[p++] = new Property( "Math", "log", "function" ); + PROPERTY[p++] = new Property( "Math", "max", "function" ); + PROPERTY[p++] = new Property( "Math", "min", "function" ); + PROPERTY[p++] = new Property( "Math", "pow", "function" ); + PROPERTY[p++] = new Property( "Math", "random", "function" ); + PROPERTY[p++] = new Property( "Math", "round", "function" ); + PROPERTY[p++] = new Property( "Math", "sin", "function" ); + PROPERTY[p++] = new Property( "Math", "sqrt", "function" ); + PROPERTY[p++] = new Property( "Math", "tan", "function" ); + + // properties of the Date object + PROPERTY[p++] = new Property( "Date", "parse", "function" ); + PROPERTY[p++] = new Property( "Date", "prototype", "object" ); + PROPERTY[p++] = new Property( "Date", "UTC", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" ); + PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" ); + PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" ); + + for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { + RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name ); + + testcases[tc++] = new TestCase( SECTION, + "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name, + PROPERTY[i].type, + RESULT ); + + RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']"); + + testcases[tc++] = new TestCase( SECTION, + "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']", + PROPERTY[i].type, + RESULT ); + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( arg0, arg1, arg2, arg3, arg4 ) { + this.name = arg0; +} +function Property( object, name, type ) { + this.object = object; + this.name = name; + this.type = type; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js new file mode 100644 index 0000000..fa3056b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js @@ -0,0 +1,124 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.1-2.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Properties are accessed by name, using either the dot notation: + MemberExpression . Identifier + CallExpression . Identifier + + or the bracket notation: MemberExpression [ Expression ] + CallExpression [ Expression ] + + The dot notation is explained by the following syntactic conversion: + MemberExpression . Identifier + is identical in its behavior to + MemberExpression [ <identifier-string> ] + and similarly + CallExpression . Identifier + is identical in its behavior to + CallExpression [ <identifier-string> ] + where <identifier-string> is a string literal containing the same sequence + of characters as the Identifier. + + The production MemberExpression : MemberExpression [ Expression ] is + evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Expression. + 4. Call GetValue(Result(3)). + 5. Call ToObject(Result(2)). + 6. Call ToString(Result(4)). + 7. Return a value of type Reference whose base object is Result(5) and + whose property name is Result(6). + + The production CallExpression : CallExpression [ Expression ] is evaluated + in exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.2.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + var testcases = new Array(); + + // go through all Native Function objects, methods, and properties and get their typeof. + + var PROPERTY = new Array(); + var p = 0; + + // try to access properties of primitive types + + PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN ); + PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN ); +// PROPERTY[p++] = new Property( 3, 3, "3", 3 ); + PROPERTY[p++] = new Property( true, true, "true", 1 ); + PROPERTY[p++] = new Property( false, false, "false", 0 ); + + for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".valueOf()", + PROPERTY[i].value, + eval( PROPERTY[i].object+ ".valueOf()" ) ); + + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".toString()", + PROPERTY[i].string, + eval( PROPERTY[i].object+ ".toString()" ) ); + + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.stringValue = value +""; + this.numberValue = Number(value); + return this; +} +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.value = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js new file mode 100644 index 0000000..f84bb28 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.1-2.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Properties are accessed by name, using either the dot notation: + MemberExpression . Identifier + CallExpression . Identifier + + or the bracket notation: MemberExpression [ Expression ] + CallExpression [ Expression ] + + The dot notation is explained by the following syntactic conversion: + MemberExpression . Identifier + is identical in its behavior to + MemberExpression [ <identifier-string> ] + and similarly + CallExpression . Identifier + is identical in its behavior to + CallExpression [ <identifier-string> ] + where <identifier-string> is a string literal containing the same sequence + of characters as the Identifier. + + The production MemberExpression : MemberExpression [ Expression ] is + evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Expression. + 4. Call GetValue(Result(3)). + 5. Call ToObject(Result(2)). + 6. Call ToString(Result(4)). + 7. Return a value of type Reference whose base object is Result(5) and + whose property name is Result(6). + + The production CallExpression : CallExpression [ Expression ] is evaluated + in exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.2.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + var testcases = new Array(); + + // go through all Native Function objects, methods, and properties and get their typeof. + + var PROPERTY = new Array(); + var p = 0; + + // try to access properties of primitive types + + PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN ); + + for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".valueOf()", + PROPERTY[i].value, + eval( PROPERTY[i].object+ ".valueOf()" ) ); + + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".toString()", + PROPERTY[i].string, + eval( PROPERTY[i].object+ ".toString()" ) ); + + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.stringValue = value +""; + this.numberValue = Number(value); + return this; +} +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.value = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js new file mode 100644 index 0000000..0127253 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.1-4-n.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Properties are accessed by name, using either the dot notation: + MemberExpression . Identifier + CallExpression . Identifier + + or the bracket notation: MemberExpression [ Expression ] + CallExpression [ Expression ] + + The dot notation is explained by the following syntactic conversion: + MemberExpression . Identifier + is identical in its behavior to + MemberExpression [ <identifier-string> ] + and similarly + CallExpression . Identifier + is identical in its behavior to + CallExpression [ <identifier-string> ] + where <identifier-string> is a string literal containing the same sequence + of characters as the Identifier. + + The production MemberExpression : MemberExpression [ Expression ] is + evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Expression. + 4. Call GetValue(Result(3)). + 5. Call ToObject(Result(2)). + 6. Call ToString(Result(4)). + 7. Return a value of type Reference whose base object is Result(5) and + whose property name is Result(6). + + The production CallExpression : CallExpression [ Expression ] is evaluated + in exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.2.1-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + var testcases = new Array(); + + // go through all Native Function objects, methods, and properties and get their typeof. + + var PROPERTY = new Array(); + var p = 0; + + // try to access properties of primitive types + + PROPERTY[p++] = new Property( "null", null, "null", 0 ); + + for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".valueOf()", + PROPERTY[i].value, + eval( PROPERTY[i].object+ ".valueOf()" ) ); + + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".toString()", + PROPERTY[i].string, + eval( PROPERTY[i].object+ ".toString()" ) ); + + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.stringValue = value +""; + this.numberValue = Number(value); + return this; +} +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.value = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js new file mode 100644 index 0000000..0cb19c9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js @@ -0,0 +1,124 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.1-5.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Properties are accessed by name, using either the dot notation: + MemberExpression . Identifier + CallExpression . Identifier + + or the bracket notation: MemberExpression [ Expression ] + CallExpression [ Expression ] + + The dot notation is explained by the following syntactic conversion: + MemberExpression . Identifier + is identical in its behavior to + MemberExpression [ <identifier-string> ] + and similarly + CallExpression . Identifier + is identical in its behavior to + CallExpression [ <identifier-string> ] + where <identifier-string> is a string literal containing the same sequence + of characters as the Identifier. + + The production MemberExpression : MemberExpression [ Expression ] is + evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Expression. + 4. Call GetValue(Result(3)). + 5. Call ToObject(Result(2)). + 6. Call ToString(Result(4)). + 7. Return a value of type Reference whose base object is Result(5) and + whose property name is Result(6). + + The production CallExpression : CallExpression [ Expression ] is evaluated + in exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.2.1-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + var testcases = new Array(); + + // go through all Native Function objects, methods, and properties and get their typeof. + + var PROPERTY = new Array(); + var p = 0; + + // try to access properties of primitive types + + PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN ); + PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN ); + PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 ); + PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 ); + PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 ); + + for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".valueOf()", + PROPERTY[i].value, + eval( "PROPERTY[i].object.valueOf()" ) ); + + testcases[tc++] = new TestCase( SECTION, + PROPERTY[i].object + ".toString()", + PROPERTY[i].string, + eval( "PROPERTY[i].object.toString()" ) ); + + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.stringValue = value +""; + this.numberValue = Number(value); + return this; +} +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.value = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js new file mode 100644 index 0000000..db73cad --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-1.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-1-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var OBJECT = new Object(); + + testcases[tc++] = new TestCase( SECTION, + "OBJECT = new Object; var o = new OBJECT()", + "error", + o = new OBJECT() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js new file mode 100644 index 0000000..48c2e6a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-1.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + testcases[tc++] = new TestCase( SECTION, + "(new TestFunction(0,1,2,3,4,5)).length", + 6, + (new TestFunction(0,1,2,3,4,5)).length ); + + + + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js new file mode 100644 index 0000000..619554d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-9-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-9-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + testcases[tc++] = new TestCase( SECTION, + "var m = new Math()", + "error", + m = new Math() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js new file mode 100644 index 0000000..a6f7364 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-9-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-9-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var FUNCTION = new Function(); + + testcases[tc++] = new TestCase( SECTION, + "var FUNCTION = new Function(); f = new FUNCTION(); typeof f", + "object", + eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") ); + + testcases[tc++] = new TestCase( SECTION, + "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f", + "object", + eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js new file mode 100644 index 0000000..4e74cd4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-2.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-2-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var UNDEFINED = void 0; + + testcases[tc++] = new TestCase( SECTION, + "UNDEFINED = void 0; var o = new UNDEFINED()", + "error", + o = new UNDEFINED() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js new file mode 100644 index 0000000..2c6b509 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-3-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-3-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var NULL = null; + + testcases[tc++] = new TestCase( SECTION, + "NULL = null; var o = new NULL()", + "error", + o = new NULL() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js new file mode 100644 index 0000000..a9e5f4a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-4-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-4-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var STRING = ""; + + testcases[tc++] = new TestCase( SECTION, + "STRING = '', var s = new STRING()", + "error", + s = new STRING() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js new file mode 100644 index 0000000..304f1d3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-5-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-5-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var NUMBER = 0; + + testcases[tc++] = new TestCase( SECTION, + "NUMBER=0, var n = new NUMBER()", + "error", + n = new NUMBER() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js new file mode 100644 index 0000000..fd24e4f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-6-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.2.2-6-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var BOOLEAN = true; + + testcases[tc++] = new TestCase( SECTION, + "BOOLEAN = true; var b = new BOOLEAN()", + "error", + b = new BOOLEAN() ); + test(); + +function TestFunction() { + return arguments; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js new file mode 100644 index 0000000..4a54726 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-6-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-6-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var STRING = new String("hi"); + + testcases[tc++] = new TestCase( SECTION, + "var STRING = new String('hi'); var s = new STRING()", + "error", + s = new STRING() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js new file mode 100644 index 0000000..eb58ff5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-8-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-8-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var NUMBER = new Number(1); + + testcases[tc++] = new TestCase( SECTION, + "var NUMBER = new Number(1); var n = new NUMBER()", + "error", + n = new NUMBER() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js new file mode 100644 index 0000000..56199cf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.2-9-n.js + ECMA Section: 11.2.2. The new operator + Description: + + MemberExpression: + PrimaryExpression + MemberExpression[Expression] + MemberExpression.Identifier + new MemberExpression Arguments + + new NewExpression + + The production NewExpression : new NewExpression is evaluated as follows: + + 1. Evaluate NewExpression. + 2. Call GetValue(Result(1)). + 3. If Type(Result(2)) is not Object, generate a runtime error. + 4. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 5. Call the [[Construct]] method on Result(2), providing no arguments + (that is, an empty list of arguments). + 6. If Type(Result(5)) is not Object, generate a runtime error. + 7. Return Result(5). + + The production MemberExpression : new MemberExpression Arguments is evaluated as follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate Arguments, producing an internal list of argument values + (section 0). + 4. If Type(Result(2)) is not Object, generate a runtime error. + 5. If Result(2) does not implement the internal [[Construct]] method, + generate a runtime error. + 6. Call the [[Construct]] method on Result(2), providing the list + Result(3) as the argument values. + 7. If Type(Result(6)) is not Object, generate a runtime error. + 8 .Return Result(6). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.2-9-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The new operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var BOOLEAN = new Boolean(); + + testcases[tc++] = new TestCase( SECTION, + "var BOOLEAN = new Boolean(); var b = new BOOLEAN()", + "error", + b = new BOOLEAN() ); + test(); + +function TestFunction() { + return arguments; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js new file mode 100644 index 0000000..7653900 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js @@ -0,0 +1,121 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.3-1.js + ECMA Section: 11.2.3. Function Calls + Description: + + The production CallExpression : MemberExpression Arguments is evaluated as + follows: + + 1.Evaluate MemberExpression. + 2.Evaluate Arguments, producing an internal list of argument values + (section 0). + 3.Call GetValue(Result(1)). + 4.If Type(Result(3)) is not Object, generate a runtime error. + 5.If Result(3) does not implement the internal [[Call]] method, generate a + runtime error. + 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, + Result(6) is null. + 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is + the same as Result(6). + 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value + and providing the list Result(2) as the argument values. + 9.Return Result(8). + + The production CallExpression : CallExpression Arguments is evaluated in + exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Note: Result(8) will never be of type Reference if Result(3) is a native + ECMAScript object. Whether calling a host object can return a value of + type Reference is implementation-dependent. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function Calls"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +/* this.eval() is no longer legal syntax. + // MemberExpression : this + + testcases[tc++] = new TestCase( SECTION, + "this.eval()", + void 0, + this.eval() ); + + testcases[tc++] = new TestCase( SECTION, + "this.eval('NaN')", + NaN, + this.eval("NaN") ); +*/ + // MemberExpression: Identifier + + var OBJECT = true; + + testcases[tc++] = new TestCase( SECTION, + "OBJECT.toString()", + "true", + OBJECT.toString() ); + + // MemberExpression[ Expression] + + testcases[tc++] = new TestCase( SECTION, + "(new Array())['length'].valueOf()", + 0, + (new Array())["length"].valueOf() ); + + // MemberExpression . Identifier + testcases[tc++] = new TestCase( SECTION, + "(new Array()).length.valueOf()", + 0, + (new Array()).length.valueOf() ); + // new MemberExpression Arguments + + testcases[tc++] = new TestCase( SECTION, + "(new Array(20))['length'].valueOf()", + 20, + (new Array(20))["length"].valueOf() ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js new file mode 100644 index 0000000..e5ba65c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.3-2-n.js + ECMA Section: 11.2.3. Function Calls + Description: + + The production CallExpression : MemberExpression Arguments is evaluated as + follows: + + 1.Evaluate MemberExpression. + 2.Evaluate Arguments, producing an internal list of argument values + (section 0). + 3.Call GetValue(Result(1)). + 4.If Type(Result(3)) is not Object, generate a runtime error. + 5.If Result(3) does not implement the internal [[Call]] method, generate a + runtime error. + 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, + Result(6) is null. + 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is + the same as Result(6). + 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value + and providing the list Result(2) as the argument values. + 9.Return Result(8). + + The production CallExpression : CallExpression Arguments is evaluated in + exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Note: Result(8) will never be of type Reference if Result(3) is a native + ECMAScript object. Whether calling a host object can return a value of + type Reference is implementation-dependent. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.3-2-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function Calls"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "3.valueOf()", + 3, + 3.valueOf() ); + + testcases[tc++] = new TestCase( SECTION, + "(3).valueOf()", + 3, + (3).valueOf() ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js new file mode 100644 index 0000000..da58907 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.3-3-n.js + ECMA Section: 11.2.3. Function Calls + Description: + + The production CallExpression : MemberExpression Arguments is evaluated as + follows: + + 1.Evaluate MemberExpression. + 2.Evaluate Arguments, producing an internal list of argument values + (section 0). + 3.Call GetValue(Result(1)). + 4.If Type(Result(3)) is not Object, generate a runtime error. + 5.If Result(3) does not implement the internal [[Call]] method, generate a + runtime error. + 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, + Result(6) is null. + 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is + the same as Result(6). + 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value + and providing the list Result(2) as the argument values. + 9.Return Result(8). + + The production CallExpression : CallExpression Arguments is evaluated in + exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Note: Result(8) will never be of type Reference if Result(3) is a native + ECMAScript object. Whether calling a host object can return a value of + type Reference is implementation-dependent. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.3-3-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function Calls"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, "(void 0).valueOf()", "error", (void 0).valueOf() ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js new file mode 100644 index 0000000..eed49b2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.3-4-n.js + ECMA Section: 11.2.3. Function Calls + Description: + + The production CallExpression : MemberExpression Arguments is evaluated as + follows: + + 1.Evaluate MemberExpression. + 2.Evaluate Arguments, producing an internal list of argument values + (section 0). + 3.Call GetValue(Result(1)). + 4.If Type(Result(3)) is not Object, generate a runtime error. + 5.If Result(3) does not implement the internal [[Call]] method, generate a + runtime error. + 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, + Result(6) is null. + 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is + the same as Result(6). + 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value + and providing the list Result(2) as the argument values. + 9.Return Result(8). + + The production CallExpression : CallExpression Arguments is evaluated in + exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Note: Result(8) will never be of type Reference if Result(3) is a native + ECMAScript object. Whether calling a host object can return a value of + type Reference is implementation-dependent. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.3-4-n.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function Calls"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, "null.valueOf()", "error", null.valueOf() ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js new file mode 100644 index 0000000..77a0f6c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.2.3-5-n.js + ECMA Section: 11.2.3. Function Calls + Description: + + The production CallExpression : MemberExpression Arguments is evaluated as + follows: + + 1. Evaluate MemberExpression. + 2. Evaluate Arguments, producing an internal list of argument values + (section 0). + 3. Call GetValue(Result(1)). + 4. If Type(Result(3)) is not Object, generate a runtime error. + 5. If Result(3) does not implement the internal [[Call]] method, generate a + runtime error. + 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, + Result(6) is null. + 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is + the same as Result(6). + 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value + and providing the list Result(2) as the argument values. + 9. Return Result(8). + + The production CallExpression : CallExpression Arguments is evaluated in + exactly the same manner, except that the contained CallExpression is + evaluated in step 1. + + Note: Result(8) will never be of type Reference if Result(3) is a native + ECMAScript object. Whether calling a host object can return a value of + type Reference is implementation-dependent. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "11.2.3-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function Calls"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, "true.valueOf()", true, true.valueOf() ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js new file mode 100644 index 0000000..0e1e8aa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js @@ -0,0 +1,154 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.3.1.js + ECMA Section: 11.3.1 Postfix increment operator + Description: + The production MemberExpression : MemberExpression ++ is evaluated as + follows: + + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Call ToNumber(Result(2)). + 4. Add the value 1 to Result(3), using the same rules as for the + + operator (section 0). + 5. Call PutValue(Result(1), Result(4)). + 6. Return Result(3). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.3.1"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Postfix increment operator"); + + testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // special numbers + array[item++] = new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") ); + + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") ); + + // number primitives + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); + + // boolean values + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") ); + + // boolean objects + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") ); + + // string primitives + array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") ); + + // string objects + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js new file mode 100644 index 0000000..1042f85 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js @@ -0,0 +1,154 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.3.2.js + ECMA Section: 11.3.2 Postfix decrement operator + Description: + + 11.3.2 Postfix decrement operator + + The production MemberExpression : MemberExpression -- is evaluated as follows: + 1. Evaluate MemberExpression. + 2. Call GetValue(Result(1)). + 3. Call ToNumber(Result(2)). + 4. Subtract the value 1 from Result(3), using the same rules as for the - + operator (section 0). + 5. Call PutValue(Result(1), Result(4)). + 6. Return Result(3). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.3.2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Postfix decrement operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // special numbers + array[item++] = new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") ); + + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") ); + + // number primitives + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); + + // boolean values + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") ); + + // boolean objects + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") ); + + // string primitives + array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") ); + + // string objects + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js new file mode 100644 index 0000000..766b786 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.4.1.js + ECMA Section: 11.4.1 the Delete Operator + Description: returns true if the property could be deleted + returns false if it could not be deleted + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + + + var SECTION = "11.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The delete operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + +// array[item++] = new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") ); +// array[item++] = new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") ); + array[item++] = new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") ); + +// array[item++] = new TestCase( SECTION, "delete(x=new Date())", true, delete(x=new Date()) ); +// array[item++] = new TestCase( SECTION, "delete('string primitive')", true, delete("string primitive") ); +// array[item++] = new TestCase( SECTION, "delete(new String( 'string object' ) )", true, delete(new String("string object")) ); +// array[item++] = new TestCase( SECTION, "delete(new Number(12345) )", true, delete(new Number(12345)) ); + array[item++] = new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) ); +// array[item++] = new TestCase( SECTION, "delete(null)", true, delete(null) ); +// array[item++] = new TestCase( SECTION, "delete(void(0))", true, delete(void(0)) ); + + // variables declared with the var statement are not deletable. + + var abc; + array[item++] = new TestCase( SECTION, "var abc; delete(abc)", false, delete abc ); + + array[item++] = new TestCase( SECTION, + "var OB = new MyObject(); for ( p in OB ) { delete p }", + true, + eval("var OB = new MyObject(); for ( p in OB ) { delete p }") ); + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + + } + stopTest(); + return ( testcases ); +} + +function MyObject() { + this.prop1 = true; + this.prop2 = false; + this.prop3 = null + this.prop4 = void 0; + this.prop5 = "hi"; + this.prop6 = 42; + this.prop7 = new Date(); + this.prop8 = Math.PI; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js new file mode 100644 index 0000000..c889ec6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.4.2.js + ECMA Section: 11.4.2 the Void Operator + Description: always returns undefined (?) + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "11.4.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The void operator"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) ); + array[item++] = new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") ); + array[item++] = new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) ); + array[item++] = new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "void(1)", void 0, void(1) ); + array[item++] = new TestCase( SECTION, "void(0)", void 0, void(0) ); + array[item++] = new TestCase( SECTION, "void(-1)", void 0, void(-1) ); + array[item++] = new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) ); + array[item++] = new TestCase( SECTION, "void(true)", void 0, void(true) ); + array[item++] = new TestCase( SECTION, "void(false)", void 0, void(false) ); + array[item++] = new TestCase( SECTION, "void(null)", void 0, void(null) ); + array[item++] = new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) ); + array[item++] = new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" ); + array[item++] = new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN ); + array[item++] = new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "void 1", void 0, void 1 ); + array[item++] = new TestCase( SECTION, "void 0", void 0, void 0 ); + array[item++] = new TestCase( SECTION, "void -1", void 0, void -1 ); + array[item++] = new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "void Math.PI", void 0, void Math.PI ); + array[item++] = new TestCase( SECTION, "void true", void 0, void true ); + array[item++] = new TestCase( SECTION, "void false", void 0, void false ); + array[item++] = new TestCase( SECTION, "void null", void 0, void null ); + +// array[item++] = new TestCase( SECTION, "void()", void 0, void() ); + + return ( array ); +} + +function test() { + for ( i = 0; i < testcases.length; i++ ) { + testcases[i].passed = writeTestCaseResult( + testcases[i].expect, + testcases[i].actual, + testcases[i].description +" = "+ testcases[i].actual ); + testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js new file mode 100644 index 0000000..eccfa0d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js @@ -0,0 +1,109 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: typeof_1.js + ECMA Section: 11.4.3 typeof operator + Description: typeof evaluates unary expressions: + undefined "undefined" + null "object" + Boolean "boolean" + Number "number" + String "string" + Object "object" [native, doesn't implement Call] + Object "function" [native, implements [Call]] + Object implementation dependent + [not sure how to test this] + Author: christine@netscape.com + Date: june 30, 1997 + +*/ + + var SECTION = "11.4.3"; + + var VERSION = "ECMA_1"; + startTest(); + var TITLE = " The typeof operator"; + + var testcases = new Array(); + + + testcases[testcases.length] = new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(null)", "object", typeof(null) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(0)", "number", typeof(0) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(1)", "number", typeof(1) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof('0')", "string", typeof("0") ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) ); + + // Math does not implement [[Construct]] or [[Call]] so its type is object. + + testcases[testcases.length] = new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) ); + + testcases[testcases.length] = new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) ); + + testcases[testcases.length] = new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") ); + testcases[testcases.length] = new TestCase( SECTION, "typeof('')", "string", typeof("") ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(test)", "function", typeof( test ) ); + testcases[testcases.length] = new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) ); + + + writeHeaderToLog( SECTION + " "+ TITLE); + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js new file mode 100644 index 0000000..7a7a547 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js @@ -0,0 +1,156 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.4.4.js + ECMA Section: 11.4.4 Prefix increment operator + Description: + The production UnaryExpression : ++ UnaryExpression is evaluated as + follows: + + 1. Evaluate UnaryExpression. + 2. Call GetValue(Result(1)). + 3. Call ToNumber(Result(2)). + 4. Add the value 1 to Result(3), using the same rules as for the + + operator (section 11.6.3). + 5. Call PutValue(Result(1), Result(4)). + 6. Return Result(4). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.4.4"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Prefix increment operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // special case: var is not defined + + array[item++] = new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") ); + + // special numbers + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") ); + + + // number primitives + array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); + + // boolean values + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") ); + + // boolean objects + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") ); + + // string primitives + array[item++] = new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") ); + + // string objects + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js new file mode 100644 index 0000000..d82ac60 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js @@ -0,0 +1,154 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.4.5.js + ECMA Section: 11.4.5 Prefix decrement operator + Description: + + The production UnaryExpression : -- UnaryExpression is evaluated as follows: + + 1.Evaluate UnaryExpression. + 2.Call GetValue(Result(1)). + 3.Call ToNumber(Result(2)). + 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3). + 5.Call PutValue(Result(1), Result(4)). + + 1.Return Result(4). + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.4.5"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Prefix decrement operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // + array[item++] = new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") ); + + // special numbers + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") ); + + + // number primitives + array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); + + // boolean values + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") ); + + // boolean objects + // verify return value + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") ); + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") ); + + // string primitives + array[item++] = new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") ); + + // string objects + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") ); + + // verify value of variable + + array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") ); + array[item++] = new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js new file mode 100644 index 0000000..31d9551 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js @@ -0,0 +1,299 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.4.6.js + ECMA Section: 11.4.6 Unary + Operator + Description: convert operand to Number type + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "11.4.6"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + var BUGNUMBER="77391"; + + writeHeaderToLog( SECTION + " Unary + operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "+('')", 0, +("") ); + array[item++] = new TestCase( SECTION, "+(' ')", 0, +(" ") ); + array[item++] = new TestCase( SECTION, "+(\\t)", 0, +("\t") ); + array[item++] = new TestCase( SECTION, "+(\\n)", 0, +("\n") ); + array[item++] = new TestCase( SECTION, "+(\\r)", 0, +("\r") ); + array[item++] = new TestCase( SECTION, "+(\\f)", 0, +("\f") ); + + array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) ); + + // a StringNumericLiteral may be preceeded or followed by whitespace and/or + // line terminators + + array[item++] = new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) ); + array[item++] = new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) ); + array[item++] = new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) ); + array[item++] = new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) ); + array[item++] = new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) ); + + array[item++] = new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') ); + array[item++] = new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) ); + array[item++] = new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) ); + array[item++] = new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) ); + array[item++] = new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) ); + + array[item++] = new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) ); + array[item++] = new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) ); + array[item++] = new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) ); + array[item++] = new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) ); + + array[item++] = new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') ); + array[item++] = new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') ); + array[item++] = new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') ); + array[item++] = new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') ); + array[item++] = new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') ); + + array[item++] = new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') ); + array[item++] = new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) ); + array[item++] = new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) ); + array[item++] = new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) ); + array[item++] = new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) ); + + array[item++] = new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) ); + array[item++] = new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) ); + array[item++] = new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) ); + array[item++] = new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) ); + + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) ); + + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); + + array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) ); + + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) ); + + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); + + array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) ); + + + // StrNumericLiteral:::StrDecimalLiteral:::Infinity + + array[item++] = new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") ); + array[item++] = new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") ); + array[item++] = new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") ); + + // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt + + array[item++] = new TestCase( SECTION, "+('0')", 0, +("0") ); + array[item++] = new TestCase( SECTION, "+('-0')", -0, +("-0") ); + array[item++] = new TestCase( SECTION, "+('+0')", 0, +("+0") ); + + array[item++] = new TestCase( SECTION, "+('1')", 1, +("1") ); + array[item++] = new TestCase( SECTION, "+('-1')", -1, +("-1") ); + array[item++] = new TestCase( SECTION, "+('+1')", 1, +("+1") ); + + array[item++] = new TestCase( SECTION, "+('2')", 2, +("2") ); + array[item++] = new TestCase( SECTION, "+('-2')", -2, +("-2") ); + array[item++] = new TestCase( SECTION, "+('+2')", 2, +("+2") ); + + array[item++] = new TestCase( SECTION, "+('3')", 3, +("3") ); + array[item++] = new TestCase( SECTION, "+('-3')", -3, +("-3") ); + array[item++] = new TestCase( SECTION, "+('+3')", 3, +("+3") ); + + array[item++] = new TestCase( SECTION, "+('4')", 4, +("4") ); + array[item++] = new TestCase( SECTION, "+('-4')", -4, +("-4") ); + array[item++] = new TestCase( SECTION, "+('+4')", 4, +("+4") ); + + array[item++] = new TestCase( SECTION, "+('5')", 5, +("5") ); + array[item++] = new TestCase( SECTION, "+('-5')", -5, +("-5") ); + array[item++] = new TestCase( SECTION, "+('+5')", 5, +("+5") ); + + array[item++] = new TestCase( SECTION, "+('6')", 6, +("6") ); + array[item++] = new TestCase( SECTION, "+('-6')", -6, +("-6") ); + array[item++] = new TestCase( SECTION, "+('+6')", 6, +("+6") ); + + array[item++] = new TestCase( SECTION, "+('7')", 7, +("7") ); + array[item++] = new TestCase( SECTION, "+('-7')", -7, +("-7") ); + array[item++] = new TestCase( SECTION, "+('+7')", 7, +("+7") ); + + array[item++] = new TestCase( SECTION, "+('8')", 8, +("8") ); + array[item++] = new TestCase( SECTION, "+('-8')", -8, +("-8") ); + array[item++] = new TestCase( SECTION, "+('+8')", 8, +("+8") ); + + array[item++] = new TestCase( SECTION, "+('9')", 9, +("9") ); + array[item++] = new TestCase( SECTION, "+('-9')", -9, +("-9") ); + array[item++] = new TestCase( SECTION, "+('+9')", 9, +("+9") ); + + array[item++] = new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") ); + array[item++] = new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") ); + array[item++] = new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") ); + + array[item++] = new TestCase( SECTION, "+('3.')", 3, +("3.") ); + array[item++] = new TestCase( SECTION, "+('-3.')", -3, +("-3.") ); + array[item++] = new TestCase( SECTION, "+('+3.')", 3, +("+3.") ); + + array[item++] = new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") ); + array[item++] = new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") ); + array[item++] = new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") ); + + array[item++] = new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") ); + array[item++] = new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") ); + array[item++] = new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") ); + + array[item++] = new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") ); + array[item++] = new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") ); + array[item++] = new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") ); + + // StrDecimalLiteral::: .DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") ); + array[item++] = new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") ); + array[item++] = new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") ); + + array[item++] = new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") ); + array[item++] = new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") ); + array[item++] = new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") ); + + array[item++] = new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") ); + array[item++] = new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") ); + array[item++] = new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") ); + + array[item++] = new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") ); + array[item++] = new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") ); + array[item++] = new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") ); + + // StrDecimalLiteral::: DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") ); + array[item++] = new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") ); + array[item++] = new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") ); + + array[item++] = new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") ); + array[item++] = new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") ); + array[item++] = new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") ); + + array[item++] = new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") ); + array[item++] = new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") ); + array[item++] = new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") ); + + // StrNumericLiteral::: HexIntegerLiteral + + array[item++] = new TestCase( SECTION, "+('0x0')", 0, +("0x0")); + array[item++] = new TestCase( SECTION, "+('0x1')", 1, +("0x1")); + array[item++] = new TestCase( SECTION, "+('0x2')", 2, +("0x2")); + array[item++] = new TestCase( SECTION, "+('0x3')", 3, +("0x3")); + array[item++] = new TestCase( SECTION, "+('0x4')", 4, +("0x4")); + array[item++] = new TestCase( SECTION, "+('0x5')", 5, +("0x5")); + array[item++] = new TestCase( SECTION, "+('0x6')", 6, +("0x6")); + array[item++] = new TestCase( SECTION, "+('0x7')", 7, +("0x7")); + array[item++] = new TestCase( SECTION, "+('0x8')", 8, +("0x8")); + array[item++] = new TestCase( SECTION, "+('0x9')", 9, +("0x9")); + array[item++] = new TestCase( SECTION, "+('0xa')", 10, +("0xa")); + array[item++] = new TestCase( SECTION, "+('0xb')", 11, +("0xb")); + array[item++] = new TestCase( SECTION, "+('0xc')", 12, +("0xc")); + array[item++] = new TestCase( SECTION, "+('0xd')", 13, +("0xd")); + array[item++] = new TestCase( SECTION, "+('0xe')", 14, +("0xe")); + array[item++] = new TestCase( SECTION, "+('0xf')", 15, +("0xf")); + array[item++] = new TestCase( SECTION, "+('0xA')", 10, +("0xA")); + array[item++] = new TestCase( SECTION, "+('0xB')", 11, +("0xB")); + array[item++] = new TestCase( SECTION, "+('0xC')", 12, +("0xC")); + array[item++] = new TestCase( SECTION, "+('0xD')", 13, +("0xD")); + array[item++] = new TestCase( SECTION, "+('0xE')", 14, +("0xE")); + array[item++] = new TestCase( SECTION, "+('0xF')", 15, +("0xF")); + + array[item++] = new TestCase( SECTION, "+('0X0')", 0, +("0X0")); + array[item++] = new TestCase( SECTION, "+('0X1')", 1, +("0X1")); + array[item++] = new TestCase( SECTION, "+('0X2')", 2, +("0X2")); + array[item++] = new TestCase( SECTION, "+('0X3')", 3, +("0X3")); + array[item++] = new TestCase( SECTION, "+('0X4')", 4, +("0X4")); + array[item++] = new TestCase( SECTION, "+('0X5')", 5, +("0X5")); + array[item++] = new TestCase( SECTION, "+('0X6')", 6, +("0X6")); + array[item++] = new TestCase( SECTION, "+('0X7')", 7, +("0X7")); + array[item++] = new TestCase( SECTION, "+('0X8')", 8, +("0X8")); + array[item++] = new TestCase( SECTION, "+('0X9')", 9, +("0X9")); + array[item++] = new TestCase( SECTION, "+('0Xa')", 10, +("0Xa")); + array[item++] = new TestCase( SECTION, "+('0Xb')", 11, +("0Xb")); + array[item++] = new TestCase( SECTION, "+('0Xc')", 12, +("0Xc")); + array[item++] = new TestCase( SECTION, "+('0Xd')", 13, +("0Xd")); + array[item++] = new TestCase( SECTION, "+('0Xe')", 14, +("0Xe")); + array[item++] = new TestCase( SECTION, "+('0Xf')", 15, +("0Xf")); + array[item++] = new TestCase( SECTION, "+('0XA')", 10, +("0XA")); + array[item++] = new TestCase( SECTION, "+('0XB')", 11, +("0XB")); + array[item++] = new TestCase( SECTION, "+('0XC')", 12, +("0XC")); + array[item++] = new TestCase( SECTION, "+('0XD')", 13, +("0XD")); + array[item++] = new TestCase( SECTION, "+('0XE')", 14, +("0XE")); + array[item++] = new TestCase( SECTION, "+('0XF')", 15, +("0XF")); + + return array; + +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js new file mode 100644 index 0000000..491167f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js @@ -0,0 +1,215 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 11.4.8.js + ECMA Section: 11.4.8 Bitwise NOT Operator + Description: flip bits up to 32 bits + no special cases + Author: christine@netscape.com + Date: 7 july 1997 + + Data File Fields: + VALUE value passed as an argument to the ~ operator + E_RESULT expected return value of ~ VALUE; + + Static variables: + none + +*/ + + var SECTION = "11.4.8"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Bitwise Not operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( var i = 0; i < 35; i++ ) { + var p = Math.pow(2,i); + + array[item++] = new TestCase( SECTION, "~"+p, Not(p), ~p ); + + } + for ( i = 0; i < 35; i++ ) { + var p = -Math.pow(2,i); + + array[item++] = new TestCase( SECTION, "~"+p, Not(p), ~p ); + + } + + return ( array ); +} +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function Not( n ) { + n = ToInt32(n); + n = ToInt32BitString(n); + + r = "" + + for( var l = 0; l < n.length; l++ ) { + r += ( n.charAt(l) == "0" ) ? "1" : "0"; + } + + n = ToInt32Decimal(r); + + return n; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js new file mode 100644 index 0000000..90ef06d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.4.9.js + ECMA Section: 11.4.9 Logical NOT Operator (!) + Description: if the ToBoolean( VALUE ) result is true, return + true. else return false. + Author: christine@netscape.com + Date: 7 july 1997 + + Static variables: + none +*/ + var SECTION = "11.4.9"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Logical NOT operator (!)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + +// version("130") + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, "!(null)", true, !(null) ); + testcases[tc++] = new TestCase( SECTION, "!(var x)", true, !(eval("var x")) ); + testcases[tc++] = new TestCase( SECTION, "!(void 0)", true, !(void 0) ); + + testcases[tc++] = new TestCase( SECTION, "!(false)", true, !(false) ); + testcases[tc++] = new TestCase( SECTION, "!(true)", false, !(true) ); + testcases[tc++] = new TestCase( SECTION, "!()", true, !(eval()) ); + testcases[tc++] = new TestCase( SECTION, "!(0)", true, !(0) ); + testcases[tc++] = new TestCase( SECTION, "!(-0)", true, !(-0) ); + testcases[tc++] = new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) ); + testcases[tc++] = new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) ); + testcases[tc++] = new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) ); + testcases[tc++] = new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) ); + testcases[tc++] = new TestCase( SECTION, "!(1)", false, !(1) ); + testcases[tc++] = new TestCase( SECTION, "!(-1)", false, !(-1) ); + testcases[tc++] = new TestCase( SECTION, "!('')", true, !("") ); + testcases[tc++] = new TestCase( SECTION, "!('\t')", false, !("\t") ); + testcases[tc++] = new TestCase( SECTION, "!('0')", false, !("0") ); + testcases[tc++] = new TestCase( SECTION, "!('string')", false, !("string") ); + testcases[tc++] = new TestCase( SECTION, "!(new String(''))", false, !(new String("")) ); + testcases[tc++] = new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) ); + testcases[tc++] = new TestCase( SECTION, "!(new String())", false, !(new String()) ); + testcases[tc++] = new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) ); + testcases[tc++] = new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) ); + testcases[tc++] = new TestCase( SECTION, "!(new Array())", false, !(new Array()) ); + testcases[tc++] = new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) ); + testcases[tc++] = new TestCase( SECTION, "!(new Number())", false, !(new Number()) ); + testcases[tc++] = new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) ); + testcases[tc++] = new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) ); + testcases[tc++] = new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) ); + + test(); + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js new file mode 100644 index 0000000..67c0a8a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js @@ -0,0 +1,115 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.5.1.js + ECMA Section: 11.5.1 Applying the * operator + Description: + + 11.5.1 Applying the * operator + + The * operator performs multiplication, producing the product of its + operands. Multiplication is commutative. Multiplication is not always + associative in ECMAScript, because of finite precision. + + The result of a floating-point multiplication is governed by the rules + of IEEE 754 double-precision arithmetic: + + If either operand is NaN, the result is NaN. + The sign of the result is positive if both operands have the same sign, + negative if the operands have different signs. + Multiplication of an infinity by a zero results in NaN. + Multiplication of an infinity by an infinity results in an infinity. + The sign is determined by the rule already stated above. + Multiplication of an infinity by a finite non-zero value results in a + signed infinity. The sign is determined by the rule already stated above. + In the remaining cases, where neither an infinity or NaN is involved, the + product is computed and rounded to the nearest representable value using IEEE + 754 round-to-nearest mode. If the magnitude is too large to represent, + the result is then an infinity of appropriate sign. If the magnitude is + oo small to represent, the result is then a zero + of appropriate sign. The ECMAScript language requires support of gradual + underflow as defined by IEEE 754. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.5.1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Applying the * operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 ); + array[item++] = new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN ); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 ); + array[item++] = new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 ); + + array[item++] = new TestCase( SECTION, "0 * -0", -0, 0 * -0 ); + array[item++] = new TestCase( SECTION, "-0 * 0", -0, -0 * 0 ); + array[item++] = new TestCase( SECTION, "-0 * -0", 0, -0 * -0 ); + array[item++] = new TestCase( SECTION, "0 * 0", 0, 0 * 0 ); + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 ); + array[item++] = new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 ); + array[item++] = new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js new file mode 100644 index 0000000..c681a35 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js @@ -0,0 +1,154 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.5.2.js + ECMA Section: 11.5.2 Applying the / operator + Description: + + The / operator performs division, producing the quotient of its operands. + The left operand is the dividend and the right operand is the divisor. + ECMAScript does not perform integer division. The operands and result of all + division operations are double-precision floating-point numbers. + The result of division is determined by the specification of IEEE 754 arithmetic: + + If either operand is NaN, the result is NaN. + The sign of the result is positive if both operands have the same sign, negative if the operands have different + signs. + Division of an infinity by an infinity results in NaN. + Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above. + Division of an infinity by a non-zero finite value results in a signed infinity. The sign is determined by the rule + already stated above. + Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above. + Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign + determined by the rule already stated above. + Division of a non-zero finite value by a zero results in a signed infinity. The sign is determined by the rule + already stated above. + In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the quotient is computed and + rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too + large to represent, we say the operation overflows; the result is then an infinity of appropriate sign. If the + magnitude is too small to represent, we say the operation underflows and the result is a zero of the appropriate + sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.5.2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + var BUGNUMBER="111202"; + + writeHeaderToLog( SECTION + " Applying the / operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // if either operand is NaN, the result is NaN. + + array[item++] = new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 ); + array[item++] = new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN ); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN ); + + // Division of an infinity by an infinity results in NaN. + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY ); + + // Division of an infinity by a zero results in an infinity. + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 ); + + // Division of an infinity by a non-zero finite value results in a signed infinity. + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 ); + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE ); + + // Division of a finite value by an infinity results in zero. + + array[item++] = new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY ); + + // Division of a zero by a zero results in NaN + + array[item++] = new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 ); + array[item++] = new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 ); + array[item++] = new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 ); + array[item++] = new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 ); + + // division of zero by any other finite value results in zero + + array[item++] = new TestCase( SECTION, "0 / 1", 0, 0 / 1 ); + array[item++] = new TestCase( SECTION, "0 / -1", -0, 0 / -1 ); + array[item++] = new TestCase( SECTION, "-0 / 1", -0, -0 / 1 ); + array[item++] = new TestCase( SECTION, "-0 / -1", 0, -0 / -1 ); + + // Division of a non-zero finite value by a zero results in a signed infinity. + + array[item++] = new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 ); + array[item++] = new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 ); + array[item++] = new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 ); + array[item++] = new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 ); + + array[item++] = new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js new file mode 100644 index 0000000..8b9722c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js @@ -0,0 +1,160 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.5.3.js + ECMA Section: 11.5.3 Applying the % operator + Description: + + The binary % operator is said to yield the remainder of its operands from + an implied division; the left operand is the dividend and the right operand + is the divisor. In C and C++, the remainder operator accepts only integral + operands, but in ECMAScript, it also accepts floating-point operands. + + The result of a floating-point remainder operation as computed by the % + operator is not the same as the "remainder" operation defined by IEEE 754. + The IEEE 754 "remainder" operation computes the remainder from a rounding + division, not a truncating division, and so its behavior is not analogous + to that of the usual integer remainder operator. Instead the ECMAScript + language defines % on floating-point operations to behave in a manner + analogous to that of the Java integer remainder operator; this may be + compared with the C library function fmod. + + The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic: + + If either operand is NaN, the result is NaN. + The sign of the result equals the sign of the dividend. + If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. + If the dividend is finite and the divisor is an infinity, the result equals the dividend. + If the dividend is a zero and the divisor is finite, the result is the same as the dividend. + In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r + from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that + is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as + possible without exceeding the magnitude of the true mathematical quotient of n and d. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.5.3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + var BUGNUMBER="111202"; + + writeHeaderToLog( SECTION + " Applying the % operator"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // if either operand is NaN, the result is NaN. + + array[item++] = new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 ); + array[item++] = new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN ); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN ); + + // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. + // dividend is an infinity + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 ); + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 ); + + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE ); + + // divisor is 0 + array[item++] = new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 ); + array[item++] = new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 ); + array[item++] = new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 ); + array[item++] = new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 ); + + array[item++] = new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 ); + array[item++] = new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 ); + array[item++] = new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 ); + array[item++] = new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 ); + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 ); + array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 ); + array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 ); + + // If the dividend is finite and the divisor is an infinity, the result equals the dividend. + + array[item++] = new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY ); + + // If the dividend is a zero and the divisor is finite, the result is the same as the dividend. + + array[item++] = new TestCase( SECTION, "0 % 1", 0, 0 % 1 ); + array[item++] = new TestCase( SECTION, "0 % -1", -0, 0 % -1 ); + array[item++] = new TestCase( SECTION, "-0 % 1", -0, -0 % 1 ); + array[item++] = new TestCase( SECTION, "-0 % -1", 0, -0 % -1 ); + +// In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r +// from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that +// is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as +// possible without exceeding the magnitude of the true mathematical quotient of n and d. + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js new file mode 100644 index 0000000..58e5edc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js @@ -0,0 +1,211 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.6.1-1.js + ECMA Section: 11.6.1 The addition operator ( + ) + Description: + + The addition operator either performs string concatenation or numeric + addition. + + The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression + is evaluated as follows: + + 1. Evaluate AdditiveExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate MultiplicativeExpression. + 4. Call GetValue(Result(3)). + 5. Call ToPrimitive(Result(2)). + 6. Call ToPrimitive(Result(4)). + 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. + (Note that this step differs from step 3 in the algorithm for comparison + for the relational operators in using or instead of and.) + 8. Call ToNumber(Result(5)). + 9. Call ToNumber(Result(6)). + 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). + 11. Return Result(10). + 12. Call ToString(Result(5)). + 13. Call ToString(Result(6)). + 14. Concatenate Result(12) followed by Result(13). + 15. Return Result(14). + + Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. + All native ECMAScript objects except Date objects handle the absence of a + hint as if the hint Number were given; Date objects handle the absence of a + hint as if the hint String were given. Host objects may handle the absence + of a hint in some other manner. + + This test does not cover cases where the Additive or Mulplicative expression + ToPrimitive is string. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.6.1-1"; + var VERSION = "ECMA_1"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The Addition operator ( + )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function getTestCases() { + var array = new Array(); + var item = 0; + + // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is + // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + array[item++] = new TestCase( SECTION, + "var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2", + 1, + eval("var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2", + 1, + eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2", + 1, + eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2", + 1, + eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2", + 1, + eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2", + "[object Object][object Object]", + eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2", + 1, + eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2", + "truefalse", + eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") ); + + // tests for number primitive, number object, Object object, a "MyObject" whose value is + // a number primitive and a number object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + array[item++] = new TestCase( SECTION, + "var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2", + 99, + eval("var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2", + 99, + eval("var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2", + 99, + eval("var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2", + 99, + eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2", + 99, + eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2", + "[object Object][object Object]", + eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") ); + + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2", + 99, + eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2", + "100-1", + eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1", + "truetrue", + eval("var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1") ); + + return ( array ); +} + + +function MyProtoValuelessObject() { + this.valueOf = new Function ( "" ); + this.__proto__ = null; +} + +function MyProtolessObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.__proto__ = null; + this.value = value; +} + +function MyValuelessObject(value) { + this.__proto__ = new MyPrototypeObject(value); +} +function MyPrototypeObject(value) { + this.valueOf = new Function( "return this.value;" ); + this.toString = new Function( "return (this.value + '');" ); + this.value = value; +} + +function MyObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.value = value; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js new file mode 100644 index 0000000..400ec71 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js @@ -0,0 +1,203 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.6.1-2.js + ECMA Section: 11.6.1 The addition operator ( + ) + Description: + + The addition operator either performs string concatenation or numeric + addition. + + The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression + is evaluated as follows: + + 1. Evaluate AdditiveExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate MultiplicativeExpression. + 4. Call GetValue(Result(3)). + 5. Call ToPrimitive(Result(2)). + 6. Call ToPrimitive(Result(4)). + 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. + (Note that this step differs from step 3 in the algorithm for comparison + for the relational operators in using or instead of and.) + 8. Call ToNumber(Result(5)). + 9. Call ToNumber(Result(6)). + 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). + 11. Return Result(10). + 12. Call ToString(Result(5)). + 13. Call ToString(Result(6)). + 14. Concatenate Result(12) followed by Result(13). + 15. Return Result(14). + + Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. + All native ECMAScript objects except Date objects handle the absence of a + hint as if the hint Number were given; Date objects handle the absence of a + hint as if the hint String were given. Host objects may handle the absence + of a hint in some other manner. + + This test does only covers cases where the Additive or Mulplicative expression + ToPrimitive is a string. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.6.1-2"; + var VERSION = "ECMA_1"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The Addition operator ( + )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is + // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + array[item++] = new TestCase( SECTION, + "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2", + "stringfalse", + eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2", + "truestring", + eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2", + "truestring", + eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2", + "truestring", + eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2", + "stringfalse", + eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2", + "truestring", + eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2", + "[object Object][object Object]", + eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2", + "stringfalse", + eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2", + "stringfalse", + eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") ); + + // tests for number primitive, number object, Object object, a "MyObject" whose value is + // a number primitive and a number object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + array[item++] = new TestCase( SECTION, + "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2", + "100string", + eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2", + "string-1", + eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2", + "100string", + eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2", + "string-1", + eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2", + "100string", + eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2", + "[object Object][object Object]", + eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2", + "100string", + eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2", + "string-1", + eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") ); + return ( array ); +} +function MyProtoValuelessObject() { + this.valueOf = new Function ( "" ); + this.__proto__ = null; +} +function MyProtolessObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.__proto__ = null; + this.value = value; +} +function MyValuelessObject(value) { + this.__proto__ = new MyPrototypeObject(value); +} +function MyPrototypeObject(value) { + this.valueOf = new Function( "return this.value;" ); + this.toString = new Function( "return (this.value + '');" ); + this.value = value; +} +function MyObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.value = value; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js new file mode 100644 index 0000000..a5fdc88 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js @@ -0,0 +1,181 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.6.1-3.js + ECMA Section: 11.6.1 The addition operator ( + ) + Description: + + The addition operator either performs string concatenation or numeric + addition. + + The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression + is evaluated as follows: + + 1. Evaluate AdditiveExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate MultiplicativeExpression. + 4. Call GetValue(Result(3)). + 5. Call ToPrimitive(Result(2)). + 6. Call ToPrimitive(Result(4)). + 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. + (Note that this step differs from step 3 in the algorithm for comparison + for the relational operators in using or instead of and.) + 8. Call ToNumber(Result(5)). + 9. Call ToNumber(Result(6)). + 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). + 11. Return Result(10). + 12. Call ToString(Result(5)). + 13. Call ToString(Result(6)). + 14. Concatenate Result(12) followed by Result(13). + 15. Return Result(14). + + Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. + All native ECMAScript objects except Date objects handle the absence of a + hint as if the hint Number were given; Date objects handle the absence of a + hint as if the hint String were given. Host objects may handle the absence + of a hint in some other manner. + + This test does only covers cases where the Additive or Mulplicative expression + is a Date. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.6.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The Addition operator ( + )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is + // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + var DATE1 = new Date(); + + array[item++] = new TestCase( SECTION, + "var DATE1 = new Date(); DATE1 + DATE1", + DATE1.toString() + DATE1.toString(), + DATE1 + DATE1 ); + + array[item++] = new TestCase( SECTION, + "var DATE1 = new Date(); DATE1 + 0", + DATE1.toString() + 0, + DATE1 + 0 ); + + array[item++] = new TestCase( SECTION, + "var DATE1 = new Date(); DATE1 + new Number(0)", + DATE1.toString() + 0, + DATE1 + new Number(0) ); + + array[item++] = new TestCase( SECTION, + "var DATE1 = new Date(); DATE1 + true", + DATE1.toString() + "true", + DATE1 + true ); + + array[item++] = new TestCase( SECTION, + "var DATE1 = new Date(); DATE1 + new Boolean(true)", + DATE1.toString() + "true", + DATE1 + new Boolean(true) ); + + array[item++] = new TestCase( SECTION, + "var DATE1 = new Date(); DATE1 + new Boolean(true)", + DATE1.toString() + "true", + DATE1 + new Boolean(true) ); + + var MYOB1 = new MyObject( DATE1 ); + var MYOB2 = new MyValuelessObject( DATE1 ); + var MYOB3 = new MyProtolessObject( DATE1 ); + var MYOB4 = new MyProtoValuelessObject( DATE1 ); + + array[item++] = new TestCase( SECTION, + "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)", + "[object Object]1", + MYOB1 + new Number(1) ); + + array[item++] = new TestCase( SECTION, + "MYOB1 = new MyObject(DATE1); MYOB1 + 1", + "[object Object]1", + MYOB1 + 1 ); + + array[item++] = new TestCase( SECTION, + "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'", + DATE1.toString() + "string", + MYOB2 + 'string' ); + + array[item++] = new TestCase( SECTION, + "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')", + DATE1.toString() + "string", + MYOB2 + new String('string') ); +/* + array[item++] = new TestCase( SECTION, + "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)", + DATE1.toString() + "true", + MYOB3 + new Boolean(true) ); +*/ + array[item++] = new TestCase( SECTION, + "MYOB1 = new MyObject(DATE1); MYOB1 + true", + "[object Object]true", + MYOB1 + true ); + + return ( array ); +} +function MyProtoValuelessObject() { + this.valueOf = new Function ( "" ); + this.__proto__ = null; +} +function MyProtolessObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.__proto__ = null; + this.value = value; +} +function MyValuelessObject(value) { + this.__proto__ = new MyPrototypeObject(value); +} +function MyPrototypeObject(value) { + this.valueOf = new Function( "return this.value;" ); + this.toString = new Function( "return (this.value + '');" ); + this.value = value; +} +function MyObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.value = value; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js new file mode 100644 index 0000000..3c1bd91 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js @@ -0,0 +1,199 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.6.2-1.js + ECMA Section: 11.6.2 The Subtraction operator ( - ) + Description: + + The production AdditiveExpression : AdditiveExpression - + MultiplicativeExpression is evaluated as follows: + + 1. Evaluate AdditiveExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate MultiplicativeExpression. + 4. Call GetValue(Result(3)). + 5. Call ToNumber(Result(2)). + 6. Call ToNumber(Result(4)). + 7. Apply the subtraction operation to Result(5) and Result(6). See the + discussion below (11.6.3). + 8. Return Result(7). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.6.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The subtraction operator ( - )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is + // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + array[item++] = new TestCase( SECTION, + "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2", + 1, + eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2", + 1, + eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2", + 1, + eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2", + 1, + eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2", + 1, + eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2", + Number.NaN, + eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2", + Number.NaN, + eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2", + 1, + eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2", + Number.NaN, + eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") ); + + // tests for number primitive, number object, Object object, a "MyObject" whose value is + // a number primitive and a number object, and "MyValuelessObject", where the value is + // set in the object's prototype, not the object itself. + + array[item++] = new TestCase( SECTION, + "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2", + 99, + eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2", + 99, + eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2", + 99, + eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2", + 99, + eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2", + 99, + eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2", + Number.NaN, + eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2", + 99, + eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") ); + + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2", + 99, + eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") ); +/* + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2", + Number.NaN, + eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") ); +*/ + // same thing with string! + array[item++] = new TestCase( SECTION, + "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2", + 254, + eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") ); + + return ( array ); +} +function MyProtoValuelessObject() { + this.valueOf = new Function ( "" ); + this.__proto__ = null; +} +function MyProtolessObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.__proto__ = null; + this.value = value; +} +function MyValuelessObject(value) { + this.__proto__ = new MyPrototypeObject(value); +} +function MyPrototypeObject(value) { + this.valueOf = new Function( "return this.value;" ); + this.toString = new Function( "return (this.value + '');" ); + this.value = value; +} +function MyObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.value = value; +} +function MyOtherObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.toString = new Function ( "return this.value + ''" ); + this.value = value; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js new file mode 100644 index 0000000..91af1b7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js @@ -0,0 +1,116 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.6.3.js + ECMA Section: 11.6.3 Applying the additive operators + (+, -) to numbers + Description: + The + operator performs addition when applied to two operands of numeric + type, producing the sum of the operands. The - operator performs + subtraction, producing the difference of two numeric operands. + + Addition is a commutative operation, but not always associative. + + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetic: + + If either operand is NaN, the result is NaN. + The sum of two infinities of opposite sign is NaN. + The sum of two infinities of the same sign is the infinity of that sign. + The sum of an infinity and a finite value is equal to the infinite operand. + The sum of two negative zeros is 0. The sum of two positive zeros, or of + two zeros of opposite sign, is +0. + The sum of a zero and a nonzero finite value is equal to the nonzero + operand. + The sum of two nonzero finite values of the same magnitude and opposite + sign is +0. + In the remaining cases, where neither an infinity, nor a zero, nor NaN is + involved, and the operands have the same sign or have different + magnitudes, the sum is computed and rounded to the nearest + representable value using IEEE 754 round-to-nearest mode. If the + magnitude is too large to represent, the operation overflows and + the result is then an infinity of appropriate sign. The ECMAScript + language requires support of gradual underflow as defined by IEEE 754. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.6.3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 ); + array[item++] = new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN ); + + array[item++] = new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 ); + array[item++] = new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN ); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY); + + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY); + + array[item++] = new TestCase( SECTION, "-0 + -0", -0, -0 + -0 ); + array[item++] = new TestCase( SECTION, "-0 - 0", -0, -0 - 0 ); + + array[item++] = new TestCase( SECTION, "0 + 0", 0, 0 + 0 ); + array[item++] = new TestCase( SECTION, "0 + -0", 0, 0 + -0 ); + array[item++] = new TestCase( SECTION, "0 - -0", 0, 0 - -0 ); + array[item++] = new TestCase( SECTION, "0 - 0", 0, 0 - 0 ); + array[item++] = new TestCase( SECTION, "-0 - -0", 0, -0 - -0 ); + array[item++] = new TestCase( SECTION, "-0 + 0", 0, -0 + 0 ); + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE ); + + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js new file mode 100644 index 0000000..23e2ab5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js @@ -0,0 +1,229 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.7.1.js + ECMA Section: 11.7.1 The Left Shift Operator ( << ) + Description: + Performs a bitwise left shift operation on the left argument by the amount + specified by the right argument. + + The production ShiftExpression : ShiftExpression << AdditiveExpression is + evaluated as follows: + + 1. Evaluate ShiftExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AdditiveExpression. + 4. Call GetValue(Result(3)). + 5. Call ToInt32(Result(2)). + 6. Call ToUint32(Result(4)). + 7. Mask out all but the least significant 5 bits of Result(6), that is, + compute Result(6) & 0x1F. + 8. Left shift Result(5) by Result(7) bits. The result is a signed 32 bit + integer. + 9. Return Result(8). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.7.1"; + var VERSION = "ECMA_1"; + startTest(); + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The left shift operator ( << )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( power = 0; power < 33; power++ ) { + shiftexp = Math.pow( 2, power ); + + for ( addexp = 0; addexp < 33; addexp++ ) { + array[item++] = new TestCase( SECTION, + shiftexp + " << " + addexp, + LeftShift( shiftexp, addexp ), + shiftexp << addexp ); + } + } + + return ( array ); +} +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + + } + + return r; +} +function LeftShift( s, a ) { + var shift = ToInt32( s ); + var add = ToUint32( a ); + add = Mask( add, 5 ); + var exp = LShift( shift, add ); + + return ( exp ); +} +function LShift( s, a ) { + s = ToInt32BitString( s ); + + for ( var z = 0; z < a; z++ ) { + s += "0"; + } + + s = s.substring( a, s.length); + + return ToInt32(ToInt32Decimal(s)); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js new file mode 100644 index 0000000..b2761cf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js @@ -0,0 +1,246 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.7.2.js + ECMA Section: 11.7.2 The signed right shift operator ( >> ) + Description: + Performs a sign-filling bitwise right shift operation on the left argument + by the amount specified by the right argument. + + The production ShiftExpression : ShiftExpression >> AdditiveExpression is + evaluated as follows: + + 1. Evaluate ShiftExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AdditiveExpression. + 4. Call GetValue(Result(3)). + 5. Call ToInt32(Result(2)). + 6. Call ToUint32(Result(4)). + 7. Mask out all but the least significant 5 bits of Result(6), that is, + compute Result(6) & 0x1F. + 8. Perform sign-extending right shift of Result(5) by Result(7) bits. The + most significant bit is propagated. The result is a signed 32 bit + integer. + 9. Return Result(8). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.7.2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The signed right shift operator ( >> )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + var power = 0; + var addexp = 0; + + for ( power = 0; power <= 32; power++ ) { + shiftexp = Math.pow( 2, power ); + + for ( addexp = 0; addexp <= 32; addexp++ ) { + array[item++] = new TestCase( SECTION, + shiftexp + " >> " + addexp, + SignedRightShift( shiftexp, addexp ), + shiftexp >> addexp ); + } + } + + for ( power = 0; power <= 32; power++ ) { + shiftexp = -Math.pow( 2, power ); + + for ( addexp = 0; addexp <= 32; addexp++ ) { + array[item++] = new TestCase( SECTION, + shiftexp + " >> " + addexp, + SignedRightShift( shiftexp, addexp ), + shiftexp >> addexp ); + } + } + + return ( array ); +} + +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function SignedRightShift( s, a ) { + s = ToInt32( s ); + a = ToUint32( a ); + a = Mask( a, 5 ); + return ( SignedRShift( s, a ) ); +} +function SignedRShift( s, a ) { + s = ToInt32BitString( s ); + + var firstbit = s.substring(0,1); + + s = s.substring( 1, s.length ); + + for ( var z = 0; z < a; z++ ) { + s = firstbit + s; + } + + s = s.substring( 0, s.length - a); + + s = firstbit +s; + + + return ToInt32(ToInt32Decimal(s)); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js new file mode 100644 index 0000000..9c963e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js @@ -0,0 +1,230 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.7.3.js + ECMA Section: 11.7.3 The unsigned right shift operator ( >>> ) + Description: + 11.7.3 The unsigned right shift operator ( >>> ) + Performs a zero-filling bitwise right shift operation on the left argument + by the amount specified by the right argument. + + The production ShiftExpression : ShiftExpression >>> AdditiveExpression is + evaluated as follows: + + 1. Evaluate ShiftExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate AdditiveExpression. + 4. Call GetValue(Result(3)). + 5. Call ToUint32(Result(2)). + 6. Call ToUint32(Result(4)). + 7. Mask out all but the least significant 5 bits of Result(6), that is, + compute Result(6) & 0x1F. + 8. Perform zero-filling right shift of Result(5) by Result(7) bits. + Vacated bits are filled with zero. The result is an unsigned 32 bit + integer. + 9. Return Result(8). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.7.3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + var addexp = 0; + var power = 0; + + for ( power = 0; power <= 32; power++ ) { + shiftexp = Math.pow( 2, power ); + + for ( addexp = 0; addexp <= 32; addexp++ ) { + array[item++] = new TestCase( SECTION, + shiftexp + " >>> " + addexp, + UnsignedRightShift( shiftexp, addexp ), + shiftexp >>> addexp ); + } + } + + return ( array ); +} + +function ToInteger( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( n != n ) { + return 0; + } + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { + return n; + } + return ( sign * Math.floor(Math.abs(n)) ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + + return ( n ); +} +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function ToUint16( n ) { + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); + + if (n <0) { + n += Math.pow(2,16); + } + + return ( n ); +} +function Mask( b, n ) { + b = ToUint32BitString( b ); + b = b.substring( b.length - n ); + b = ToUint32Decimal( b ); + return ( b ); +} +function ToUint32BitString( n ) { + var b = ""; + for ( p = 31; p >=0; p-- ) { + if ( n >= Math.pow(2,p) ) { + b += "1"; + n -= Math.pow(2,p); + } else { + b += "0"; + } + } + return b; +} +function ToInt32BitString( n ) { + var b = ""; + var sign = ( n < 0 ) ? -1 : 1; + + b += ( sign == 1 ) ? "0" : "1"; + + for ( p = 30; p >=0; p-- ) { + if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { + b += ( sign == 1 ) ? "1" : "0"; + n -= sign * Math.pow( 2, p ); + } else { + b += ( sign == 1 ) ? "0" : "1"; + } + } + + return b; +} +function ToInt32Decimal( bin ) { + var r = 0; + var sign; + + if ( Number(bin.charAt(0)) == 0 ) { + sign = 1; + r = 0; + } else { + sign = -1; + r = -(Math.pow(2,31)); + } + + for ( var j = 0; j < 31; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + } + + return r; +} +function ToUint32Decimal( bin ) { + var r = 0; + + + for ( l = bin.length; l < 32; l++ ) { + bin = "0" + bin; + } + + for ( j = 0; j < 32; j++ ) { + r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); + + } + + return r; +} +function RShift( s, a ) { + s = ToUint32BitString( s ); + for ( z = 0; z < a; z++ ) { + s = "0" + s; + } + s = s.substring( 0, s.length - a ); + + return ToUint32Decimal(s); +} +function UnsignedRightShift( s, a ) { + s = ToUint32( s ); + a = ToUint32( a ); + a = Mask( a, 5 ); + return ( RShift( s, a ) ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js new file mode 100644 index 0000000..db2c701 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js @@ -0,0 +1,121 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.8.1.js + ECMA Section: 11.8.1 The less-than operator ( < ) + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.8.1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The less-than operator ( < )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true < false", false, true < false ); + array[item++] = new TestCase( SECTION, "false < true", true, false < true ); + array[item++] = new TestCase( SECTION, "false < false", false, false < false ); + array[item++] = new TestCase( SECTION, "true < true", false, true < true ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) ); + + array[item++] = new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) ); + + array[item++] = new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) ); + + array[item++] = new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN ); + array[item++] = new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 ); + + array[item++] = new TestCase( SECTION, "0 < -0", false, 0 < -0 ); + array[item++] = new TestCase( SECTION, "-0 < 0", false, -0 < 0 ); + + array[item++] = new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 ); + array[item++] = new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 ); + array[item++] = new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE ); + + array[item++] = new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' ); + array[item++] = new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' ); + array[item++] = new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' ); + array[item++] = new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' ); + array[item++] = new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' ); + array[item++] = new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' ); + + return ( array ); +} +function MyObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = new Function( "return this.value +''" ); +} +function MyValueObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +} +function MyStringObject(value) { + this.value = value; + this.toString = new Function( "return this.value +''" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js new file mode 100644 index 0000000..962c33e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.8.2.js + ECMA Section: 11.8.2 The greater-than operator ( > ) + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.8.2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The greater-than operator ( > )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true > false", true, true > false ); + array[item++] = new TestCase( SECTION, "false > true", false, false > true ); + array[item++] = new TestCase( SECTION, "false > false", false, false > false ); + array[item++] = new TestCase( SECTION, "true > true", false, true > true ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) ); + + array[item++] = new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) ); + + array[item++] = new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) ); + + array[item++] = new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN ); + array[item++] = new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 ); + + array[item++] = new TestCase( SECTION, "0 > -0", false, 0 > -0 ); + array[item++] = new TestCase( SECTION, "-0 > 0", false, -0 > 0 ); + + array[item++] = new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 ); + array[item++] = new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 ); + array[item++] = new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE ); + + array[item++] = new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' ); + array[item++] = new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' ); + array[item++] = new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' ); + array[item++] = new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' ); + array[item++] = new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' ); + array[item++] = new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' ); + + + return ( array ); +} +function MyObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = new Function( "return this.value +''" ); +} +function MyValueObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +} +function MyStringObject(value) { + this.value = value; + this.toString = new Function( "return this.value +''" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js new file mode 100644 index 0000000..5da73d6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.8.3.js + ECMA Section: 11.8.3 The less-than-or-equal operator ( <= ) + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.8.1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true <= false", false, true <= false ); + array[item++] = new TestCase( SECTION, "false <= true", true, false <= true ); + array[item++] = new TestCase( SECTION, "false <= false", true, false <= false ); + array[item++] = new TestCase( SECTION, "true <= true", true, true <= true ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) ); + + array[item++] = new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) ); + + array[item++] = new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) ); + + array[item++] = new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN ); + array[item++] = new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 ); + + array[item++] = new TestCase( SECTION, "0 <= -0", true, 0 <= -0 ); + array[item++] = new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 ); + + array[item++] = new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 ); + array[item++] = new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 ); + array[item++] = new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE ); + + array[item++] = new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' ); + array[item++] = new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' ); + array[item++] = new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' ); + array[item++] = new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' ); + array[item++] = new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' ); + array[item++] = new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' ); + + return ( array ); +} +function MyObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = new Function( "return this.value +''" ); +} +function MyValueObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +} +function MyStringObject(value) { + this.value = value; + this.toString = new Function( "return this.value +''" ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js new file mode 100644 index 0000000..7e25b05 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.8.4.js + ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= ) + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.8.4"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "true >= false", true, true >= false ); + array[item++] = new TestCase( SECTION, "false >= true", false, false >= true ); + array[item++] = new TestCase( SECTION, "false >= false", true, false >= false ); + array[item++] = new TestCase( SECTION, "true >= true", true, true >= true ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) ); + + array[item++] = new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) ); + array[item++] = new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) ); + + array[item++] = new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) ); + array[item++] = new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) ); + + array[item++] = new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN ); + array[item++] = new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN ); + array[item++] = new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 ); + + array[item++] = new TestCase( SECTION, "0 >= -0", true, 0 >= -0 ); + array[item++] = new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 ); + + array[item++] = new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 ); + array[item++] = new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY ); + + array[item++] = new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 ); + array[item++] = new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE ); + + array[item++] = new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' ); + array[item++] = new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' ); + array[item++] = new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' ); + array[item++] = new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' ); + array[item++] = new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' ); + array[item++] = new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' ); + + + return ( array ); +} +function MyObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = new Function( "return this.value +''" ); +} +function MyValueObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +} +function MyStringObject(value) { + this.value = value; + this.toString = new Function( "return this.value +''" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js new file mode 100644 index 0000000..b64df9a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js @@ -0,0 +1,162 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.9.1.js + ECMA Section: 11.9.1 The equals operator ( == ) + Description: + + The production EqualityExpression: + EqualityExpression == RelationalExpression is evaluated as follows: + + 1. Evaluate EqualityExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate RelationalExpression. + 4. Call GetValue(Result(3)). + 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) + 6. Return Result(5). + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.9.1"; + var VERSION = "ECMA_1"; + startTest(); + var BUGNUMBER="77391"; + + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The equals operator ( == )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // type x and type y are the same. if type x is undefined or null, return true + + array[item++] = new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 ); + array[item++] = new TestCase( SECTION, "null == null", true, null == null ); + + // if x is NaN, return false. if y is NaN, return false. + + array[item++] = new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN ); + array[item++] = new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 ); + array[item++] = new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN ); + array[item++] = new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN ); + + // if x is the same number value as y, return true. + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY ); + + // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. + + array[item++] = new TestCase( SECTION, "0 == 0", true, 0 == 0 ); + array[item++] = new TestCase( SECTION, "0 == -0", true, 0 == -0 ); + array[item++] = new TestCase( SECTION, "-0 == 0", true, -0 == 0 ); + array[item++] = new TestCase( SECTION, "-0 == -0", true, -0 == -0 ); + + // return false. + + array[item++] = new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 ); + array[item++] = new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 ); + array[item++] = new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 ); + array[item++] = new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 ); + + // type x and type y are the same type, but not numbers. + + + // x and y are strings. return true if x and y are exactly the same sequence of characters. + // otherwise, return false. + + array[item++] = new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" ); + + // x and y are booleans. return true if both are true or both are false. + + array[item++] = new TestCase( SECTION, "true == true", true, true == true ); + array[item++] = new TestCase( SECTION, "false == false", true, false == false ); + array[item++] = new TestCase( SECTION, "true == false", false, true == false ); + array[item++] = new TestCase( SECTION, "false == true", false, false == true ); + + // return true if x and y refer to the same object. otherwise return false. + + array[item++] = new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); + + + array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") ); + array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); + + // if x is null and y is undefined, return true. if x is undefined and y is null return true. + + array[item++] = new TestCase( SECTION, "null == void 0", true, null == void 0 ); + array[item++] = new TestCase( SECTION, "void 0 == null", true, void 0 == null ); + + // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y). + + array[item++] = new TestCase( SECTION, "1 == '1'", true, 1 == '1' ); + array[item++] = new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' ); + array[item++] = new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" ); + array[item++] = new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" ); + + + array[item++] = new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) ); + + array[item++] = new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false ); + array[item++] = new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false ); + + array[item++] = new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) ); + + array[item++] = new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) ); + array[item++] = new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) ); + + return ( array ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js new file mode 100644 index 0000000..9eb4bfc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js @@ -0,0 +1,161 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.9.2.js + ECMA Section: 11.9.2 The equals operator ( == ) + Description: + + The production EqualityExpression: + EqualityExpression == RelationalExpression is evaluated as follows: + + 1. Evaluate EqualityExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate RelationalExpression. + 4. Call GetValue(Result(3)). + 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) + 6. Return Result(5). + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.9.2"; + var VERSION = "ECMA_1"; + startTest(); + var BUGNUMBER="77391"; + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The equals operator ( == )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // type x and type y are the same. if type x is undefined or null, return true + + array[item++] = new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 ); + array[item++] = new TestCase( SECTION, "null == null", false, null != null ); + + // if x is NaN, return false. if y is NaN, return false. + + array[item++] = new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN ); + array[item++] = new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 ); + array[item++] = new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN ); + array[item++] = new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN ); + + // if x is the same number value as y, return true. + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY ); + + // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. + + array[item++] = new TestCase( SECTION, "0 != 0", false, 0 != 0 ); + array[item++] = new TestCase( SECTION, "0 != -0", false, 0 != -0 ); + array[item++] = new TestCase( SECTION, "-0 != 0", false, -0 != 0 ); + array[item++] = new TestCase( SECTION, "-0 != -0", false, -0 != -0 ); + + // return false. + + array[item++] = new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 ); + array[item++] = new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 ); + array[item++] = new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 ); + array[item++] = new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 ); + + // type x and type y are the same type, but not numbers. + + + // x and y are strings. return true if x and y are exactly the same sequence of characters. + // otherwise, return false. + + array[item++] = new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" ); + + // x and y are booleans. return true if both are true or both are false. + + array[item++] = new TestCase( SECTION, "true != true", false, true != true ); + array[item++] = new TestCase( SECTION, "false != false", false, false != false ); + array[item++] = new TestCase( SECTION, "true != false", true, true != false ); + array[item++] = new TestCase( SECTION, "false != true", true, false != true ); + + // return true if x and y refer to the same object. otherwise return false. + + array[item++] = new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) ); + + + array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") ); + array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) ); + + // if x is null and y is undefined, return true. if x is undefined and y is null return true. + + array[item++] = new TestCase( SECTION, "null != void 0", false, null != void 0 ); + array[item++] = new TestCase( SECTION, "void 0 != null", false, void 0 != null ); + + // if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y). + + array[item++] = new TestCase( SECTION, "1 != '1'", false, 1 != '1' ); + array[item++] = new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' ); + array[item++] = new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" ); + array[item++] = new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" ); + + + array[item++] = new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) ); + + array[item++] = new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false ); + array[item++] = new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false ); + + array[item++] = new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) ); + array[item++] = new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) ); + + array[item++] = new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) ); + array[item++] = new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) ); + + return ( array ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js new file mode 100644 index 0000000..134060b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js @@ -0,0 +1,161 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 11.9.3.js + ECMA Section: 11.9.3 The equals operator ( == ) + Description: + + The production EqualityExpression: + EqualityExpression == RelationalExpression is evaluated as follows: + + 1. Evaluate EqualityExpression. + 2. Call GetValue(Result(1)). + 3. Evaluate RelationalExpression. + 4. Call GetValue(Result(3)). + 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) + 6. Return Result(5). + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "11.9.3"; + var VERSION = "ECMA_1"; + startTest(); + var BUGNUMBER="77391"; + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The equals operator ( == )"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // type x and type y are the same. if type x is undefined or null, return true + + array[item++] = new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 ); + array[item++] = new TestCase( SECTION, "null == null", true, null == null ); + + // if x is NaN, return false. if y is NaN, return false. + + array[item++] = new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN ); + array[item++] = new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 ); + array[item++] = new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN ); + array[item++] = new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN ); + + // if x is the same number value as y, return true. + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE ); + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY ); + + // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. + + array[item++] = new TestCase( SECTION, "0 == 0", true, 0 == 0 ); + array[item++] = new TestCase( SECTION, "0 == -0", true, 0 == -0 ); + array[item++] = new TestCase( SECTION, "-0 == 0", true, -0 == 0 ); + array[item++] = new TestCase( SECTION, "-0 == -0", true, -0 == -0 ); + + // return false. + + array[item++] = new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 ); + array[item++] = new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 ); + array[item++] = new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 ); + array[item++] = new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 ); + + // type x and type y are the same type, but not numbers. + + + // x and y are strings. return true if x and y are exactly the same sequence of characters. + // otherwise, return false. + + array[item++] = new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" ); + + // x and y are booleans. return true if both are true or both are false. + + array[item++] = new TestCase( SECTION, "true == true", true, true == true ); + array[item++] = new TestCase( SECTION, "false == false", true, false == false ); + array[item++] = new TestCase( SECTION, "true == false", false, true == false ); + array[item++] = new TestCase( SECTION, "false == true", false, false == true ); + + // return true if x and y refer to the same object. otherwise return false. + + array[item++] = new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); + + + array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") ); + array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") ); + + array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); + + // if x is null and y is undefined, return true. if x is undefined and y is null return true. + + array[item++] = new TestCase( SECTION, "null == void 0", true, null == void 0 ); + array[item++] = new TestCase( SECTION, "void 0 == null", true, void 0 == null ); + + // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y). + + array[item++] = new TestCase( SECTION, "1 == '1'", true, 1 == '1' ); + array[item++] = new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' ); + array[item++] = new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" ); + array[item++] = new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" ); + + + array[item++] = new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) ); + + array[item++] = new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false ); + array[item++] = new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false ); + + array[item++] = new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) ); + array[item++] = new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) ); + + array[item++] = new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) ); + array[item++] = new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) ); + + return ( array ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js new file mode 100644 index 0000000..c20dd37 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.1.1.js + ECMA Section: 15.3.1.1 The Function Constructor Called as a Function + + Description: + When the Function function is called with some arguments p1, p2, . . . , pn, body + (where n might be 0, that is, there are no "p" arguments, and where body might + also not be provided), the following steps are taken: + + 1. Create and return a new Function object exactly if the function constructor had + been called with the same arguments (15.3.2.1). + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.1.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Function Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var myfunc = Function(); + myfunc.toString = Object.prototype.toString; + +// not going to test toString here since it is implementation dependent. +// array[item++] = new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); + + myfunc.toString = Object.prototype.toString; + array[item++] = new TestCase( SECTION, + "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc.toString() ); + array[item++] = new TestCase( SECTION, "myfunc.length", 0, myfunc.length ); + array[item++] = new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() ); + array[item++] = new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); + array[item++] = new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() ); + array[item++] = new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") ); + array[item++] = new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") ); + array[item++] = new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype ); + array[item++] = new TestCase( SECTION, "MyObject.length", 1, MyObject.length ); + array[item++] = new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor ); + array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js new file mode 100644 index 0000000..ce6994e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js @@ -0,0 +1,118 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.1.1-2.js + ECMA Section: 15.3.1.1 The Function Constructor Called as a Function + Function(p1, p2, ..., pn, body ) + + Description: + When the Function function is called with some arguments p1, p2, . . . , pn, + body (where n might be 0, that is, there are no "p" arguments, and where body + might also not be provided), the following steps are taken: + + 1. Create and return a new Function object exactly if the function constructor + had been called with the same arguments (15.3.2.1). + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.1.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Function Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + var myfunc1 = Function("a","b","c", "return a+b+c" ); + var myfunc2 = Function("a, b, c", "return a+b+c" ); + var myfunc3 = Function("a,b", "c", "return a+b+c" ); + + myfunc1.toString = Object.prototype.toString; + myfunc2.toString = Object.prototype.toString; + myfunc3.toString = Object.prototype.toString; + + array[item++] = new TestCase( SECTION, "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc1.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length ); + array[item++] = new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments ); + array[item++] = new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) ); + array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS", + "", + eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc2.toString() ); + array[item++] = new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ ); + array[item++] = new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length ); + array[item++] = new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments ); + array[item++] = new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) ); + array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS", + "", + eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc3.toString() ); + array[item++] = new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ ); + array[item++] = new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length ); + array[item++] = new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() ); + array[item++] = new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' ); + array[item++] = new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments ); + array[item++] = new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) ); + + array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS", + "", + eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js new file mode 100644 index 0000000..459a6bf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.1.1-3.js + ECMA Section: 15.3.1.1 The Function Constructor Called as a Function + + new Function(p1, p2, ..., pn, body ) + + Description: The last argument specifies the body (executable code) + of a function; any preceeding arguments sepcify formal + parameters. + + See the text for description of this section. + + This test examples from the specification. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.1.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Function Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + + var testcases = new Array(); + + var args = ""; + + for ( var i = 0; i < 2000; i++ ) { + args += "arg"+i; + if ( i != 1999 ) { + args += ","; + } + } + + var s = ""; + + for ( var i = 0; i < 2000; i++ ) { + s += ".0005"; + if ( i != 1999 ) { + s += ","; + } + } + + MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); + MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); + + var MY_OB = eval( "MyFunc("+ s +")" ); + + testcases[testcases.length] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); + testcases[testcases.length] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB ); + testcases[testcases.length] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); + + testcases[testcases.length] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); + + testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); + testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); + testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js new file mode 100644 index 0000000..ec1b86b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js @@ -0,0 +1,94 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.2.1.js + ECMA Section: 15.3.2.1 The Function Constructor + new Function(p1, p2, ..., pn, body ) + + Description: The last argument specifies the body (executable code) + of a function; any preceeding arguments sepcify formal + parameters. + + See the text for description of this section. + + This test examples from the specification. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.2.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Function Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var myfunc = new Function(); + +// not going to test toString here since it is implementation dependent. +// array[item++] = new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); + + myfunc.toString = Object.prototype.toString; + + array[item++] = new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc.toString() ); + array[item++] = new TestCase( SECTION, "myfunc.length", 0, myfunc.length ); + array[item++] = new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments ); + + array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); + array[item++] = new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() ); + array[item++] = new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") ); + array[item++] = new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") ); + + array[item++] = new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype ); + array[item++] = new TestCase( SECTION, "MyObject.length", 1, MyObject.length ); + array[item++] = new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor ); + array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js new file mode 100644 index 0000000..b8f403c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.2.1.js + ECMA Section: 15.3.2.1 The Function Constructor + new Function(p1, p2, ..., pn, body ) + + Description: + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.2.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Function Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + var myfunc1 = new Function("a","b","c", "return a+b+c" ); + var myfunc2 = new Function("a, b, c", "return a+b+c" ); + var myfunc3 = new Function("a,b", "c", "return a+b+c" ); + + myfunc1.toString = Object.prototype.toString; + myfunc2.toString = Object.prototype.toString; + myfunc3.toString = Object.prototype.toString; + + array[item++] = new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc1.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length ); + array[item++] = new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments ); + array[item++] = new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) ); + array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS", + "", + eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc2.toString() ); + array[item++] = new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ ); + array[item++] = new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length ); + array[item++] = new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() ); + + array[item++] = new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments ); + array[item++] = new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) ); + array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS", + "", + eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + myfunc3.toString() ); + array[item++] = new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ ); + array[item++] = new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length ); + array[item++] = new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() ); + array[item++] = new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' ); + array[item++] = new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor ); + array[item++] = new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments ); + array[item++] = new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) ); + + array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS", + "", + eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js new file mode 100644 index 0000000..76c5e2f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.2.1-3.js + ECMA Section: 15.3.2.1 The Function Constructor + new Function(p1, p2, ..., pn, body ) + + Description: The last argument specifies the body (executable code) + of a function; any preceeding arguments sepcify formal + parameters. + + See the text for description of this section. + + This test examples from the specification. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.2.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Function Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var args = ""; + + for ( var i = 0; i < 2000; i++ ) { + args += "arg"+i; + if ( i != 1999 ) { + args += ","; + } + } + + var s = ""; + + for ( var i = 0; i < 2000; i++ ) { + s += ".0005"; + if ( i != 1999 ) { + s += ","; + } + } + + MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); + MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); + + array[item++] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); + array[item++] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); + + array[item++] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); + + array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); + array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); + array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js new file mode 100644 index 0000000..4442e27 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js @@ -0,0 +1,62 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.3.1-1.js + ECMA Section: 15.3.3.1 Properties of the Function Constructor + Function.prototype + + Description: The initial value of Function.prototype is the built-in + Function prototype object. + + This property shall have the attributes [DontEnum | + DontDelete | ReadOnly] + + This test the value of Function.prototype. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.3.1-1"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "Function.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + testcases[tc++] = new TestCase( SECTION, "Function.prototype == Function.proto", true, Function.__proto__ == Function.prototype ); + + test(); + +function test() { + for (tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js new file mode 100644 index 0000000..e39abbf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.3.1-2.js + ECMA Section: 15.3.3.1 Properties of the Function Constructor + Function.prototype + + Description: The initial value of Function.prototype is the built-in + Function prototype object. + + This property shall have the attributes [DontEnum | + DontDelete | ReadOnly] + + This test the DontEnum property of Function.prototype. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "var str='';for (prop in Function ) str += prop; str;", + "", + eval("var str='';for (prop in Function) str += prop; str;") + ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js new file mode 100644 index 0000000..b95752c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.3.1-3.js + ECMA Section: 15.3.3.1 Properties of the Function Constructor + Function.prototype + + Description: The initial value of Function.prototype is the built-in + Function prototype object. + + This property shall have the attributes [DontEnum | + DontDelete | ReadOnly] + + This test the DontDelete property of Function.prototype. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.3.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var FUN_PROTO = Function.prototype; + + array[item++] = new TestCase( SECTION, + "delete Function.prototype", + false, + delete Function.prototype + ); + + array[item++] = new TestCase( SECTION, + "delete Function.prototype; Function.prototype", + FUN_PROTO, + eval("delete Function.prototype; Function.prototype") + ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js new file mode 100644 index 0000000..5b4e811 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.3.1-4.js + ECMA Section: 15.3.3.1 Properties of the Function Constructor + Function.prototype + + Description: The initial value of Function.prototype is the built-in + Function prototype object. + + This property shall have the attributes [DontEnum | + DontDelete | ReadOnly] + + This test the ReadOnly property of Function.prototype. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.3.1-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "Function.prototype = null; Function.prototype", + Function.prototype, + eval("Function.prototype = null; Function.prototype") + ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js new file mode 100644 index 0000000..821f93e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js @@ -0,0 +1,60 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.3.2.js + ECMA Section: 15.3.3.2 Properties of the Function Constructor + Function.length + + Description: The length property is 1. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.3.3.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.length"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Function.length", 1, Function.length ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js new file mode 100644 index 0000000..d919d41 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.4-1.js + ECMA Section: 15.3.4 Properties of the Function Prototype Object + + Description: The Function prototype object is itself a Function + object ( its [[Class]] is "Function") that, when + invoked, accepts any arguments and returns undefined. + + The value of the internal [[Prototype]] property + object is the Object prototype object. + + It is a function with an "empty body"; if it is + invoked, it merely returns undefined. + + The Function prototype object does not have a valueOf + property of its own; however it inherits the valueOf + property from the Object prototype Object. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.3.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Function Prototype Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()")); + + +// array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf ); + array[item++] = new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() ); + array[item++] = new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js new file mode 100644 index 0000000..ce75a14 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js @@ -0,0 +1,62 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.4.1.js + ECMA Section: 15.3.4.1 Function.prototype.constructor + + Description: The initial value of Function.prototype.constructor + is the built-in Function constructor. + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.3.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.prototype.constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor ); + + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js new file mode 100644 index 0000000..df519d2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.4.js + ECMA Section: 15.3.4 Properties of the Function Prototype Object + + Description: The Function prototype object is itself a Function + object ( its [[Class]] is "Function") that, when + invoked, accepts any arguments and returns undefined. + + The value of the internal [[Prototype]] property + object is the Object prototype object. + + It is a function with an "empty body"; if it is + invoked, it merely returns undefined. + + The Function prototype object does not have a valueOf + property of its own; however it inherits the valueOf + property from the Object prototype Object. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.3.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Function Prototype Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()", + "[object Function]", + eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()")); + + +// array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf ); + array[item++] = new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() ); + array[item++] = new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js new file mode 100644 index 0000000..1e63370 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js @@ -0,0 +1,118 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.5-1.js + ECMA Section: 15.3.5 Properties of Function Instances + new Function(p1, p2, ..., pn, body ) + + Description: + + 15.3.5.1 length + + The value of the length property is usually an integer that indicates + the "typical" number of arguments expected by the function. However, + the language permits the function to be invoked with some other number + of arguments. The behavior of a function when invoked on a number of + arguments other than the number specified by its length property depends + on the function. + + 15.3.5.2 prototype + The value of the prototype property is used to initialize the internal [[ + Prototype]] property of a newly created object before the Function object + is invoked as a constructor for that newly created object. + + 15.3.5.3 arguments + + The value of the arguments property is normally null if there is no + outstanding invocation of the function in progress (that is, the function has been called + but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its + arguments property is "dynamically bound" to a newly created object that contains the + arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this + property is discouraged; it is provided principally for compatibility with existing old code. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.3.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of Function Instances"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var args = ""; + + for ( var i = 0; i < 2000; i++ ) { + args += "arg"+i; + if ( i != 1999 ) { + args += ","; + } + } + + var s = ""; + + for ( var i = 0; i < 2000; i++ ) { + s += ".0005"; + if ( i != 1999 ) { + s += ","; + } + } + + MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); + MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); + + + array[item++] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); + array[item++] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); + array[item++] = new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() ); + array[item++] = new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype ); + + + array[item++] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); + + array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); + array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); + array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js new file mode 100644 index 0000000..fe24e32 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js @@ -0,0 +1,92 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.5-1.js + ECMA Section: 15.3.5 Properties of Function Instances + new Function(p1, p2, ..., pn, body ) + + Description: + + 15.3.5.1 length + + The value of the length property is usually an integer that indicates + the "typical" number of arguments expected by the function. However, + the language permits the function to be invoked with some other number + of arguments. The behavior of a function when invoked on a number of + arguments other than the number specified by its length property depends + on the function. + + 15.3.5.2 prototype + The value of the prototype property is used to initialize the internal [[ + Prototype]] property of a newly created object before the Function object + is invoked as a constructor for that newly created object. + + 15.3.5.3 arguments + + The value of the arguments property is normally null if there is no + outstanding invocation of the function in progress (that is, the function has been called + but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its + arguments property is "dynamically bound" to a newly created object that contains the + arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this + property is discouraged; it is provided principally for compatibility with existing old code. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.3.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of Function Instances"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' ); + + array[item++] = new TestCase( SECTION, "MyObject.length", 3, MyObject.length ); + array[item++] = new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype ); + array[item++] = new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor ); + array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js new file mode 100644 index 0000000..3da3b0e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.5.1.js + ECMA Section: Function.length + Description: + + The value of the length property is usually an integer that indicates the + "typical" number of arguments expected by the function. However, the + language permits the function to be invoked with some other number of + arguments. The behavior of a function when invoked on a number of arguments + other than the number specified by its length property depends on the function. + + this test needs a 1.2 version check. + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204 + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.3.5.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.length"; + var BUGNUMBER="104204"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var f = new Function( "a","b", "c", "return f.length"); + + testcases[tc++] = new TestCase( SECTION, + 'var f = new Function( "a","b", "c", "return f.length"); f()', + 3, + f() ); + + + testcases[tc++] = new TestCase( SECTION, + 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', + 3, + f(1,2,3,4,5) ); + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js new file mode 100644 index 0000000..eaf6dbe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.5.3.js + ECMA Section: Function.arguments + Description: + + The value of the arguments property is normally null if there is no + outstanding invocation of the function in progress (that is, the + function has been called but has not yet returned). When a non-internal + Function object (15.3.2.1) is invoked, its arguments property is + "dynamically bound" to a newly created object that contains the arguments + on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this + property is discouraged; it is provided principally for compatibility + with existing old code. + + See sections 10.1.6 and 10.1.8 for more extensive tests. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.3.5.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.arguments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array =new Array(); + var item = 0; + + var MYFUNCTION = new Function( "return this.arguments" ); + + + array[item++] = new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments ); + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js new file mode 100644 index 0000000..906b0b4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1-1-n.js + ECMA Section: The global object + Description: + + The global object does not have a [[Construct]] property; it is not + possible to use the global object as a constructor with the new operator. + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.1-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Global Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc] = new TestCase( SECTION, + "var MY_GLOBAL = new this()", + "error", + "var MY_GLOBAL = new this()" ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js new file mode 100644 index 0000000..327c685 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1-2-n.js + ECMA Section: The global object + Description: + + The global object does not have a [[Call]] property; it is not possible + to invoke the global object as a function. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.1-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Global Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc] = new TestCase( SECTION, + "var MY_GLOBAL = this()", + "error", + "var MY_GLOBAL = this()" ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js new file mode 100644 index 0000000..4310a51 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.1.1.js + ECMA Section: 15.1.1.1 NaN + + Description: The initial value of NaN is NaN. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.1.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "NaN"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[array.length] = new TestCase( SECTION, "NaN", Number.NaN, NaN ); + array[array.length] = new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN ); + array[array.length] = new TestCase( SECTION, "typeof NaN", "number", typeof NaN ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js new file mode 100644 index 0000000..35324d6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.1.2.js + ECMA Section: 15.1.1.2 Infinity + + Description: The initial value of Infinity is +Infinity. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.1.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Infinity"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity ); + array[item++] = new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity ); + array[item++] = new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js new file mode 100644 index 0000000..d4f38a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js @@ -0,0 +1,91 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.1-1.js + ECMA Section: 15.1.2.1 eval(x) + + if x is not a string object, return x. + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.1.2.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "eval(x)"; + + var BUGNUMBER = "111199"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "eval.length", 1, eval.length ); + array[item++] = new TestCase( SECTION, "delete eval.length", false, delete eval.length ); + array[item++] = new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") ); + array[item++] = new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") ); +// array[item++] = new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); + + // test cases where argument is not a string. should return the argument. + + array[item++] = new TestCase( SECTION, "eval()", void 0, eval() ); + array[item++] = new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) ); + array[item++] = new TestCase( SECTION, "eval(null)", null, eval( null ) ); + array[item++] = new TestCase( SECTION, "eval(true)", true, eval( true ) ); + array[item++] = new TestCase( SECTION, "eval(false)", false, eval( false ) ); + + array[item++] = new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) ); + + array[item++] = new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) ); + array[item++] = new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) ); + array[item++] = new TestCase( SECTION, "eval(1)", 1, eval(1) ); + array[item++] = new TestCase( SECTION, "eval(0)", 0, eval(0) ); + array[item++] = new TestCase( SECTION, "eval(-1)", -1, eval(-1) ); + array[item++] = new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) ); + array[item++] = new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) ); + array[item++] = new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js new file mode 100644 index 0000000..203cd4d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.1-2.js + ECMA Section: 15.1.2.1 eval(x) + + Parse x as an ECMAScript Program. If the parse fails, + generate a runtime error. Evaluate the program. If + result is "Normal completion after value V", return + the value V. Else, return undefined. + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.1.2.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "eval(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[0] = new TestCase( SECTION, + "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x", + "0/1/1970", + eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" ) + ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js new file mode 100644 index 0000000..422109d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js @@ -0,0 +1,291 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.2-1.js + ECMA Section: 15.1.2.2 Function properties of the global object + parseInt( string, radix ) + + Description: + + The parseInt function produces an integer value dictated by intepretation + of the contents of the string argument according to the specified radix. + + When the parseInt function is called, the following steps are taken: + + 1. Call ToString(string). + 2. Compute a substring of Result(1) consisting of the leftmost character + that is not a StrWhiteSpaceChar and all characters to the right of + that character. (In other words, remove leading whitespace.) + 3. Let sign be 1. + 4. If Result(2) is not empty and the first character of Result(2) is a + minus sign -, let sign be -1. + 5. If Result(2) is not empty and the first character of Result(2) is a + plus sign + or a minus sign -, then Result(5) is the substring of + Result(2) produced by removing the first character; otherwise, Result(5) + is Result(2). + 6. If the radix argument is not supplied, go to step 12. + 7. Call ToInt32(radix). + 8. If Result(7) is zero, go to step 12; otherwise, if Result(7) < 2 or + Result(7) > 36, return NaN. + 9. Let R be Result(7). + 10. If R = 16 and the length of Result(5) is at least 2 and the first two + characters of Result(5) are either "0x" or "0X", let S be the substring + of Result(5) consisting of all but the first two characters; otherwise, + let S be Result(5). + 11. Go to step 22. + 12. If Result(5) is empty or the first character of Result(5) is not 0, + go to step 20. + 13. If the length of Result(5) is at least 2 and the second character of + Result(5) is x or X, go to step 17. + 14. Let R be 8. + 15. Let S be Result(5). + 16. Go to step 22. + 17. Let R be 16. + 18. Let S be the substring of Result(5) consisting of all but the first + two characters. + 19. Go to step 22. + 20. Let R be 10. + 21. Let S be Result(5). + 22. If S contains any character that is not a radix-R digit, then let Z be + the substring of S consisting of all characters to the left of the + leftmost such character; otherwise, let Z be S. + 23. If Z is empty, return NaN. + 24. Compute the mathematical integer value that is represented by Z in + radix-R notation. (But if R is 10 and Z contains more than 20 + significant digits, every digit after the 20th may be replaced by a 0 + digit, at the option of the implementation; and if R is not 2, 4, 8, + 10, 16, or 32, then Result(24) may be an implementation-dependent + approximation to the mathematical integer value that is represented + by Z in radix-R notation.) + 25. Compute the number value for Result(24). + 26. Return sign Result(25). + + Note that parseInt may interpret only a leading portion of the string as + an integer value; it ignores any characters that cannot be interpreted as + part of the notation of an integer, and no indication is given that any + such characters were ignored. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.2.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "parseInt(string, radix)"; + var BUGNUMBER="111199"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var HEX_STRING = "0x0"; + var HEX_VALUE = 0; + + array[item++] = new TestCase( SECTION, "parseInt.length", 2, parseInt.length ); + array[item++] = new TestCase( SECTION, "parseInt.length = 0; parseInt.length", 2, eval("parseInt.length = 0; parseInt.length") ); + array[item++] = new TestCase( SECTION, "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "", eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") ); + array[item++] = new TestCase( SECTION, "delete parseInt.length", false, delete parseInt.length ); + array[item++] = new TestCase( SECTION, "delete parseInt.length; parseInt.length", 2, eval("delete parseInt.length; parseInt.length") ); + array[item++] = new TestCase( SECTION, "parseInt.length = null; parseInt.length", 2, eval("parseInt.length = null; parseInt.length") ); + + array[item++] = new TestCase( SECTION, "parseInt()", NaN, parseInt() ); + array[item++] = new TestCase( SECTION, "parseInt('')", NaN, parseInt("") ); + array[item++] = new TestCase( SECTION, "parseInt('','')", NaN, parseInt("","") ); + array[item++] = new TestCase( SECTION, + "parseInt(\" 0xabcdef ", + 11259375, + parseInt( " 0xabcdef " )); + + array[item++] = new TestCase( SECTION, + "parseInt(\" 0XABCDEF ", + 11259375, + parseInt( " 0XABCDEF " ) ); + + array[item++] = new TestCase( SECTION, + "parseInt( 0xabcdef )", + 11259375, + parseInt( "0xabcdef") ); + + array[item++] = new TestCase( SECTION, + "parseInt( 0XABCDEF )", + 11259375, + parseInt( "0XABCDEF") ); + + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + + // a few tests with spaces + + for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; + POWER < 15; + POWER++, HEX_STRING = HEX_STRING +"f", space += " ") + { + array[item++] = new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + + // a few tests with negative numbers + for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); + HEX_VALUE -= Math.pow(16,POWER)*15; + } + + // we should stop parsing when we get to a value that is not a numeric literal for the type we expect + + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) ); + HEX_VALUE += Math.pow(16,POWER)*15; + } + + for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); + HEX_VALUE -= Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); + HEX_VALUE -= Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); + HEX_VALUE -= Math.pow(16,POWER)*15; + } + for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { + array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); + HEX_VALUE -= Math.pow(16,POWER)*15; + } + + // let us do some octal tests. numbers that start with 0 and do not provid a radix should + // default to using "0" as a radix. + + var OCT_STRING = "0"; + var OCT_VALUE = 0; + + for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { + array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); + OCT_VALUE += Math.pow(8,POWER)*7; + } + + for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { + array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); + OCT_VALUE -= Math.pow(8,POWER)*7; + } + + // should get the same results as above if we provid the radix of 8 (or 010) + + for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { + array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) ); + OCT_VALUE += Math.pow(8,POWER)*7; + } + for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { + array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) ); + OCT_VALUE -= Math.pow(8,POWER)*7; + } + + // we shall stop parsing digits when we get one that isn't a numeric literal of the type we think + // it should be. + for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { + array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) ); + OCT_VALUE += Math.pow(8,POWER)*7; + } + for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { + array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) ); + OCT_VALUE -= Math.pow(8,POWER)*7; + } + + array[item++] = new TestCase( SECTION, "parseInt( '0x' )", NaN, parseInt("0x") ); + array[item++] = new TestCase( SECTION, "parseInt( '0X' )", NaN, parseInt("0X") ); + + array[item++] = new TestCase( SECTION, "parseInt( '11111111112222222222' )", 11111111112222222222, parseInt("11111111112222222222") ); + array[item++] = new TestCase( SECTION, "parseInt( '111111111122222222223' )", 111111111122222222220, parseInt("111111111122222222223") ); + array[item++] = new TestCase( SECTION, "parseInt( '11111111112222222222',10 )", 11111111112222222222, parseInt("11111111112222222222",10) ); + array[item++] = new TestCase( SECTION, "parseInt( '111111111122222222223',10 )", 111111111122222222220, parseInt("111111111122222222223",10) ); + + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', -1 )", Number.NaN, parseInt("01234567890",-1) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 0 )", Number.NaN, parseInt("01234567890",1) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 1 )", Number.NaN, parseInt("01234567890",1) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 2 )", 1, parseInt("01234567890",2) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 3 )", 5, parseInt("01234567890",3) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 4 )", 27, parseInt("01234567890",4) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 5 )", 194, parseInt("01234567890",5) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 6 )", 1865, parseInt("01234567890",6) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 7 )", 22875, parseInt("01234567890",7) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 8 )", 342391, parseInt("01234567890",8) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 9 )", 6053444, parseInt("01234567890",9) ); + array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 10 )", 1234567890, parseInt("01234567890",10) ); + + // need more test cases with hex radix + + array[item++] = new TestCase( SECTION, "parseInt( '1234567890', '0xa')", 1234567890, parseInt("1234567890","0xa") ); + + array[item++] = new TestCase( SECTION, "parseInt( '012345', 11 )", 17715, parseInt("012345",11) ); + + array[item++] = new TestCase( SECTION, "parseInt( '012345', 35 )", 1590195, parseInt("012345",35) ); + array[item++] = new TestCase( SECTION, "parseInt( '012345', 36 )", 1776965, parseInt("012345",36) ); + array[item++] = new TestCase( SECTION, "parseInt( '012345', 37 )", Number.NaN, parseInt("012345",37) ); + + return ( array ); +} +function test( array ) { + for ( tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js new file mode 100644 index 0000000..27d31be --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js @@ -0,0 +1,232 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.2-1.js + ECMA Section: 15.1.2.2 Function properties of the global object + parseInt( string, radix ) + + Description: parseInt test cases written by waldemar, and documented in + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ +var SECTION = "15.1.2.2-2"; +var VERSION = "ECMA_1"; + startTest(); +var TITLE = "parseInt(string, radix)"; +var BUGNUMBER="123874"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcases = new Array(); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)', + 9027215253084860, + parseInt("000000100000000100100011010001010110011110001001101010111100",2) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)', + 9027215253084860, + parseInt("000000100000000100100011010001010110011110001001101010111101",2)); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)', + 9027215253084864, + parseInt("000000100000000100100011010001010110011110001001101010111111",2) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)', + 18054430506169720, + parseInt("0000001000000001001000110100010101100111100010011010101111010",2) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)', + 18054430506169724, + parseInt("0000001000000001001000110100010101100111100010011010101111011",2)); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)', + 18054430506169724, + parseInt("0000001000000001001000110100010101100111100010011010101111100",2) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)', + 18054430506169728, + parseInt("0000001000000001001000110100010101100111100010011010101111110",2) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("yz",35)', + 34, + parseInt("yz",35) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("yz",36)', + 1259, + parseInt("yz",36) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("yz",37)', + NaN, + parseInt("yz",37) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("+77")', + 77, + parseInt("+77") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("-77",9)', + -70, + parseInt("-77",9) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("\u20001234\u2000")', + 1234, + parseInt("\u20001234\u2000") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("123456789012345678")', + 123456789012345680, + parseInt("123456789012345678") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("9",8)', + NaN, + parseInt("9",8) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("1e2")', + 1, + parseInt("1e2") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("1.9999999999999999999")', + 1, + parseInt("1.9999999999999999999") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0x10")', + 16, + parseInt("0x10") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0x10",10)', + 0, + parseInt("0x10",10)); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0022")', + 18, + parseInt("0022")); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0022",10)', + 22, + parseInt("0022",10) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0x1000000000000080")', + 1152921504606847000, + parseInt("0x1000000000000080") ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt("0x1000000000000081")', + 1152921504606847200, + parseInt("0x1000000000000081") ); + +s = +"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + +s += "0000000000000000000000000000000000000"; + +testcases[tc++] = new TestCase( SECTION, + "s = " + s +"; -s", + -1.7976931348623157e+308, + -s ); + +s = +"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; +s += "0000000000000000000000000000000000001"; + +testcases[tc++] = new TestCase( SECTION, + "s = " + s +"; -s", + -1.7976931348623157e+308, + -s ); + + +s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +s += "0000000000000000000000000000000000000" + + +testcases[tc++] = new TestCase( SECTION, + "s = " + s + "; -s", + -Infinity, + -s ); + +s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; +s += "0000000000000000000000000000000000001"; + +testcases[tc++] = new TestCase( SECTION, + "s = " + s + "; -s", + -1.7976931348623157e+308, + -s ); + +s += "0" + +testcases[tc++] = new TestCase( SECTION, + "s = " + s + "; -s", + -Infinity, + -s ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt(s)', + Infinity, + parseInt(s) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt(s,32)', + 0, + parseInt(s,32) ); + +testcases[tc++] = new TestCase( SECTION, + 'parseInt(s,36)', + Infinity, + parseInt(s,36)); + +test(); + +function test( array ) { + for ( tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js new file mode 100644 index 0000000..0efec6b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js @@ -0,0 +1,444 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.3.js + ECMA Section: 15.1.2.3 Function properties of the global object: + parseFloat( string ) + + Description: The parseFloat function produces a number value dictated + by the interpretation of the contents of the string + argument defined as a decimal literal. + + When the parseFloat function is called, the following + steps are taken: + + 1. Call ToString( string ). + 2. Remove leading whitespace Result(1). + 3. If neither Result(2) nor any prefix of Result(2) + satisfies the syntax of a StrDecimalLiteral, + return NaN. + 4. Compute the longest prefix of Result(2) which might + be Resusult(2) itself, that satisfies the syntax of + a StrDecimalLiteral + 5. Return the number value for the MV of Result(4). + + Note that parseFloate may interpret only a leading + portion of the string as a number value; it ignores any + characters that cannot be interpreted as part of the + notation of a decimal literal, and no indication is given + that such characters were ignored. + + StrDecimalLiteral:: + Infinity + DecimalDigits.DecimalDigits opt ExponentPart opt + .DecimalDigits ExponentPart opt + DecimalDigits ExponentPart opt + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.1.2.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "parseFloat(string)"; + var BUGNUMBER= "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length ); + + array[item++] = new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") ); + array[item++] = new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length ); + array[item++] = new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") ); + array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() ); + array[item++] = new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') ); + + array[item++] = new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') ); + array[item++] = new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) ); + array[item++] = new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) ); + array[item++] = new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") ); + array[item++] = new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') ); + + array[item++] = new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") ); + array[item++] = new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) ); + + + array[item++] = new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') ); + + array[item++] = new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") ); + array[item++] = new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) ); + + array[item++] = new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") ); + array[item++] = new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") ); + array[item++] = new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") ); + + array[item++] = new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") ); + array[item++] = new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") ); + array[item++] = new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") ); + + array[item++] = new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") ); + array[item++] = new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") ); + array[item++] = new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") ); + + array[item++] = new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") ); + array[item++] = new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") ); + array[item++] = new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") ); + + array[item++] = new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") ); + array[item++] = new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") ); + array[item++] = new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") ); + + array[item++] = new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") ); + array[item++] = new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") ); + array[item++] = new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") ); + + array[item++] = new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") ); + array[item++] = new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") ); + array[item++] = new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") ); + + array[item++] = new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") ); + array[item++] = new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") ); + array[item++] = new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") ); + + array[item++] = new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") ); + array[item++] = new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") ); + array[item++] = new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") ); + + array[item++] = new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") ); + array[item++] = new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") ); + array[item++] = new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") ); + + array[item++] = new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") ); + array[item++] = new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") ); + array[item++] = new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") ); + + array[item++] = new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") ); + array[item++] = new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") ); + array[item++] = new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") ); + + array[item++] = new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") ); + array[item++] = new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") ); + array[item++] = new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") ); + + array[item++] = new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") ); + array[item++] = new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") ); + array[item++] = new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") ); + + array[item++] = new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") ); + array[item++] = new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") ); + array[item++] = new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") ); + + // StrDecimalLiteral::: .DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") ); + array[item++] = new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") ); + array[item++] = new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") ); + + array[item++] = new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") ); + array[item++] = new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") ); + array[item++] = new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") ); + + array[item++] = new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") ); + array[item++] = new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") ); + array[item++] = new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") ); + + array[item++] = new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") ); + array[item++] = new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") ); + array[item++] = new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") ); + + // StrDecimalLiteral::: DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") ); + array[item++] = new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") ); + array[item++] = new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") ); + + array[item++] = new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") ); + array[item++] = new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") ); + array[item++] = new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") ); + + array[item++] = new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") ); + array[item++] = new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") ); + array[item++] = new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") ); + + + array[item++] = new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) ); + array[item++] = new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) ); + + array[item++] = new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) ); + + array[item++] = new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) ); + array[item++] = new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) ); + + array[item++] = new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) ); + array[item++] = new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) ); + + array[item++] = new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) ); + array[item++] = new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) ); + + array[item++] = new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) ); + array[item++] = new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) ); + + array[item++] = new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) ); + array[item++] = new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) ); + + array[item++] = new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) ); + array[item++] = new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) ); + + array[item++] = new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) ); + array[item++] = new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) ); + + + array[item++] = new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) ); + + array[item++] = new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) ); + array[item++] = new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) ); + + // StrDecimalLiteral::: .DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) ); + array[item++] = new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) ); + + array[item++] = new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) ); + array[item++] = new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) ); + + array[item++] = new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) ); + array[item++] = new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) ); + + array[item++] = new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) ); + array[item++] = new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) ); + + // StrDecimalLiteral::: DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) ); + array[item++] = new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) ); + + array[item++] = new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) ); + array[item++] = new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) ); + + array[item++] = new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) ); + array[item++] = new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) ); + + // hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral) + + array[item++] = new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0")); + array[item++] = new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1")); + array[item++] = new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2")); + array[item++] = new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3")); + array[item++] = new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4")); + array[item++] = new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5")); + array[item++] = new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6")); + array[item++] = new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7")); + array[item++] = new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8")); + array[item++] = new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9")); + array[item++] = new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa")); + array[item++] = new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb")); + array[item++] = new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc")); + array[item++] = new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd")); + array[item++] = new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe")); + array[item++] = new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf")); + array[item++] = new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA")); + array[item++] = new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB")); + array[item++] = new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC")); + array[item++] = new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD")); + array[item++] = new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE")); + array[item++] = new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF")); + + array[item++] = new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0")); + array[item++] = new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1")); + array[item++] = new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2")); + array[item++] = new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3")); + array[item++] = new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4")); + array[item++] = new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5")); + array[item++] = new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6")); + array[item++] = new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7")); + array[item++] = new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8")); + array[item++] = new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9")); + array[item++] = new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa")); + array[item++] = new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb")); + array[item++] = new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc")); + array[item++] = new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd")); + array[item++] = new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe")); + array[item++] = new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf")); + array[item++] = new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA")); + array[item++] = new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB")); + array[item++] = new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC")); + array[item++] = new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD")); + array[item++] = new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE")); + array[item++] = new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF ")); + + // hex literals should still succeed + + array[item++] = new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0)); + array[item++] = new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1)); + array[item++] = new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2)); + array[item++] = new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3)); + array[item++] = new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4)); + array[item++] = new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5)); + array[item++] = new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6)); + array[item++] = new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7)); + array[item++] = new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8)); + array[item++] = new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9)); + array[item++] = new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa)); + array[item++] = new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb)); + array[item++] = new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc)); + array[item++] = new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd)); + array[item++] = new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe)); + array[item++] = new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf)); + array[item++] = new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA)); + array[item++] = new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB)); + array[item++] = new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC)); + array[item++] = new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD)); + array[item++] = new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE)); + array[item++] = new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF)); + + array[item++] = new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0)); + array[item++] = new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1)); + array[item++] = new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2)); + array[item++] = new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3)); + array[item++] = new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4)); + array[item++] = new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5)); + array[item++] = new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6)); + array[item++] = new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7)); + array[item++] = new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8)); + array[item++] = new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9)); + array[item++] = new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa)); + array[item++] = new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb)); + array[item++] = new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc)); + array[item++] = new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd)); + array[item++] = new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe)); + array[item++] = new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf)); + array[item++] = new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA)); + array[item++] = new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB)); + array[item++] = new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC)); + array[item++] = new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD)); + array[item++] = new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE)); + array[item++] = new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF)); + + + // A StringNumericLiteral may not use octal notation + + array[item++] = new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00")); + array[item++] = new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01")); + array[item++] = new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02")); + array[item++] = new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03")); + array[item++] = new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04")); + array[item++] = new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05")); + array[item++] = new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06")); + array[item++] = new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07")); + array[item++] = new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010")); + array[item++] = new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011")); + + // A StringNumericLIteral may have any number of leading 0 digits + + array[item++] = new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001")); + array[item++] = new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 ")); + + // an octal numeric literal should be treated as an octal + + array[item++] = new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00)); + array[item++] = new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01)); + array[item++] = new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02)); + array[item++] = new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03)); + array[item++] = new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04)); + array[item++] = new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05)); + array[item++] = new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06)); + array[item++] = new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07)); + array[item++] = new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010)); + array[item++] = new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011)); + + // A StringNumericLIteral may have any number of leading 0 digits + + array[item++] = new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); + array[item++] = new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); + + // make sure it's reflexive + array[item++] = new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI)); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2)); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10)); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E)); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E)); + array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2)); + array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2)); + + array[item++] = new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+'')); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+'')); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+'')); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+'')); + array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+'')); + array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+'')); + array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+'')); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js new file mode 100644 index 0000000..c3905c0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js @@ -0,0 +1,295 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.3-2.js + ECMA Section: 15.1.2.3 Function properties of the global object: + parseFloat( string ) + + Description: The parseFloat function produces a number value dictated + by the interpretation of the contents of the string + argument defined as a decimal literal. + + When the parseFloat function is called, the following + steps are taken: + + 1. Call ToString( string ). + 2. Remove leading whitespace Result(1). + 3. If neither Result(2) nor any prefix of Result(2) + satisfies the syntax of a StrDecimalLiteral, + return NaN. + 4. Compute the longest prefix of Result(2) which might + be Resusult(2) itself, that satisfies the syntax of + a StrDecimalLiteral + 5. Return the number value for the MV of Result(4). + + Note that parseFloate may interpret only a leading + portion of the string as a number value; it ignores any + characters that cannot be interpreted as part of the + notation of a decimal literal, and no indication is given + that such characters were ignored. + + StrDecimalLiteral:: + Infinity + DecimalDigits.DecimalDigits opt ExponentPart opt + .DecimalDigits ExponentPart opt + DecimalDigits ExponentPart opt + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.2.3-2"; + var VERSION = "ECMA_1"; + startTest(); + + var BUGNUMBER = "77391"; + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " parseFloat(string)"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) ); + array[item++] = new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) ); + array[item++] = new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") ); +// array[item++] = new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") ); + + // StrDecimalLiteral::: .DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") ); + + // StrDecimalLiteral::: DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") ); + + + array[item++] = new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") ); + + // StrDecimalLiteral::: DecimalDigits ExponentPart opt + array[item++] = new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") ); + + array[item++] = new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") ); + array[item++] = new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") ); + + + // hex cases should all return NaN + + array[item++] = new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF")); + + array[item++] = new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF")); + + // A StringNumericLiteral may not use octal notation + + array[item++] = new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00")); + array[item++] = new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01")); + array[item++] = new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02")); + array[item++] = new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03")); + array[item++] = new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04")); + array[item++] = new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05")); + array[item++] = new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06")); + array[item++] = new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07")); + array[item++] = new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010")); + array[item++] = new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011")); + + // A StringNumericLIteral may have any number of leading 0 digits + + array[item++] = new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001")); + array[item++] = new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001")); + + // A StringNumericLIteral may have any number of leading 0 digits + + array[item++] = new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); + array[item++] = new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); + + // make sure it' s reflexive + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' ')); + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' ')); + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' ')); + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' ')); + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' ')); + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' ')); + array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' ')); + + + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js new file mode 100644 index 0000000..386f3a6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js @@ -0,0 +1,206 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.4.js + ECMA Section: 15.1.2.4 Function properties of the global object + escape( string ) + + Description: + The escape function computes a new version of a string value in which + certain characters have been replaced by a hexadecimal escape sequence. + The result thus contains no special characters that might have special + meaning within a URL. + + For characters whose Unicode encoding is 0xFF or less, a two-digit + escape sequence of the form %xx is used in accordance with RFC1738. + For characters whose Unicode encoding is greater than 0xFF, a four- + digit escape sequence of the form %uxxxx is used. + + When the escape function is called with one argument string, the + following steps are taken: + + 1. Call ToString(string). + 2. Compute the number of characters in Result(1). + 3. Let R be the empty string. + 4. Let k be 0. + 5. If k equals Result(2), return R. + 6. Get the character at position k within Result(1). + 7. If Result(6) is one of the 69 nonblank ASCII characters + ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz + 0123456789 @*_+-./, go to step 14. + 8. Compute the 16-bit unsigned integer that is the Unicode character + encoding of Result(6). + 9. If Result(8), is less than 256, go to step 12. + 10. Let S be a string containing six characters "%uwxyz" where wxyz are + four hexadecimal digits encoding the value of Result(8). + 11. Go to step 15. + 12. Let S be a string containing three characters "%xy" where xy are two + hexadecimal digits encoding the value of Result(8). + 13. Go to step 15. + 14. Let S be a string containing the single character Result(6). + 15. Let R be a new string value computed by concatenating the previous value + of R and S. + 16. Increase k by 1. + 17. Go to step 5. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.2.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "escape(string)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "escape.length", 1, escape.length ); + array[item++] = new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") ); + array[item++] = new TestCase( SECTION, "delete escape.length", false, delete escape.length ); + array[item++] = new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") ); + array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "escape()", "undefined", escape() ); + array[item++] = new TestCase( SECTION, "escape('')", "", escape('') ); + array[item++] = new TestCase( SECTION, "escape( null )", "null", escape(null) ); + array[item++] = new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) ); + array[item++] = new TestCase( SECTION, "escape( true )", "true", escape( true ) ); + array[item++] = new TestCase( SECTION, "escape( false )", "false", escape( false ) ); + + array[item++] = new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) ); + + array[item++] = new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) ); + array[item++] = new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) ); + array[item++] = new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) ); + array[item++] = new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) ); + + var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; + + array[item++] = new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) ); + + // ASCII value less than + + for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "escape(String.fromCharCode("+CHARCODE+"))", + "%"+ToHexString(CHARCODE), + escape(String.fromCharCode(CHARCODE)) ); + } + for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "escape(String.fromCharCode("+CHARCODE+"))", + "%"+ToHexString(CHARCODE), + escape(String.fromCharCode(CHARCODE)) ); + } + + for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "escape(String.fromCharCode("+CHARCODE+"))", + "%u"+ ToUnicodeString(CHARCODE), + escape(String.fromCharCode(CHARCODE)) ); + } + for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "escape(String.fromCharCode("+CHARCODE+"))", + "%u"+ ToUnicodeString(CHARCODE), + escape(String.fromCharCode(CHARCODE)) ); + } + + return ( array ); +} + +function ToUnicodeString( n ) { + var string = ToHexString(n); + + for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { + string = "0" + string; + } + + return string; +} +function ToHexString( n ) { + var hex = new Array(); + + for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { + ; + } + + for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { + hex[index] = Math.floor( n / Math.pow(16,mag) ); + n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); + } + + hex[hex.length] = n % 16; + + var string =""; + + for ( var index = 0 ; index < hex.length ; index++ ) { + switch ( hex[index] ) { + case 10: + string += "A"; + break; + case 11: + string += "B"; + break; + case 12: + string += "C"; + break; + case 13: + string += "D"; + break; + case 14: + string += "E"; + break; + case 15: + string += "F"; + break; + default: + string += hex[index]; + } + } + + if ( string.length == 1 ) { + string = "0" + string; + } + return string; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js new file mode 100644 index 0000000..da1a6f9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js @@ -0,0 +1,207 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.5-1.js + ECMA Section: 15.1.2.5 Function properties of the global object + unescape( string ) + + Description: + The unescape function computes a new version of a string value in which + each escape sequences of the sort that might be introduced by the escape + function is replaced with the character that it represents. + + When the unescape function is called with one argument string, the + following steps are taken: + + 1. Call ToString(string). + 2. Compute the number of characters in Result(1). + 3. Let R be the empty string. + 4. Let k be 0. + 5. If k equals Result(2), return R. + 6. Let c be the character at position k within Result(1). + 7. If c is not %, go to step 18. + 8. If k is greater than Result(2)-6, go to step 14. + 9. If the character at position k+1 within result(1) is not u, go to step + 14. + 10. If the four characters at positions k+2, k+3, k+4, and k+5 within + Result(1) are not all hexadecimal digits, go to step 14. + 11. Let c be the character whose Unicode encoding is the integer represented + by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 + within Result(1). + 12. Increase k by 5. + 13. Go to step 18. + 14. If k is greater than Result(2)-3, go to step 18. + 15. If the two characters at positions k+1 and k+2 within Result(1) are not + both hexadecimal digits, go to step 18. + 16. Let c be the character whose Unicode encoding is the integer represented + by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 + within Result(1). + 17. Increase k by 2. + 18. Let R be a new string value computed by concatenating the previous value + of R and c. + 19. Increase k by 1. + 20. Go to step 5. + Author: christine@netscape.com + Date: 28 october 1997 +*/ + + var SECTION = "15.1.2.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "unescape(string)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "unescape.length", 1, unescape.length ); + array[item++] = new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") ); + array[item++] = new TestCase( SECTION, "delete unescape.length", false, delete unescape.length ); + array[item++] = new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") ); + array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "unescape()", "undefined", unescape() ); + array[item++] = new TestCase( SECTION, "unescape('')", "", unescape('') ); + array[item++] = new TestCase( SECTION, "unescape( null )", "null", unescape(null) ); + array[item++] = new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) ); + array[item++] = new TestCase( SECTION, "unescape( true )", "true", unescape( true ) ); + array[item++] = new TestCase( SECTION, "unescape( false )", "false", unescape( false ) ); + + array[item++] = new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) ); + + array[item++] = new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) ); + array[item++] = new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) ); + array[item++] = new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) ); + array[item++] = new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) ); + + var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; + + array[item++] = new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) ); + + // escaped chars with ascii values less than 256 + + for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "unescape( %"+ ToHexString(CHARCODE)+" )", + String.fromCharCode(CHARCODE), + unescape( "%" + ToHexString(CHARCODE) ) ); + } + + // unicode chars represented by two hex digits + for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "unescape( %u"+ ToHexString(CHARCODE)+" )", + "%u"+ToHexString(CHARCODE), + unescape( "%u" + ToHexString(CHARCODE) ) ); + } +/* + for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "unescape( %u"+ ToUnicodeString(CHARCODE)+" )", + String.fromCharCode(CHARCODE), + unescape( "%u" + ToUnicodeString(CHARCODE) ) ); + } + for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) { + array[item++] = new TestCase( SECTION, + "unescape( %u"+ ToUnicodeString(CHARCODE)+" )", + String.fromCharCode(CHARCODE), + unescape( "%u" + ToUnicodeString(CHARCODE) ) ); + } +*/ + return ( array ); +} + +function ToUnicodeString( n ) { + var string = ToHexString(n); + + for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { + string = "0" + string; + } + + return string; +} +function ToHexString( n ) { + var hex = new Array(); + + for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { + ; + } + + for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { + hex[index] = Math.floor( n / Math.pow(16,mag) ); + n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); + } + + hex[hex.length] = n % 16; + + var string =""; + + for ( var index = 0 ; index < hex.length ; index++ ) { + switch ( hex[index] ) { + case 10: + string += "A"; + break; + case 11: + string += "B"; + break; + case 12: + string += "C"; + break; + case 13: + string += "D"; + break; + case 14: + string += "E"; + break; + case 15: + string += "F"; + break; + default: + string += hex[index]; + } + } + + if ( string.length == 1 ) { + string = "0" + string; + } + return string; +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js new file mode 100644 index 0000000..d8fc253 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js @@ -0,0 +1,184 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.5-2.js + ECMA Section: 15.1.2.5 Function properties of the global object + unescape( string ) + Description: + + This tests the cases where there are fewer than 4 characters following "%u", + or fewer than 2 characters following "%" or "%u". + + The unescape function computes a new version of a string value in which + each escape sequences of the sort that might be introduced by the escape + function is replaced with the character that it represents. + + When the unescape function is called with one argument string, the + following steps are taken: + + 1. Call ToString(string). + 2. Compute the number of characters in Result(1). + 3. Let R be the empty string. + 4. Let k be 0. + 5. If k equals Result(2), return R. + 6. Let c be the character at position k within Result(1). + 7. If c is not %, go to step 18. + 8. If k is greater than Result(2)-6, go to step 14. + 9. If the character at position k+1 within result(1) is not u, go to step + 14. + 10. If the four characters at positions k+2, k+3, k+4, and k+5 within + Result(1) are not all hexadecimal digits, go to step 14. + 11. Let c be the character whose Unicode encoding is the integer represented + by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 + within Result(1). + 12. Increase k by 5. + 13. Go to step 18. + 14. If k is greater than Result(2)-3, go to step 18. + 15. If the two characters at positions k+1 and k+2 within Result(1) are not + both hexadecimal digits, go to step 18. + 16. Let c be the character whose Unicode encoding is the integer represented + by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 + within Result(1). + 17. Increase k by 2. + 18. Let R be a new string value computed by concatenating the previous value + of R and c. + 19. Increase k by 1. + 20. Go to step 5. + Author: christine@netscape.com + Date: 28 october 1997 +*/ + + var SECTION = "15.1.2.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "unescape(string)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // since there is only one character following "%", no conversion should occur. + + for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) { + array[item++] = new TestCase( SECTION, + "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )", + "%"+(ToHexString(CHARCODE)).substring(0,1), + unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) ); + } + + // since there is only one character following "%u", no conversion should occur. + + for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) { + array[item++] = new TestCase( SECTION, + "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )", + "%u"+(ToHexString(CHARCODE)).substring(0,1), + unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) ); + } + + + // three char unicode string. no conversion should occur + + for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) { + array[item++] = new TestCase + ( SECTION, + "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )", + + "%u"+(ToUnicodeString(CHARCODE)).substring(0,3), + unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) ) + ); + } + + return ( array ); +} + +function ToUnicodeString( n ) { + var string = ToHexString(n); + + for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { + string = "0" + string; + } + + return string; +} +function ToHexString( n ) { + var hex = new Array(); + + for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { + ; + } + + for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { + hex[index] = Math.floor( n / Math.pow(16,mag) ); + n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); + } + + hex[hex.length] = n % 16; + + var string =""; + + for ( var index = 0 ; index < hex.length ; index++ ) { + switch ( hex[index] ) { + case 10: + string += "A"; + break; + case 11: + string += "B"; + break; + case 12: + string += "C"; + break; + case 13: + string += "D"; + break; + case 14: + string += "E"; + break; + case 15: + string += "F"; + break; + default: + string += hex[index]; + } + } + + if ( string.length == 1 ) { + string = "0" + string; + } + return string; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js new file mode 100644 index 0000000..9fa83f3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js @@ -0,0 +1,207 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.5-3.js + ECMA Section: 15.1.2.5 Function properties of the global object + unescape( string ) + + Description: + This tests the cases where one of the four characters following "%u" is + not a hexidecimal character, or one of the two characters following "%" + or "%u" is not a hexidecimal character. + + The unescape function computes a new version of a string value in which + each escape sequences of the sort that might be introduced by the escape + function is replaced with the character that it represents. + + When the unescape function is called with one argument string, the + following steps are taken: + + 1. Call ToString(string). + 2. Compute the number of characters in Result(1). + 3. Let R be the empty string. + 4. Let k be 0. + 5. If k equals Result(2), return R. + 6. Let c be the character at position k within Result(1). + 7. If c is not %, go to step 18. + 8. If k is greater than Result(2)-6, go to step 14. + 9. If the character at position k+1 within result(1) is not u, go to step + 14. + 10. If the four characters at positions k+2, k+3, k+4, and k+5 within + Result(1) are not all hexadecimal digits, go to step 14. + 11. Let c be the character whose Unicode encoding is the integer represented + by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 + within Result(1). + 12. Increase k by 5. + 13. Go to step 18. + 14. If k is greater than Result(2)-3, go to step 18. + 15. If the two characters at positions k+1 and k+2 within Result(1) are not + both hexadecimal digits, go to step 18. + 16. Let c be the character whose Unicode encoding is the integer represented + by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 + within Result(1). + 17. Increase k by 2. + 18. Let R be a new string value computed by concatenating the previous value + of R and c. + 19. Increase k by 1. + 20. Go to step 5. + Author: christine@netscape.com + Date: 28 october 1997 +*/ + + + var SECTION = "15.1.2.5-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "unescape(string)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) { + NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); + + array[item++] = new TestCase( SECTION, + "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) + + String.fromCharCode( NONHEXCHARCODE ) +" )" + + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", + "%"+(ToHexString(CHARCODE)).substring(0,1)+ + String.fromCharCode( NONHEXCHARCODE ), + unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+ + String.fromCharCode( NONHEXCHARCODE ) ) ); + } + for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) { + NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); + + array[item++] = new TestCase( SECTION, + "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) + + String.fromCharCode( NONHEXCHARCODE ) +" )" + + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", + "%u"+(ToHexString(CHARCODE)).substring(0,1)+ + String.fromCharCode( NONHEXCHARCODE ), + unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+ + String.fromCharCode( NONHEXCHARCODE ) ) ); + } + + for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) { + NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); + + array[item++] = new TestCase( SECTION, + "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) + + String.fromCharCode( NONHEXCHARCODE ) +" )" + + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", + + String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) + + (ToUnicodeString(CHARCODE)).substring(2,3) + + String.fromCharCode( NONHEXCHARCODE ), + + unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+ + String.fromCharCode( NONHEXCHARCODE ) ) ); + } + + return ( array ); +} +function getNextNonHexCharCode( n ) { + for ( ; n < Math.pow(2,16); n++ ) { + if ( ( n == 43 || n == 45 || n == 46 || n == 47 || + (n >= 71 && n <= 90) || (n >= 103 && n <= 122) || + n == 64 || n == 95 ) ) { + break; + } else { + n = ( n > 122 ) ? 0 : n; + } + } + return n; +} +function ToUnicodeString( n ) { + var string = ToHexString(n); + + for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { + string = "0" + string; + } + + return string; +} +function ToHexString( n ) { + var hex = new Array(); + + for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { + ; + } + + for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { + hex[index] = Math.floor( n / Math.pow(16,mag) ); + n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); + } + + hex[hex.length] = n % 16; + + var string =""; + + for ( var index = 0 ; index < hex.length ; index++ ) { + switch ( hex[index] ) { + case 10: + string += "A"; + break; + case 11: + string += "B"; + break; + case 12: + string += "C"; + break; + case 13: + string += "D"; + break; + case 14: + string += "E"; + break; + case 15: + string += "F"; + break; + default: + string += hex[index]; + } + } + + if ( string.length == 1 ) { + string = "0" + string; + } + return string; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js new file mode 100644 index 0000000..053dab4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js @@ -0,0 +1,127 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.6.js + ECMA Section: 15.1.2.6 isNaN( x ) + + Description: Applies ToNumber to its argument, then returns true if + the result isNaN and otherwise returns false. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.2.6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "isNaN( x )"; + + var BUGNUMBER = "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "isNaN.length", 1, isNaN.length ); + array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") ); + array[item++] = new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") ); + array[item++] = new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length ); + array[item++] = new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") ); + +// array[item++] = new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ ); + + array[item++] = new TestCase( SECTION, "isNaN()", true, isNaN() ); + array[item++] = new TestCase( SECTION, "isNaN( null )", false, isNaN(null) ); + array[item++] = new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) ); + array[item++] = new TestCase( SECTION, "isNaN( true )", false, isNaN(true) ); + array[item++] = new TestCase( SECTION, "isNaN( false)", false, isNaN(false) ); + array[item++] = new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) ); + + array[item++] = new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) ); + array[item++] = new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) ); + array[item++] = new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) ); + array[item++] = new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) ); + array[item++] = new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) ); + array[item++] = new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) ); + array[item++] = new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) ); + array[item++] = new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) ); + array[item++] = new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) ); + array[item++] = new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) ); + + array[item++] = new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') ); + array[item++] = new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') ); + array[item++] = new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') ); + array[item++] = new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') ); + array[item++] = new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') ); + array[item++] = new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') ); + array[item++] = new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') ); + array[item++] = new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') ); + array[item++] = new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') ); + array[item++] = new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') ); + + + array[item++] = new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) ); + array[item++] = new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) ); + array[item++] = new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) ); + array[item++] = new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) ); + + array[item++] = new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) ); + array[item++] = new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) ); + array[item++] = new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) ); + array[item++] = new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) ); + + array[item++] = new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) ); + array[item++] = new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) ); + + + array[item++] = new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) ); + array[item++] = new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) ); + + array[item++] = new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) ); + array[item++] = new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) ); + + array[item++] = new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") ); + array[item++] = new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js new file mode 100644 index 0000000..df384fa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js @@ -0,0 +1,131 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.1.2.7.js + ECMA Section: 15.1.2.7 isFinite(number) + + Description: Applies ToNumber to its argument, then returns false if + the result is NaN, Infinity, or -Infinity, and otherwise + returns true. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.1.2.7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "isFinite( x )"; + + var BUGNUMBER= "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "isFinite.length", 1, isFinite.length ); + array[item++] = new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") ); + array[item++] = new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length ); + array[item++] = new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") ); + array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") ); + + array[item++] = new TestCase( SECTION, "isFinite()", false, isFinite() ); + array[item++] = new TestCase( SECTION, "isFinite( null )", true, isFinite(null) ); + array[item++] = new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) ); + array[item++] = new TestCase( SECTION, "isFinite( false )", true, isFinite(false) ); + array[item++] = new TestCase( SECTION, "isFinite( true)", true, isFinite(true) ); + array[item++] = new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) ); + + array[item++] = new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) ); + + array[item++] = new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) ); + array[item++] = new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) ); + array[item++] = new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) ); + array[item++] = new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) ); + array[item++] = new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) ); + array[item++] = new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) ); + array[item++] = new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) ); + array[item++] = new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) ); + array[item++] = new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) ); + array[item++] = new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) ); + + array[item++] = new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') ); + array[item++] = new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') ); + array[item++] = new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') ); + array[item++] = new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') ); + array[item++] = new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') ); + array[item++] = new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') ); + array[item++] = new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') ); + array[item++] = new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') ); + array[item++] = new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') ); + array[item++] = new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') ); + + array[item++] = new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) ); + array[item++] = new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) ); + array[item++] = new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) ); + array[item++] = new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) ); + + array[item++] = new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) ); + array[item++] = new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) ); + array[item++] = new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) ); + array[item++] = new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) ); + + array[item++] = new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) ); + array[item++] = new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) ); + + array[item++] = new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) ); + array[item++] = new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) ); + + array[item++] = new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") ); + array[item++] = new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") ); + array[item++] = new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) ); + array[item++] = new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) ); + array[item++] = new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) ); + + + array[item++] = new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js new file mode 100644 index 0000000..d801063 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.1-1.js + ECMA Section: 7.1 White Space + Description: - readability + - separate tokens + - otherwise should be insignificant + - in strings, white space characters are significant + - cannot appear within any other kind of token + + white space characters are: + unicode name formal name string representation + \u0009 tab <TAB> \t + \u000B veritical tab <VT> \v + \U000C form feed <FF> \f + \u0020 space <SP> " " + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + + var SECTION = "7.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "White Space"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + // whitespace between var keyword and identifier + + array[item++] = new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') ); + array[item++] = new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') ); + array[item++] = new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') ); + array[item++] = new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') ); + + // use whitespace between tokens object name, dot operator, and object property + + array[item++] = new TestCase( SECTION, + "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length", + 12345, + eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js new file mode 100644 index 0000000..04da3c9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.1-2.js + ECMA Section: 7.1 White Space + Description: - readability + - separate tokens + - otherwise should be insignificant + - in strings, white space characters are significant + - cannot appear within any other kind of token + + white space characters are: + unicode name formal name string representation + \u0009 tab <TAB> \t + \u000B veritical tab <VT> ?? + \U000C form feed <FF> \f + \u0020 space <SP> " " + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + + var SECTION = "7.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "White Space"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); + array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); + array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); + array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js new file mode 100644 index 0000000..c9c6ae1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js @@ -0,0 +1,92 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.1-3.js + ECMA Section: 7.1 White Space + Description: - readability + - separate tokens + - otherwise should be insignificant + - in strings, white space characters are significant + - cannot appear within any other kind of token + + white space characters are: + unicode name formal name string representation + \u0009 tab <TAB> \t + \u000B veritical tab <VT> ?? + \U000C form feed <FF> \f + \u0020 space <SP> " " + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + + var SECTION = "7.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "White Space"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); + array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); + array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); + array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); + + // +<white space>+ should be interpreted as the unary + operator twice, not as a post or prefix increment operator + + array[item++] = new TestCase( SECTION, + "var VAR = 12345; + + VAR", + 12345, + eval("var VAR = 12345; + + VAR") ); + + array[item++] = new TestCase( SECTION, + "var VAR = 12345;VAR+ + VAR", + 24690, + eval("var VAR = 12345;VAR+ +VAR") ); + array[item++] = new TestCase( SECTION, + "var VAR = 12345;VAR - - VAR", + 24690, + eval("var VAR = 12345;VAR- -VAR") ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js new file mode 100644 index 0000000..4936984 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.2-1.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Line Terminators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") ); + array[item++] = new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") ); + array[item++] = new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") ); + array[item++] = new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") ); + array[item++] = new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") ); + array[item++] = new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js new file mode 100644 index 0000000..268fc56 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.2.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + this test uses onerror to capture line numbers. because + we use on error, we can only have one test case per file. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Line Terminators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + // this is line 29 + a = "\r\r\r\nb"; + eval( a ); + + // if we get this far, the test failed. + testcases[tc].passed = writeTestCaseResult( + "failure on line" + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[0].passed = false; + + testcases[tc].reason = "test should have caused runtime error "; + + stopTest(); + + return ( testcases ); +} + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[0] = new TestCase( "7.2", "<cr>a", "error", ""); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js new file mode 100644 index 0000000..ff3753d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.2-3.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + this test uses onerror to capture line numbers. because + we use on error, we can only have one test case per file. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Line Terminators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + + // this is line 27 + + a = "\r\nb"; + eval( a ); + + // if we get this far, the test failed. + testcases[tc].passed = writeTestCaseResult( + "failure on line" + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[0].passed = false; + + testcases[tc].reason = "test should have caused runtime error "; + + stopTest(); + return ( testcases ); +} + + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[0] = new TestCase( "7.2", "<cr>a", "error", ""); + + return ( array ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js new file mode 100644 index 0000000..0f98b9b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js @@ -0,0 +1,82 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.2.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + this test uses onerror to capture line numbers. because + we use on error, we can only have one test case per file. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.2-6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Line Terminators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + // this is line 33 + + a = "\nb"; + eval( a ); + + // if we get this far, the test failed. + testcases[tc].passed = writeTestCaseResult( + "failure on line" + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[0].passed = false; + + testcases[tc].reason = "test should have caused runtime error "; + + stopTest(); + + return ( testcases ); +} + + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[0] = new TestCase( "7.2", "a = \\nb", "error", ""); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js new file mode 100644 index 0000000..b226a98 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.2.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + this test uses onerror to capture line numbers. because + we use on error, we can only have one test case per file. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.2-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Line Terminators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function test() { + // this is line 27 + + a = "\rb"; + eval( a ); + + // if we get this far, the test failed. + testcases[tc].passed = writeTestCaseResult( + "failure on line" + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].passed = false; + + testcases[tc].reason = "test should have caused runtime error "; + + passed = false; + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} + + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[0] = new TestCase( "7.2", "<cr>a", "error", ""); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js new file mode 100644 index 0000000..70cff7e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.2-6.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.2-6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Line Terminators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") ); + array[item++] = new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js new file mode 100644 index 0000000..ff94a3c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-1.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item] = new TestCase( SECTION, + "a comment with a line terminator string, and text following", + "pass", + "pass"); + + // "\u000A" array[item].actual = "fail"; + + item++; + + array[item] = new TestCase( SECTION, + "// test \\n array[item].actual = \"pass\"", + "pass", + "" ); + + var x = "// test \n array[item].actual = 'pass'" + + array[0].actual = eval(x); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js new file mode 100644 index 0000000..ed4a5b3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-10.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "code following multiline comment", + "pass", + "fail"); + return ( array ); +} +function test() { + + /*//*/testcases[tc].actual="pass"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js new file mode 100644 index 0000000..8b6773a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-11.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "code following multiline comment", + "pass", + "pass"); + return ( array ); +} +function test() { + + ////testcases[tc].actual="fail"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js new file mode 100644 index 0000000..fede098 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-12.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "code following multiline comment", + "pass", + "pass"); + return ( array ); +} +function test() { + + /*testcases[tc].actual="fail";**/ + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js new file mode 100644 index 0000000..92394e6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-13-n.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-13-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "nested comment", + "error", + "pass"); + return ( array ); +} +function test() { + + /*/*testcases[tc].actual="fail";*/*/ + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js new file mode 100644 index 0000000..8eca512 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-2.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "a comment with a carriage return, and text following", + "pass", + "pass"); + return ( array ); +} +function test() { + + // "\u000D" testcases[tc].actual = "fail"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js new file mode 100644 index 0000000..1bcd561 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-3.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "source text directly following a single-line comment", + "pass", + "fail"); + return ( array ); +} +function test() { + + // a comment string + testcases[tc].actual = "pass"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js new file mode 100644 index 0000000..7ac82c7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-4.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "multiline comment ", + "pass", + "pass"); + return ( array ); +} +function test() { + + /*testcases[tc].actual = "fail";*/ + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js new file mode 100644 index 0000000..2ce6844 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-5.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "a comment with a carriage return, and text following", + "pass", + "pass"); + return ( array ); +} +function test() { + + // "\u000A" testcases[tc].actual = "fail"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js new file mode 100644 index 0000000..d010817 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-6.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "comment with multiple asterisks", + "pass", + "fail"); + return ( array ); +} +function test() { + + /* + ***/testcases[tc].actual="pass"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js new file mode 100644 index 0000000..8bdf623 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-7.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "single line comment following multiline comment", + "pass", + "pass"); + return ( array ); +} +function test() { + + /* + ***///testcases[tc].actual="fail"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js new file mode 100644 index 0000000..6d686cf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-7.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "code following multiline comment", + "pass", + "fail"); + return ( array ); +} +function test() { + + /**/testcases[tc].actual="pass"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js new file mode 100644 index 0000000..701e115 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.3-9.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.3-9"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Comments"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "code following multiline comment", + "pass", + "fail"); + return ( array ); +} +function test() { + + /*/*/testcases[tc].actual="pass"; + + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js new file mode 100644 index 0000000..37b1c4e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.1-1-n.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var null = true", "error", "var null = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js new file mode 100644 index 0000000..f85891b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.1-2.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var true = false", "error", "var true = false" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js new file mode 100644 index 0000000..a05480a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.1-3-n.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var false = true", "error", "var false = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js new file mode 100644 index 0000000..43d0425 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-1.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var break = true", "error", "var break = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js new file mode 100644 index 0000000..0ad19db --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-10.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-10-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var if = true", "error", "var if = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js new file mode 100644 index 0000000..e8a0f80 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-11-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-11-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var this = true", "error", "var this = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js new file mode 100644 index 0000000..ffc3350 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-12-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-12-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var while = true", "error", "var while = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js new file mode 100644 index 0000000..78320b2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-13-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-13-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var else = true", "error", "var else = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js new file mode 100644 index 0000000..4b8bb0f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-14-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-14-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var in = true", "error", "var in = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js new file mode 100644 index 0000000..d84f9d7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-15-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-15-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var typeof = true", "error", "var typeof = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js new file mode 100644 index 0000000..8293eee --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-16-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-16-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var with = true", "error", "var with = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js new file mode 100644 index 0000000..2b799b1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-2-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var for = true", "error", "var for = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js new file mode 100644 index 0000000..3b5feb0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-3-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var new = true", "error", "var new = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js new file mode 100644 index 0000000..13faf32 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-4-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var var = true", "error", "var var = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js new file mode 100644 index 0000000..004249b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-5-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-5-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var continue = true", "error", "var continue = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js new file mode 100644 index 0000000..3b830f8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-6.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-6-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var function = true", "error", "var function = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js new file mode 100644 index 0000000..c84ca9d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-7-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-7"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + writeHeaderToLog( SECTION + " Keywords"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var return = true", "error", "var return = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js new file mode 100644 index 0000000..f2397bb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-8-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.2-8"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + writeHeaderToLog( SECTION + " Keywords"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var void = true", "error", "var void = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js new file mode 100644 index 0000000..5b5a288 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.2-9-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "7.4.1-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Keywords"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var delete = true", "error", "var delete = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js new file mode 100644 index 0000000..5a626a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-1-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var case = true", "error", "var case = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js new file mode 100644 index 0000000..84d6cf3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-10-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-10-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var do = true", "error", "var do = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js new file mode 100644 index 0000000..b850584 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-11-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-11-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var finally = true", "error", "var finally = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js new file mode 100644 index 0000000..7dfe3cc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-12-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-12-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var throw = true", "error", "var throw = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js new file mode 100644 index 0000000..ede44c1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-13-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-13-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var const = true", "error", "var const = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js new file mode 100644 index 0000000..31b6794 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-14-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-14-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var enum = true", "error", "var enum = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js new file mode 100644 index 0000000..dfda054 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-15-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-15-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var import = true", "error", "var import = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js new file mode 100644 index 0000000..cf61635 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: lexical-023.js + Corresponds To: 7.4.3-16-n.js + ECMA Section: 7.4.3 + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-023.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + try = true; + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "try = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js new file mode 100644 index 0000000..46da571 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-2-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var debugger = true", "error", "var debugger = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js new file mode 100644 index 0000000..bfdbe3b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-3-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var export = true", "error", "var export = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js new file mode 100644 index 0000000..11b97c9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-4-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var super = true", "error", "var super = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js new file mode 100644 index 0000000..8acbbcd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-5-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-5-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var catch = true", "error", "var catch = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js new file mode 100644 index 0000000..d5ea75e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-6-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-6-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var default = true", "error", "var default = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js new file mode 100644 index 0000000..93cf4cd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-7-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-7-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var extends = true", "error", "var extends = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js new file mode 100644 index 0000000..7d09f0c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-8-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var switch = true", "error", "var switch = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js new file mode 100644 index 0000000..f0e71f9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.4.3-9-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "7.4.3-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Future Reserved Words"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var class = true", "error", "var class = true" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js new file mode 100644 index 0000000..ef1b257 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-1.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") ); + array[item++] = new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js new file mode 100644 index 0000000..b1bb872 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-9-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item] = new TestCase( SECTION, "var 123=\"hi\"", "error", "" ); + + 123 = "hi"; + + array[item] = 123; + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js new file mode 100644 index 0000000..b8a161d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-2-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 0abc" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js new file mode 100644 index 0000000..0d0aa84 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-2.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 1abc" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js new file mode 100644 index 0000000..8a21a77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-4-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 2abc" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js new file mode 100644 index 0000000..7a17f16 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-5-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-5-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 3abc" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js new file mode 100644 index 0000000..8b19307 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-6.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var _0abc = 5", 5, "var _0abc = 5; _0abc" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js new file mode 100644 index 0000000..7ade939 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-7.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var $0abc = 5", 5, "var $0abc = 5; $0abc" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js new file mode 100644 index 0000000..f17e071 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-8-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-8-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var @0abc = 5", "error", "var @0abc = 5; @0abc" ); + return ( array ); +} + +function test() {s + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js new file mode 100644 index 0000000..8ef78d6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.5-9-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "7.5-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Identifiers"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item] = new TestCase( SECTION, "var 123=\"hi\"", "error", "" ); + + var 123 = "hi"; + + array[item] = 123; + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +": "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js new file mode 100644 index 0000000..68b66be --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js @@ -0,0 +1,309 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.6.js + ECMA Section: Punctuators + Description: + + This tests verifies that all ECMA punctutors are recognized as a + token separator, but does not attempt to verify the functionality + of any punctuator. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "7.6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Punctuators"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // == + testcases[tc++] = new TestCase( SECTION, + "var c,d;c==d", + true, + eval("var c,d;c==d") ); + + // = + + testcases[tc++] = new TestCase( SECTION, + "var a=true;a", + true, + eval("var a=true;a") ); + + // > + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=false;a>b", + true, + eval("var a=true,b=false;a>b") ); + + // < + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=false;a<b", + false, + eval("var a=true,b=false;a<b") ); + + // <= + testcases[tc++] = new TestCase( SECTION, + "var a=0xFFFF,b=0X0FFF;a<=b", + false, + eval("var a=0xFFFF,b=0X0FFF;a<=b") ); + + // >= + testcases[tc++] = new TestCase( SECTION, + "var a=0xFFFF,b=0XFFFE;a>=b", + true, + eval("var a=0xFFFF,b=0XFFFE;a>=b") ); + + // != + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=false;a!=b", + true, + eval("var a=true,b=false;a!=b") ); + + testcases[tc++] = new TestCase( SECTION, + "var a=false,b=false;a!=b", + false, + eval("var a=false,b=false;a!=b") ); + // , + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=false;a,b", + false, + eval("var a=true,b=false;a,b") ); + // ! + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=false;!a", + false, + eval("var a=true,b=false;!a") ); + + // ~ + testcases[tc++] = new TestCase( SECTION, + "var a=true;~a", + -2, + eval("var a=true;~a") ); + // ? + testcases[tc++] = new TestCase( SECTION, + "var a=true; (a ? 'PASS' : '')", + "PASS", + eval("var a=true; (a ? 'PASS' : '')") ); + + // : + + testcases[tc++] = new TestCase( SECTION, + "var a=false; (a ? 'FAIL' : 'PASS')", + "PASS", + eval("var a=false; (a ? 'FAIL' : 'PASS')") ); + // . + + testcases[tc++] = new TestCase( SECTION, + "var a=Number;a.NaN", + NaN, + eval("var a=Number;a.NaN") ); + + // && + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=true;if(a&&b)'PASS';else'FAIL'", + "PASS", + eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") ); + + // || + testcases[tc++] = new TestCase( SECTION, + "var a=false,b=false;if(a||b)'FAIL';else'PASS'", + "PASS", + eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") ); + // ++ + testcases[tc++] = new TestCase( SECTION, + "var a=false,b=false;++a", + 1, + eval("var a=false,b=false;++a") ); + // -- + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=false--a", + 0, + eval("var a=true,b=false;--a") ); + // + + + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=true;a+b", + 2, + eval("var a=true,b=true;a+b") ); + // - + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=true;a-b", + 0, + eval("var a=true,b=true;a-b") ); + // * + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=true;a*b", + 1, + eval("var a=true,b=true;a*b") ); + // / + testcases[tc++] = new TestCase( SECTION, + "var a=true,b=true;a/b", + 1, + eval("var a=true,b=true;a/b") ); + // & + testcases[tc++] = new TestCase( SECTION, + "var a=3,b=2;a&b", + 2, + eval("var a=3,b=2;a&b") ); + // | + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a|b", + 7, + eval("var a=4,b=3;a|b") ); + + // | + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a^b", + 7, + eval("var a=4,b=3;a^b") ); + + // % + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a|b", + 1, + eval("var a=4,b=3;a%b") ); + + // << + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a<<b", + 32, + eval("var a=4,b=3;a<<b") ); + + // >> + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=1;a>>b", + 2, + eval("var a=4,b=1;a>>b") ); + + // >>> + testcases[tc++] = new TestCase( SECTION, + "var a=1,b=1;a>>>b", + 0, + eval("var a=1,b=1;a>>>b") ); + // += + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a+=b;a", + 7, + eval("var a=4,b=3;a+=b;a") ); + + // -= + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a-=b;a", + 1, + eval("var a=4,b=3;a-=b;a") ); + // *= + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a*=b;a", + 12, + eval("var a=4,b=3;a*=b;a") ); + // += + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a+=b;a", + 7, + eval("var a=4,b=3;a+=b;a") ); + // /= + testcases[tc++] = new TestCase( SECTION, + "var a=12,b=3;a/=b;a", + 4, + eval("var a=12,b=3;a/=b;a") ); + + // &= + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=5;a&=b;a", + 4, + eval("var a=4,b=5;a&=b;a") ); + + // |= + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=5;a&=b;a", + 5, + eval("var a=4,b=5;a|=b;a") ); + // ^= + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=5;a^=b;a", + 1, + eval("var a=4,b=5;a^=b;a") ); + // %= + testcases[tc++] = new TestCase( SECTION, + "var a=12,b=5;a%=b;a", + 2, + eval("var a=12,b=5;a%=b;a") ); + // <<= + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;a<<=b;a", + 32, + eval("var a=4,b=3;a<<=b;a") ); + + // >> + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=1;a>>=b;a", + 2, + eval("var a=4,b=1;a>>=b;a") ); + + // >>> + testcases[tc++] = new TestCase( SECTION, + "var a=1,b=1;a>>>=b;a", + 0, + eval("var a=1,b=1;a>>>=b;a") ); + + // () + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;(a)", + 4, + eval("var a=4,b=3;(a)") ); + // {} + testcases[tc++] = new TestCase( SECTION, + "var a=4,b=3;{b}", + 3, + eval("var a=4,b=3;{b}") ); + + // [] + testcases[tc++] = new TestCase( SECTION, + "var a=new Array('hi');a[0]", + "hi", + eval("var a=new Array('hi');a[0]") ); + // [] + testcases[tc++] = new TestCase( SECTION, + ";", + void 0, + eval(";") ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js new file mode 100644 index 0000000..a939e51 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.7.1.js + ECMA Section: 7.7.1 Null Literals + + Description: NullLiteral:: + null + + + The value of the null literal null is the sole value + of the Null type, namely null. + + Author: christine@netscape.com + Date: 21 october 1997 +*/ + var SECTION = "7.7.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Null Literals"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "null", null, null); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = testcases[tc].actual; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + + // all tests must return the test array + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js new file mode 100644 index 0000000..1202df3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.7.2.js + ECMA Section: 7.7.2 Boolean Literals + + Description: BooleanLiteral:: + true + false + + The value of the Boolean literal true is a value of the + Boolean type, namely true. + + The value of the Boolean literal false is a value of the + Boolean type, namely false. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "7.7.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean Literals"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // StringLiteral:: "" and '' + + array[item++] = new TestCase( SECTION, "true", Boolean(true), true ); + array[item++] = new TestCase( SECTION, "false", Boolean(false), false ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = testcases[tc].actual; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + stopTest(); + } + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js new file mode 100644 index 0000000..91becca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js @@ -0,0 +1,197 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.7.3-1.js + ECMA Section: 7.7.3 Numeric Literals + + Description: A numeric literal stands for a value of the Number type + This value is determined in two steps: first a + mathematical value (MV) is derived from the literal; + second, this mathematical value is rounded, ideally + using IEEE 754 round-to-nearest mode, to a reprentable + value of of the number type. + + These test cases came from Waldemar. + + Author: christine@netscape.com + Date: 12 June 1998 +*/ + +var SECTION = "7.7.3-1"; +var VERSION = "ECMA_1"; + startTest(); +var TITLE = "Numeric Literals"; +var BUGNUMBER="122877"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcases = new Array(); + + +testcases[tc++] = new TestCase( SECTION, + "0x12345678", + 305419896, + 0x12345678 ); + +testcases[tc++] = new TestCase( SECTION, + "0x80000000", + 2147483648, + 0x80000000 ); + +testcases[tc++] = new TestCase( SECTION, + "0xffffffff", + 4294967295, + 0xffffffff ); + +testcases[tc++] = new TestCase( SECTION, + "0x100000000", + 4294967296, + 0x100000000 ); + +testcases[tc++] = new TestCase( SECTION, + "077777777777777777", + 2251799813685247, + 077777777777777777 ); + +testcases[tc++] = new TestCase( SECTION, + "077777777777777776", + 2251799813685246, + 077777777777777776 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1fffffffffffff", + 9007199254740991, + 0x1fffffffffffff ); + +testcases[tc++] = new TestCase( SECTION, + "0x20000000000000", + 9007199254740992, + 0x20000000000000 ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abc", + 9027215253084860, + 0x20123456789abc ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abd", + 9027215253084860, + 0x20123456789abd ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abe", + 9027215253084862, + 0x20123456789abe ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abf", + 9027215253084864, + 0x20123456789abf ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000080", + 1152921504606847000, + 0x1000000000000080 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000081", + 1152921504606847200, + 0x1000000000000081 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000100", + 1152921504606847200, + 0x1000000000000100 ); + +testcases[tc++] = new TestCase( SECTION, + "0x100000000000017f", + 1152921504606847200, + 0x100000000000017f ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000180", + 1152921504606847500, + 0x1000000000000180 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000181", + 1152921504606847500, + 0x1000000000000181 ); + +testcases[tc++] = new TestCase( SECTION, + "0x10000000000001f0", + 1152921504606847500, + 0x10000000000001f0 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000200", + 1152921504606847500, + 0x1000000000000200 ); + +testcases[tc++] = new TestCase( SECTION, + "0x100000000000027f", + 1152921504606847500, + 0x100000000000027f ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000280", + 1152921504606847500, + 0x1000000000000280 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000281", + 1152921504606847700, + 0x1000000000000281 ); + +testcases[tc++] = new TestCase( SECTION, + "0x10000000000002ff", + 1152921504606847700, + 0x10000000000002ff ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000300", + 1152921504606847700, + 0x1000000000000300 ); + +testcases[tc++] = new TestCase( SECTION, + "0x10000000000000000", + 18446744073709552000, + 0x10000000000000000 ); + +test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = testcases[tc].actual; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js new file mode 100644 index 0000000..b6e750c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js @@ -0,0 +1,93 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.7.3-2.js + ECMA Section: 7.7.3 Numeric Literals + + Description: + + This is a regression test for + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884 + + Waldemar's comments: + + A numeric literal that starts with either '08' or '09' is interpreted as a + decimal literal; it should be an error instead. (Strictly speaking, according + to ECMA v1 such literals should be interpreted as two integers -- a zero + followed by a decimal number whose first digit is 8 or 9, but this is a bug in + ECMA that will be fixed in v2. In any case, there is no place in the grammar + where two consecutive numbers would be legal.) + + Author: christine@netscape.com + Date: 15 june 1998 + +*/ + var SECTION = "7.7.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Numeric Literals"; + var BUGNUMBER="122884"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "9", + 9, + 9 ); + + testcases[tc++] = new TestCase( SECTION, + "09", + 9, + 09 ); + + testcases[tc++] = new TestCase( SECTION, + "099", + 99, + 099 ); + + + testcases[tc++] = new TestCase( SECTION, + "077", + 63, + 077 ); + + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = testcases[tc].actual; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js new file mode 100644 index 0000000..7d47a40 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js @@ -0,0 +1,337 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.7.3.js + ECMA Section: 7.7.3 Numeric Literals + + Description: A numeric literal stands for a value of the Number type + This value is determined in two steps: first a + mathematical value (MV) is derived from the literal; + second, this mathematical value is rounded, ideally + using IEEE 754 round-to-nearest mode, to a reprentable + value of of the number type. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "7.7.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Numeric Literals"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "0", 0, 0 ); + array[item++] = new TestCase( SECTION, "1", 1, 1 ); + array[item++] = new TestCase( SECTION, "2", 2, 2 ); + array[item++] = new TestCase( SECTION, "3", 3, 3 ); + array[item++] = new TestCase( SECTION, "4", 4, 4 ); + array[item++] = new TestCase( SECTION, "5", 5, 5 ); + array[item++] = new TestCase( SECTION, "6", 6, 6 ); + array[item++] = new TestCase( SECTION, "7", 7, 7 ); + array[item++] = new TestCase( SECTION, "8", 8, 8 ); + array[item++] = new TestCase( SECTION, "9", 9, 9 ); + + array[item++] = new TestCase( SECTION, "0.", 0, 0. ); + array[item++] = new TestCase( SECTION, "1.", 1, 1. ); + array[item++] = new TestCase( SECTION, "2.", 2, 2. ); + array[item++] = new TestCase( SECTION, "3.", 3, 3. ); + array[item++] = new TestCase( SECTION, "4.", 4, 4. ); + + array[item++] = new TestCase( SECTION, "0.e0", 0, 0.e0 ); + array[item++] = new TestCase( SECTION, "1.e1", 10, 1.e1 ); + array[item++] = new TestCase( SECTION, "2.e2", 200, 2.e2 ); + array[item++] = new TestCase( SECTION, "3.e3", 3000, 3.e3 ); + array[item++] = new TestCase( SECTION, "4.e4", 40000, 4.e4 ); + + array[item++] = new TestCase( SECTION, "0.1e0", .1, 0.1e0 ); + array[item++] = new TestCase( SECTION, "1.1e1", 11, 1.1e1 ); + array[item++] = new TestCase( SECTION, "2.2e2", 220, 2.2e2 ); + array[item++] = new TestCase( SECTION, "3.3e3", 3300, 3.3e3 ); + array[item++] = new TestCase( SECTION, "4.4e4", 44000, 4.4e4 ); + + array[item++] = new TestCase( SECTION, ".1e0", .1, .1e0 ); + array[item++] = new TestCase( SECTION, ".1e1", 1, .1e1 ); + array[item++] = new TestCase( SECTION, ".2e2", 20, .2e2 ); + array[item++] = new TestCase( SECTION, ".3e3", 300, .3e3 ); + array[item++] = new TestCase( SECTION, ".4e4", 4000, .4e4 ); + + array[item++] = new TestCase( SECTION, "0e0", 0, 0e0 ); + array[item++] = new TestCase( SECTION, "1e1", 10, 1e1 ); + array[item++] = new TestCase( SECTION, "2e2", 200, 2e2 ); + array[item++] = new TestCase( SECTION, "3e3", 3000, 3e3 ); + array[item++] = new TestCase( SECTION, "4e4", 40000, 4e4 ); + + array[item++] = new TestCase( SECTION, "0e0", 0, 0e0 ); + array[item++] = new TestCase( SECTION, "1e1", 10, 1e1 ); + array[item++] = new TestCase( SECTION, "2e2", 200, 2e2 ); + array[item++] = new TestCase( SECTION, "3e3", 3000, 3e3 ); + array[item++] = new TestCase( SECTION, "4e4", 40000, 4e4 ); + + array[item++] = new TestCase( SECTION, "0E0", 0, 0E0 ); + array[item++] = new TestCase( SECTION, "1E1", 10, 1E1 ); + array[item++] = new TestCase( SECTION, "2E2", 200, 2E2 ); + array[item++] = new TestCase( SECTION, "3E3", 3000, 3E3 ); + array[item++] = new TestCase( SECTION, "4E4", 40000, 4E4 ); + + array[item++] = new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 ); + array[item++] = new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 ); + array[item++] = new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 ); + array[item++] = new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 ); + + array[item++] = new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 ); + array[item++] = new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 ); + array[item++] = new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 ); + array[item++] = new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 ); + array[item++] = new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 ); + + array[item++] = new TestCase( SECTION, ".1e-0", .1, .1e-0 ); + array[item++] = new TestCase( SECTION, ".1e-1", .01, .1e-1 ); + array[item++] = new TestCase( SECTION, ".2e-2", .002, .2e-2 ); + array[item++] = new TestCase( SECTION, ".3e-3", .0003, .3e-3 ); + array[item++] = new TestCase( SECTION, ".4e-4", .00004, .4e-4 ); + + array[item++] = new TestCase( SECTION, "1.e+1", 10, 1.e+1 ); + array[item++] = new TestCase( SECTION, "2.e+2", 200, 2.e+2 ); + array[item++] = new TestCase( SECTION, "3.e+3", 3000, 3.e+3 ); + array[item++] = new TestCase( SECTION, "4.e+4", 40000, 4.e+4 ); + + array[item++] = new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 ); + array[item++] = new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 ); + array[item++] = new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 ); + array[item++] = new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 ); + array[item++] = new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 ); + + array[item++] = new TestCase( SECTION, ".1e+0", .1, .1e+0 ); + array[item++] = new TestCase( SECTION, ".1e+1", 1, .1e+1 ); + array[item++] = new TestCase( SECTION, ".2e+2", 20, .2e+2 ); + array[item++] = new TestCase( SECTION, ".3e+3", 300, .3e+3 ); + array[item++] = new TestCase( SECTION, ".4e+4", 4000, .4e+4 ); + + array[item++] = new TestCase( SECTION, "0x0", 0, 0x0 ); + array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 ); + array[item++] = new TestCase( SECTION, "0x2", 2, 0x2 ); + array[item++] = new TestCase( SECTION, "0x3", 3, 0x3 ); + array[item++] = new TestCase( SECTION, "0x4", 4, 0x4 ); + array[item++] = new TestCase( SECTION, "0x5", 5, 0x5 ); + array[item++] = new TestCase( SECTION, "0x6", 6, 0x6 ); + array[item++] = new TestCase( SECTION, "0x7", 7, 0x7 ); + array[item++] = new TestCase( SECTION, "0x8", 8, 0x8 ); + array[item++] = new TestCase( SECTION, "0x9", 9, 0x9 ); + array[item++] = new TestCase( SECTION, "0xa", 10, 0xa ); + array[item++] = new TestCase( SECTION, "0xb", 11, 0xb ); + array[item++] = new TestCase( SECTION, "0xc", 12, 0xc ); + array[item++] = new TestCase( SECTION, "0xd", 13, 0xd ); + array[item++] = new TestCase( SECTION, "0xe", 14, 0xe ); + array[item++] = new TestCase( SECTION, "0xf", 15, 0xf ); + + array[item++] = new TestCase( SECTION, "0X0", 0, 0X0 ); + array[item++] = new TestCase( SECTION, "0X1", 1, 0X1 ); + array[item++] = new TestCase( SECTION, "0X2", 2, 0X2 ); + array[item++] = new TestCase( SECTION, "0X3", 3, 0X3 ); + array[item++] = new TestCase( SECTION, "0X4", 4, 0X4 ); + array[item++] = new TestCase( SECTION, "0X5", 5, 0X5 ); + array[item++] = new TestCase( SECTION, "0X6", 6, 0X6 ); + array[item++] = new TestCase( SECTION, "0X7", 7, 0X7 ); + array[item++] = new TestCase( SECTION, "0X8", 8, 0X8 ); + array[item++] = new TestCase( SECTION, "0X9", 9, 0X9 ); + array[item++] = new TestCase( SECTION, "0Xa", 10, 0Xa ); + array[item++] = new TestCase( SECTION, "0Xb", 11, 0Xb ); + array[item++] = new TestCase( SECTION, "0Xc", 12, 0Xc ); + array[item++] = new TestCase( SECTION, "0Xd", 13, 0Xd ); + array[item++] = new TestCase( SECTION, "0Xe", 14, 0Xe ); + array[item++] = new TestCase( SECTION, "0Xf", 15, 0Xf ); + + array[item++] = new TestCase( SECTION, "0x0", 0, 0x0 ); + array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 ); + array[item++] = new TestCase( SECTION, "0x2", 2, 0x2 ); + array[item++] = new TestCase( SECTION, "0x3", 3, 0x3 ); + array[item++] = new TestCase( SECTION, "0x4", 4, 0x4 ); + array[item++] = new TestCase( SECTION, "0x5", 5, 0x5 ); + array[item++] = new TestCase( SECTION, "0x6", 6, 0x6 ); + array[item++] = new TestCase( SECTION, "0x7", 7, 0x7 ); + array[item++] = new TestCase( SECTION, "0x8", 8, 0x8 ); + array[item++] = new TestCase( SECTION, "0x9", 9, 0x9 ); + array[item++] = new TestCase( SECTION, "0xA", 10, 0xA ); + array[item++] = new TestCase( SECTION, "0xB", 11, 0xB ); + array[item++] = new TestCase( SECTION, "0xC", 12, 0xC ); + array[item++] = new TestCase( SECTION, "0xD", 13, 0xD ); + array[item++] = new TestCase( SECTION, "0xE", 14, 0xE ); + array[item++] = new TestCase( SECTION, "0xF", 15, 0xF ); + + array[item++] = new TestCase( SECTION, "0X0", 0, 0X0 ); + array[item++] = new TestCase( SECTION, "0X1", 1, 0X1 ); + array[item++] = new TestCase( SECTION, "0X2", 2, 0X2 ); + array[item++] = new TestCase( SECTION, "0X3", 3, 0X3 ); + array[item++] = new TestCase( SECTION, "0X4", 4, 0X4 ); + array[item++] = new TestCase( SECTION, "0X5", 5, 0X5 ); + array[item++] = new TestCase( SECTION, "0X6", 6, 0X6 ); + array[item++] = new TestCase( SECTION, "0X7", 7, 0X7 ); + array[item++] = new TestCase( SECTION, "0X8", 8, 0X8 ); + array[item++] = new TestCase( SECTION, "0X9", 9, 0X9 ); + array[item++] = new TestCase( SECTION, "0XA", 10, 0XA ); + array[item++] = new TestCase( SECTION, "0XB", 11, 0XB ); + array[item++] = new TestCase( SECTION, "0XC", 12, 0XC ); + array[item++] = new TestCase( SECTION, "0XD", 13, 0XD ); + array[item++] = new TestCase( SECTION, "0XE", 14, 0XE ); + array[item++] = new TestCase( SECTION, "0XF", 15, 0XF ); + + + array[item++] = new TestCase( SECTION, "00", 0, 00 ); + array[item++] = new TestCase( SECTION, "01", 1, 01 ); + array[item++] = new TestCase( SECTION, "02", 2, 02 ); + array[item++] = new TestCase( SECTION, "03", 3, 03 ); + array[item++] = new TestCase( SECTION, "04", 4, 04 ); + array[item++] = new TestCase( SECTION, "05", 5, 05 ); + array[item++] = new TestCase( SECTION, "06", 6, 06 ); + array[item++] = new TestCase( SECTION, "07", 7, 07 ); + + array[item++] = new TestCase( SECTION, "000", 0, 000 ); + array[item++] = new TestCase( SECTION, "011", 9, 011 ); + array[item++] = new TestCase( SECTION, "022", 18, 022 ); + array[item++] = new TestCase( SECTION, "033", 27, 033 ); + array[item++] = new TestCase( SECTION, "044", 36, 044 ); + array[item++] = new TestCase( SECTION, "055", 45, 055 ); + array[item++] = new TestCase( SECTION, "066", 54, 066 ); + array[item++] = new TestCase( SECTION, "077", 63, 077 ); + + array[item++] = new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 ); + array[item++] = new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 ); + + + array[item++] = new TestCase( SECTION, + "123456789012345671.9999", + "123456789012345660", + 123456789012345671.9999 +""); + array[item++] = new TestCase( SECTION, + "123456789012345672", + "123456789012345660", + 123456789012345672 +""); + + array[item++] = new TestCase( SECTION, + "123456789012345672.000000000000000000000000000", + "123456789012345660", + 123456789012345672.000000000000000000000000000 +""); + + array[item++] = new TestCase( SECTION, + "123456789012345672.01", + "123456789012345680", + 123456789012345672.01 +""); + + array[item++] = new TestCase( SECTION, + "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660", + true, + ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 ) + || + ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) ); + + array[item++] = new TestCase( SECTION, + "123456789012345673", + "123456789012345680", + 123456789012345673 +"" ); + + array[item++] = new TestCase( SECTION, + "-123456789012345671.9999", + "-123456789012345660", + -123456789012345671.9999 +"" ); + + array[item++] = new TestCase( SECTION, + "-123456789012345672", + "-123456789012345660", + -123456789012345672+""); + + array[item++] = new TestCase( SECTION, + "-123456789012345672.000000000000000000000000000", + "-123456789012345660", + -123456789012345672.000000000000000000000000000 +""); + + array[item++] = new TestCase( SECTION, + "-123456789012345672.01", + "-123456789012345680", + -123456789012345672.01 +"" ); + + array[item++] = new TestCase( SECTION, + "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660", + true, + (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680) + || + (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660)); + + array[item++] = new TestCase( SECTION, + -123456789012345673, + "-123456789012345680", + -123456789012345673 +""); + + array[item++] = new TestCase( SECTION, + "12345678901234567890", + "12345678901234567000", + 12345678901234567890 +"" ); + + +/* + array[item++] = new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" ); + array[item++] = new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" ); + array[item++] = new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" ); + array[item++] = new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" ); + array[item++] = new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" ); + array[item++] = new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" ); +*/ + array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 ); + array[item++] = new TestCase( SECTION, "0x10", 16, 0x10 ); + array[item++] = new TestCase( SECTION, "0x100", 256, 0x100 ); + array[item++] = new TestCase( SECTION, "0x1000", 4096, 0x1000 ); + array[item++] = new TestCase( SECTION, "0x10000", 65536, 0x10000 ); + array[item++] = new TestCase( SECTION, "0x100000", 1048576, 0x100000 ); + array[item++] = new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 ); + array[item++] = new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 ); +/* + array[item++] = new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); + array[item++] = new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 ); + array[item++] = new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 ); +*/ + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = testcases[tc].actual; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js new file mode 100644 index 0000000..769b819 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js @@ -0,0 +1,275 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.7.4.js + ECMA Section: 7.7.4 String Literals + + Description: A string literal is zero or more characters enclosed in + single or double quotes. Each character may be + represented by an escape sequence. + + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "7.7.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String Literals"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // StringLiteral:: "" and '' + + array[item++] = new TestCase( SECTION, "\"\"", "", "" ); + array[item++] = new TestCase( SECTION, "\'\'", "", '' ); + + // DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence + array[item++] = new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" ); + array[item++] = new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" ); + array[item++] = new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" ); + array[item++] = new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" ); + array[item++] = new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" ); + array[item++] = new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" ); + array[item++] = new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" ); + array[item++] = new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" ); + array[item++] = new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" ); + + // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence + + array[item++] = new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" ); + array[item++] = new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" ); + array[item++] = new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" ); + array[item++] = new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" ); + array[item++] = new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" ); + array[item++] = new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" ); + array[item++] = new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" ); + array[item++] = new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" ); + + array[item++] = new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" ); + array[item++] = new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" ); + array[item++] = new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" ); + array[item++] = new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" ); + array[item++] = new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" ); + array[item++] = new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" ); + array[item++] = new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" ); + array[item++] = new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" ); + array[item++] = new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" ); + array[item++] = new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" ); + + array[item++] = new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" ); + array[item++] = new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" ); + array[item++] = new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" ); + array[item++] = new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" ); + array[item++] = new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" ); + array[item++] = new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" ); + array[item++] = new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" ); + array[item++] = new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" ); + + array[item++] = new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" ); + array[item++] = new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" ); + array[item++] = new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" ); + array[item++] = new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" ); + array[item++] = new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" ); + array[item++] = new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" ); + array[item++] = new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" ); + array[item++] = new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" ); + array[item++] = new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" ); + array[item++] = new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" ); + + array[item++] = new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" ); + array[item++] = new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" ); + array[item++] = new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" ); + array[item++] = new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" ); + +// following line commented out as it causes a compile time error +// array[item++] = new TestCase( SECTION, "\\444", "444", "\444" ); + + // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence +/* + array[item++] = new TestCase( SECTION, "\\x0", String.fromCharCode(0), "\x0" ); + array[item++] = new TestCase( SECTION, "\\x1", String.fromCharCode(1), "\x1" ); + array[item++] = new TestCase( SECTION, "\\x2", String.fromCharCode(2), "\x2" ); + array[item++] = new TestCase( SECTION, "\\x3", String.fromCharCode(3), "\x3" ); + array[item++] = new TestCase( SECTION, "\\x4", String.fromCharCode(4), "\x4" ); + array[item++] = new TestCase( SECTION, "\\x5", String.fromCharCode(5), "\x5" ); + array[item++] = new TestCase( SECTION, "\\x6", String.fromCharCode(6), "\x6" ); + array[item++] = new TestCase( SECTION, "\\x7", String.fromCharCode(7), "\x7" ); + array[item++] = new TestCase( SECTION, "\\x8", String.fromCharCode(8), "\x8" ); + array[item++] = new TestCase( SECTION, "\\x9", String.fromCharCode(9), "\x9" ); + array[item++] = new TestCase( SECTION, "\\xA", String.fromCharCode(10), "\xA" ); + array[item++] = new TestCase( SECTION, "\\xB", String.fromCharCode(11), "\xB" ); + array[item++] = new TestCase( SECTION, "\\xC", String.fromCharCode(12), "\xC" ); + array[item++] = new TestCase( SECTION, "\\xD", String.fromCharCode(13), "\xD" ); + array[item++] = new TestCase( SECTION, "\\xE", String.fromCharCode(14), "\xE" ); + array[item++] = new TestCase( SECTION, "\\xF", String.fromCharCode(15), "\xF" ); + +*/ + array[item++] = new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" ); + array[item++] = new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" ); + array[item++] = new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" ); + array[item++] = new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" ); + array[item++] = new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" ); + array[item++] = new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" ); + array[item++] = new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" ); + array[item++] = new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" ); + array[item++] = new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" ); + array[item++] = new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" ); + array[item++] = new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" ); + array[item++] = new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" ); + array[item++] = new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" ); + array[item++] = new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" ); + array[item++] = new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" ); + array[item++] = new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" ); + + // string literals only take up to two hext digits. therefore, the third character in this string + // should be interpreted as a StringCharacter and not part of the HextEscapeSequence + + array[item++] = new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" ); + array[item++] = new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" ); + array[item++] = new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" ); + array[item++] = new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" ); + array[item++] = new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" ); + array[item++] = new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" ); + array[item++] = new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" ); + array[item++] = new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" ); + array[item++] = new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" ); + array[item++] = new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" ); + array[item++] = new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" ); + array[item++] = new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" ); + array[item++] = new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" ); + array[item++] = new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" ); + array[item++] = new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" ); + array[item++] = new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" ); + + // G is out of hex range + + array[item++] = new TestCase( SECTION, "\\xG", "xG", "\xG" ); + array[item++] = new TestCase( SECTION, "\\xCG", "xCG", "\xCG" ); + + // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter + array[item++] = new TestCase( SECTION, "\\a", "a", "\a" ); + array[item++] = new TestCase( SECTION, "\\c", "c", "\c" ); + array[item++] = new TestCase( SECTION, "\\d", "d", "\d" ); + array[item++] = new TestCase( SECTION, "\\e", "e", "\e" ); + array[item++] = new TestCase( SECTION, "\\g", "g", "\g" ); + array[item++] = new TestCase( SECTION, "\\h", "h", "\h" ); + array[item++] = new TestCase( SECTION, "\\i", "i", "\i" ); + array[item++] = new TestCase( SECTION, "\\j", "j", "\j" ); + array[item++] = new TestCase( SECTION, "\\k", "k", "\k" ); + array[item++] = new TestCase( SECTION, "\\l", "l", "\l" ); + array[item++] = new TestCase( SECTION, "\\m", "m", "\m" ); + array[item++] = new TestCase( SECTION, "\\o", "o", "\o" ); + array[item++] = new TestCase( SECTION, "\\p", "p", "\p" ); + array[item++] = new TestCase( SECTION, "\\q", "q", "\q" ); + array[item++] = new TestCase( SECTION, "\\s", "s", "\s" ); + array[item++] = new TestCase( SECTION, "\\u", "u", "\u" ); + + array[item++] = new TestCase( SECTION, "\\w", "w", "\w" ); + array[item++] = new TestCase( SECTION, "\\x", "x", "\x" ); + array[item++] = new TestCase( SECTION, "\\y", "y", "\y" ); + array[item++] = new TestCase( SECTION, "\\z", "z", "\z" ); + array[item++] = new TestCase( SECTION, "\\9", "9", "\9" ); + + array[item++] = new TestCase( SECTION, "\\A", "A", "\A" ); + array[item++] = new TestCase( SECTION, "\\B", "B", "\B" ); + array[item++] = new TestCase( SECTION, "\\C", "C", "\C" ); + array[item++] = new TestCase( SECTION, "\\D", "D", "\D" ); + array[item++] = new TestCase( SECTION, "\\E", "E", "\E" ); + array[item++] = new TestCase( SECTION, "\\F", "F", "\F" ); + array[item++] = new TestCase( SECTION, "\\G", "G", "\G" ); + array[item++] = new TestCase( SECTION, "\\H", "H", "\H" ); + array[item++] = new TestCase( SECTION, "\\I", "I", "\I" ); + array[item++] = new TestCase( SECTION, "\\J", "J", "\J" ); + array[item++] = new TestCase( SECTION, "\\K", "K", "\K" ); + array[item++] = new TestCase( SECTION, "\\L", "L", "\L" ); + array[item++] = new TestCase( SECTION, "\\M", "M", "\M" ); + array[item++] = new TestCase( SECTION, "\\N", "N", "\N" ); + array[item++] = new TestCase( SECTION, "\\O", "O", "\O" ); + array[item++] = new TestCase( SECTION, "\\P", "P", "\P" ); + array[item++] = new TestCase( SECTION, "\\Q", "Q", "\Q" ); + array[item++] = new TestCase( SECTION, "\\R", "R", "\R" ); + array[item++] = new TestCase( SECTION, "\\S", "S", "\S" ); + array[item++] = new TestCase( SECTION, "\\T", "T", "\T" ); + array[item++] = new TestCase( SECTION, "\\U", "U", "\U" ); + array[item++] = new TestCase( SECTION, "\\V", "V", "\V" ); + array[item++] = new TestCase( SECTION, "\\W", "W", "\W" ); + array[item++] = new TestCase( SECTION, "\\X", "X", "\X" ); + array[item++] = new TestCase( SECTION, "\\Y", "Y", "\Y" ); + array[item++] = new TestCase( SECTION, "\\Z", "Z", "\Z" ); + + // DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence + + array[item++] = new TestCase( SECTION, "\\u0020", " ", "\u0020" ); + array[item++] = new TestCase( SECTION, "\\u0021", "!", "\u0021" ); + array[item++] = new TestCase( SECTION, "\\u0022", "\"", "\u0022" ); + array[item++] = new TestCase( SECTION, "\\u0023", "#", "\u0023" ); + array[item++] = new TestCase( SECTION, "\\u0024", "$", "\u0024" ); + array[item++] = new TestCase( SECTION, "\\u0025", "%", "\u0025" ); + array[item++] = new TestCase( SECTION, "\\u0026", "&", "\u0026" ); + array[item++] = new TestCase( SECTION, "\\u0027", "'", "\u0027" ); + array[item++] = new TestCase( SECTION, "\\u0028", "(", "\u0028" ); + array[item++] = new TestCase( SECTION, "\\u0029", ")", "\u0029" ); + array[item++] = new TestCase( SECTION, "\\u002A", "*", "\u002A" ); + array[item++] = new TestCase( SECTION, "\\u002B", "+", "\u002B" ); + array[item++] = new TestCase( SECTION, "\\u002C", ",", "\u002C" ); + array[item++] = new TestCase( SECTION, "\\u002D", "-", "\u002D" ); + array[item++] = new TestCase( SECTION, "\\u002E", ".", "\u002E" ); + array[item++] = new TestCase( SECTION, "\\u002F", "/", "\u002F" ); + array[item++] = new TestCase( SECTION, "\\u0030", "0", "\u0030" ); + array[item++] = new TestCase( SECTION, "\\u0031", "1", "\u0031" ); + array[item++] = new TestCase( SECTION, "\\u0032", "2", "\u0032" ); + array[item++] = new TestCase( SECTION, "\\u0033", "3", "\u0033" ); + array[item++] = new TestCase( SECTION, "\\u0034", "4", "\u0034" ); + array[item++] = new TestCase( SECTION, "\\u0035", "5", "\u0035" ); + array[item++] = new TestCase( SECTION, "\\u0036", "6", "\u0036" ); + array[item++] = new TestCase( SECTION, "\\u0037", "7", "\u0037" ); + array[item++] = new TestCase( SECTION, "\\u0038", "8", "\u0038" ); + array[item++] = new TestCase( SECTION, "\\u0039", "9", "\u0039" ); + + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = testcases[tc].actual; + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js new file mode 100644 index 0000000..82bd7c4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js @@ -0,0 +1,48 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 7.8.2.js + ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion + Description: compare some specific examples of the automatic + insertion rules in the EMCA specification. + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION="7.8.2"; + var VERSION="ECMA_1" + startTest(); + writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion"); + + testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + +// array[item++] = new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, "{ 1 \n 2 } 3" ); + array[item++] = new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") ); + + return ( array ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js new file mode 100644 index 0000000..8b08eb6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js @@ -0,0 +1,84 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8-1.js + ECMA Section: 15.8 The Math Object + + Description: + + The Math object is merely a single object that has some named properties, + some of which are functions. + + The value of the internal [[Prototype]] property of the Math object is the + Object prototype object (15.2.3.1). + + The Math object does not have a [[Construct]] property; it is not possible + to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] property; it is not possible to + invoke the Math object as a function. + + Recall that, in this specification, the phrase "the number value for x" has + a technical meaning defined in section 8.5. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + + var SECTION = "15.8-1"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "The Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "Math.__proto__ == Object.prototype", + true, + Math.__proto__ == Object.prototype ); + + array[item++] = new TestCase( SECTION, + "Math.__proto__", + Object.prototype, + Math.__proto__ ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js new file mode 100644 index 0000000..2bf41c0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8-2.js + ECMA Section: 15.8 The Math Object + + Description: + + The Math object is merely a single object that has some named properties, + some of which are functions. + + The value of the internal [[Prototype]] property of the Math object is the + Object prototype object (15.2.3.1). + + The Math object does not have a [[Construct]] property; it is not possible + to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] property; it is not possible to + invoke the Math object as a function. + + Recall that, in this specification, the phrase "the number value for x" has + a technical meaning defined in section 8.5. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + + var SECTION = "15.8-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "MYMATH = new Math()", + "error", + "MYMATH = new Math()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += "Math does not have the [Construct] property"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js new file mode 100644 index 0000000..4896f48 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8-3.js + ECMA Section: 15.8 The Math Object + + Description: + + The Math object is merely a single object that has some named properties, + some of which are functions. + + The value of the internal [[Prototype]] property of the Math object is the + Object prototype object (15.2.3.1). + + The Math object does not have a [[Construct]] property; it is not possible + to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] property; it is not possible to + invoke the Math object as a function. + + Recall that, in this specification, the phrase "the number value for x" has + a technical meaning defined in section 8.5. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.8-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "MYMATH = Math()", + "error", + "MYMATH = Math()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += "Math does not have the [Call] property"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js new file mode 100644 index 0000000..f22fdca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js @@ -0,0 +1,62 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.1-1.js + ECMA Section: 15.8.1.1.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.E = 0; Math.E", 2.7182818284590452354, ("Math.E=0;Math.E") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "Math.E should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js new file mode 100644 index 0000000..2aea4ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.1-2.js + ECMA Section: 15.8.1.1.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MATH_E = 2.7182818284590452354 + array[item++] = new TestCase( SECTION, "delete(Math.E)", false, "delete Math.E" ); + array[item++] = new TestCase( SECTION, "delete(Math.E); Math.E", MATH_E, "delete Math.E; Math.E" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "should not be able to delete property"; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js new file mode 100644 index 0000000..a9d8c0d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js @@ -0,0 +1,62 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.2-1.js + ECMA Section: 15.8.2.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LN10 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN10"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.LN10=0; Math.LN10", 2.302585092994046, "Math.LN10=0; Math.LN10" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js new file mode 100644 index 0000000..2774177 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.2-1.js + ECMA Section: 15.8.2.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LN10 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN10"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); Math.LN10", 2.302585092994046, "delete(Math.LN10); Math.LN10" ); + array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); ", false, "delete(Math.LN10)" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js new file mode 100644 index 0000000..d8354ad --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.3-1.js + ECMA Section: 15.8.1.3.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LN2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.LN2=0; Math.LN2", 0.6931471805599453, ("Math.LN2=0; Math.LN2") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js new file mode 100644 index 0000000..a26ef79 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.3-3.js + ECMA Section: 15.8.1.3.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LN2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MATH_LN2 = 0.6931471805599453; + + array[item++] = new TestCase( SECTION, "delete(Math.LN2)", false, "delete(Math.LN2)" ); + array[item++] = new TestCase( SECTION, "delete(Math.LN2); Math.LN2", MATH_LN2, "delete(Math.LN2); Math.LN2" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js new file mode 100644 index 0000000..82e2fea --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.4-1.js + ECMA Section: 15.8.1.4.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LOG2E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG2E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.L0G2E=0; Math.LOG2E", 1.4426950408889634, ("Math.LOG2E=0; Math.LOG2E") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js new file mode 100644 index 0000000..9208b46 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.4-2.js + ECMA Section: 15.8.1.4.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LOG2E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.4-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG2E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete(Math.L0G2E);Math.LOG2E", 1.4426950408889634, "delete(Math.LOG2E);Math.LOG2E" ); + array[item++] = new TestCase( SECTION, "delete(Math.L0G2E)", false, "delete(Math.LOG2E)" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js new file mode 100644 index 0000000..1ad5000 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.5-1.js + ECMA Section: 15.8.1.5.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LOG10E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.8.1.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG10E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.LOG10E=0; Math.LOG10E", 0.4342944819032518, ("Math.LOG10E=0; Math.LOG10E") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js new file mode 100644 index 0000000..7b204e7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.5-2.js + ECMA Section: 15.8.1.5.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LOG10E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG10E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.LOG10E; Math.LOG10E", 0.4342944819032518, "delete Math.LOG10E; Math.LOG10E" ); + array[item++] = new TestCase( SECTION, "delete Math.LOG10E", false, "delete Math.LOG10E" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js new file mode 100644 index 0000000..4a998cc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.6-1.js + ECMA Section: 15.8.1.6.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.PI + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.6-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.PI"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.PI=0; Math.PI", 3.1415926535897923846, "Math.PI=0; Math.PI" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js new file mode 100644 index 0000000..3a0fb1f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.6-2.js + ECMA Section: 15.8.1.6.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.PI + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.6-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.PI"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", 3.1415926535897923846, "delete Math.PI; Math.PI" ); + array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", false, "delete Math.PI" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js new file mode 100644 index 0000000..9eeb6d7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.7-1.js + ECMA Section: 15.8.1.7.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.SQRT1_2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.7-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT1_2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.SQRT1_2=0; Math.SQRT1_2", 0.7071067811865476, "Math.SQRT1_2=0; Math.SQRT1_2" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js new file mode 100644 index 0000000..85dd054 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.7-2.js + ECMA Section: 15.8.1.7.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.SQRT1_2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.7-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT1_2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2; Math.SQRT1_2", 0.7071067811865476, "delete Math.SQRT1_2; Math.SQRT1_2" ); + array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2", false, "delete Math.SQRT1_2" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js new file mode 100644 index 0000000..1b3615d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.8-1.js + ECMA Section: 15.8.1.8.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.SQRT2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.8-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.SQRT2=0; Math.SQRT2", 1.4142135623730951, ("Math.SQRT2=0; Math.SQRT2") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js new file mode 100644 index 0000000..25634dd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.8-2.js + ECMA Section: 15.8.1.8.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.SQRT2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.8-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.SQRT2; Math.SQRT2", 1.4142135623730951, "delete Math.SQRT2; Math.SQRT2" ); + array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, "delete Math.SQRT2" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js new file mode 100644 index 0000000..d1df188 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js @@ -0,0 +1,61 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.8-3.js + ECMA Section: 15.8.1.8.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.SQRT2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.8-3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, ("delete Math.SQRT2") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js new file mode 100644 index 0000000..a0fdf26 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.1.js + ECMA Section: 15.8.1.js Value Properties of the Math Object + 15.8.1.1 E + 15.8.1.2 LN10 + 15.8.1.3 LN2 + 15.8.1.4 LOG2E + 15.8.1.5 LOG10E + 15.8.1.6 PI + 15.8.1.7 SQRT1_2 + 15.8.1.8 SQRT2 + Description: verify the values of some math constants + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.1" + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Value Properties of the Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E ); + array[item++] = new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E ); + array[item++] = new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 ); + array[item++] = new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 ); + array[item++] = new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 ); + array[item++] = new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 ); + array[item++] = new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E ); + array[item++] = new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E ); + array[item++] = new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E); + array[item++] = new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E); + array[item++] = new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI ); + array[item++] = new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI ); + array[item++] = new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2); + array[item++] = new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2); + array[item++] = new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 ); + array[item++] = new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 ); + + array[item++] = new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS", + "", + eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") ); + + return ( array ); +} + +function test() { + for ( i = 0; i < testcases.length; i++ ) { + testcases[i].passed = writeTestCaseResult( + testcases[i].expect, + testcases[i].actual, + testcases[i].description +" = "+ testcases[i].actual ); + testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js new file mode 100644 index 0000000..4f0ba21 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js @@ -0,0 +1,103 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.1.js + ECMA Section: 15.8.2.1 abs( x ) + Description: return the absolute value of the argument, + which should be the magnitude of the argument + with a positive sign. + - if x is NaN, return NaN + - if x is -0, result is +0 + - if x is -Infinity, result is +Infinity + Author: christine@netscape.com + Date: 7 july 1997 +*/ + var SECTION = "15.8.2.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.abs()"; + var BUGNUMBER = "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.abs.length", 1, Math.abs.length ); + + array[item++] = new TestCase( SECTION, "Math.abs()", Number.NaN, Math.abs() ); + array[item++] = new TestCase( SECTION, "Math.abs( void 0 )", Number.NaN, Math.abs(void 0) ); + array[item++] = new TestCase( SECTION, "Math.abs( null )", 0, Math.abs(null) ); + array[item++] = new TestCase( SECTION, "Math.abs( true )", 1, Math.abs(true) ); + array[item++] = new TestCase( SECTION, "Math.abs( false )", 0, Math.abs(false) ); + array[item++] = new TestCase( SECTION, "Math.abs( string primitive)", Number.NaN, Math.abs("a string primitive") ); + array[item++] = new TestCase( SECTION, "Math.abs( string object )", Number.NaN, Math.abs(new String( 'a String object' )) ); + array[item++] = new TestCase( SECTION, "Math.abs( Number.NaN )", Number.NaN, Math.abs(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.abs(0)", 0, Math.abs( 0 ) ); + array[item++] = new TestCase( SECTION, "Math.abs( -0 )", 0, Math.abs(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.abs(-0)", Infinity, Infinity/Math.abs(-0) ); + + array[item++] = new TestCase( SECTION, "Math.abs( -Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.NEGATIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "Math.abs( Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.POSITIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "Math.abs( - MAX_VALUE )", Number.MAX_VALUE, Math.abs( - Number.MAX_VALUE ) ); + array[item++] = new TestCase( SECTION, "Math.abs( - MIN_VALUE )", Number.MIN_VALUE, Math.abs( -Number.MIN_VALUE ) ); + array[item++] = new TestCase( SECTION, "Math.abs( MAX_VALUE )", Number.MAX_VALUE, Math.abs( Number.MAX_VALUE ) ); + array[item++] = new TestCase( SECTION, "Math.abs( MIN_VALUE )", Number.MIN_VALUE, Math.abs( Number.MIN_VALUE ) ); + + array[item++] = new TestCase( SECTION, "Math.abs( -1 )", 1, Math.abs( -1 ) ); + array[item++] = new TestCase( SECTION, "Math.abs( new Number( -1 ) )", 1, Math.abs( new Number(-1) ) ); + array[item++] = new TestCase( SECTION, "Math.abs( 1 )", 1, Math.abs( 1 ) ); + array[item++] = new TestCase( SECTION, "Math.abs( Math.PI )", Math.PI, Math.abs( Math.PI ) ); + array[item++] = new TestCase( SECTION, "Math.abs( -Math.PI )", Math.PI, Math.abs( -Math.PI ) ); + array[item++] = new TestCase( SECTION, "Math.abs(-1/100000000)", 1/100000000, Math.abs(-1/100000000) ); + array[item++] = new TestCase( SECTION, "Math.abs(-Math.pow(2,32))", Math.pow(2,32), Math.abs(-Math.pow(2,32)) ); + array[item++] = new TestCase( SECTION, "Math.abs(Math.pow(2,32))", Math.pow(2,32), Math.abs(Math.pow(2,32)) ); + array[item++] = new TestCase( SECTION, "Math.abs( -0xfff )", 4095, Math.abs( -0xfff ) ); + array[item++] = new TestCase( SECTION, "Math.abs( -0777 )", 511, Math.abs(-0777 ) ); + + array[item++] = new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') ); + array[item++] = new TestCase( SECTION, "Math.abs('0xff')", 255, Math.abs('0xff') ); + array[item++] = new TestCase( SECTION, "Math.abs('077')", 77, Math.abs('077') ); + array[item++] = new TestCase( SECTION, "Math.abs( 'Infinity' )", Infinity, Math.abs('Infinity') ); + array[item++] = new TestCase( SECTION, "Math.abs( '-Infinity' )", Infinity, Math.abs('-Infinity') ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js new file mode 100644 index 0000000..24b6cb8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.10.js + ECMA Section: 15.8.2.10 Math.log(x) + Description: return an approximiation to the natural logarithm of + the argument. + special cases: + - if arg is NaN result is NaN + - if arg is <0 result is NaN + - if arg is 0 or -0 result is -Infinity + - if arg is 1 result is 0 + - if arg is Infinity result is Infinity + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.log(x)"; + var BUGNUMBER = "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.log.length", 1, Math.log.length ); + + array[item++] = new TestCase( SECTION, "Math.log()", Number.NaN, Math.log() ); + array[item++] = new TestCase( SECTION, "Math.log(void 0)", Number.NaN, Math.log(void 0) ); + array[item++] = new TestCase( SECTION, "Math.log(null)", Number.NEGATIVE_INFINITY, Math.log(null) ); + array[item++] = new TestCase( SECTION, "Math.log(true)", 0, Math.log(true) ); + array[item++] = new TestCase( SECTION, "Math.log(false)", -Infinity, Math.log(false) ); + array[item++] = new TestCase( SECTION, "Math.log('0')", -Infinity, Math.log('0') ); + array[item++] = new TestCase( SECTION, "Math.log('1')", 0, Math.log('1') ); + array[item++] = new TestCase( SECTION, "Math.log('Infinity')", Infinity, Math.log("Infinity") ); + + array[item++] = new TestCase( SECTION, "Math.log(NaN)", Number.NaN, Math.log(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.log(-0.0000001)", Number.NaN, Math.log(-0.000001) ); + array[item++] = new TestCase( SECTION, "Math.log(-1)", Number.NaN, Math.log(-1) ); + array[item++] = new TestCase( SECTION, "Math.log(0)", Number.NEGATIVE_INFINITY, Math.log(0) ); + array[item++] = new TestCase( SECTION, "Math.log(-0)", Number.NEGATIVE_INFINITY, Math.log(-0)); + array[item++] = new TestCase( SECTION, "Math.log(1)", 0, Math.log(1) ); + array[item++] = new TestCase( SECTION, "Math.log(Infinity)", Number.POSITIVE_INFINITY, Math.log(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.log(-Infinity)", Number.NaN, Math.log(Number.NEGATIVE_INFINITY) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js new file mode 100644 index 0000000..4be499c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.11.js + ECMA Section: 15.8.2.11 Math.max(x, y) + Description: return the smaller of the two arguments. + special cases: + - if x is NaN or y is NaN return NaN + - if x < y return x + - if y > x return y + - if x is +0 and y is +0 return +0 + - if x is +0 and y is -0 return -0 + - if x is -0 and y is +0 return -0 + - if x is -0 and y is -0 return -0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.max(x, y)"; + var BUGNUMBER="76439"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.max.length", 2, Math.max.length ); + + array[item++] = new TestCase( SECTION, "Math.max()", -Infinity, Math.max() ); + array[item++] = new TestCase( SECTION, "Math.max(void 0, 1)", Number.NaN, Math.max( void 0, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.max(void 0, void 0)", Number.NaN, Math.max( void 0, void 0 ) ); + array[item++] = new TestCase( SECTION, "Math.max(null, 1)", 1, Math.max( null, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.max(-1, null)", 0, Math.max( -1, null ) ); + array[item++] = new TestCase( SECTION, "Math.max(true, false)", 1, Math.max(true,false) ); + + array[item++] = new TestCase( SECTION, "Math.max('-99','99')", 99, Math.max( "-99","99") ); + + array[item++] = new TestCase( SECTION, "Math.max(NaN, Infinity)", Number.NaN, Math.max(Number.NaN,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(NaN, 0)", Number.NaN, Math.max(Number.NaN, 0) ); + array[item++] = new TestCase( SECTION, "Math.max('a string', 0)", Number.NaN, Math.max("a string", 0) ); + array[item++] = new TestCase( SECTION, "Math.max(NaN, 1)", Number.NaN, Math.max(Number.NaN,1) ); + array[item++] = new TestCase( SECTION, "Math.max('a string',Infinity)", Number.NaN, Math.max("a string", Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(Infinity, NaN)", Number.NaN, Math.max( Number.POSITIVE_INFINITY, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(NaN, NaN)", Number.NaN, Math.max(Number.NaN, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(0,NaN)", Number.NaN, Math.max(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(1, NaN)", Number.NaN, Math.max(1, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(0,0)", 0, Math.max(0,0) ); + array[item++] = new TestCase( SECTION, "Math.max(0,-0)", 0, Math.max(0,-0) ); + array[item++] = new TestCase( SECTION, "Math.max(-0,0)", 0, Math.max(-0,0) ); + array[item++] = new TestCase( SECTION, "Math.max(-0,-0)", -0, Math.max(-0,-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.max(-0,-0)", -Infinity, Infinity/Math.max(-0,-0) ); + array[item++] = new TestCase( SECTION, "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "Math.max(Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(-Infinity,-Infinity)", Number.NEGATIVE_INFINITY, Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(1,.99999999999999)", 1, Math.max(1,.99999999999999) ); + array[item++] = new TestCase( SECTION, "Math.max(-1,-.99999999999999)", -.99999999999999, Math.max(-1,-.99999999999999) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js new file mode 100644 index 0000000..0706e0b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.12.js + ECMA Section: 15.8.2.12 Math.min(x, y) + Description: return the smaller of the two arguments. + special cases: + - if x is NaN or y is NaN return NaN + - if x < y return x + - if y > x return y + - if x is +0 and y is +0 return +0 + - if x is +0 and y is -0 return -0 + - if x is -0 and y is +0 return -0 + - if x is -0 and y is -0 return -0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + + var SECTION = "15.8.2.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.min(x, y)"; + var BUGNUMBER="76439"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.min.length", 2, Math.min.length ); + + array[item++] = new TestCase( SECTION, "Math.min()", Infinity, Math.min() ); + array[item++] = new TestCase( SECTION, "Math.min(void 0, 1)", Number.NaN, Math.min( void 0, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.min(void 0, void 0)", Number.NaN, Math.min( void 0, void 0 ) ); + array[item++] = new TestCase( SECTION, "Math.min(null, 1)", 0, Math.min( null, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.min(-1, null)", -1, Math.min( -1, null ) ); + array[item++] = new TestCase( SECTION, "Math.min(true, false)", 0, Math.min(true,false) ); + + array[item++] = new TestCase( SECTION, "Math.min('-99','99')", -99, Math.min( "-99","99") ); + + array[item++] = new TestCase( SECTION, "Math.min(NaN,0)", Number.NaN, Math.min(Number.NaN,0) ); + array[item++] = new TestCase( SECTION, "Math.min(NaN,1)", Number.NaN, Math.min(Number.NaN,1) ); + array[item++] = new TestCase( SECTION, "Math.min(NaN,-1)", Number.NaN, Math.min(Number.NaN,-1) ); + array[item++] = new TestCase( SECTION, "Math.min(0,NaN)", Number.NaN, Math.min(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(1,NaN)", Number.NaN, Math.min(1,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(-1,NaN)", Number.NaN, Math.min(-1,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(NaN,NaN)", Number.NaN, Math.min(Number.NaN,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(1,1.0000000001)", 1, Math.min(1,1.0000000001) ); + array[item++] = new TestCase( SECTION, "Math.min(1.0000000001,1)", 1, Math.min(1.0000000001,1) ); + array[item++] = new TestCase( SECTION, "Math.min(0,0)", 0, Math.min(0,0) ); + array[item++] = new TestCase( SECTION, "Math.min(0,-0)", -0, Math.min(0,-0) ); + array[item++] = new TestCase( SECTION, "Math.min(-0,-0)", -0, Math.min(-0,-0) ); + + array[item++] = new TestCase( SECTION, "Infinity/Math.min(0,-0)", -Infinity, Infinity/Math.min(0,-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.min(-0,-0)", -Infinity, Infinity/Math.min(-0,-0) ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js new file mode 100644 index 0000000..4744eb0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js @@ -0,0 +1,132 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.13.js + ECMA Section: 15.8.2.13 Math.pow(x, y) + Description: return an approximation to the result of x + to the power of y. there are many special cases; + refer to the spec. + Author: christine@netscape.com + Date: 9 july 1997 +*/ + + var SECTION = "15.8.2.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.pow(x, y)"; + var BUGNUMBER="77141"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.pow.length", 2, Math.pow.length ); + + array[item++] = new TestCase( SECTION, "Math.pow()", Number.NaN, Math.pow() ); + array[item++] = new TestCase( SECTION, "Math.pow(null, null)", 1, Math.pow(null,null) ); + array[item++] = new TestCase( SECTION, "Math.pow(void 0, void 0)", Number.NaN, Math.pow(void 0, void 0)); + array[item++] = new TestCase( SECTION, "Math.pow(true, false)", 1, Math.pow(true, false) ); + array[item++] = new TestCase( SECTION, "Math.pow(false,true)", 0, Math.pow(false,true) ); + array[item++] = new TestCase( SECTION, "Math.pow('2','32')", 4294967296, Math.pow('2','32') ); + + array[item++] = new TestCase( SECTION, "Math.pow(1,NaN)", Number.NaN, Math.pow(1,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.pow(0,NaN)", Number.NaN, Math.pow(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,0)", 1, Math.pow(Number.NaN,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,-0)", 1, Math.pow(Number.NaN,-0) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,1)", Number.NaN, Math.pow(Number.NaN, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,.5)", Number.NaN, Math.pow(Number.NaN, .5) ); + array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(1.00000001, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, -Infinity)", 0, Math.pow(1.00000001, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(-1.00000001,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, -Infinity)", 0, Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(1, Infinity)", Number.NaN, Math.pow(1, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(1, -Infinity)", Number.NaN, Math.pow(1, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, Infinity)", Number.NaN, Math.pow(-1, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, -Infinity)", Number.NaN, Math.pow(-1, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, Infinity)", 0, Math.pow(.0000000009, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-.0000000009, Infinity)", 0, Math.pow(-.0000000009, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, .00000000001)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY,.00000000001) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 1)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -.00000000001)",0, Math.pow(Number.POSITIVE_INFINITY, -.00000000001) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -1)", 0, Math.pow(Number.POSITIVE_INFINITY, -1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 1)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 333)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 333) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 2)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 666)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 666) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 0.5)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -1)", -0, Math.pow(Number.NEGATIVE_INFINITY, -1) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-Infinity, -1)", -Infinity, Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) ); + + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -3)", -0, Math.pow(Number.NEGATIVE_INFINITY, -3) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -2)", 0, Math.pow(Number.NEGATIVE_INFINITY, -2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -0.5)", 0, Math.pow(Number.NEGATIVE_INFINITY,-0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -Infinity)", 0, Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 1)", 0, Math.pow(0,1) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 0)", 1, Math.pow(0,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(1, 0)", 1, Math.pow(1,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, 0)", 1, Math.pow(-1,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 0.5)", 0, Math.pow(0,0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 1000)", 0, Math.pow(0,1000) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, Infinity)", 0, Math.pow(0, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -1)", Number.POSITIVE_INFINITY, Math.pow(0, -1) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -0.5)", Number.POSITIVE_INFINITY, Math.pow(0, -0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -1000)", Number.POSITIVE_INFINITY, Math.pow(0, -1000) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(0, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, 1)", -0, Math.pow(-0, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, 3)", -0, Math.pow(-0,3) ); + + array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 1)", -Infinity, Infinity/Math.pow(-0, 1) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 3)", -Infinity, Infinity/Math.pow(-0,3) ); + + array[item++] = new TestCase( SECTION, "Math.pow(-0, 2)", 0, Math.pow(-0,2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, -1)", Number.NEGATIVE_INFINITY, Math.pow(-0, -1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, -10001)", Number.NEGATIVE_INFINITY, Math.pow(-0, -10001) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, -2)", Number.POSITIVE_INFINITY, Math.pow(-0, -2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, 0.5)", 0, Math.pow(-0, 0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, 0.5)", Number.NaN, Math.pow(-1, 0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, NaN)", Number.NaN, Math.pow(-1, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, -0.5)", Number.NaN, Math.pow(-1, -0.5) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js new file mode 100644 index 0000000..e5ed1fb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.14.js + ECMA Section: 15.8.2.14 Math.random() + returns a number value x with a positive sign + with 1 > x >= 0 with approximately uniform + distribution over that range, using an + implementation-dependent algorithm or strategy. + This function takes no arguments. + + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.2.14"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.random()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( item = 0; item < 100; item++ ) { + array[item] = new TestCase( SECTION, "Math.random()", "pass", null ); + } + + return ( array ); +} +function getRandom( caseno ) { + testcases[caseno].reason = Math.random(); + testcases[caseno].actual = "pass"; + + if ( ! ( testcases[caseno].reason >= 0) ) { + testcases[caseno].actual = "fail"; + } + + if ( ! (testcases[caseno].reason < 1) ) { + testcases[caseno].actual = "fail"; + } +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + getRandom( tc ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js new file mode 100644 index 0000000..ca8cc94 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js @@ -0,0 +1,113 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.15.js + ECMA Section: 15.8.2.15 Math.round(x) + Description: return the greatest number value that is closest to the + argument and is an integer. if two integers are equally + close to the argument. then the result is the number value + that is closer to Infinity. if the argument is an integer, + return the argument. + special cases: + - if x is NaN return NaN + - if x = +0 return +0 + - if x = -0 return -0 + - if x = Infinity return Infinity + - if x = -Infinity return -Infinity + - if 0 < x < 0.5 return 0 + - if -0.5 <= x < 0 return -0 + example: + Math.round( 3.5 ) == 4 + Math.round( -3.5 ) == 3 + also: + - Math.round(x) == Math.floor( x + 0.5 ) + except if x = -0. in that case, Math.round(x) = -0 + + and Math.floor( x+0.5 ) = +0 + + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.15"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.round(x)"; + var BUGNUMBER="331411"; + + var EXCLUDE = "true"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.round.length", 1, Math.round.length ); + + array[item++] = new TestCase( SECTION, "Math.round()", Number.NaN, Math.round() ); + array[item++] = new TestCase( SECTION, "Math.round(null)", 0, Math.round(0) ); + array[item++] = new TestCase( SECTION, "Math.round(void 0)", Number.NaN, Math.round(void 0) ); + array[item++] = new TestCase( SECTION, "Math.round(true)", 1, Math.round(true) ); + array[item++] = new TestCase( SECTION, "Math.round(false)", 0, Math.round(false) ); + array[item++] = new TestCase( SECTION, "Math.round('.99999')", 1, Math.round('.99999') ); + array[item++] = new TestCase( SECTION, "Math.round('12345e-2')", 123, Math.round('12345e-2') ); + + array[item++] = new TestCase( SECTION, "Math.round(NaN)", Number.NaN, Math.round(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.round(0)", 0, Math.round(0) ); + array[item++] = new TestCase( SECTION, "Math.round(-0)", -0, Math.round(-0)); + array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0)", -Infinity, Infinity/Math.round(-0) ); + + array[item++] = new TestCase( SECTION, "Math.round(Infinity)", Number.POSITIVE_INFINITY, Math.round(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.round(-Infinity)",Number.NEGATIVE_INFINITY, Math.round(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.round(0.49)", 0, Math.round(0.49)); + array[item++] = new TestCase( SECTION, "Math.round(0.5)", 1, Math.round(0.5)); + array[item++] = new TestCase( SECTION, "Math.round(0.51)", 1, Math.round(0.51)); + + array[item++] = new TestCase( SECTION, "Math.round(-0.49)", -0, Math.round(-0.49)); + array[item++] = new TestCase( SECTION, "Math.round(-0.5)", -0, Math.round(-0.5)); + array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.49)", -Infinity, Infinity/Math.round(-0.49)); + array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.5)", -Infinity, Infinity/Math.round(-0.5)); + + array[item++] = new TestCase( SECTION, "Math.round(-0.51)", -1, Math.round(-0.51)); + array[item++] = new TestCase( SECTION, "Math.round(3.5)", 4, Math.round(3.5)); + array[item++] = new TestCase( SECTION, "Math.round(-3.5)", -3, Math.round(-3)); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js new file mode 100644 index 0000000..b144d9b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.16.js + ECMA Section: 15.8.2.16 sin( x ) + Description: return an approximation to the sine of the + argument. argument is expressed in radians + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.2.16"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.sin(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length ); + + array[item++] = new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() ); + array[item++] = new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) ); + array[item++] = new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) ); + array[item++] = new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) ); + array[item++] = new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') ); + + array[item++] = new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) ); + array[item++] = new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0)); + array[item++] = new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974)); + array[item++] = new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795)); + array[item++] = new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192)); + array[item++] = new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359)); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js new file mode 100644 index 0000000..16859ed --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.17.js + ECMA Section: 15.8.2.17 Math.sqrt(x) + Description: return an approximation to the squareroot of the argument. + special cases: + - if x is NaN return NaN + - if x < 0 return NaN + - if x == 0 return 0 + - if x == -0 return -0 + - if x == Infinity return Infinity + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.17"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.sqrt(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.sqrt.length", 1, Math.sqrt.length ); + + array[item++] = new TestCase( SECTION, "Math.sqrt()", Number.NaN, Math.sqrt() ); + array[item++] = new TestCase( SECTION, "Math.sqrt(void 0)", Number.NaN, Math.sqrt(void 0) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(null)", 0, Math.sqrt(null) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(true)", 1, Math.sqrt(1) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(false)", 0, Math.sqrt(false) ); + array[item++] = new TestCase( SECTION, "Math.sqrt('225')", 15, Math.sqrt('225') ); + + array[item++] = new TestCase( SECTION, "Math.sqrt(NaN)", Number.NaN, Math.sqrt(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(-Infinity)", Number.NaN, Math.sqrt(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sqrt(-1)", Number.NaN, Math.sqrt(-1)); + array[item++] = new TestCase( SECTION, "Math.sqrt(-0.5)", Number.NaN, Math.sqrt(-0.5)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0)", 0, Math.sqrt(0)); + array[item++] = new TestCase( SECTION, "Math.sqrt(-0)", -0, Math.sqrt(-0)); + array[item++] = new TestCase( SECTION, "Infinity/Math.sqrt(-0)", -Infinity, Infinity/Math.sqrt(-0) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(Infinity)", Number.POSITIVE_INFINITY, Math.sqrt(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sqrt(1)", 1, Math.sqrt(1)); + array[item++] = new TestCase( SECTION, "Math.sqrt(2)", Math.SQRT2, Math.sqrt(2)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.5)", Math.SQRT1_2, Math.sqrt(0.5)); + array[item++] = new TestCase( SECTION, "Math.sqrt(4)", 2, Math.sqrt(4)); + array[item++] = new TestCase( SECTION, "Math.sqrt(9)", 3, Math.sqrt(9)); + array[item++] = new TestCase( SECTION, "Math.sqrt(16)", 4, Math.sqrt(16)); + array[item++] = new TestCase( SECTION, "Math.sqrt(25)", 5, Math.sqrt(25)); + array[item++] = new TestCase( SECTION, "Math.sqrt(36)", 6, Math.sqrt(36)); + array[item++] = new TestCase( SECTION, "Math.sqrt(49)", 7, Math.sqrt(49)); + array[item++] = new TestCase( SECTION, "Math.sqrt(64)", 8, Math.sqrt(64)); + array[item++] = new TestCase( SECTION, "Math.sqrt(256)", 16, Math.sqrt(256)); + array[item++] = new TestCase( SECTION, "Math.sqrt(10000)", 100, Math.sqrt(10000)); + array[item++] = new TestCase( SECTION, "Math.sqrt(65536)", 256, Math.sqrt(65536)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.09)", 0.3, Math.sqrt(0.09)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.01)", 0.1, Math.sqrt(0.01)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.00000001)",0.0001, Math.sqrt(0.00000001)); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js new file mode 100644 index 0000000..f745dd7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.18.js + ECMA Section: 15.8.2.18 tan( x ) + Description: return an approximation to the tan of the + argument. argument is expressed in radians + special cases: + - if x is NaN result is NaN + - if x is 0 result is 0 + - if x is -0 result is -0 + - if x is Infinity or -Infinity result is NaN + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.18"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.tan(x)"; + var EXCLUDE = "true"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.tan.length", 1, Math.tan.length ); + + array[item++] = new TestCase( SECTION, "Math.tan()", Number.NaN, Math.tan() ); + array[item++] = new TestCase( SECTION, "Math.tan(void 0)", Number.NaN, Math.tan(void 0)); + array[item++] = new TestCase( SECTION, "Math.tan(null)", 0, Math.tan(null) ); + array[item++] = new TestCase( SECTION, "Math.tan(false)", 0, Math.tan(false) ); + + array[item++] = new TestCase( SECTION, "Math.tan(NaN)", Number.NaN, Math.tan(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.tan(0)", 0, Math.tan(0)); + array[item++] = new TestCase( SECTION, "Math.tan(-0)", -0, Math.tan(-0)); + array[item++] = new TestCase( SECTION, "Math.tan(Infinity)", Number.NaN, Math.tan(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.tan(-Infinity)", Number.NaN, Math.tan(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/4)", 1, Math.tan(Math.PI/4)); + array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/4)", -1, Math.tan(3*Math.PI/4)); + array[item++] = new TestCase( SECTION, "Math.tan(Math.PI)", -0, Math.tan(Math.PI)); + array[item++] = new TestCase( SECTION, "Math.tan(5*Math.PI/4)", 1, Math.tan(5*Math.PI/4)); + array[item++] = new TestCase( SECTION, "Math.tan(7*Math.PI/4)", -1, Math.tan(7*Math.PI/4)); + array[item++] = new TestCase( SECTION, "Infinity/Math.tan(-0)", -Infinity, Infinity/Math.tan(-0) ); + +/* + Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2. + That is to say, perturbing PI/2 by this much is about the smallest rounding error possible. + + This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I + suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest + results to infinity that the algorithm can deliver. + + In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger. + = C = +*/ + array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/2) >= 5443000000000000", true, Math.tan(3*Math.PI/2) >= 5443000000000000 ); + array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/2) >= 5443000000000000", true, Math.tan(Math.PI/2) >= 5443000000000000 ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js new file mode 100644 index 0000000..4a6f11e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.2.js + ECMA Section: 15.8.2.2 acos( x ) + Description: return an approximation to the arc cosine of the + argument. the result is expressed in radians and + range is from +0 to +PI. special cases: + - if x is NaN, return NaN + - if x > 1, the result is NaN + - if x < -1, the result is NaN + - if x == 1, the result is +0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + var SECTION = "15.8.2.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.acos()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.acos.length", 1, Math.acos.length ); + + array[item++] = new TestCase( SECTION, "Math.acos(void 0)", Number.NaN, Math.acos(void 0) ); + array[item++] = new TestCase( SECTION, "Math.acos()", Number.NaN, Math.acos() ); + array[item++] = new TestCase( SECTION, "Math.acos(null)", Math.PI/2, Math.acos(null) ); + array[item++] = new TestCase( SECTION, "Math.acos(NaN)", Number.NaN, Math.acos(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.acos(a string)", Number.NaN, Math.acos("a string") ); + array[item++] = new TestCase( SECTION, "Math.acos('0')", Math.PI/2, Math.acos('0') ); + array[item++] = new TestCase( SECTION, "Math.acos('1')", 0, Math.acos('1') ); + array[item++] = new TestCase( SECTION, "Math.acos('-1')", Math.PI, Math.acos('-1') ); + + array[item++] = new TestCase( SECTION, "Math.acos(1.00000001)", Number.NaN, Math.acos(1.00000001) ); + array[item++] = new TestCase( SECTION, "Math.acos(11.00000001)", Number.NaN, Math.acos(-1.00000001) ); + array[item++] = new TestCase( SECTION, "Math.acos(1)", 0, Math.acos(1) ); + array[item++] = new TestCase( SECTION, "Math.acos(-1)", Math.PI, Math.acos(-1) ); + array[item++] = new TestCase( SECTION, "Math.acos(0)", Math.PI/2, Math.acos(0) ); + array[item++] = new TestCase( SECTION, "Math.acos(-0)", Math.PI/2, Math.acos(-0) ); + array[item++] = new TestCase( SECTION, "Math.acos(Math.SQRT1_2)", Math.PI/4, Math.acos(Math.SQRT1_2)); + array[item++] = new TestCase( SECTION, "Math.acos(-Math.SQRT1_2)", Math.PI/4*3, Math.acos(-Math.SQRT1_2)); + array[item++] = new TestCase( SECTION, "Math.acos(0.9999619230642)", Math.PI/360, Math.acos(0.9999619230642)); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js new file mode 100644 index 0000000..2a00e93 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.3.js + ECMA Section: 15.8.2.3 asin( x ) + Description: return an approximation to the arc sine of the + argument. the result is expressed in radians and + range is from -PI/2 to +PI/2. special cases: + - if x is NaN, the result is NaN + - if x > 1, the result is NaN + - if x < -1, the result is NaN + - if x == +0, the result is +0 + - if x == -0, the result is -0 + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.2.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.asin()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.asin()", Number.NaN, Math.asin() ); + array[item++] = new TestCase( SECTION, "Math.asin(void 0)", Number.NaN, Math.asin(void 0) ); + array[item++] = new TestCase( SECTION, "Math.asin(null)", 0, Math.asin(null) ); + array[item++] = new TestCase( SECTION, "Math.asin(NaN)", Number.NaN, Math.asin(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.asin('string')", Number.NaN, Math.asin("string") ); + array[item++] = new TestCase( SECTION, "Math.asin('0')", 0, Math.asin("0") ); + array[item++] = new TestCase( SECTION, "Math.asin('1')", Math.PI/2, Math.asin("1") ); + array[item++] = new TestCase( SECTION, "Math.asin('-1')", -Math.PI/2, Math.asin("-1") ); + array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2+'')", Math.PI/4, Math.asin(Math.SQRT1_2+'') ); + array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2+'')", -Math.PI/4, Math.asin(-Math.SQRT1_2+'') ); + + array[item++] = new TestCase( SECTION, "Math.asin(1.000001)", Number.NaN, Math.asin(1.000001) ); + array[item++] = new TestCase( SECTION, "Math.asin(-1.000001)", Number.NaN, Math.asin(-1.000001) ); + array[item++] = new TestCase( SECTION, "Math.asin(0)", 0, Math.asin(0) ); + array[item++] = new TestCase( SECTION, "Math.asin(-0)", -0, Math.asin(-0) ); + + array[item++] = new TestCase( SECTION, "Infinity/Math.asin(-0)", -Infinity, Infinity/Math.asin(-0) ); + + array[item++] = new TestCase( SECTION, "Math.asin(1)", Math.PI/2, Math.asin(1) ); + array[item++] = new TestCase( SECTION, "Math.asin(-1)", -Math.PI/2, Math.asin(-1) ); + array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2))", Math.PI/4, Math.asin(Math.SQRT1_2) ); + array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2))", -Math.PI/4, Math.asin(-Math.SQRT1_2)); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js new file mode 100644 index 0000000..3711331 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js @@ -0,0 +1,88 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + /** + File Name: 15.8.2.4.js + ECMA Section: 15.8.2.4 atan( x ) + Description: return an approximation to the arc tangent of the + argument. the result is expressed in radians and + range is from -PI/2 to +PI/2. special cases: + - if x is NaN, the result is NaN + - if x == +0, the result is +0 + - if x == -0, the result is -0 + - if x == +Infinity, the result is approximately +PI/2 + - if x == -Infinity, the result is approximately -PI/2 + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + + var SECTION = "15.8.2.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.atan()"; + var BUGNUMBER="77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.atan.length", 1, Math.atan.length ); + + array[item++] = new TestCase( SECTION, "Math.atan()", Number.NaN, Math.atan() ); + array[item++] = new TestCase( SECTION, "Math.atan(void 0)", Number.NaN, Math.atan(void 0) ); + array[item++] = new TestCase( SECTION, "Math.atan(null)", 0, Math.atan(null) ); + array[item++] = new TestCase( SECTION, "Math.atan(NaN)", Number.NaN, Math.atan(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.atan('a string')", Number.NaN, Math.atan("a string") ); + array[item++] = new TestCase( SECTION, "Math.atan('0')", 0, Math.atan('0') ); + array[item++] = new TestCase( SECTION, "Math.atan('1')", Math.PI/4, Math.atan('1') ); + array[item++] = new TestCase( SECTION, "Math.atan('-1')", -Math.PI/4, Math.atan('-1') ); + array[item++] = new TestCase( SECTION, "Math.atan('Infinity)", Math.PI/2, Math.atan('Infinity') ); + array[item++] = new TestCase( SECTION, "Math.atan('-Infinity)", -Math.PI/2, Math.atan('-Infinity') ); + + array[item++] = new TestCase( SECTION, "Math.atan(0)", 0, Math.atan(0) ); + array[item++] = new TestCase( SECTION, "Math.atan(-0)", -0, Math.atan(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.atan(-0)", -Infinity, Infinity/Math.atan(-0) ); + array[item++] = new TestCase( SECTION, "Math.atan(Infinity)", Math.PI/2, Math.atan(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan(-Infinity)", -Math.PI/2, Math.atan(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan(1)", Math.PI/4, Math.atan(1) ); + array[item++] = new TestCase( SECTION, "Math.atan(-1)", -Math.PI/4, Math.atan(-1) ); + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js new file mode 100644 index 0000000..d1eeead --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.5.js + ECMA Section: 15.8.2.5 atan2( y, x ) + Description: + + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.2.5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.atan2(x,y)"; + var BUGNUMBER="76111"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.atan2.length", 2, Math.atan2.length ); + + array[item++] = new TestCase( SECTION, "Math.atan2(NaN, 0)", Number.NaN, Math.atan2(Number.NaN,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(null, null)", 0, Math.atan2(null, null) ); + array[item++] = new TestCase( SECTION, "Math.atan2(void 0, void 0)", Number.NaN, Math.atan2(void 0, void 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2()", Number.NaN, Math.atan2() ); + + array[item++] = new TestCase( SECTION, "Math.atan2(0, NaN)", Number.NaN, Math.atan2(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1, 0)", Math.PI/2, Math.atan2(1,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1,-0)", Math.PI/2, Math.atan2(1,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0,0.001)", 0, Math.atan2(0,0.001) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0,0)", 0, Math.atan2(0,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0, -0)", Math.PI, Math.atan2(0,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0, -1)", Math.PI, Math.atan2(0, -1) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-0, 1)", -0, Math.atan2(-0, 1) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-0, 1)", -Infinity, Infinity/Math.atan2(-0,1) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-0, 0)", -0, Math.atan2(-0,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-0, -0)", -Math.PI, Math.atan2(-0, -0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-0, -1)", -Math.PI, Math.atan2(-0, -1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-1, 0)", -Math.PI/2, Math.atan2(-1, 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-1, -0)", -Math.PI/2, Math.atan2(-1, -0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1, Infinity)", 0, Math.atan2(1, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1,-Infinity)", Math.PI, Math.atan2(1, Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-1, Infinity)", -0, Math.atan2(-1,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-1, Infinity)", -Infinity, Infinity/Math.atan2(-1,Infinity) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-1,-Infinity)", -Math.PI, Math.atan2(-1,Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity,-0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, Infinity)", Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, -Infinity)", 3*Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, Infinity)", -Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -Infinity)", -3*Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-1, 1)", -Math.PI/4, Math.atan2( -1, 1) ); + + return array; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js new file mode 100644 index 0000000..738bfe4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js @@ -0,0 +1,108 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.6.js + ECMA Section: 15.8.2.6 Math.ceil(x) + Description: return the smallest number value that is not less than the + argument and is equal to a mathematical integer. if the + number is already an integer, return the number itself. + special cases: + - if x is NaN return NaN + - if x = +0 return +0 + - if x = 0 return -0 + - if x = Infinity return Infinity + - if x = -Infinity return -Infinity + - if ( -1 < x < 0 ) return -0 + also: + - the value of Math.ceil(x) == -Math.ceil(-x) + Author: christine@netscape.com + Date: 7 july 1997 +*/ + var SECTION = "15.8.2.6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.ceil(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.ceil.length", 1, Math.ceil.length ); + + array[item++] = new TestCase( SECTION, "Math.ceil(NaN)", Number.NaN, Math.ceil(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.ceil(null)", 0, Math.ceil(null) ); + array[item++] = new TestCase( SECTION, "Math.ceil()", Number.NaN, Math.ceil() ); + array[item++] = new TestCase( SECTION, "Math.ceil(void 0)", Number.NaN, Math.ceil(void 0) ); + + array[item++] = new TestCase( SECTION, "Math.ceil('0')", 0, Math.ceil('0') ); + array[item++] = new TestCase( SECTION, "Math.ceil('-0')", -0, Math.ceil('-0') ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('0')", Infinity, Infinity/Math.ceil('0')); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('-0')", -Infinity, Infinity/Math.ceil('-0')); + + array[item++] = new TestCase( SECTION, "Math.ceil(0)", 0, Math.ceil(0) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-0)", -0, Math.ceil(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(0)", Infinity, Infinity/Math.ceil(0)); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0)", -Infinity, Infinity/Math.ceil(-0)); + + array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", Number.POSITIVE_INFINITY, Math.ceil(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", Number.NEGATIVE_INFINITY, Math.ceil(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -0, Math.ceil(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-Number.MIN_VALUE)", -Infinity, Infinity/Math.ceil(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "Math.ceil(1)", 1, Math.ceil(1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -1, Math.ceil(-1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -0, Math.ceil(-0.9) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0.9)", -Infinity, Infinity/Math.ceil(-0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", 1, Math.ceil( 0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -1, Math.ceil( -1.1)); + array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", 2, Math.ceil( 1.1)); + + array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", -Math.floor(-Infinity), Math.ceil(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", -Math.floor(Infinity), Math.ceil(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -Math.floor(Number.MIN_VALUE), Math.ceil(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "Math.ceil(1)", -Math.floor(-1), Math.ceil(1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -Math.floor(1), Math.ceil(-1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -Math.floor(0.9), Math.ceil(-0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", -Math.floor(-0.9), Math.ceil( 0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -Math.floor(1.1), Math.ceil( -1.1)); + array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", -Math.floor(-1.1), Math.ceil( 1.1)); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js new file mode 100644 index 0000000..6b7dcfe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.7.js + ECMA Section: 15.8.2.7 cos( x ) + Description: return an approximation to the cosine of the + argument. argument is expressed in radians + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + + var SECTION = "15.8.2.7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.cos(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.cos.length", 1, Math.cos.length ); + + array[item++] = new TestCase( SECTION, "Math.cos()", Number.NaN, Math.cos() ); + array[item++] = new TestCase( SECTION, "Math.cos(void 0)", Number.NaN, Math.cos(void 0) ); + array[item++] = new TestCase( SECTION, "Math.cos(false)", 1, Math.cos(false) ); + array[item++] = new TestCase( SECTION, "Math.cos(null)", 1, Math.cos(null) ); + + array[item++] = new TestCase( SECTION, "Math.cos('0')", 1, Math.cos('0') ); + array[item++] = new TestCase( SECTION, "Math.cos('Infinity')", Number.NaN, Math.cos("Infinity") ); + array[item++] = new TestCase( SECTION, "Math.cos('3.14159265359')", -1, Math.cos('3.14159265359') ); + + array[item++] = new TestCase( SECTION, "Math.cos(NaN)", Number.NaN, Math.cos(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.cos(0)", 1, Math.cos(0) ); + array[item++] = new TestCase( SECTION, "Math.cos(-0)", 1, Math.cos(-0) ); + array[item++] = new TestCase( SECTION, "Math.cos(Infinity)", Number.NaN, Math.cos(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Infinity)", Number.NaN, Math.cos(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.cos(0.7853981633974)", 0.7071067811865, Math.cos(0.7853981633974) ); + array[item++] = new TestCase( SECTION, "Math.cos(1.570796326795)", 0, Math.cos(1.570796326795) ); + array[item++] = new TestCase( SECTION, "Math.cos(2.356194490192)", -0.7071067811865, Math.cos(2.356194490192) ); + array[item++] = new TestCase( SECTION, "Math.cos(3.14159265359)", -1, Math.cos(3.14159265359) ); + array[item++] = new TestCase( SECTION, "Math.cos(3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); + array[item++] = new TestCase( SECTION, "Math.cos(4.712388980385)", 0, Math.cos(4.712388980385) ); + array[item++] = new TestCase( SECTION, "Math.cos(5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(Math.PI*2) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/4)", Math.SQRT2/2, Math.cos(Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/2)", 0, Math.cos(Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/4)", -Math.SQRT2/2, Math.cos(3*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI)", -1, Math.cos(Math.PI) ); + array[item++] = new TestCase( SECTION, "Math.cos(5*Math.PI/4)", -Math.SQRT2/2, Math.cos(5*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/2)", 0, Math.cos(3*Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(7*Math.PI/4)", Math.SQRT2/2, Math.cos(7*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(2*Math.PI) ); + array[item++] = new TestCase( SECTION, "Math.cos(-0.7853981633974)", 0.7071067811865, Math.cos(-0.7853981633974) ); + array[item++] = new TestCase( SECTION, "Math.cos(-1.570796326795)", 0, Math.cos(-1.570796326795) ); + array[item++] = new TestCase( SECTION, "Math.cos(-2.3561944901920)", -.7071067811865, Math.cos(2.3561944901920) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3.14159265359)", -1, Math.cos(3.14159265359) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); + array[item++] = new TestCase( SECTION, "Math.cos(-4.712388980385)", 0, Math.cos(4.712388980385) ); + array[item++] = new TestCase( SECTION, "Math.cos(-5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); + array[item++] = new TestCase( SECTION, "Math.cos(-6.28318530718)", 1, Math.cos(6.28318530718) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/4)", Math.SQRT2/2, Math.cos(-Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/2)", 0, Math.cos(-Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/4)", -Math.SQRT2/2, Math.cos(-3*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI)", -1, Math.cos(-Math.PI) ); + array[item++] = new TestCase( SECTION, "Math.cos(-5*Math.PI/4)", -Math.SQRT2/2, Math.cos(-5*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/2)", 0, Math.cos(-3*Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(-7*Math.PI/4)", Math.SQRT2/2, Math.cos(-7*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI*2)", 1, Math.cos(-Math.PI*2) ); + + return ( array ); +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js new file mode 100644 index 0000000..c0a4924 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js @@ -0,0 +1,84 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.8.js + ECMA Section: 15.8.2.8 Math.exp(x) + Description: return an approximation to the exponential function of + the argument (e raised to the power of the argument) + special cases: + - if x is NaN return NaN + - if x is 0 return 1 + - if x is -0 return 1 + - if x is Infinity return Infinity + - if x is -Infinity return 0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + + var SECTION = "15.8.2.8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.exp(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.exp.length", 1, Math.exp.length ); + + array[item++] = new TestCase( SECTION, "Math.exp()", Number.NaN, Math.exp() ); + array[item++] = new TestCase( SECTION, "Math.exp(null)", 1, Math.exp(null) ); + array[item++] = new TestCase( SECTION, "Math.exp(void 0)", Number.NaN, Math.exp(void 0) ); + array[item++] = new TestCase( SECTION, "Math.exp(1)", Math.E, Math.exp(1) ); + array[item++] = new TestCase( SECTION, "Math.exp(true)", Math.E, Math.exp(true) ); + array[item++] = new TestCase( SECTION, "Math.exp(false)", 1, Math.exp(false) ); + + array[item++] = new TestCase( SECTION, "Math.exp('1')", Math.E, Math.exp('1') ); + array[item++] = new TestCase( SECTION, "Math.exp('0')", 1, Math.exp('0') ); + + array[item++] = new TestCase( SECTION, "Math.exp(NaN)", Number.NaN, Math.exp(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.exp(0)", 1, Math.exp(0) ); + array[item++] = new TestCase( SECTION, "Math.exp(-0)", 1, Math.exp(-0) ); + array[item++] = new TestCase( SECTION, "Math.exp(Infinity)", Number.POSITIVE_INFINITY, Math.exp(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.exp(-Infinity)", 0, Math.exp(Number.NEGATIVE_INFINITY) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js new file mode 100644 index 0000000..c1ea987 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.8.2.9.js + ECMA Section: 15.8.2.9 Math.floor(x) + Description: return the greatest number value that is not greater + than the argument and is equal to a mathematical integer. + if the number is already an integer, return the number + itself. special cases: + - if x is NaN return NaN + - if x = +0 return +0 + - if x = -0 return -0 + - if x = Infinity return Infinity + - if x = -Infinity return -Infinity + - if ( -1 < x < 0 ) return -0 + also: + - the value of Math.floor(x) == -Math.ceil(-x) + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.9"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.floor(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.floor.length", 1, Math.floor.length ); + + array[item++] = new TestCase( SECTION, "Math.floor()", Number.NaN, Math.floor() ); + array[item++] = new TestCase( SECTION, "Math.floor(void 0)", Number.NaN, Math.floor(void 0) ); + array[item++] = new TestCase( SECTION, "Math.floor(null)", 0, Math.floor(null) ); + array[item++] = new TestCase( SECTION, "Math.floor(true)", 1, Math.floor(true) ); + array[item++] = new TestCase( SECTION, "Math.floor(false)", 0, Math.floor(false) ); + + array[item++] = new TestCase( SECTION, "Math.floor('1.1')", 1, Math.floor("1.1") ); + array[item++] = new TestCase( SECTION, "Math.floor('-1.1')", -2, Math.floor("-1.1") ); + array[item++] = new TestCase( SECTION, "Math.floor('0.1')", 0, Math.floor("0.1") ); + array[item++] = new TestCase( SECTION, "Math.floor('-0.1')", -1, Math.floor("-0.1") ); + + array[item++] = new TestCase( SECTION, "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.floor(0)", 0, Math.floor(0) ); + array[item++] = new TestCase( SECTION, "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) ); + + array[item++] = new TestCase( SECTION, "Math.floor(-0)", -0, Math.floor(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) ); + array[item++] = new TestCase( SECTION, "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) ); + + array[item++] = new TestCase( SECTION, "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)", 0, Math.floor(0.0000001) ); + array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) ); + + array[item++] = new TestCase( SECTION, "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) ); + array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js new file mode 100644 index 0000000..cecdd90 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.js + ECMA Section: 15 Native ECMAScript Objects + Description: Every built-in prototype object has the Object prototype + object, which is the value of the expression + Object.prototype (15.2.3.1) as the value of its internal + [[Prototype]] property, except the Object prototype + object itself. + + Every native object associated with a program-created + function also has the Object prototype object as the + value of its internal [[Prototype]] property. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Native ECMAScript Objects"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; +/* + array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ ); +// array[item++] = new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ ); + array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ ); + + array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ ); +*/ + array[item++] = new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype ); + array[item++] = new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype ); + array[item++] = new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype ); + array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype ); + array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype ); +// array[item++] = new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype ); + array[item++] = new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype ); + array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype ); + + array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype ); + + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + return ( testcases ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js new file mode 100644 index 0000000..612e1b4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15-2.js + ECMA Section: 15 Native ECMAScript Objects + + Description: Every built-in function and every built-in constructor + has the Function prototype object, which is the value of + the expression Function.prototype as the value of its + internal [[Prototype]] property, except the Function + prototype object itself. + + That is, the __proto__ property of builtin functions and + constructors should be the Function.prototype object. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Native ECMAScript Objects"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); + array[item++] = new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ ); + array[item++] = new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ ); + array[item++] = new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ ); + array[item++] = new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ ); + array[item++] = new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ ); + array[item++] = new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ ); + + array[item++] = new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); + array[item++] = new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ ); + array[item++] = new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js new file mode 100644 index 0000000..102912d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.1.js + ECMA Section: 15.7.1 The Number Constructor Called as a Function + 15.7.1.1 + 15.7.1.2 + + Description: When Number is called as a function rather than as a + constructor, it performs a type conversion. + 15.7.1.1 Return a number value (not a Number object) + computed by ToNumber( value ) + 15.7.1.2 Number() returns 0. + + need to add more test cases. see the testcases for + TypeConversion ToNumber. + + Author: christine@netscape.com + Date: 29 september 1997 +*/ + + var SECTION = "15.7.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Number Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "Number()", 0, Number() ); + array[item++] = new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); + array[item++] = new TestCase(SECTION, "Number(null)", 0, Number(null) ); + array[item++] = new TestCase(SECTION, "Number()", 0, Number() ); + array[item++] = new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) ); + array[item++] = new TestCase(SECTION, "Number(0)", 0, Number(0) ); + array[item++] = new TestCase(SECTION, "Number(1)", 1, Number(1) ); + array[item++] = new TestCase(SECTION, "Number(-1)", -1, Number(-1) ); + array[item++] = new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) ); + array[item++] = new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") ); + array[item++] = new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) ); + array[item++] = new TestCase(SECTION, "Number('')", 0, Number( "" ) ); + array[item++] = new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") ); + + array[item++] = new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js new file mode 100644 index 0000000..6e3982b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js @@ -0,0 +1,173 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.2.js + ECMA Section: 15.7.2 The Number Constructor + 15.7.2.1 + 15.7.2.2 + + Description: 15.7.2 When Number is called as part of a new + expression, it is a constructor: it initializes + the newly created object. + + 15.7.2.1 The [[Prototype]] property of the newly + constructed object is set to othe original Number + prototype object, the one that is the initial value + of Number.prototype(0). The [[Class]] property is + set to "Number". The [[Value]] property of the + newly constructed object is set to ToNumber(value) + + 15.7.2.2 new Number(). same as in 15.7.2.1, except + the [[Value]] property is set to +0. + + need to add more test cases. see the testcases for + TypeConversion ToNumber. + + Author: christine@netscape.com + Date: 29 september 1997 +*/ + + var SECTION = "15.7.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Number Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // To verify that the object's prototype is the Number.prototype, check to see if the object's + // constructor property is the same as Number.prototype.constructor. + + array[item++] = new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); + + array[item++] = new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); + array[item++] = new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) ); + array[item++] = new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) ); + array[item++] = new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) ); + array[item++] = new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) ); + array[item++] = new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) ); + array[item++] = new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) ); + array[item++] = new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) ); + array[item++] = new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) ); + array[item++] = new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + array[item++] = new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) ); + array[item++] = new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + + array[item++] = new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); + array[item++] = new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); + array[item++] = new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); + array[item++] = new TestCase(SECTION, + "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + return ( array ); +} + + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js new file mode 100644 index 0000000..71aea75 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.1-2.js + ECMA Section: 15.7.3.1 Number.prototype + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.prototype + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.1-1"; +var VERSION = "ECMA_1"; + startTest(); +var TITLE = "Number.prototype"; + +writeHeaderToLog( SECTION +" "+ TITLE); + +var testcases = getTestCases(); +test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype", true, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype" ); + array[item++] = new TestCase(SECTION, "delete( Number.prototype )", false, "delete( Number.prototype )" ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js new file mode 100644 index 0000000..dbce0e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.1-2.js + ECMA Section: 15.7.3.1 Number.prototype + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.prototype + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT", + true, + eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") ); + + array[item++] = new TestCase( SECTION, + "Number.prototype=0; Number.prototype", + Number.prototype, + eval("Number.prototype=0; Number.prototype") ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js new file mode 100644 index 0000000..34bd2ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.1-4.js + ECMA Section: 15.7.3.1 Number.prototype + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.prototype + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "15.7.3.1-3"; + var TITLE = "Number.prototype"; + + writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute"); + + var testcases = getTestCases(); + + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;") + ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += "property should not be enumerated "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js new file mode 100644 index 0000000..51d679a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.2-1.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MAX_VALUE"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test( testcases ); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Number.MAX_VALUE", 1.7976931348623157e308, Number.MAX_VALUE ); + + + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js new file mode 100644 index 0000000..b5f57c9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.2-2.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MAX_VALUE: DontDelete Attribute"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test( testcases ); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "delete( Number.MAX_VALUE ); Number.MAX_VALUE", 1.7976931348623157e308, "delete( Number.MAX_VALUE );Number.MAX_VALUE" ); + array[item++] = new TestCase( SECTION, "delete( Number.MAX_VALUE )", false, "delete( Number.MAX_VALUE )" ); + + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js new file mode 100644 index 0000000..c8040cd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.2-3.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MAX_VALUE"; + + writeHeaderToLog( SECTION + " "+ TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MAX_VAL = 1.7976931348623157e308; + + array[item++] = new TestCase( SECTION, + "Number.MAX_VALUE=0; Number.MAX_VALUE", + MAX_VAL, + eval("Number.MAX_VALUE=0; Number.MAX_VALUE") ); + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js new file mode 100644 index 0000000..846a3c1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.2-4.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.3.2-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MAX_VALUE: DontEnum Attribute"; + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;") + ); + + return ( array ); +} +function test( testcases ) { + for ( tc = 0; tc < testcases.length; tc++ ) { + writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += "property should not be enumerated "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js new file mode 100644 index 0000000..f912583 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.3-1.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.3.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MIN_VALUE"; + + writeHeaderToLog( SECTION + " "+ TITLE ); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MIN_VAL = 5e-324; + + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE", MIN_VAL, Number.MIN_VALUE ); + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js new file mode 100644 index 0000000..fdcfb0a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.3-2.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.3.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MIN_VALUE"; + + writeHeaderToLog( SECTION + " "+ TITLE ); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MIN_VAL = 5e-324; + + array[item++] = new TestCase( SECTION, "delete( Number.MIN_VALUE )", false, "delete( Number.MIN_VALUE )" ); + array[item++] = new TestCase( SECTION, "delete( Number.MIN_VALUE ); Number.MIN_VALUE", MIN_VAL, "delete( Number.MIN_VALUE );Number.MIN_VALUE" ); + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js new file mode 100644 index 0000000..f1c4380 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.3-3.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.3.3-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.MIN_VALUE: ReadOnly Attribute"; + + writeHeaderToLog( SECTION + " "+TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( + SECTION, + "Number.MIN_VALUE=0; Number.MIN_VALUE", + Number.MIN_VALUE, + "Number.MIN_VALUE=0; Number.MIN_VALUE" ); + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += "property should be readonly "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js new file mode 100644 index 0000000..7b3fa19 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.3-4.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.3.3-4"; + var VERSION = "ECMA_1"; + startTest(); + + writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute"); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;") + ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += "property should not be enumerated "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js new file mode 100644 index 0000000..2ff39f6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.4-1.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.3.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NaN"; + + writeHeaderToLog( SECTION + " "+ TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase(SECTION, "NaN", NaN, Number.NaN ); + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js new file mode 100644 index 0000000..96535f1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.4-2.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.3.4-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NaN"; + + writeHeaderToLog( SECTION + " "+ TITLE ); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "delete( Number.NaN ); Number.NaN", NaN, "delete( Number.NaN );Number.NaN" ); + array[item++] = new TestCase( SECTION, "delete( Number.NaN )", false, "delete( Number.NaN )" ); + + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js new file mode 100644 index 0000000..3f13a2f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.4-3.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.4-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NaN"; + + writeHeaderToLog( SECTION + " "+ TITLE ); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( + SECTION, + "Number.NaN=0; Number.NaN", + Number.NaN, + "Number.NaN=0; Number.NaN" ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += "property should be readonly "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js new file mode 100644 index 0000000..33b1667 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.4-4.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.4-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NaN"; + + writeHeaderToLog( SECTION + " " + TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;") + ); + + return ( array ); +} + +function test( testcases ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += "property should not be enumerated "; + passed = false; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js new file mode 100644 index 0000000..1ca04eb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js @@ -0,0 +1,61 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.5-1.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.3.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NEGATIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase(SECTION, "Number.NEGATIVE_INFINITY", -Infinity, Number.NEGATIVE_INFINITY ); + + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js new file mode 100644 index 0000000..2291552 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.5-2.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NEGATIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "delete( Number.NEGATIVE_INFINITY )", + false, + "delete( Number.NEGATIVE_INFINITY )" ); + + array[item++] = new TestCase( SECTION, + "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY", + -Infinity, + "delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY" ); + return ( array ); +} +function test( testcases ) { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js new file mode 100644 index 0000000..c14fcf8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.5-3.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.5-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NEGATIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( + SECTION, + "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY", + -Infinity, + "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += "property should be readonly "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js new file mode 100644 index 0000000..fd3fd4e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.5-4.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.5-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.NEGATIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;") + ); + return ( array ); +} + +function test( testcases ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += "property should not be enumerated "; + + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js new file mode 100644 index 0000000..a14b35e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js @@ -0,0 +1,60 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.6-1.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.6-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.POSITIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY", Infinity, Number.POSITIVE_INFINITY ); + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js new file mode 100644 index 0000000..573648b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.6-2.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.3.6-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.POSITIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY )", false, "delete( Number.POSITIVE_INFINITY )" ); + array[item++] = new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY", Infinity, "delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY" ); + return ( array ); +} + +function test( testcases ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js new file mode 100644 index 0000000..c4c5973 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.6-3.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.7.3.6-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.POSITIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( + SECTION, + "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY", + Number.POSITIVE_INFINITY, + "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY" ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += "property should be readonly "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js new file mode 100644 index 0000000..25b2b4f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.6-4.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.3.6-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.POSITIVE_INFINITY"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;") + ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += "property should not be enumerated "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js new file mode 100644 index 0000000..c832cfc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.3.js + 15.7.3 Properties of the Number Constructor + + Description: The value of the internal [[Prototype]] property + of the Number constructor is the Function prototype + object. The Number constructor also has the internal + [[Call]] and [[Construct]] properties, and the length + property. + + Other properties are in subsequent tests. + + Author: christine@netscape.com + Date: 29 september 1997 +*/ + + var SECTION = "15.7.3"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "Properties of the Number Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase(SECTION, "Number.__proto__", Function.prototype, Number.__proto__ ); + array[item++] = new TestCase(SECTION, "Number.length", 1, Number.length ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js new file mode 100644 index 0000000..8d7c79d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4-1.js + ECMA Section: 15.7.4.1 Properties of the Number Prototype Object + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.7.4-1"; + var VERSION = "ECMA_1"; + startTest(); + writeHeaderToLog( SECTION + "Properties of the Number prototype object"); + + var testcases = getTestCases(); + + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); + array[item++] = new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) ); + array[item++] = new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number ); +// array[item++] = new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js new file mode 100644 index 0000000..789e71c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.1.js + ECMA Section: 15.7.4.1.1 Number.prototype.constructor + + Number.prototype.constructor is the built-in Number constructor. + + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Number.prototype.constructor"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "Number.prototype.constructor", + Number, + Number.prototype.constructor ); + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js new file mode 100644 index 0000000..f41b698 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.2.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.toString()"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + +// the following two lines cause navigator to crash -- cmb 9/16/97 + array[item++] = new TestCase(SECTION, "Number.prototype.toString()", "0", "Number.prototype.toString()" ); + array[item++] = new TestCase(SECTION, "typeof(Number.prototype.toString())", "string", "typeof(Number.prototype.toString())" ); + + array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()", "0", "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()" ); + array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()", "1", "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()" ); + array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()", "-1", "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()" ); + + array[item++] = new TestCase(SECTION, "var MYNUM = new Number(255); MYNUM.toString(10)", "255", "var MYNUM = new Number(255); MYNUM.toString(10)" ); + array[item++] = new TestCase(SECTION, "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)", "NaN", "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)" ); + array[item++] = new TestCase(SECTION, "var MYNUM = new Number(Infinity); MYNUM.toString(10)", "Infinity", "var MYNUM = new Number(Infinity); MYNUM.toString(10)" ); + array[item++] = new TestCase(SECTION, "var MYNUM = new Number(-Infinity); MYNUM.toString(10)", "-Infinity", "var MYNUM = new Number(-Infinity); MYNUM.toString(10)" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual= eval(testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js new file mode 100644 index 0000000..2aa035a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.2-2-n.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.2-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.toString()"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "o = new Object(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new Object(); o.toString = Number.prototype.toString; o.toString()" ); +// array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new String(); o.toString = Number.prototype.toString; o.toString()" ); +// array[item++] = new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", "o = 3; o.toString = Number.prototype.toString; o.toString()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js new file mode 100644 index 0000000..8e73acb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.2-3-n.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.2-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.toString()"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new String(); o.toString = Number.prototype.toString; o.toString()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js new file mode 100644 index 0000000..4896ba9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.2-4.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.2-4"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.toString()"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "3", "o = 3; o.toString = Number.prototype.toString; o.toString()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js new file mode 100644 index 0000000..341b347 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.3-1.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + +// the following two line causes navigator to crash -- cmb 9/16/97 + array[item++] = new TestCase("15.7.4.1", "Number.prototype.valueOf()", 0, "Number.prototype.valueOf()" ); + + array[item++] = new TestCase("15.7.4.1", "(new Number(1)).valueOf()", 1, "(new Number(1)).valueOf()" ); + array[item++] = new TestCase("15.7.4.1", "(new Number(-1)).valueOf()", -1, "(new Number(-1)).valueOf()" ); + array[item++] = new TestCase("15.7.4.1", "(new Number(0)).valueOf()", 0, "(new Number(0)).valueOf()" ); + array[item++] = new TestCase("15.7.4.1", "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, "(new Number(Number.POSITIVE_INFINITY)).valueOf()" ); + array[item++] = new TestCase("15.7.4.1", "(new Number(Number.NaN)).valueOf()", Number.NaN, "(new Number(Number.NaN)).valueOf()" ); + array[item++] = new TestCase("15.7.4.1", "(new Number()).valueOf()", 0, "(new Number()).valueOf()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js new file mode 100644 index 0000000..6b81da6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.3-2.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase(SECTION, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", 3, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js new file mode 100644 index 0000000..8905f25 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.3-3.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.7.4.3-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + +// array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()" ); + array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()", "error", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()" ); +// array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()" ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js new file mode 100644 index 0000000..fd62ad5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js @@ -0,0 +1,86 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.7.4.js + ECMA Section: 15.7.4 + + Description: + + The Number prototype object is itself a Number object (its [[Class]] is + "Number") whose value is +0. + + The value of the internal [[Prototype]] property of the Number prototype + object is the Object prototype object (15.2.3.1). + + In following descriptions of functions that are properties of the Number + prototype object, the phrase "this Number object" refers to the object + that is the this value for the invocation of the function; it is an error + if this does not refer to an object for which the value of the internal + [[Class]] property is "Number". Also, the phrase "this number value" refers + to the number value represented by this Number object, that is, the value + of the internal [[Value]] property of this Number object. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "15.7.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Number Prototype Object"; + + writeHeaderToLog( SECTION + " "+TITLE); + + var testcases = getTestCases(); + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()", + "[object Number]", + eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") ); + array[item++] = new TestCase( SECTION, "typeof Number.prototype", "object", typeof Number.prototype ); + array[item++] = new TestCase( SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); + + +// The __proto__ property cannot be used in ECMA_1 tests. +// array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ ); +// array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype ); + + + return ( array ); +} +function test( ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js new file mode 100644 index 0000000..cbc1783 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js @@ -0,0 +1,151 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.1.1.js + ECMA Section: 15.2.1.1 The Object Constructor Called as a Function: + Object(value) + Description: When Object is called as a function rather than as a + constructor, the following steps are taken: + + 1. If value is null or undefined, create and return a + new object with no properties other than internal + properties exactly as if the object constructor + had been called on that same value (15.2.2.1). + 2. Return ToObject (value), whose rules are: + + undefined generate a runtime error + null generate a runtime error + boolean create a new Boolean object whose default + value is the value of the boolean. + number Create a new Number object whose default + value is the value of the number. + string Create a new String object whose default + value is the value of the string. + object Return the input argument (no conversion). + + Author: christine@netscape.com + Date: 17 july 1997 +*/ + + var SECTION = "15.2.1.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object( value )"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var NULL_OBJECT = Object(null); + + array[item++] = new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) ); + array[item++] = new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ ); + + var UNDEFINED_OBJECT = Object( void 0 ); + + array[item++] = new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) ); + array[item++] = new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") ); +// array[item++] = new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += + ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js new file mode 100644 index 0000000..6a619b6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.1.2.js + ECMA Section: 15.2.1.2 The Object Constructor Called as a Function: + Object(value) + Description: When Object is called as a function rather than as a + constructor, the following steps are taken: + + 1. If value is null or undefined, create and return a + new object with no proerties other than internal + properties exactly as if the object constructor + had been called on that same value (15.2.2.1). + 2. Return ToObject (value), whose rules are: + + undefined generate a runtime error + null generate a runtime error + boolean create a new Boolean object whose default + value is the value of the boolean. + number Create a new Number object whose default + value is the value of the number. + string Create a new String object whose default + value is the value of the string. + object Return the input argument (no conversion). + + Author: christine@netscape.com + Date: 17 july 1997 +*/ + + var SECTION = "15.2.1.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MYOB = Object(); + + array[item++] = new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) ); + array[item++] = new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += + ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js new file mode 100644 index 0000000..cf04ce4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js @@ -0,0 +1,139 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.2.1.js + ECMA Section: 15.2.2.1 The Object Constructor: new Object( value ) + + 1.If the type of the value is not Object, go to step 4. + 2.If the value is a native ECMAScript object, do not create a new object; simply return value. + 3.If the value is a host object, then actions are taken and a result is returned in an + implementation-dependent manner that may depend on the host object. + 4.If the type of the value is String, return ToObject(value). + 5.If the type of the value is Boolean, return ToObject(value). + 6.If the type of the value is Number, return ToObject(value). + 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object. + The [[Prototype]] property of the newly constructed object is set to the Object prototype object. + The [[Class]] property of the newly constructed object is set to "Object". + The newly constructed object has no [[Value]] property. + Return the newly created native object. + + Description: This does not test cases where the object is a host object. + Author: christine@netscape.com + Date: 7 october 1997 +*/ + + var SECTION = "15.2.2.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Object( value )"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) ); + array[item++] = new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) ); + array[item++] = new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + + array[item++] = new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() ); + + array[item++] = new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) ); + array[item++] = new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); + array[item++] = new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() ); + + + var myglobal = this; + var myobject = new Object( "my new object" ); + var myarray = new Array(); + var myboolean = new Boolean(); + var mynumber = new Number(); + var mystring = new String(); + var myobject = new Object(); + var myfunction = new Function( "x", "return x"); + var mymath = Math; + + array[item++] = new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) ); + array[item++] = new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) ); + array[item++] = new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) ); + array[item++] = new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) ); + array[item++] = new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) ); + array[item++] = new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) ); + array[item++] = new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) ); + array[item++] = new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) ); + array[item++] = new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) ); + + return ( array ); +} +function test() { + for (tc = 0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js new file mode 100644 index 0000000..eddedfa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js @@ -0,0 +1,81 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.2.2.js + ECMA Section: 15.2.2.2 new Object() + Description: + + When the Object constructor is called with no argument, the following + step is taken: + + 1. Create a new native ECMAScript object. + The [[Prototype]] property of the newly constructed object is set to + the Object prototype object. + + The [[Class]] property of the newly constructed object is set + to "Object". + + The newly constructed object has no [[Value]] property. + + Return the newly created native object. + + Author: christine@netscape.com + Date: 7 october 1997 +*/ + var SECTION = "15.2.2.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "new Object()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() ); + array[item++] = new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() ); + array[item++] = new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() ); + + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = new Function( "return this.value+''" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js new file mode 100644 index 0000000..06f50ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.3-1.js + ECMA Section: 15.2.3 Properties of the Object Constructor + + Description: The value of the internal [[Prototype]] property of the + Object constructor is the Function prototype object. + + Besides the call and construct propreties and the length + property, the Object constructor has properties described + in 15.2.3.1. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.2.3"; + var VERSION = "ECMA_2"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Properties of the Object Constructor"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); + array[item++] = new TestCase( SECTION, "Object.length", 1, Object.length ); + + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js new file mode 100644 index 0000000..ee0539a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.3.1-1.js + ECMA Section: 15.2.3.1 Object.prototype + + Description: The initial value of Object.prototype is the built-in + Object prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete ReadOnly ] + + This tests the [DontEnum] property of Object.prototype + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.2.3.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "var str = '';for ( p in Object ) { str += p; }; str", + "", + eval( "var str = ''; for ( p in Object ) { str += p; }; str" ) + ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js new file mode 100644 index 0000000..fc2c735 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.3.1-2.js + ECMA Section: 15.2.3.1 Object.prototype + + Description: The initial value of Object.prototype is the built-in + Object prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete ReadOnly ] + + This tests the [DontDelete] property of Object.prototype + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.2.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete( Object.prototype )", + false, + "delete( Object.prototype )" + ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js new file mode 100644 index 0000000..eb3a79d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.3.1-3.js + ECMA Section: 15.2.3.1 Object.prototype + + Description: The initial value of Object.prototype is the built-in + Object prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete ReadOnly ] + + This tests the [ReadOnly] property of Object.prototype + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.2.3.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Object.prototype = null; Object.prototype", + Object.prototype, + "Object.prototype = null; Object.prototype" + ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js new file mode 100644 index 0000000..8a39d7e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.3.1-4.js + ECMA Section: 15.2.3.1 Object.prototype + + Description: The initial value of Object.prototype is the built-in + Object prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete ReadOnly ] + + This tests the [DontDelete] property of Object.prototype + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.2.3.1-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete( Object.prototype ); Object.prototype", + Object.prototype, + "delete(Object.prototype); Object.prototype" + ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js new file mode 100644 index 0000000..152add9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.3.js + ECMA Section: 15.2.3 Properties of the Object Constructor + + Description: The value of the internal [[Prototype]] property of the + Object constructor is the Function prototype object. + + Besides the call and construct propreties and the length + property, the Object constructor has properties described + in 15.2.3.1. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.2.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Object Constructor"; + + writeHeaderToLog( SECTION + " " + TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + +// array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); + array[item++] = new TestCase( SECTION, "Object.length", 1, Object.length ); + + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js new file mode 100644 index 0000000..61f2898 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js @@ -0,0 +1,63 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.4.1.js + ECMA Section: 15.2.4 Object.prototype.constructor + + Description: The initial value of the Object.prototype.constructor + is the built-in Object constructor. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.2.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype.constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Object.prototype.constructor", + Object, + Object.prototype.constructor + ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js new file mode 100644 index 0000000..40eca1b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js @@ -0,0 +1,128 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.4.2.js + ECMA Section: 15.2.4.2 Object.prototype.toString() + + Description: When the toString method is called, the following + steps are taken: + 1. Get the [[Class]] property of this object + 2. Call ToString( Result(1) ) + 3. Compute a string value by concatenating the three + strings "[object " + Result(2) + "]" + 4. Return Result(3). + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.2.4.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype.toString()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() ); + + array[item++] = new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()", + GLOBAL, + eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Function]", + eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()", + '[object Object]', + eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Number]", + eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()", + "[object String]", + eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Math]", + eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Function]", + eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Array]", + eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Boolean]", + eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()", + "[object Date]", + eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") ); + + array[item++] = new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()", + GLOBAL, + eval("var MYVAR = new Object( this ); MYVAR.toString()") ); + + array[item++] = new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()", + "[object Object]", + eval("var MYVAR = new Object(); MYVAR.toString()") ); + + array[item++] = new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()", + "[object Object]", + eval("var MYVAR = new Object(void 0); MYVAR.toString()") ); + + array[item++] = new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()", + "[object Object]", + eval("var MYVAR = new Object(null); MYVAR.toString()") ); + + return ( array ); +} +function test( array ) { + for ( tc=0 ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function MyObject( value ) { + this.value = new Function( "return this.value" ); + this.toString = new Function ( "return this.value+''"); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js new file mode 100644 index 0000000..1daf04a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js @@ -0,0 +1,115 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.4.3.js + ECMA Section: 15.2.4.3 Object.prototype.valueOf() + + Description: As a rule, the valueOf method for an object simply + returns the object; but if the object is a "wrapper" + for a host object, as may perhaps be created by the + Object constructor, then the contained host object + should be returned. + + This only covers native objects. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.2.4.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Object.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var myarray = new Array(); + myarray.valueOf = Object.prototype.valueOf; + var myboolean = new Boolean(); + myboolean.valueOf = Object.prototype.valueOf; + var myfunction = new Function(); + myfunction.valueOf = Object.prototype.valueOf; + var myobject = new Object(); + myobject.valueOf = Object.prototype.valueOf; + var mymath = Math; + mymath.valueOf = Object.prototype.valueOf; + var mydate = new Date(); + mydate.valueOf = Object.prototype.valueOf; + var mynumber = new Number(); + mynumber.valueOf = Object.prototype.valueOf; + var mystring = new String(); + mystring.valueOf = Object.prototype.valueOf; + + array[item++] = new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length ); + + array[item++] = new TestCase( SECTION, + "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()", + myarray, + myarray.valueOf() ); + array[item++] = new TestCase( SECTION, + "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()", + myboolean, + myboolean.valueOf() ); + array[item++] = new TestCase( SECTION, + "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()", + myfunction, + myfunction.valueOf() ); + array[item++] = new TestCase( SECTION, + "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()", + myobject, + myobject.valueOf() ); + array[item++] = new TestCase( SECTION, + "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()", + mymath, + mymath.valueOf() ); + array[item++] = new TestCase( SECTION, + "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()", + mynumber, + mynumber.valueOf() ); + array[item++] = new TestCase( SECTION, + "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()", + mystring, + mystring.valueOf() ); + array[item++] = new TestCase( SECTION, + "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()", + mydate, + mydate.valueOf() ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js new file mode 100644 index 0000000..5a018c0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js @@ -0,0 +1,60 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.2.4.js + ECMA Section: 15.2.4 Properties of the Object prototype object + + Description: The value of the internal [[Prototype]] property of + the Object prototype object is null + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + + var SECTION = "15.2.4"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "Properties of the Object.prototype object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + testcases[tc++] = new TestCase( SECTION, "Object.prototype.__proto__", + null, + Object.prototype.__proto__ + ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js new file mode 100644 index 0000000..759402b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js @@ -0,0 +1,124 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 6-1.js + ECMA Section: Source Text + Description: + + ECMAScript source text is represented as a sequence of characters + representable using the Unicode version 2.0 character encoding. + + SourceCharacter :: + any Unicode character + + However, it is possible to represent every ECMAScript program using + only ASCII characters (which are equivalent to the first 128 Unicode + characters). Non-ASCII Unicode characters may appear only within comments + and string literals. In string literals, any Unicode character may also be + expressed as a Unicode escape sequence consisting of six ASCII characters, + namely \u plus four hexadecimal digits. Within a comment, such an escape + sequence is effectively ignored as part of the comment. Within a string + literal, the Unicode escape sequence contributes one character to the string + value of the literal. + + Note that ECMAScript differs from the Java programming language in the + behavior of Unicode escape sequences. In a Java program, if the Unicode escape + sequence \u000A, for example, occurs within a single-line comment, it is + interpreted as a line terminator (Unicode character 000A is line feed) and + therefore the next character is not part of the comment. Similarly, if the + Unicode escape sequence \u000A occurs within a string literal in a Java + program, it is likewise interpreted as a line terminator, which is not + allowed within a string literal-one must write \n instead of \u000A to + cause a line feed to be part of the string value of a string literal. In + an ECMAScript program, a Unicode escape sequence occurring within a comment + is never interpreted and therefore cannot contribute to termination of the + comment. Similarly, a Unicode escape sequence occurring within a string literal + in an ECMAScript program always contributes a character to the string value of + the literal and is never interpreted as a line terminator or as a quote mark + that might terminate the string literal. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "6-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Source Text"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc] = new TestCase( SECTION, + "// the following character should not be interpreted as a line terminator in a comment: \u000A", + 'PASSED', + "PASSED" ); + + // \u000A testcases[tc].actual = "FAILED!"; + + tc++; + + testcases[tc] = new TestCase( SECTION, + "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'", + 'PASSED', + 'PASSED' ); + + // the following character should noy be interpreted as a line terminator: \\n testcases[tc].actual = "FAILED" + + tc++; + + testcases[tc] = new TestCase( SECTION, + "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'", + 'PASSED', + 'PASSED' ) + + // the following character should not be interpreted as a line terminator: \u000A testcases[tc].actual = "FAILED" + + testcases[tc++] = new TestCase( SECTION, + "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'", + 'PASSED', + 'PASSED' ) + // the following character should not be interpreted as a line terminator: \n testcases[tc].actual = 'FAILED' + + testcases[tc] = new TestCase( SECTION, + "// the following character should not be interpreted as a line terminator in a comment: u000D", + 'PASSED', + 'PASSED' ) + + // the following character should not be interpreted as a line terminator: \u000D testcases[tc].actual = "FAILED" + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js new file mode 100644 index 0000000..9e7c7f9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js @@ -0,0 +1,129 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 6-1.js + ECMA Section: Source Text + Description: + + ECMAScript source text is represented as a sequence of characters + representable using the Unicode version 2.0 character encoding. + + SourceCharacter :: + any Unicode character + + However, it is possible to represent every ECMAScript program using + only ASCII characters (which are equivalent to the first 128 Unicode + characters). Non-ASCII Unicode characters may appear only within comments + and string literals. In string literals, any Unicode character may also be + expressed as a Unicode escape sequence consisting of six ASCII characters, + namely \u plus four hexadecimal digits. Within a comment, such an escape + sequence is effectively ignored as part of the comment. Within a string + literal, the Unicode escape sequence contributes one character to the string + value of the literal. + + Note that ECMAScript differs from the Java programming language in the + behavior of Unicode escape sequences. In a Java program, if the Unicode escape + sequence \u000A, for example, occurs within a single-line comment, it is + interpreted as a line terminator (Unicode character 000A is line feed) and + therefore the next character is not part of the comment. Similarly, if the + Unicode escape sequence \u000A occurs within a string literal in a Java + program, it is likewise interpreted as a line terminator, which is not + allowed within a string literal-one must write \n instead of \u000A to + cause a line feed to be part of the string value of a string literal. In + an ECMAScript program, a Unicode escape sequence occurring within a comment + is never interpreted and therefore cannot contribute to termination of the + comment. Similarly, a Unicode escape sequence occurring within a string literal + in an ECMAScript program always contributes a character to the string value of + the literal and is never interpreted as a line terminator or as a quote mark + that might terminate the string literal. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "6-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Source Text"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // encoded quotes should not end a quote + + testcases[tc++]= new TestCase( SECTION, + "var s = 'PAS\\u0022SED'; s", + "PAS\"SED", + eval("var s = 'PAS\\u0022SED'; s") ); + + testcases[tc++]= new TestCase( SECTION, + 'var s = "PAS\\u0022SED"; s', + "PAS\"SED", + eval('var s = "PAS\\u0022SED"; s') ); + + + testcases[tc++]= new TestCase( SECTION, + "var s = 'PAS\\u0027SED'; s", + "PAS\'SED", + eval("var s = 'PAS\\u0027SED'; s") ); + + + testcases[tc++]= new TestCase( SECTION, + 'var s = "PAS\\u0027SED"; s', + "PAS\'SED", + eval('var s = "PAS\\u0027SED"; s') ); + + testcases[tc] = new TestCase( SECTION, + 'var s="PAS\\u0027SED"; s', + "PAS\'SED", + "" ) + var s = "PAS\u0027SED"; + + testcases[tc].actual = s; + + tc++; + + testcases[tc]= new TestCase( SECTION, + 'var s = "PAS\\u0027SED"; s', + "PAS\"SED", + "" ); + var s = "PAS\u0022SED"; + + testcases[tc].actual = s; + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js new file mode 100644 index 0000000..cf33b0a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js @@ -0,0 +1,151 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.10-1.js + ECMA Section: 12.10 The with statement + Description: + WithStatement : + with ( Expression ) Statement + + The with statement adds a computed object to the front of the scope chain + of the current execution context, then executes a statement with this + augmented scope chain, then restores the scope chain. + + Semantics + + The production WithStatement : with ( Expression ) Statement is evaluated + as follows: + 1. Evaluate Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Add Result(3) to the front of the scope chain. + 5. Evaluate Statement using the augmented scope chain from step 4. + 6. Remove Result(3) from the front of the scope chain. + 7. Return Result(5). + + Discussion + Note that no matter how control leaves the embedded Statement, whether + normally or by some form of abrupt completion, the scope chain is always + restored to its former state. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "12.10-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The with statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // although the scope chain changes, the this value is immutable for a given + // execution context. + + array[item++] = new TestCase( SECTION, + "with( new Number() ) { this +'' }", + "[object global]", + eval("with( new Number() ) { this +'' }") ); + + // the object's functions and properties should override those of the + // global object. + + array[item++] = new TestCase( + SECTION, + "var MYOB = new WithObject(true); with (MYOB) { parseInt() }", + true, + eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") ); + + array[item++] = new TestCase( + SECTION, + "var MYOB = new WithObject(false); with (MYOB) { NaN }", + false, + eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") ); + + array[item++] = new TestCase( + SECTION, + "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }", + Number.NaN, + eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") ); + + array[item++] = new TestCase( + SECTION, + "var MYOB = new WithObject(false); with (MYOB) { }; Infinity", + Number.POSITIVE_INFINITY, + eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") ); + + + array[item++] = new TestCase( + SECTION, + "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }", + Number.POSITIVE_INFINITY, + eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") ); + + // let us leave the with block via a break. + + array[item++] = new TestCase( + SECTION, + "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity", + Number.POSITIVE_INFINITY, + eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") ); + + return ( array ); +} +function WithObject( value ) { + this.prop1 = 1; + this.prop2 = new Boolean(true); + this.prop3 = "a string"; + this.value = value; + + // now we will override global functions + + this.parseInt = new Function( "return this.value" ); + this.NaN = value; + this.Infinity = value; + this.unescape = new Function( "return this.value" ); + this.escape = new Function( "return this.value" ); + this.eval = new Function( "return this.value" ); + this.parseFloat = new Function( "return this.value" ); + this.isNaN = new Function( "return this.value" ); + this.isFinite = new Function( "return this.value" ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js new file mode 100644 index 0000000..08e8ebc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.10-1.js + ECMA Section: 12.10 The with statement + Description: + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.10-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The with statement"; + + var testcases = getTestCases(); + + writeHeaderToLog( SECTION +" "+ TITLE); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var x; with (7) x = valueOf(); typeof x;", + "number", + eval("var x; with(7) x = valueOf(); typeof x;") ); + return ( array ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js new file mode 100644 index 0000000..44f64b8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.2-1.js + ECMA Section: The variable statement + Description: + + If the variable statement occurs inside a FunctionDeclaration, the + variables are defined with function-local scope in that function, as + described in section 10.1.3. Otherwise, they are defined with global + scope, that is, they are created as members of the global object, as + described in section 0. Variables are created when the execution scope + is entered. A Block does not define a new execution scope. Only Program and + FunctionDeclaration produce a new scope. Variables are initialized to the + undefined value when created. A variable with an Initializer is assigned + the value of its AssignmentExpression when the VariableStatement is executed, + not when the variable is created. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "12.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The variable statement"; + + writeHeaderToLog( SECTION +" "+ TITLE); + + var testcases = new Array(); + + testcases[tc] = new TestCase( "SECTION", + "var x = 3; function f() { var a = x; var x = 23; return a; }; f()", + void 0, + eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js new file mode 100644 index 0000000..b0fe400 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.5-1.js + ECMA Section: The if statement + Description: + + The production IfStatement : if ( Expression ) Statement else Statement + is evaluated as follows: + + 1.Evaluate Expression. + 2.Call GetValue(Result(1)). + 3.Call ToBoolean(Result(2)). + 4.If Result(3) is false, go to step 7. + 5.Evaluate the first Statement. + 6.Return Result(5). + 7.Evaluate the second Statement. + 8.Return Result(7). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + + var SECTION = "12.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The if statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';", + "PASSED", + eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';", + "PASSED", + eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';", + "PASSED", + eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';", + "PASSED", + eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';", + "PASSED", + eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';", + "PASSED", + eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js new file mode 100644 index 0000000..9b30bfd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.5-2.js + ECMA Section: The if statement + Description: + + The production IfStatement : if ( Expression ) Statement else Statement + is evaluated as follows: + + 1.Evaluate Expression. + 2.Call GetValue(Result(1)). + 3.Call ToBoolean(Result(2)). + 4.If Result(3) is false, go to step 7. + 5.Evaluate the first Statement. + 6.Return Result(5). + 7.Evaluate the second Statement. + 8.Return Result(7). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "12.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The if statement" ; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR", + "PASSED", + eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;", + "PASSED", + eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR", + "PASSED", + eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR", + "PASSED", + eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR", + "PASSED", + eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") ); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;", + "PASSED", + eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js new file mode 100644 index 0000000..0b43603 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.1-1.js + ECMA Section: The while statement + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "12.6.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The While statement"; + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ", + 1, + eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ")); + + testcases[tc++] = new TestCase( SECTION, + "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ", + 100, + eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ")); + + testcases[tc++] = new TestCase( SECTION, + "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)", + 2, + eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)")); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js new file mode 100644 index 0000000..387cf14 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-1.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is not present + 3. third expression is not present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "12.6.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + array[0] = new TestCase( "12.6.2-1", "for statement", 99, "" ); + return ( array ); +} + +function testprogram() { + myVar = 0; + + for ( ; ; ) { + if ( ++myVar == 99 ) + break; + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + + stopTest(); + + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js new file mode 100644 index 0000000..788a5d0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-2.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is not present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "12.6.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + array[0] = new TestCase( SECTION, "for statement", 99, "" ); + return ( array ); +} + +function testprogram() { + myVar = 0; + + for ( ; ; myVar++ ) { + if ( myVar < 99 ) { + continue; + } else { + break; + } + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js new file mode 100644 index 0000000..706f224 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-3.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "12.6.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + testcases[0] = new TestCase( SECTION, "for statement", 100, "" ); + + test(); + +function testprogram() { + myVar = 0; + + for ( ; myVar < 100 ; myVar++ ) { + continue; + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + stopTest(); + + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js new file mode 100644 index 0000000..887dea4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-4.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "12.6.2-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[testcases.length] = new TestCase( SECTION, + "for statement", 100, testprogram() ); + + test(); + +function testprogram() { + myVar = 0; + + for ( ; myVar < 100 ; myVar++ ) { + } + + return myVar; +} +function test() { + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js new file mode 100644 index 0000000..3404ecf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-5.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "12.6.2-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + array[0] = new TestCase( SECTION, "for statement", 99, "" ); + return ( array ); +} + +function testprogram() { + myVar = 0; + + for ( ; myVar < 100 ; myVar++ ) { + if (myVar == 99) + break; + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js new file mode 100644 index 0000000..1ed50d8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-6.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is present. + 2. second expression is not present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "12.6.2-6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + array[0] = new TestCase( "12.6.2-6", "for statement", 256, "" ); + return ( array ); +} + +function testprogram() { + var myVar; + + for ( myVar=2; ; myVar *= myVar ) { + + if (myVar > 100) + break; + continue; + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js new file mode 100644 index 0000000..ec9f246 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-7.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is present. + 2. second expression is not present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "12.6.2-7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + array[0] = new TestCase( SECTION, "for statement", 256, "" ); + return ( array ); +} + +function testprogram() { + var myVar; + + for ( myVar=2; myVar < 100 ; myVar *= myVar ) { + + continue; + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js new file mode 100644 index 0000000..ecabc06 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-8.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is present. + 2. second expression is present + 3. third expression is present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "12.6.2-8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + array[0] = new TestCase( SECTION, "for statement", 256, "" ); + return ( array ); +} +function testprogram() { + var myVar; + + for ( myVar=2; myVar < 256; myVar *= myVar ) { + } + + return myVar; +} +function test() { + testcases[0].actual = testprogram(); + + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js new file mode 100644 index 0000000..ef7c12e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.2-9-n.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is not present + 3. third expression is not present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + + var SECTION = "12.6.2-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[testcases.length] = new TestCase( SECTION, + "for (i)", + "error", + "" ); + + for (i) { + } + + test(); + +function test() { + testcases[0].passed = writeTestCaseResult( + testcases[0].expect, + testcases[0].actual, + testcases[0].description +" = "+ testcases[0].actual ); + + testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value "; + + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js new file mode 100644 index 0000000..9b2aa2b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + + var SECTION = "12.6.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x", + "foo", + eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") ); + + return ( array ); +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject(a, b, c, d, e) { + + +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js new file mode 100644 index 0000000..f2f042b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js @@ -0,0 +1,112 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-10.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + var count = 0; + function f() { count++; return new Array("h","e","l","l","o"); } + + var result = ""; + for ( p in f() ) { result += f()[p] }; + + testcases[testcases.length] = new TestCase( SECTION, + "count = 0; result = \"\"; "+ + "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+ + "for ( p in f() ) { result += f()[p] }; count", + 6, + count ); + + testcases[testcases.length] = new TestCase( SECTION, + "result", + "hello", + result ); + + // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] + // LeftHandSideExpression:NewExpression:MemberExpression . Identifier + // LeftHandSideExpression:NewExpression:new MemberExpression Arguments + // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) + // LeftHandSideExpression:CallExpression:MemberExpression Arguments + // LeftHandSideExpression:CallExpression Arguments + // LeftHandSideExpression:CallExpression [ Expression ] + // LeftHandSideExpression:CallExpression . Identifier + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js new file mode 100644 index 0000000..579845a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js @@ -0,0 +1,93 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-11.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +// 5. Get the name of the next property of Result(3) that doesn't have the +// DontEnum attribute. If there is no such property, go to step 14. + + var result = ""; + + for ( p in Number ) { result += String(p) }; + + testcases[testcases.length] = new TestCase( SECTION, + "result = \"\"; for ( p in Number ) { result += String(p) };", + "", + result ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js new file mode 100644 index 0000000..b5c4b18 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-12.js + ECMA Section: 12.6.3 The for...in Statement + Description: + + This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802. + + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var result = "PASSED"; + + for ( aVar in this ) { + if (aVar == "aVar") { + result = "FAILED" + } + }; + + testcases[testcases.length] = new TestCase( + SECTION, + "var result=''; for ( aVar in this ) { " + + "if (aVar == 'aVar') {return a failure}; result", + "PASSED", + result ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js new file mode 100644 index 0000000..4f386d8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js @@ -0,0 +1,114 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + var count = 0; + function f() { count++; return new Array("h","e","l","l","o"); } + + var result = ""; + for ( p in f() ) { result += f()[p] }; + + testcases[testcases.length] = new TestCase( SECTION, + "count = 0; result = \"\"; "+ + "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+ + "for ( p in f() ) { result += f()[p] }; count", + 6, + count ); + + testcases[testcases.length] = new TestCase( SECTION, + "result", + "hello", + result ); + + + + // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] + // LeftHandSideExpression:NewExpression:MemberExpression . Identifier + // LeftHandSideExpression:NewExpression:new MemberExpression Arguments + // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) + // LeftHandSideExpression:CallExpression:MemberExpression Arguments + // LeftHandSideExpression:CallExpression Arguments + // LeftHandSideExpression:CallExpression [ Expression ] + // LeftHandSideExpression:CallExpression . Identifier + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js new file mode 100644 index 0000000..f025a09 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-2.js + ECMA Section: 12.6.3 The for...in Statement + Description: Check the Boolean Object + + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + + var SECTION = "12.6.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]", + 34, + eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js new file mode 100644 index 0000000..32cce34 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-3.js + ECMA Section: for..in loops + Description: + + This verifies the fix to + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156 + for..in should take general lvalue for first argument + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "12.6.3-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var o = {}; + + var result = ""; + + for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } + + testcases[testcases.length] = new TestCase( SECTION, + "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result", + "123", + result ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js new file mode 100644 index 0000000..d0876b6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js @@ -0,0 +1,193 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + var o = new MyObject(); + var result = 0; + + for ( MyObject in o ) { + result += o[MyObject]; + } + + testcases[testcases.length] = new TestCase( SECTION, + "for ( MyObject in o ) { result += o[MyObject] }", + 6, + result ); + + var result = 0; + + for ( value in o ) { + result += o[value]; + } + + testcases[testcases.length] = new TestCase( SECTION, + "for ( value in o ) { result += o[value]", + 6, + result ); + + var value = "value"; + var result = 0; + for ( value in o ) { + result += o[value]; + } + + testcases[testcases.length] = new TestCase( SECTION, + "value = \"value\"; for ( value in o ) { result += o[value]", + 6, + result ); + + var value = 0; + var result = 0; + for ( value in o ) { + result += o[value]; + } + + testcases[testcases.length] = new TestCase( SECTION, + "value = 0; for ( value in o ) { result += o[value]", + 6, + result ); + + // this causes a segv + + var ob = { 0:"hello" }; + var result = 0; + for ( ob[0] in o ) { + result += o[ob[0]]; + } + testcases[testcases.length] = new TestCase( SECTION, + "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]", + 6, + result ); + + var result = 0; + for ( ob["0"] in o ) { + result += o[ob["0"]]; + } + testcases[testcases.length] = new TestCase( SECTION, + "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]", + 6, + result ); + + var result = 0; + var ob = { value:"hello" }; + for ( ob[value] in o ) { + result += o[ob[value]]; + } + testcases[testcases.length] = new TestCase( SECTION, + "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]", + 6, + result ); + + var result = 0; + for ( ob["value"] in o ) { + result += o[ob["value"]]; + } + testcases[testcases.length] = new TestCase( SECTION, + "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]", + 6, + result ); + + var result = 0; + for ( ob.value in o ) { + result += o[ob.value]; + } + testcases[testcases.length] = new TestCase( SECTION, + "value = 0; for ( ob.value in o ) { result += o[ob.value]", + 6, + result ); + + // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] + // LeftHandSideExpression:NewExpression:MemberExpression . Identifier + // LeftHandSideExpression:NewExpression:new MemberExpression Arguments + // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) + // LeftHandSideExpression:CallExpression:MemberExpression Arguments + // LeftHandSideExpression:CallExpression Arguments + // LeftHandSideExpression:CallExpression [ Expression ] + // LeftHandSideExpression:CallExpression . Identifier + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js new file mode 100644 index 0000000..1fb4ce5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + var error = err; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + testcases[testcases.length] = new TestCase( SECTION, + "more than one member expression", + "error", + "" ); + + var o = new MyObject(); + var result = 0; + + for ( var i, p in this) { + result += this[p]; + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js new file mode 100644 index 0000000..bd6bb1b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + var error = err; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + testcases[testcases.length] = new TestCase( SECTION, + "bad left-hand side expression", + "error", + "" ); + + var o = new MyObject(); + var result = 0; + + for ( this in o) { + result += this[p]; + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js new file mode 100644 index 0000000..5dfad13 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + var error = err; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + testcases[testcases.length] = new TestCase( SECTION, + "bad left-hand side expression", + "error", + "" ); + + var o = new MyObject(); + var result = 0; + + for ( "a" in o) { + result += this[p]; + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js new file mode 100644 index 0000000..ac93487 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-8-n.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + var error = err; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + testcases[testcases.length] = new TestCase( SECTION, + "bad left-hand side expression", + "error", + "" ); + + var o = new MyObject(); + var result = 0; + + for ( 1 in o) { + result += this[p]; + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js new file mode 100644 index 0000000..06000a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.6.3-9-n.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "12.6.3-9-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The for..in statment"; + var error = err; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // for ( LeftHandSideExpression in Expression ) + // LeftHandSideExpression:NewExpression:MemberExpression + + testcases[testcases.length] = new TestCase( SECTION, + "object is not defined", + "error", + "" ); + + var o = new MyObject(); + var result = 0; + + for ( var o in foo) { + result += this[o]; + } + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js new file mode 100644 index 0000000..b9b13e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.7-1-n.js + ECMA Section: 12.7 The continue statement + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "12.7.1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The continue statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "continue", + "error", + "continue" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js new file mode 100644 index 0000000..9594a73 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.8-1-n.js + ECMA Section: 12.8 The break statement + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "12.8-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The break in statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "break", + "error", + "break" ); + + return ( array ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js new file mode 100644 index 0000000..c0383c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js @@ -0,0 +1,64 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 12.9-1-n.js + ECMA Section: 12.9 The return statement + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "12.9-1-n"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " The return statement"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "return", + "error", + "return" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js new file mode 100644 index 0000000..7971afe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js @@ -0,0 +1,137 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.1.js + ECMA Section: 15.5.1 The String Constructor called as a Function + 15.5.1.1 String(value) + 15.5.1.2 String() + + Description: + When String is called as a function rather than as + a constructor, it performs a type conversion. + - String(value) returns a string value (not a String + object) computed by ToString(value) + - String() returns the empty string "" + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The String Constructor Called as a Function"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') ); + array[item++] = new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) ); + array[item++] = new TestCase( SECTION, "String(null)", "null", String( null ) ); + array[item++] = new TestCase( SECTION, "String(true)", "true", String( true) ); + array[item++] = new TestCase( SECTION, "String(false)", "false", String( false ) ); + array[item++] = new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) ); + array[item++] = new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) ); + array[item++] = new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) ); + array[item++] = new TestCase( SECTION, "String(new Array())", "", String( new Array()) ); + array[item++] = new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) ); + + + array[item++] = new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) ); + array[item++] = new TestCase( SECTION, "String( 0 )", "0", String( 0 ) ); + array[item++] = new TestCase( SECTION, "String( -0 )", "0", String( -0 ) ); + array[item++] = new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) ); + + // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21 + + array[item++] = new TestCase( SECTION, "String( 1 )", "1", String( 1 ) ); + array[item++] = new TestCase( SECTION, "String( 10 )", "10", String( 10 ) ); + array[item++] = new TestCase( SECTION, "String( 100 )", "100", String( 100 ) ); + array[item++] = new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) ); + array[item++] = new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) ); + array[item++] = new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) ); + array[item++] = new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) ); + array[item++] = new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) ); + + array[item++] = new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) ); + array[item++] = new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) ); + + array[item++] = new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) ); + array[item++] = new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) ); + array[item++] = new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) ); + array[item++] = new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) ); + array[item++] = new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) ); + array[item++] = new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) ); + array[item++] = new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) ); + array[item++] = new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) ); + + array[item++] = new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) ); + array[item++] = new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) ); + + // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21, + array[item++] = new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) ); + + + // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0 + + // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6 + + array[item++] = new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) ); + array[item++] = new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) ); + + // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6 + array[item++] = new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345)); + array[item++] = new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 )); + + array[item++] = new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) ); + array[item++] = new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) ); + array[item++] = new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) ); + array[item++] = new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) ); + array[item++] = new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) ); + array[item++] = new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) ); + array[item++] = new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345)); + + array[item++] = new TestCase( "15.5.2", "String()", "", String() ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js new file mode 100644 index 0000000..59daad0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js @@ -0,0 +1,112 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.2.js + ECMA Section: 15.5.2 The String Constructor + 15.5.2.1 new String(value) + 15.5.2.2 new String() + + Description: When String is called as part of a new expression, it + is a constructor; it initializes the newly constructed + object. + + - The prototype property of the newly constructed + object is set to the original String prototype object, + the one that is the intial value of String.prototype + - The internal [[Class]] property of the object is "String" + - The value of the object is ToString(value). + - If no value is specified, its value is the empty string. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The String Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring ); + + array[item++] = new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString ); + + array[item++] = new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf ); + + array[item++] = new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt ); + + array[item++] = new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt ); + + array[item++] = new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf ); + + array[item++] = new TestCase( SECTION, "typeof new String()", "object", typeof new String() ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf ); + + array[item++] = new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') ); + array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js new file mode 100644 index 0000000..af15536 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.1-1.js + ECMA Section: 15.5.3.1 Properties of the String Constructor + + Description: The initial value of String.prototype is the built-in + String prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete, ReadOnly] + + This tests the DontEnum attribute. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.3.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the String Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length ); + + array[item++] = new TestCase( SECTION, + "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str", + "", + eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js new file mode 100644 index 0000000..d4d7fa3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.1-2.js + ECMA Section: 15.5.3.1 Properties of the String Constructor + + Description: The initial value of String.prototype is the built-in + String prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete, ReadOnly] + + This tests the ReadOnly attribute. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the String Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "String.prototype=null;String.prototype", + String.prototype, + eval("String.prototype=null;String.prototype") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js new file mode 100644 index 0000000..01da54a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.1-3.js + ECMA Section: 15.5.3.1 Properties of the String Constructor + + Description: The initial value of String.prototype is the built-in + String prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete, ReadOnly] + + This tests the DontDelete attribute. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.3.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the String Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js new file mode 100644 index 0000000..fbaea31 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.1-4.js + ECMA Section: 15.5.3.1 Properties of the String Constructor + + Description: The initial value of String.prototype is the built-in + String prototype object. + + This property shall have the attributes [ DontEnum, + DontDelete, ReadOnly] + + This tests the DontDelete attribute. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.3.1-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the String Constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js new file mode 100644 index 0000000..f5fb16d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js @@ -0,0 +1,195 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.2-1.js + ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) + Description: Return a string value containing as many characters + as the number of arguments. Each argument specifies + one character of the resulting string, with the first + argument specifying the first character, and so on, + from left to right. An argument is converted to a + character by applying the operation ToUint16 and + regarding the resulting 16bit integeras the Unicode + encoding of a character. If no arguments are supplied, + the result is the empty string. + + This test covers Basic Latin (range U+0020 - U+007F) + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + + var SECTION = "15.5.3.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.fromCharCode()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode ); + array[item++] = new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode ); + array[item++] = new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") ); + array[item++] = new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) ); + + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) ); + array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) ); +// array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) ); + + return array; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js new file mode 100644 index 0000000..4ff3693 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.2-2.js + ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) + Description: Return a string value containing as many characters + as the number of arguments. Each argument specifies + one character of the resulting string, with the first + argument specifying the first character, and so on, + from left to right. An argument is converted to a + character by applying the operation ToUint16 and + regarding the resulting 16bit integeras the Unicode + encoding of a character. If no arguments are supplied, + the result is the empty string. + + This tests String.fromCharCode with multiple arguments. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + + var SECTION = "15.5.3.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.fromCharCode()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING", + " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" )); + + array[item++] = new TestCase( SECTION, + "MYSTRING.length", + 0x007f - 0x0020, + MYSTRING.length ); + return array; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js new file mode 100644 index 0000000..e6b515e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.2-1.js + ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) + Description: Return a string value containing as many characters + as the number of arguments. Each argument specifies + one character of the resulting string, with the first + argument specifying the first character, and so on, + from left to right. An argument is converted to a + character by applying the operation ToUint16 and + regarding the resulting 16bit integeras the Unicode + encoding of a character. If no arguments are supplied, + the result is the empty string. + + This test covers Basic Latin (range U+0020 - U+007F) + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + + var SECTION = "15.5.3.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.fromCharCode()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", + ToUint16(CHARCODE), + (String.fromCharCode(CHARCODE)).charCodeAt(0) + ); + } + for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", + ToUint16(CHARCODE), + (String.fromCharCode(CHARCODE)).charCodeAt(0) + ); + } + for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", + ToUint16(CHARCODE), + (String.fromCharCode(CHARCODE)).charCodeAt(0) + ); + } + for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", + ToUint16(CHARCODE), + (String.fromCharCode(CHARCODE)).charCodeAt(0) + ); + } + for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", + ToUint16(CHARCODE), + (String.fromCharCode(CHARCODE)).charCodeAt(0) + ); + } + array[item++] = new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) ); + + return array; +} +function ToUint16( num ) { + num = Number( num ); + if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) { + return 0; + } + + var sign = ( num < 0 ) ? -1 : 1; + + num = sign * Math.floor( Math.abs( num ) ); + num = num % Math.pow(2,16); + num = ( num > -65536 && num < 0) ? 65536 + num : num; + return num; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js new file mode 100644 index 0000000..3a1012d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.3.1.js + ECMA Section: 15.5.3 Properties of the String Constructor + + Description: The value of the internal [[Prototype]] property of + the String constructor is the Function prototype + object. + + In addition to the internal [[Call]] and [[Construct]] + properties, the String constructor also has the length + property, as well as properties described in 15.5.3.1 + and 15.5.3.2. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.3"; + var VERSION = "ECMA_2"; + startTest(); + var passed = true; + writeHeaderToLog( SECTION + " Properties of the String Constructor" ); + + var testcases = getTestCases(); + var tc= 0; + +// all tests must call a function that returns an array of TestCase objects. + test( testcases ); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ ); + array[item++] = new TestCase( SECTION, "String.length", 1, String.length ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js new file mode 100644 index 0000000..393f25a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.1.js + ECMA Section: 15.5.4.1 String.prototype.constructor + + Description: + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.5.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.constructor"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String ); + array[item++] = new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()", + "[object String]", + eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") ); + return ( array ); +} +function test( array ) { + for ( ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js new file mode 100644 index 0000000..454afef --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js @@ -0,0 +1,218 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.10-1.js + ECMA Section: 15.5.4.10 String.prototype.substring( start, end ) + Description: + + 15.5.4.10 String.prototype.substring(start, end) + + Returns a substring of the result of converting this object to a string, + starting from character position start and running to character position + end of the string. The result is a string value, not a String object. + + If either argument is NaN or negative, it is replaced with zero; if either + argument is larger than the length of the string, it is replaced with the + length of the string. + + If start is larger than end, they are swapped. + + When the substring method is called with two arguments start and end, the + following steps are taken: + + 1. Call ToString, giving it the this value as its argument. + 2. Call ToInteger(start). + 3. Call ToInteger (end). + 4. Compute the number of characters in Result(1). + 5. Compute min(max(Result(2), 0), Result(4)). + 6. Compute min(max(Result(3), 0), Result(4)). + 7. Compute min(Result(5), Result(6)). + 8. Compute max(Result(5), Result(6)). + 9. Return a string whose length is the difference between Result(8) and + Result(7), containing characters from Result(1), namely the characters + with indices Result(7) through Result(8)1, in ascending order. + + Note that the substring function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.10-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.substring( start, end )"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") ); + + // test cases for when substring is called with no arguments. + + // this is a string object + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); typeof s.substring()", + "string", + eval("var s = new String('this is a string object'); typeof s.substring()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(''); s.substring(1,0)", + "", + eval("var s = new String(''); s.substring(1,0)") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(true, false)", + "t", + eval("var s = new String('this is a string object'); s.substring(false, true)") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(NaN, Infinity)", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(Infinity, NaN)", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(Infinity, Infinity)", + "", + eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(-0.01, 0)", + "", + eval("var s = new String('this is a string object'); s.substring(-0.01,0)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(s.length, s.length)", + "", + eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(s.length+1, 0)", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)", + "", + eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") ); + + // this is not a String object, start is not an integer + + + array[item++] = new TestCase( SECTION, + "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)", + "1,2,3,4,5", + eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") ); + + array[item++] = new TestCase( SECTION, + "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)", + "1", + eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") ); + + array[item++] = new TestCase( SECTION, + "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')", + "3", + eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") ); + + + // this is an object object + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)", + "[object ", + eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)", + "Object]", + eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") ); + + // this is a function object + array[item++] = new TestCase( SECTION, + "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)", + "Function]", + eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") ); + // this is a number object + array[item++] = new TestCase( SECTION, + "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)", + "NaN", + eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") ); + + // this is the Math object + array[item++] = new TestCase( SECTION, + "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)", + "[ob", + eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") ); + + // this is a Boolean object + + array[item++] = new TestCase( SECTION, + "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))", + "f", + eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") ); + + // this is a user defined object + + array[item++] = new TestCase( SECTION, + "var obj = new MyObject( void 0 ); obj.substring(0, 100)", + "undefined", + eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") ); + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js new file mode 100644 index 0000000..b24a9cc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js @@ -0,0 +1,514 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.11-1.js + ECMA Section: 15.5.4.11 String.prototype.toLowerCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toLowerCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.11-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toLowerCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") ); + + // Basic Latin, Latin-1 Supplement, Latin Extended A + for ( var i = 0; i <= 0x017f; i++ ) { + var U = new Unicode(i); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", + String.fromCharCode(U.lower), + eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", + U.lower, + eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); + + } + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = 0x039C; + u[1] = c; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js new file mode 100644 index 0000000..b75f3e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js @@ -0,0 +1,633 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +/** + File Name: 15.5.4.11-2.js + ECMA Section: 15.5.4.11 String.prototype.toLowerCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toLowerCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +/* + Safari Changes: This test differs from the mozilla tests in two significant + ways. + First, the lower case range for Georgian letters in this file is the + correct range according to the Unicode 5.0 standard, as opposed to the + Georgian caseless range that mozilla uses. + Secondly this test uses an array for expected results with two entries, + instead of a single expected result. This allows us to accept Unicode 4.0 or + Unicode 5.0 results as correct, as opposed to the mozilla test, which assumes + Unicode 5.0. This allows Safari to pass this test on OS' with different + Unicode standards implemented (e.g. Tiger and XP) +*/ + var SECTION = "15.5.4.11-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toLowerCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Georgian + // Range: U+10A0 to U+10FF + for ( var i = 0x10A0; i <= 0x10FF; i++ ) { + var U = new Array(new Unicode( i, 4 ), new Unicode( i, 5 )); + +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", + String.fromCharCode(U.lower), + eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); +*/ + array[item++] = new TestCaseDualExpected( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", + U, + eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); + } + + return array; +} + +/* + * TestCase constructor + * + */ + +function TestCaseDualExpected( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResultDualExpected( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} + +// Added so that either Unicode 4.0 or 5.0 results will be considered correct. +function writeTestCaseResultDualExpected( expect, actual, string ) { + var passed = getTestCaseResultDualExpected( expect, actual ); + writeFormattedResult( expect[1].lower, actual, string, passed ); + return passed; +} +/* + * Added so that either Unicode 4.0 or 5.0 results will be considered correct. + * Compare expected result to the actual result and figure out whether + * the test case passed. + */ +function getTestCaseResultDualExpected( expect, actual ) { + expectedU4 = expect[0].lower; + expectedU5 = expect[1].lower; + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + + if ( expectedU4 != expectedU4 ) { + if ( typeof expectedU4 == "object" ) { + expectedU4 = "NaN object"; + } else { + expectedU4 = "NaN number"; + } + } + if ( expectedU5 != expectedU5 ) { + if ( typeof expectedU5 == "object" ) { + expectedU5 = "NaN object"; + } else { + expectedU5 = "NaN number"; + } + } + + var passed = ( expectedU4 == actual || expectedU5 == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed && + typeof(actual) == "number" && + (typeof(expectedU4) == "number" || + typeof(expectedU5) == "number")) { + if (( Math.abs(actual-expectedU4) < 0.0000001 ) || ( Math.abs(actual-expectedU5) < 0.0000001 )) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expectedU4) != typeof(actual) && typeof(expectedU5) != typeof(actual) ) { + passed = false; + } + + return passed; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResultDualExpected( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} + +function Unicode( c, version ) { + u = GetUnicodeValues( c, version ); + this.upper = u[0]; + this.lower = u[1] + return this; +} + +function GetUnicodeValues( c, version ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = c; + u[1] = 0x039C; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + if ( version == 5 ) { + if ( c >= 0x10A0 && c <= 0x10C5 ) { + u[0] = c; + u[1] = c + 7264; //48; + return u; + } + if ( c >= 0x2D00 && c <= 0x2D25 ) { + u[0] = c; + u[1] = c; + return u; + } + } + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js new file mode 100644 index 0000000..b718188 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js @@ -0,0 +1,509 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.11-2.js + ECMA Section: 15.5.4.11 String.prototype.toLowerCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toLowerCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.11-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toLowerCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + for ( var i = 0xFF00; i <= 0xFFEF; i++ ) { + var U = new Unicode(i); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", + String.fromCharCode(U.lower), + eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", + U.lower, + eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); + } + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = c; + u[1] = 0x039C; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js new file mode 100644 index 0000000..5258dc2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js @@ -0,0 +1,508 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.11-2.js + ECMA Section: 15.5.4.11 String.prototype.toLowerCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toLowerCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.11-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toLowerCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Hiragana (no upper / lower case) + // Range: U+3040 to U+309F + + for ( var i = 0x3040; i <= 0x309F; i++ ) { + var U = new Unicode( i ); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", + String.fromCharCode(U.lower), + eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", + U.lower, + eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); + } + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + this.upper = c; + this.lower = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + this.upper = c; + this.lower = c + 32; + return this; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + this.upper = c - 32; + this.lower = c; + return this; + } + + // upper case Latin-1 Supplement + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + this.upper = c; + this.lower = c + 32; + return this; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + this.upper = c - 32; + this.lower = c; + return this; + } + if ( c == 0x00FF ) { + this.upper = 0x0178; + this.lower = c; + return this; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + this.upper = c; + this.lower = 0x0069; + return this; + } + if ( c == 0x0131 ) { + this.upper = 0x0049; + this.lower = c; + return this; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + this.upper = c; + this.lower = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + this.upper = c-1; + this.lower = c; + } + return this; + } + if ( c == 0x0178 ) { + this.upper = c; + this.lower = 0x00FF; + return this; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + this.upper = c; + this.lower = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + this.upper = c-1; + this.lower = c; + } + return this; + } + if ( c == 0x017F ) { + this.upper = 0x0053; + this.lower = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + this.upper = c; + this.lower = c+1; + } else { + this.upper = c-1; + this.lower = c; + } + return this; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { + this.upper = c; + this.lower = c + 80; + return this; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + this.upper = c; + this.lower = c + 32; + return this; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + this.upper = c - 32; + this.lower = c; + return this; + + } + if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { + this.upper = c -80; + this.lower = c; + return this; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + this.upper = c; + this.lower = c +1; + } else { + this.upper = c - 1; + this.lower = c; + } + return this; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + this.upper = c; + this.lower = c + 48; + return this; + } + if ( c >= 0x0561 && c < 0x0587 ) { + this.upper = c - 48; + this.lower = c; + return this; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + if ( c >= 0x10A0 && c <= 0x10C5 ) { + this.upper = c; + this.lower = c + 48; + return this; + } + if ( c >= 0x10D0 && c <= 0x10F5 ) { + this.upper = c; + this.lower = c; + return this; + } + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + this.upper = c; + this.lower = c + 32; + return this; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + this.upper = c - 32; + this.lower = c; + return this; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return this; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js new file mode 100644 index 0000000..4d42091 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js @@ -0,0 +1,514 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.11-5.js + ECMA Section: 15.5.4.11 String.prototype.toLowerCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toLowerCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.11-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toLowerCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") ); + + // Cyrillic (part) + // Range: U+0400 to U+04FF + for ( var i = 0x0400; i <= 0x047F; i++ ) { + var U = new Unicode( i ); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", + String.fromCharCode(U.lower), + eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", + U.lower, + eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); + + } + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = c; + u[1] = 0x039C; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js new file mode 100644 index 0000000..a3282f6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js @@ -0,0 +1,511 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.11-6.js + ECMA Section: 15.5.4.11 String.prototype.toLowerCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toLowerCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.11-6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toLowerCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Armenian + // Range: U+0530 to U+058F + for ( var i = 0x0530; i <= 0x058F; i++ ) { + + var U = new Unicode( i ); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", + String.fromCharCode(U.lower), + eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", + U.lower, + eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); + + } + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = c; + u[1] = 0x039C; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js new file mode 100644 index 0000000..fb8f0df --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js @@ -0,0 +1,527 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.12-1.js + ECMA Section: 15.5.4.12 String.prototype.toUpperCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toUpperCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.12-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toUpperCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") ); + + // Basic Latin, Latin-1 Supplement, Latin Extended A + for ( var i = 0; i <= 0x017f; i++ ) { + var U = new Unicode( i ); + + // XXX DF fails in java + + if ( i == 0x00DF ) { + continue; + } + + + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", + U.upper, + eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); + } + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = 0x039C; + u[1] = c; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE, uppercase takes two code points + if (c == 0x0149) { + u[0] = 0x02bc; + u[1] = c; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + if (c == 0x0587) { + u[0] = 0x0535; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js new file mode 100644 index 0000000..2d8c694 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js @@ -0,0 +1,514 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.12-2.js + ECMA Section: 15.5.4.12 String.prototype.toUpperCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toUpperCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.12-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toUpperCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var TEST_STRING = ""; + var EXPECT_STRING = ""; + + // basic latin test + + for ( var i = 0; i < 0x007A; i++ ) { + var u = new Unicode(i); + TEST_STRING += String.fromCharCode(i); + EXPECT_STRING += String.fromCharCode( u.upper ); + } + + // don't print out the value of the strings since they contain control + // characters that break the driver + var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase(); + + array[item++] = new TestCase( SECTION, + "isEqual", + true, + isEqual); + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = 0x039C; + u[1] = c; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js new file mode 100644 index 0000000..1561db5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js @@ -0,0 +1,556 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.12-3.js + ECMA Section: 15.5.4.12 String.prototype.toUpperCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toUpperCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.12-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toUpperCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Georgian + // Range: U+10A0 to U+10FF + for ( var i = 0x10A0; i <= 0x10FF; i++ ) { + var U = new Unicode( i ); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", + String.fromCharCode(U.upper), + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", + U.upper, + eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); + + } + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + for ( var i = 0xFF00; i <= 0xFFEF; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", + eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ), + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", + eval( "var u = new Unicode( i ); u.upper" ), + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") ); + } + + // Hiragana (no upper / lower case) + // Range: U+3040 to U+309F + + for ( var i = 0x3040; i <= 0x309F; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", + eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ), + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", + eval( "var u = new Unicode( i ); u.upper" ), + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") ); + } + + +/* + var TEST_STRING = ""; + var EXPECT_STRING = ""; + + // basic latin test + + for ( var i = 0; i < 0x007A; i++ ) { + var u = new Unicode(i); + TEST_STRING += String.fromCharCode(i); + EXPECT_STRING += String.fromCharCode( u.upper ); + } +*/ + + + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = 0x039C; + u[1] = c; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js new file mode 100644 index 0000000..54e365e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js @@ -0,0 +1,511 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.12-1.js + ECMA Section: 15.5.4.12 String.prototype.toUpperCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toUpperCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.12-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toUpperCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Cyrillic (part) + // Range: U+0400 to U+04FF + for ( var i = 0x0400; i <= 0x047F; i++ ) { + var U =new Unicode( i ); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", + U.upper, + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", + U.upper, + eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); + + } + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = 0x039C; + u[1] = c; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js new file mode 100644 index 0000000..bbcfad4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js @@ -0,0 +1,523 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.12-1.js + ECMA Section: 15.5.4.12 String.prototype.toUpperCase() + Description: + + Returns a string equal in length to the length of the result of converting + this object to a string. The result is a string value, not a String object. + + Every character of the result is equal to the corresponding character of the + string, unless that character has a Unicode 2.0 uppercase equivalent, in which + case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case + mapping shall be used, which does not depend on implementation or locale.) + + Note that the toUpperCase function is intentionally generic; it does not require + that its this value be a String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.12-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toUpperCase()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // Armenian + // Range: U+0530 to U+058F + for ( var i = 0x0530; i <= 0x058F; i++ ) { + var U = new Unicode( i ); +/* + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", + String.fromCharCode(U.upper), + eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); +*/ + array[item++] = new TestCase( SECTION, + "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", + U.upper, + eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); + + } + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +} +function Unicode( c ) { + u = GetUnicodeValues( c ); + this.upper = u[0]; + this.lower = u[1] + return this; +} +function GetUnicodeValues( c ) { + u = new Array(); + + u[0] = c; + u[1] = c; + + // upper case Basic Latin + + if ( c >= 0x0041 && c <= 0x005A) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Basic Latin + if ( c >= 0x0061 && c <= 0x007a ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // upper case Latin-1 Supplement + if ( c == 0x00B5 ) { + u[0] = 0x039C; + u[1] = c; + return u; + } + if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + // lower case Latin-1 Supplement + if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { + u[0] = c - 32; + u[1] = c; + return u; + } + if ( c == 0x00FF ) { + u[0] = 0x0178; + u[1] = c; + return u; + } + // Latin Extended A + if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { + // special case for capital I + if ( c == 0x0130 ) { + u[0] = c; + u[1] = 0x0069; + return u; + } + if ( c == 0x0131 ) { + u[0] = 0x0049; + u[1] = c; + return u; + } + + if ( c % 2 == 0 ) { + // if it's even, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's odd, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x0178 ) { + u[0] = c; + u[1] = 0x00FF; + return u; + } + + // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE, uppercase takes two code points + if (c == 0x0149) { + u[0] = 0x02bc; + u[1] = c; + return u; + } + + if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { + if ( c % 2 == 1 ) { + // if it's odd, it's a capital and the lower case is c +1 + u[0] = c; + u[1] = c+1; + } else { + // if it's even, it's a lower case and upper case is c-1 + u[0] = c-1; + u[1] = c; + } + return u; + } + if ( c == 0x017F ) { + u[0] = 0x0053; + u[1] = c; + } + + // Latin Extended B + // need to improve this set + + if ( c >= 0x0200 && c <= 0x0217 ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c+1; + } else { + u[0] = c-1; + u[1] = c; + } + return u; + } + + // Latin Extended Additional + // Range: U+1E00 to U+1EFF + // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html + + // Spacing Modifier Leters + // Range: U+02B0 to U+02FF + + // Combining Diacritical Marks + // Range: U+0300 to U+036F + + // skip Greek for now + // Greek + // Range: U+0370 to U+03FF + + // Cyrillic + // Range: U+0400 to U+04FF + + if ( c >= 0x0400 && c <= 0x040F) { + u[0] = c; + u[1] = c + 80; + return u; + } + + + if ( c >= 0x0410 && c <= 0x042F ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0x0430 && c<= 0x044F ) { + u[0] = c - 32; + u[1] = c; + return u; + + } + if ( c >= 0x0450 && c<= 0x045F ) { + u[0] = c -80; + u[1] = c; + return u; + } + + if ( c >= 0x0460 && c <= 0x047F ) { + if ( c % 2 == 0 ) { + u[0] = c; + u[1] = c +1; + } else { + u[0] = c - 1; + u[1] = c; + } + return u; + } + + // Armenian + // Range: U+0530 to U+058F + if ( c >= 0x0531 && c <= 0x0556 ) { + u[0] = c; + u[1] = c + 48; + return u; + } + if ( c >= 0x0561 && c < 0x0587 ) { + u[0] = c - 48; + u[1] = c; + return u; + } + if (c == 0x0587) { + u[0] = 0x0535; + u[1] = c; + return u; + } + + // Hebrew + // Range: U+0590 to U+05FF + + + // Arabic + // Range: U+0600 to U+06FF + + // Devanagari + // Range: U+0900 to U+097F + + + // Bengali + // Range: U+0980 to U+09FF + + + // Gurmukhi + // Range: U+0A00 to U+0A7F + + + // Gujarati + // Range: U+0A80 to U+0AFF + + + // Oriya + // Range: U+0B00 to U+0B7F + // no capital / lower case + + + // Tamil + // Range: U+0B80 to U+0BFF + // no capital / lower case + + + // Telugu + // Range: U+0C00 to U+0C7F + // no capital / lower case + + + // Kannada + // Range: U+0C80 to U+0CFF + // no capital / lower case + + + // Malayalam + // Range: U+0D00 to U+0D7F + + // Thai + // Range: U+0E00 to U+0E7F + + + // Lao + // Range: U+0E80 to U+0EFF + + + // Tibetan + // Range: U+0F00 to U+0FBF + + // Georgian + // Range: U+10A0 to U+10F0 + + // Hangul Jamo + // Range: U+1100 to U+11FF + + // Greek Extended + // Range: U+1F00 to U+1FFF + // skip for now + + + // General Punctuation + // Range: U+2000 to U+206F + + // Superscripts and Subscripts + // Range: U+2070 to U+209F + + // Currency Symbols + // Range: U+20A0 to U+20CF + + + // Combining Diacritical Marks for Symbols + // Range: U+20D0 to U+20FF + // skip for now + + + // Number Forms + // Range: U+2150 to U+218F + // skip for now + + + // Arrows + // Range: U+2190 to U+21FF + + // Mathematical Operators + // Range: U+2200 to U+22FF + + // Miscellaneous Technical + // Range: U+2300 to U+23FF + + // Control Pictures + // Range: U+2400 to U+243F + + // Optical Character Recognition + // Range: U+2440 to U+245F + + // Enclosed Alphanumerics + // Range: U+2460 to U+24FF + + // Box Drawing + // Range: U+2500 to U+257F + + // Block Elements + // Range: U+2580 to U+259F + + // Geometric Shapes + // Range: U+25A0 to U+25FF + + // Miscellaneous Symbols + // Range: U+2600 to U+26FF + + // Dingbats + // Range: U+2700 to U+27BF + + // CJK Symbols and Punctuation + // Range: U+3000 to U+303F + + // Hiragana + // Range: U+3040 to U+309F + + // Katakana + // Range: U+30A0 to U+30FF + + // Bopomofo + // Range: U+3100 to U+312F + + // Hangul Compatibility Jamo + // Range: U+3130 to U+318F + + // Kanbun + // Range: U+3190 to U+319F + + + // Enclosed CJK Letters and Months + // Range: U+3200 to U+32FF + + // CJK Compatibility + // Range: U+3300 to U+33FF + + // Hangul Syllables + // Range: U+AC00 to U+D7A3 + + // High Surrogates + // Range: U+D800 to U+DB7F + + // Private Use High Surrogates + // Range: U+DB80 to U+DBFF + + // Low Surrogates + // Range: U+DC00 to U+DFFF + + // Private Use Area + // Range: U+E000 to U+F8FF + + // CJK Compatibility Ideographs + // Range: U+F900 to U+FAFF + + // Alphabetic Presentation Forms + // Range: U+FB00 to U+FB4F + + // Arabic Presentation Forms-A + // Range: U+FB50 to U+FDFF + + // Combining Half Marks + // Range: U+FE20 to U+FE2F + + // CJK Compatibility Forms + // Range: U+FE30 to U+FE4F + + // Small Form Variants + // Range: U+FE50 to U+FE6F + + // Arabic Presentation Forms-B + // Range: U+FE70 to U+FEFF + + // Halfwidth and Fullwidth Forms + // Range: U+FF00 to U+FFEF + + if ( c >= 0xFF21 && c <= 0xFF3A ) { + u[0] = c; + u[1] = c + 32; + return u; + } + + if ( c >= 0xFF41 && c <= 0xFF5A ) { + u[0] = c - 32; + u[1] = c; + return u; + } + + // Specials + // Range: U+FFF0 to U+FFFF + + return u; +} + +function DecimalToHexString( n ) { + n = Number( n ); + var h = "0x"; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js new file mode 100644 index 0000000..3569556 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.2-1.js + ECMA Section: 15.5.4.2 String.prototype.toString() + + Description: Returns this string value. Note that, for a String + object, the toString() method happens to return the same + thing as the valueOf() method. + + The toString function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.4.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() ); + array[item++] = new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() ); + array[item++] = new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() ); + array[item++] = new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() ); + array[item++] = new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() ); + array[item++] = new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() ); + return ( array ); +} +function test( array ) { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js new file mode 100644 index 0000000..b444bae --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.2-2-n.js + ECMA Section: 15.5.4.2 String.prototype.toString() + + Description: Returns this string value. Note that, for a String + object, the toString() method happens to return the same + thing as the valueOf() method. + + The toString function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.4.2-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()", + "error", + "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js new file mode 100644 index 0000000..f1855e2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.2-3.js + ECMA Section: 15.5.4.2 String.prototype.toString() + + Description: Returns this string value. Note that, for a String + object, the toString() method happens to return the same + thing as the valueOf() method. + + The toString function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + + var SECTION = "15.5.4.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + + testcases[tc].actual = eval( testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()", + "", + "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()" ); + array[item++] = new TestCase( SECTION, + "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()", + "0", + "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()" ); + array[item++] = new TestCase( SECTION, + "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()", + "hello", + "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()" ); + array[item++] = new TestCase( SECTION, + "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()", + "", + "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js new file mode 100644 index 0000000..8779e33 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js @@ -0,0 +1,92 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.2.js + ECMA Section: 15.5.4.2 String.prototype.toString + + Description: + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.5.4.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.tostring"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ ); + array[item++] = new TestCase( SECTION, + "String.prototype.toString() == String.prototype.valueOf()", + true, + String.prototype.toString() == String.prototype.valueOf() ); + + array[item++] = new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() ); + array[item++] = new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length ); + + + array[item++] = new TestCase( SECTION, + "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()", + true, + eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, + "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()", + true, + eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, + "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()", + true, + eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, + "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()", + true, + eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") ); + array[item++] = new TestCase( SECTION, + "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()", + true, + eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") ); + + return ( array ); +} +function test( array ) { + for ( ; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js new file mode 100644 index 0000000..d55c437 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.3-1.js + ECMA Section: 15.5.4.3 String.prototype.valueOf() + + Description: Returns this string value. + + The valueOf function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + var SECTION = "15.5.4.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.valueOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length ); + + array[item++] = new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() ); + array[item++] = new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() ); + array[item++] = new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() ); + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js new file mode 100644 index 0000000..21d3407 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js @@ -0,0 +1,89 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.3-2.js + ECMA Section: 15.5.4.3 String.prototype.valueOf() + + Description: Returns this string value. + + The valueOf function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + + var SECTION = "15.5.4.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.valueOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()", + "", + "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()" ); + array[item++] = new TestCase( SECTION, + "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()", + "0", + "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()" ); + array[item++] = new TestCase( SECTION, + "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()", + "hello", + "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()" ); + array[item++] = new TestCase( SECTION, + "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()", + "", + "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()" ); +/* + array[item++] = new TestCase( SECTION, + "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()", + "error", + "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()" ); +*/ + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js new file mode 100644 index 0000000..f7c420a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.3-3-n.js + ECMA Section: 15.5.4.3 String.prototype.valueOf() + + Description: Returns this string value. + + The valueOf function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + + + var SECTION = "15.5.4.3-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.valueOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual ); + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()", + "error", + "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()" ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js new file mode 100644 index 0000000..e0dc042 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.4-1.js + ECMA Section: 15.5.4.4 String.prototype.charAt(pos) + Description: Returns a string containing the character at position + pos in the string. If there is no character at that + string, the result is the empty string. The result is + a string value, not a String object. + + When the charAt method is called with one argument, + pos, the following steps are taken: + 1. Call ToString, with this value as its argument + 2. Call ToInteger pos + + In this test, this is a String, pos is an integer, and + all pos are in range. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( i = 0x0020; i < 0x007e; i++, item++) { + array[item] = new TestCase( SECTION, + "TEST_STRING.charAt("+item+")", + String.fromCharCode( i ), + TEST_STRING.charAt( item ) ); + } + for ( i = 0x0020; i < 0x007e; i++, item++) { + array[item] = new TestCase( SECTION, + "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")", + true, + TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 ) + ); + } + array[item++] = new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length ); + + return array; +} +function test() { + writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js new file mode 100644 index 0000000..0ca8fb2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js @@ -0,0 +1,141 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.4-1.js + ECMA Section: 15.5.4.4 String.prototype.charAt(pos) + Description: Returns a string containing the character at position + pos in the string. If there is no character at that + string, the result is the empty string. The result is + a string value, not a String object. + + When the charAt method is called with one argument, + pos, the following steps are taken: + 1. Call ToString, with this value as its argument + 2. Call ToInteger pos + 3. Compute the number of characters in Result(1) + 4. If Result(2) is less than 0 is or not less than + Result(3), return the empty string + 5. Return a string of length 1 containing one character + from result (1), the character at position Result(2). + + Note that the charAt function is intentionally generic; + it does not require that its this value be a String + object. Therefore it can be transferred to other kinds + of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.4-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") ); + + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") ); + + array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") ); + + array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") ); + + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") ); + + array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") ); + + // MyOtherObject.toString will return "[object Object] + + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") ); + array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") ); + + return (array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + + stopTest(); + return ( testcases ); +} + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value;" ); + this.toString = new Function( "return this.value +''" ); + this.charAt = String.prototype.charAt; +} +function MyOtherObject(value) { + this.value = value; + this.valueOf = new Function( "return this.value;" ); + this.charAt = String.prototype.charAt; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js new file mode 100644 index 0000000..7de6788 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js @@ -0,0 +1,117 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.4-3.js + ECMA Section: 15.5.4.4 String.prototype.charAt(pos) + Description: Returns a string containing the character at position + pos in the string. If there is no character at that + string, the result is the empty string. The result is + a string value, not a String object. + + When the charAt method is called with one argument, + pos, the following steps are taken: + 1. Call ToString, with this value as its argument + 2. Call ToInteger pos + 3. Compute the number of characters in Result(1) + 4. If Result(2) is less than 0 is or not less than + Result(3), return the empty string + 5. Return a string of length 1 containing one character + from result (1), the character at position Result(2). + + Note that the charAt function is intentionally generic; + it does not require that its this value be a String + object. Therefore it can be transferred to other kinds + of objects for use as a method. + + This tests assiging charAt to a user-defined function. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.4-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function MyObject (v) { + this.value = v; + this.toString = new Function( "return this.value +'';" ); + this.valueOf = new Function( "return this.value" ); + this.charAt = String.prototype.charAt; +} +function getTestCases() { + var array = new Array(); + var item = 0; + + var foo = new MyObject('hello'); + + + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) ); + + var boo = new MyObject(true); + + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) ); + + var noo = new MyObject( Math.PI ); + + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) ); + + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js new file mode 100644 index 0000000..69ee2e5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js @@ -0,0 +1,159 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.4-4.js + ECMA Section: 15.5.4.4 String.prototype.charAt(pos) + Description: Returns a string containing the character at position + pos in the string. If there is no character at that + string, the result is the empty string. The result is + a string value, not a String object. + + When the charAt method is called with one argument, + pos, the following steps are taken: + 1. Call ToString, with this value as its argument + 2. Call ToInteger pos + 3. Compute the number of characters in Result(1) + 4. If Result(2) is less than 0 is or not less than + Result(3), return the empty string + 5. Return a string of length 1 containing one character + from result (1), the character at position Result(2). + + Note that the charAt function is intentionally generic; + it does not require that its this value be a String + object. Therefore it can be transferred to other kinds + of objects for use as a method. + + This tests assiging charAt to primitive types.. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.4-4"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "String.prototype.charAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; +/* + array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); + + array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); +*/ + array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); + array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") ); + + array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); + + array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); + + array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); + + + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") ); + + array[item++] = new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") ); + + array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") ); + + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") ); + array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") ); + + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") ); + array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") ); + + + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js new file mode 100644 index 0000000..62d42b4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js @@ -0,0 +1,89 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.5.1.js + ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) + Description: Returns a number (a nonnegative integer less than 2^16) + representing the Unicode encoding of the character at + position pos in this string. If there is no character + at that position, the number is NaN. + + When the charCodeAt method is called with one argument + pos, the following steps are taken: + 1. Call ToString, giving it the theis value as its + argument + 2. Call ToInteger(pos) + 3. Compute the number of characters in result(1). + 4. If Result(2) is less than 0 or is not less than + Result(3), return NaN. + 5. Return a value of Number type, of positive sign, whose + magnitude is the Unicode encoding of one character + from result 1, namely the characer at position Result + (2), where the first character in Result(1) is + considered to be at position 0. + + Note that the charCodeAt funciton is intentionally + generic; it does not require that its this value be a + String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charCodeAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + + for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) { + array[j] = new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) ); + } + + item = array.length; + + array[item++] = new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) ); + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js new file mode 100644 index 0000000..2570687 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js @@ -0,0 +1,128 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.5.1.js + ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) + Description: Returns a number (a nonnegative integer less than 2^16) + representing the Unicode encoding of the character at + position pos in this string. If there is no character + at that position, the number is NaN. + + When the charCodeAt method is called with one argument + pos, the following steps are taken: + 1. Call ToString, giving it the theis value as its + argument + 2. Call ToInteger(pos) + 3. Compute the number of characters in result(1). + 4. If Result(2) is less than 0 or is not less than + Result(3), return NaN. + 5. Return a value of Number type, of positive sign, whose + magnitude is the Unicode encoding of one character + from result 1, namely the characer at position Result + (2), where the first character in Result(1) is + considered to be at position 0. + + Note that the charCodeAt funciton is intentionally + generic; it does not require that its this value be a + String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charCodeAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var x; + + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") ); + + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") ); + + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") ); + + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") ); + + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") ); + + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") ); + + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") ); + + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") ); + array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") ); + + return (array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js new file mode 100644 index 0000000..20d380b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js @@ -0,0 +1,136 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.5-3.js + ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) + Description: Returns a number (a nonnegative integer less than 2^16) + representing the Unicode encoding of the character at + position pos in this string. If there is no character + at that position, the number is NaN. + + When the charCodeAt method is called with one argument + pos, the following steps are taken: + 1. Call ToString, giving it the theis value as its + argument + 2. Call ToInteger(pos) + 3. Compute the number of characters in result(1). + 4. If Result(2) is less than 0 or is not less than + Result(3), return NaN. + 5. Return a value of Number type, of positive sign, whose + magnitude is the Unicode encoding of one character + from result 1, namely the characer at position Result + (2), where the first character in Result(1) is + considered to be at position 0. + + Note that the charCodeAt funciton is intentionally + generic; it does not require that its this value be a + String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.5-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charCodeAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); + + var testcases = getTestCases(); + test(); + +function MyObject (v) { + this.value = v; + this.toString = new Function ( "return this.value +\"\"" ); + this.charCodeAt = String.prototype.charCodeAt; +} + +function getTestCases() { + var array = new Array(); + var item = 0; + + var foo = new MyObject('hello'); + + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) ); + + var boo = new MyObject(true); + + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) ); + + var noo = new MyObject( Math.PI ); + + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) ); + + var noo = new MyObject( null ); + + array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) ); + + var noo = new MyObject( void 0 ); + + array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) ); + + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value "; + + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js new file mode 100644 index 0000000..cd99bc2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.5-4.js + ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) + + Description: Returns a nonnegative integer less than 2^16. + + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var VERSION = "0697"; + startTest(); + var SECTION = "15.5.4.5-4"; + + writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var MAXCHARCODE = Math.pow(2,16); + var item=0, CHARCODE; + + for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)", + CHARCODE, + (String.fromCharCode(CHARCODE)).charCodeAt(0) ); + } + for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) { + array[item++] = new TestCase( SECTION, + "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)", + CHARCODE, + (String.fromCharCode(CHARCODE)).charCodeAt(0) ); + } + + array[item++] = new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) ); + + return ( array ); +} +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js new file mode 100644 index 0000000..091f5e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.5.1.js + ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) + Description: Returns a number (a nonnegative integer less than 2^16) + representing the Unicode encoding of the character at + position pos in this string. If there is no character + at that position, the number is NaN. + + When the charCodeAt method is called with one argument + pos, the following steps are taken: + 1. Call ToString, giving it the theis value as its + argument + 2. Call ToInteger(pos) + 3. Compute the number of characters in result(1). + 4. If Result(2) is less than 0 or is not less than + Result(3), return NaN. + 5. Return a value of Number type, of positive sign, whose + magnitude is the Unicode encoding of one character + from result 1, namely the characer at position Result + (2), where the first character in Result(1) is + considered to be at position 0. + + Note that the charCodeAt funciton is intentionally + generic; it does not require that its this value be a + String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.5-5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.charCodeAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var TEST_STRING = ""; + + for ( var i = 0x0000; i < 255; i++ ) { + TEST_STRING += String.fromCharCode( i ); + } + + + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") ); + + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") ); + array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") ); + + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") ); + + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") ); + array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") ); + + for ( var j = 0; j < 255; j++ ) { + array[item++] = new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) ); + } + return (array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js new file mode 100644 index 0000000..8b7ae18 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.5-6.js + ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) + Description: Returns a number (a nonnegative integer less than 2^16) + representing the Unicode encoding of the character at + position pos in this string. If there is no character + at that position, the number is NaN. + + When the charCodeAt method is called with one argument + pos, the following steps are taken: + 1. Call ToString, giving it the theis value as its + argument + 2. Call ToInteger(pos) + 3. Compute the number of characters in result(1). + 4. If Result(2) is less than 0 or is not less than + Result(3), return NaN. + 5. Return a value of Number type, of positive sign, whose + magnitude is the Unicode encoding of one character + from result 1, namely the characer at position Result + (2), where the first character in Result(1) is + considered to be at position 0. + + Note that the charCodeAt funciton is intentionally + generic; it does not require that its this value be a + String object. Therefore it can be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.5-6"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "String.prototype.charCodeAt"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", + "true", + eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); + + array[item++] = new TestCase( SECTION, + "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", + "1234", + eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); + + array[item++] = new TestCase( SECTION, + "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", + "hello", + eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); + return (array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js new file mode 100644 index 0000000..ab9d725 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js @@ -0,0 +1,158 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.6-1.js + ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos) + Description: If the given searchString appears as a substring of the + result of converting this object to a string, at one or + more positions that are at or to the right of the + specified position, then the index of the leftmost such + position is returned; otherwise -1 is returned. If + positionis undefined or not supplied, 0 is assumed, so + as to search all of the string. + + When the indexOf method is called with two arguments, + searchString and pos, the following steps are taken: + + 1. Call ToString, giving it the this value as its + argument. + 2. Call ToString(searchString). + 3. Call ToInteger(position). (If position is undefined + or not supplied, this step produces the value 0). + 4. Compute the number of characters in Result(1). + 5. Compute min(max(Result(3), 0), Result(4)). + 6. Compute the number of characters in the string that + is Result(2). + 7. Compute the smallest possible integer k not smaller + than Result(5) such that k+Result(6) is not greater + than Result(4), and for all nonnegative integers j + less than Result(6), the character at position k+j + of Result(1) is the same as the character at position + j of Result(2); but if there is no such integer k, + then compute the value -1. + 8. Return Result(7). + + Note that the indexOf function is intentionally generic; + it does not require that its this value be a String object. + Therefore it can be transferred to other kinds of objects + for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.6-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.protoype.indexOf"; + + var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var j = 0; + + for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.indexOf(" +String.fromCharCode(i)+ ", 0)", + k, + TEST_STRING.indexOf( String.fromCharCode(i), 0 ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")", + k, + TEST_STRING.indexOf( String.fromCharCode(i), k ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")", + -1, + TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.indexOf("+(String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+0+")", + k, + TEST_STRING.indexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + 0 ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.indexOf("+(String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+ k +")", + k, + TEST_STRING.indexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + k ) ); + } + for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.indexOf("+(String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+ k+1 +")", + -1, + TEST_STRING.indexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + k+1 ) ); + } + + array[j++] = new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) ); + array[j++] = new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 )); + + return array; +} + +function test() { + writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); + + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + + } + stopTest(); + + return ( testcases ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js new file mode 100644 index 0000000..6054a51 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js @@ -0,0 +1,259 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.6-1.js + ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos) + Description: If the given searchString appears as a substring of the + result of converting this object to a string, at one or + more positions that are at or to the right of the + specified position, then the index of the leftmost such + position is returned; otherwise -1 is returned. If + positionis undefined or not supplied, 0 is assumed, so + as to search all of the string. + + When the indexOf method is called with two arguments, + searchString and pos, the following steps are taken: + + 1. Call ToString, giving it the this value as its + argument. + 2. Call ToString(searchString). + 3. Call ToInteger(position). (If position is undefined + or not supplied, this step produces the value 0). + 4. Compute the number of characters in Result(1). + 5. Compute min(max(Result(3), 0), Result(4)). + 6. Compute the number of characters in the string that + is Result(2). + 7. Compute the smallest possible integer k not smaller + than Result(5) such that k+Result(6) is not greater + than Result(4), and for all nonnegative integers j + less than Result(6), the character at position k+j + of Result(1) is the same as the character at position + j of Result(2); but if there is no such integer k, + then compute the value -1. + 8. Return Result(7). + + Note that the indexOf function is intentionally generic; + it does not require that its this value be a String object. + Therefore it can be transferred to other kinds of objects + for use as a method. + + Author: christine@netscape.com, pschwartau@netscape.com + Date: 02 October 1997 + Modified: 14 July 2002 + Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 + ECMA-262 Ed.3 Section 15.5.4.7 + The length property of the indexOf method is 1 +* +*/ + var SECTION = "15.5.4.6-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.protoype.indexOf"; + var BUGNUMBER="105721"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +// the following test regresses http://scopus/bugsplat/show_bug.cgi?id=105721 + +function f() { + return this; +} +function g() { + var h = f; + return h(); +} + +function MyObject (v) { + this.value = v; + this.toString = new Function ( "return this.value +\"\""); + this.indexOf = String.prototype.indexOf; +} + +function getTestCases() { + var array = new Array(); + var item = 0; + + // regress http://scopus/bugsplat/show_bug.cgi?id=105721 + + array[item++] = new TestCase( SECTION, "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()", GLOBAL, g().toString() ); + + + array[item++] = new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length ); + array[item++] = new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") ); + array[item++] = new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") ); + + array[item++] = new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") ); + + // some Unicode tests. + + // generate a test string. + + var TEST_STRING = ""; + + for ( var u = 0x00A1; u <= 0x00FF; u++ ) { + TEST_STRING += String.fromCharCode( u ); + } + + for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) { + array[item++] = new TestCase( SECTION, + "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )", + i, + TEST_STRING.indexOf( String.fromCharCode(u) ) ); + } + for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) { + array[item++] = new TestCase( SECTION, + "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )", + i, + TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) ); + } + + + + var foo = new MyObject('hello'); + + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") ); + array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) ); + + var boo = new MyObject(true); + + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") ); + array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") ); + + + var noo = new MyObject( Math.PI ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') ); + array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') ); + + array[item++] = new TestCase( SECTION, + "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')", + 0, + eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") ); + + array[item++] = new TestCase( SECTION, + "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')", + 3, + eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')", + 0, + eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')", + 2, + eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") ); + + array[item++] = new TestCase( SECTION, + "var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')", + 0, + eval("var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')") ); + + array[item++] = new TestCase( SECTION, + "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')", + 0, + eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") ); + + array[item++] = new TestCase( SECTION, + "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')", + -1, + eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") ); + + array[item++] = new TestCase( SECTION, + "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)", + -1, + eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") ); + + array[item++] = new TestCase( SECTION, + "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)", + 0, + eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") ); + + array[item++] = new TestCase( SECTION, + "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')", + 1, + eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") ); + + array[item++] = new TestCase( SECTION, + "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')", + 0, + eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") ); + + array[item++] = new TestCase( SECTION, + "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')", + 1, + eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") ); + + array[item++] = new TestCase( SECTION, + "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )", + 8, + eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") ); + + // new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively + array[item++] = new TestCase( SECTION, + "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')", + 8, + eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") ); + + + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) + ? "" + : "wrong value " + } + stopTest(); + + // all tests must return a boolean value + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js new file mode 100644 index 0000000..55d0313 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js @@ -0,0 +1,221 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.7-1.js + ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) + Description: + + If the given searchString appears as a substring of the result of + converting this object to a string, at one or more positions that are + at or to the left of the specified position, then the index of the + rightmost such position is returned; otherwise -1 is returned. If position + is undefined or not supplied, the length of this string value is assumed, + so as to search all of the string. + + When the lastIndexOf method is called with two arguments searchString and + position, the following steps are taken: + + 1.Call ToString, giving it the this value as its argument. + 2.Call ToString(searchString). + 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). + 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). + 5.Compute the number of characters in Result(1). + 6.Compute min(max(Result(4), 0), Result(5)). + 7.Compute the number of characters in the string that is Result(2). + 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater + than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of + Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then + compute the value -1. + + 1.Return Result(8). + + Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a + String object. Therefore it can be transferred to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.7-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.protoype.lastIndexOf"; + + var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var j = 0; + + for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)", + -1, + TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")", + k, + TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")", + k, + TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) ); + } + + for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + + "String.lastIndexOf("+(String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+ 0 + ")", + LastIndexOf( TEST_STRING, String.fromCharCode(i) + + String.fromCharCode(i+1)+String.fromCharCode(i+2), 0), + TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + 0 ) ); + } + + for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.lastIndexOf("+(String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+ k +")", + k, + TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + k ) ); + } + for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.lastIndexOf("+(String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+ k+1 +")", + k, + TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + k+1 ) ); + } + for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { + array[j] = new TestCase( SECTION, + "String.lastIndexOf("+ + (String.fromCharCode(i) + + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)) +", "+ (k-1) +")", + LastIndexOf( TEST_STRING, String.fromCharCode(i) + + String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1), + TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ + String.fromCharCode(i+1)+ + String.fromCharCode(i+2)), + k-1 ) ); + } + + array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) ); +// array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 )); + array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING )); + + return array; +} + +function test() { + writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); + + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + + } + stopTest(); + + return ( testcases ); +} + +function LastIndexOf( string, search, position ) { + string = String( string ); + search = String( search ); + + position = Number( position ) + + if ( isNaN( position ) ) { + position = Infinity; + } else { + position = ToInteger( position ); + } + + result5= string.length; + result6 = Math.min(Math.max(position, 0), result5); + result7 = search.length; + + if (result7 == 0) { + return Math.min(position, result5); + } + + result8 = -1; + + for ( k = 0; k <= result6; k++ ) { + if ( k+ result7 > result5 ) { + break; + } + for ( j = 0; j < result7; j++ ) { + if ( string.charAt(k+j) != search.charAt(j) ){ + break; + } else { + if ( j == result7 -1 ) { + result8 = k; + } + } + } + } + + return result8; +} +function ToInteger( n ) { + n = Number( n ); + if ( isNaN(n) ) { + return 0; + } + if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { + return n; + } + + var sign = ( n < 0 ) ? -1 : 1; + + return ( sign * Math.floor(Math.abs(n)) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js new file mode 100644 index 0000000..9972c7e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js @@ -0,0 +1,220 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.7-2.js + ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) + Description: + + If the given searchString appears as a substring of the result of + converting this object to a string, at one or more positions that are + at or to the left of the specified position, then the index of the + rightmost such position is returned; otherwise -1 is returned. If position + is undefined or not supplied, the length of this string value is assumed, + so as to search all of the string. + + When the lastIndexOf method is called with two arguments searchString and + position, the following steps are taken: + + 1.Call ToString, giving it the this value as its argument. + 2.Call ToString(searchString). + 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). + 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). + 5.Compute the number of characters in Result(1). + 6.Compute min(max(Result(4), 0), Result(5)). + 7.Compute the number of characters in the string that is Result(2). + 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater + than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of + Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then + compute the value -1. + + 1.Return Result(8). + + Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a + String object. Therefore it can be transferred to other kinds of objects for use as a method. + + Author: christine@netscape.com, pschwartau@netscape.com + Date: 02 October 1997 + Modified: 14 July 2002 + Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 + ECMA-262 Ed.3 Section 15.5.4.8 + The length property of the lastIndexOf method is 1 +* +*/ + var SECTION = "15.5.4.7-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.protoype.lastIndexOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) ); + + array[item++] = new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") ); + array[item++] = new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") ); + + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") ); + + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") ); + + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") ); + array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") ); + for ( var i = 0; i < ( "[object Object]" ).length; i++ ) { + array[item++] = new TestCase( SECTION, + "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")", + ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) , + eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") ); + } + for ( var i = 0; i < 5; i ++ ) { + array[item++] = new TestCase( SECTION, + "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")", + ( i < 2 ? -1 : 2 ), + eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") ); + } + for ( var i = 0; i < 5; i ++ ) { + array[item++] = new TestCase( SECTION, + "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")", + ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ), + eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") ); + } + for ( var i = 0; i < 9; i++ ) { + array[item++] = new TestCase( SECTION, + "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )", + ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ), + eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") ); + } + var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" ); + + for ( var i = 0; i < (a.toString()).length; i++ ) { + array[item++] = new TestCase( SECTION, + "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )", + ( i < 15 ? -1 : 15 ), + eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") ); + } + + for ( var i = 0; i < 15; i ++ ) { + array[item++] = new TestCase( SECTION, + "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")", + ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ), + eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") ); + } +/* + for ( var i = 0; i < 15; i++ ) { + array[item++] = new TestCase( SECTION, + "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )", + ) + } + +*/ + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + + return ( testcases ); +} + +function LastIndexOf( string, search, position ) { + string = String( string ); + search = String( search ); + + position = Number( position ) + + if ( isNaN( position ) ) { + position = Infinity; + } else { + position = ToInteger( position ); + } + + result5= string.length; + result6 = Math.min(Math.max(position, 0), result5); + result7 = search.length; + + if (result7 == 0) { + return Math.min(position, result5); + } + + result8 = -1; + + for ( k = 0; k <= result6; k++ ) { + if ( k+ result7 > result5 ) { + break; + } + for ( j = 0; j < result7; j++ ) { + if ( string.charAt(k+j) != search.charAt(j) ){ + break; + } else { + if ( j == result7 -1 ) { + result8 = k; + } + } + } + } + + return result8; +} +function ToInteger( n ) { + n = Number( n ); + if ( isNaN(n) ) { + return 0; + } + if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { + return n; + } + + var sign = ( n < 0 ) ? -1 : 1; + + return ( sign * Math.floor(Math.abs(n)) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js new file mode 100644 index 0000000..aed400c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js @@ -0,0 +1,166 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.7-3.js + ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) + Description: + + If the given searchString appears as a substring of the result of + converting this object to a string, at one or more positions that are + at or to the left of the specified position, then the index of the + rightmost such position is returned; otherwise -1 is returned. If position + is undefined or not supplied, the length of this string value is assumed, + so as to search all of the string. + + When the lastIndexOf method is called with two arguments searchString and + position, the following steps are taken: + + 1.Call ToString, giving it the this value as its argument. + 2.Call ToString(searchString). + 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). + 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). + 5.Compute the number of characters in Result(1). + 6.Compute min(max(Result(4), 0), Result(5)). + 7.Compute the number of characters in the string that is Result(2). + 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater + than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of + Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then + compute the value -1. + + 1.Return Result(8). + + Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a + String object. Therefore it can be transferred to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 2 october 1997 +*/ + var SECTION = "15.5.4.7-3"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "String.protoype.lastIndexOf"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )", + -1, + eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") ); + + array[item++] = new TestCase( SECTION, + "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )", + 1, + eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") ); + + array[item++] = new TestCase( SECTION, + "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )", + 1, + eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") ); + + array[item++] = new TestCase( SECTION, + "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )", + 1, + eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") ); + + array[item++] = new TestCase( SECTION, + "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )", + 1, + eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") ); + + return array; +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + + return ( testcases ); +} + +function LastIndexOf( string, search, position ) { + string = String( string ); + search = String( search ); + + position = Number( position ) + + if ( isNaN( position ) ) { + position = Infinity; + } else { + position = ToInteger( position ); + } + + result5= string.length; + result6 = Math.min(Math.max(position, 0), result5); + result7 = search.length; + + if (result7 == 0) { + return Math.min(position, result5); + } + + result8 = -1; + + for ( k = 0; k <= result6; k++ ) { + if ( k+ result7 > result5 ) { + break; + } + for ( j = 0; j < result7; j++ ) { + if ( string.charAt(k+j) != search.charAt(j) ){ + break; + } else { + if ( j == result7 -1 ) { + result8 = k; + } + } + } + } + + return result8; +} +function ToInteger( n ) { + n = Number( n ); + if ( isNaN(n) ) { + return 0; + } + if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { + return n; + } + + var sign = ( n < 0 ) ? -1 : 1; + + return ( sign * Math.floor(Math.abs(n)) ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js new file mode 100644 index 0000000..1dddd41 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js @@ -0,0 +1,234 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.8-1.js + ECMA Section: 15.5.4.8 String.prototype.split( separator ) + Description: + + Returns an Array object into which substrings of the result of converting + this object to a string have been stored. The substrings are determined by + searching from left to right for occurrences of the given separator; these + occurrences are not part of any substring in the returned array, but serve + to divide up this string value. The separator may be a string of any length. + + As a special case, if the separator is the empty string, the string is split + up into individual characters; the length of the result array equals the + length of the string, and each substring contains one character. + + If the separator is not supplied, then the result array contains just one + string, which is the string. + + Author: christine@netscape.com, pschwartau@netscape.com + Date: 12 November 1997 + Modified: 14 July 2002 + Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 + ECMA-262 Ed.3 Section 15.5.4.14 + The length property of the split method is 2 +* +*/ + + var SECTION = "15.5.4.8-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.split"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") ); + + // test cases for when split is called with no arguments. + + // this is a string object + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); typeof s.split()", + "object", + eval("var s = new String('this is a string object'); typeof s.split()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()", + "[object Array]", + eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.split().length", + 1, + eval("var s = new String('this is a string object'); s.split().length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.split()[0]", + "this is a string object", + eval("var s = new String('this is a string object'); s.split()[0]") ); + + // this is an object object + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()", + "object", + eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", + "[object Array]", + eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.split = String.prototype.split; obj.split().length", + 1, + eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]", + "[object Object]", + eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") ); + + // this is a function object + array[item++] = new TestCase( SECTION, + "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()", + "object", + eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", + "[object Array]", + eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Function(); obj.split = String.prototype.split; obj.split().length", + 1, + eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]", + "[object Function]", + eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") ); + + // this is a number object + array[item++] = new TestCase( SECTION, + "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()", + "object", + eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", + "[object Array]", + eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length", + 1, + eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]", + "-1e+21", + eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") ); + + + // this is the Math object + array[item++] = new TestCase( SECTION, + "var obj = Math; obj.split = String.prototype.split; typeof obj.split()", + "object", + eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") ); + + array[item++] = new TestCase( SECTION, + "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", + "[object Array]", + eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); + + array[item++] = new TestCase( SECTION, + "var obj = Math; obj.split = String.prototype.split; obj.split().length", + 1, + eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") ); + + array[item++] = new TestCase( SECTION, + "var obj = Math; obj.split = String.prototype.split; obj.split()[0]", + "[object Math]", + eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") ); + + // this is an array object + array[item++] = new TestCase( SECTION, + "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()", + "object", + eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", + "[object Array]", + eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length", + 1, + eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]", + "1,2,3,4,5", + eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") ); + + // this is a Boolean object + + array[item++] = new TestCase( SECTION, + "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()", + "object", + eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", + "[object Array]", + eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length", + 1, + eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") ); + + array[item++] = new TestCase( SECTION, + "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]", + "false", + eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") ); + + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js new file mode 100644 index 0000000..18e41cd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js @@ -0,0 +1,248 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.8-2.js + ECMA Section: 15.5.4.8 String.prototype.split( separator ) + Description: + + Returns an Array object into which substrings of the result of converting + this object to a string have been stored. The substrings are determined by + searching from left to right for occurrences of the given separator; these + occurrences are not part of any substring in the returned array, but serve + to divide up this string value. The separator may be a string of any length. + + As a special case, if the separator is the empty string, the string is split + up into individual characters; the length of the result array equals the + length of the string, and each substring contains one character. + + If the separator is not supplied, then the result array contains just one + string, which is the string. + + When the split method is called with one argument separator, the following steps are taken: + + 1. Call ToString, giving it the this value as its argument. + 2. Create a new Array object of length 0 and call it A. + 3. If separator is not supplied, call the [[Put]] method of A with 0 and + Result(1) as arguments, and then return A. + 4. Call ToString(separator). + 5. Compute the number of characters in Result(1). + 6. Compute the number of characters in the string that is Result(4). + 7. Let p be 0. + 8. If Result(6) is zero (the separator string is empty), go to step 17. + 9. Compute the smallest possible integer k not smaller than p such that + k+Result(6) is not greater than Result(5), and for all nonnegative + integers j less than Result(6), the character at position k+j of + Result(1) is the same as the character at position j of Result(2); + but if there is no such integer k, then go to step 14. + 10. Compute a string value equal to the substring of Result(1), consisting + of the characters at positions p through k1, inclusive. + 11. Call the [[Put]] method of A with A.length and Result(10) as arguments. + 12. Let p be k+Result(6). + 13. Go to step 9. + 14. Compute a string value equal to the substring of Result(1), consisting + of the characters from position p to the end of Result(1). + 15. Call the [[Put]] method of A with A.length and Result(14) as arguments. + 16. Return A. + 17. If p equals Result(5), return A. + 18. Compute a string value equal to the substring of Result(1), consisting of + the single character at position p. + 19. Call the [[Put]] method of A with A.length and Result(18) as arguments. + 20. Increase p by 1. + 21. Go to step 17. + +Note that the split function is intentionally generic; it does not require that its this value be a String +object. Therefore it can be transferred to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.8-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.split"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + // case where separator is the empty string. + + var TEST_STRING = "this is a string object"; + + array[item++] = new TestCase( SECTION, + "var s = new String( "+ TEST_STRING +" ); s.split('').length", + TEST_STRING.length, + eval("var s = new String( TEST_STRING ); s.split('').length") ); + + for ( var i = 0; i < TEST_STRING.length; i++ ) { + + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]", + TEST_STRING.charAt(i), + eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") ); + } + + // case where the value of the separator is undefined. in this case. the value of the separator + // should be ToString( separator ), or "undefined". + + var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject"; + var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); + + array[item++] = new TestCase( SECTION, + "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length", + EXPECT_STRING.length, + eval("var s = new String( TEST_STRING ); s.split(void 0).length") ); + + for ( var i = 0; i < EXPECT_STRING.length; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]", + EXPECT_STRING[i], + eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") ); + } + + // case where the value of the separator is null. in this case the value of the separator is "null". + TEST_STRING = "thisnullisnullanullstringnullobject"; + var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); + + array[item++] = new TestCase( SECTION, + "var s = new String( "+ TEST_STRING +" ); s.split(null).length", + EXPECT_STRING.length, + eval("var s = new String( TEST_STRING ); s.split(null).length") ); + + for ( var i = 0; i < EXPECT_STRING.length; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]", + EXPECT_STRING[i], + eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") ); + } + + // case where the value of the separator is a boolean. + TEST_STRING = "thistrueistrueatruestringtrueobject"; + var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); + + array[item++] = new TestCase( SECTION, + "var s = new String( "+ TEST_STRING +" ); s.split(true).length", + EXPECT_STRING.length, + eval("var s = new String( TEST_STRING ); s.split(true).length") ); + + for ( var i = 0; i < EXPECT_STRING.length; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]", + EXPECT_STRING[i], + eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") ); + } + + // case where the value of the separator is a number + TEST_STRING = "this123is123a123string123object"; + var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); + + array[item++] = new TestCase( SECTION, + "var s = new String( "+ TEST_STRING +" ); s.split(123).length", + EXPECT_STRING.length, + eval("var s = new String( TEST_STRING ); s.split(123).length") ); + + for ( var i = 0; i < EXPECT_STRING.length; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]", + EXPECT_STRING[i], + eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") ); + } + + + // case where the value of the separator is a number + TEST_STRING = "this123is123a123string123object"; + var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); + + array[item++] = new TestCase( SECTION, + "var s = new String( "+ TEST_STRING +" ); s.split(123).length", + EXPECT_STRING.length, + eval("var s = new String( TEST_STRING ); s.split(123).length") ); + + for ( var i = 0; i < EXPECT_STRING.length; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]", + EXPECT_STRING[i], + eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") ); + } + + // case where the separator is not in the string + TEST_STRING = "this is a string"; + EXPECT_STRING = new Array( "this is a string" ); + + array[item++] = new TestCase( SECTION, + "var s = new String( " + TEST_STRING + " ); s.split(':').length", + 1, + eval("var s = new String( TEST_STRING ); s.split(':').length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String( " + TEST_STRING + " ); s.split(':')[0]", + TEST_STRING, + eval("var s = new String( TEST_STRING ); s.split(':')[0]") ); + + // case where part but not all of separator is in the string. + TEST_STRING = "this is a string"; + EXPECT_STRING = new Array( "this is a string" ); + array[item++] = new TestCase( SECTION, + "var s = new String( " + TEST_STRING + " ); s.split('strings').length", + 1, + eval("var s = new String( TEST_STRING ); s.split('strings').length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]", + TEST_STRING, + eval("var s = new String( TEST_STRING ); s.split('strings')[0]") ); + + // case where the separator is at the end of the string + TEST_STRING = "this is a string"; + EXPECT_STRING = new Array( "this is a " ); + array[item++] = new TestCase( SECTION, + "var s = new String( " + TEST_STRING + " ); s.split('string').length", + 2, + eval("var s = new String( TEST_STRING ); s.split('string').length") ); + + for ( var i = 0; i < EXPECT_STRING.length; i++ ) { + array[item++] = new TestCase( SECTION, + "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]", + EXPECT_STRING[i], + eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") ); + } + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js new file mode 100644 index 0000000..d3861bb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js @@ -0,0 +1,205 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.8-3.js + ECMA Section: 15.5.4.8 String.prototype.split( separator ) + Description: + + Returns an Array object into which substrings of the result of converting + this object to a string have been stored. The substrings are determined by + searching from left to right for occurrences of the given separator; these + occurrences are not part of any substring in the returned array, but serve + to divide up this string value. The separator may be a string of any length. + + As a special case, if the separator is the empty string, the string is split + up into individual characters; the length of the result array equals the + length of the string, and each substring contains one character. + + If the separator is not supplied, then the result array contains just one + string, which is the string. + + When the split method is called with one argument separator, the following steps are taken: + + 1. Call ToString, giving it the this value as its argument. + 2. Create a new Array object of length 0 and call it A. + 3. If separator is not supplied, call the [[Put]] method of A with 0 and + Result(1) as arguments, and then return A. + 4. Call ToString(separator). + 5. Compute the number of characters in Result(1). + 6. Compute the number of characters in the string that is Result(4). + 7. Let p be 0. + 8. If Result(6) is zero (the separator string is empty), go to step 17. + 9. Compute the smallest possible integer k not smaller than p such that + k+Result(6) is not greater than Result(5), and for all nonnegative + integers j less than Result(6), the character at position k+j of + Result(1) is the same as the character at position j of Result(2); + but if there is no such integer k, then go to step 14. + 10. Compute a string value equal to the substring of Result(1), consisting + of the characters at positions p through k1, inclusive. + 11. Call the [[Put]] method of A with A.length and Result(10) as arguments. + 12. Let p be k+Result(6). + 13. Go to step 9. + 14. Compute a string value equal to the substring of Result(1), consisting + of the characters from position p to the end of Result(1). + 15. Call the [[Put]] method of A with A.length and Result(14) as arguments. + 16. Return A. + 17. If p equals Result(5), return A. + 18. Compute a string value equal to the substring of Result(1), consisting of + the single character at position p. + 19. Call the [[Put]] method of A with A.length and Result(18) as arguments. + 20. Increase p by 1. + 21. Go to step 17. + +Note that the split function is intentionally generic; it does not require that its this value be a String +object. Therefore it can be transferred to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.8-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.split"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var TEST_STRING = ""; + var EXPECT = new Array(); + + // this.toString is the empty string. + + array[item++] = new TestCase( SECTION, + "var s = new String(); s.split().length", + 1, + eval("var s = new String(); s.split().length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(); s.split()[0]", + "", + eval("var s = new String(); s.split()[0]") ); + + // this.toString() is the empty string, separator is specified. + + array[item++] = new TestCase( SECTION, + "var s = new String(); s.split('').length", + 0, + eval("var s = new String(); s.split('').length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(); s.split(' ').length", + 1, + eval("var s = new String(); s.split(' ').length") ); + + // this to string is " " + array[item++] = new TestCase( SECTION, + "var s = new String(' '); s.split().length", + 1, + eval("var s = new String(' '); s.split().length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(' '); s.split()[0]", + " ", + eval("var s = new String(' '); s.split()[0]") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(' '); s.split('').length", + 1, + eval("var s = new String(' '); s.split('').length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(' '); s.split('')[0]", + " ", + eval("var s = new String(' '); s.split('')[0]") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(' '); s.split(' ').length", + 2, + eval("var s = new String(' '); s.split(' ').length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(' '); s.split(' ')[0]", + "", + eval("var s = new String(' '); s.split(' ')[0]") ); + + array[item++] = new TestCase( SECTION, + "\"\".split(\"\").length", + 0, + ("".split("")).length ); + + array[item++] = new TestCase( SECTION, + "\"\".split(\"x\").length", + 1, + ("".split("x")).length ); + + array[item++] = new TestCase( SECTION, + "\"\".split(\"x\")[0]", + "", + ("".split("x"))[0] ); + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function Split( string, separator ) { + string = String( string ); + + var A = new Array(); + + if ( arguments.length < 2 ) { + A[0] = string; + return A; + } + + separator = String( separator ); + + var str_len = String( string ).length; + var sep_len = String( separator ).length; + + var p = 0; + var k = 0; + + if ( sep_len == 0 ) { + for ( ; p < str_len; p++ ) { + A[A.length] = String( string.charAt(p) ); + } + } + return A; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js new file mode 100644 index 0000000..9ae08dc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js @@ -0,0 +1,202 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.9-1.js + ECMA Section: 15.5.4.9 String.prototype.substring( start ) + Description: + + 15.5.4.9 String.prototype.substring(start) + + Returns a substring of the result of converting this object to a string, + starting from character position start and running to the end of the + string. The result is a string value, not a String object. + + If the argument is NaN or negative, it is replaced with zero; if the + argument is larger than the length of the string, it is replaced with the + length of the string. + + When the substring method is called with one argument start, the following + steps are taken: + + 1.Call ToString, giving it the this value as its argument. + 2.Call ToInteger(start). + 3.Compute the number of characters in Result(1). + 4.Compute min(max(Result(2), 0), Result(3)). + 5.Return a string whose length is the difference between Result(3) and Result(4), + containing characters from Result(1), namely the characters with indices Result(4) + through Result(3)1, in ascending order. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.4.9-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.prototype.substring( start )"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length ); + array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") ); + + // test cases for when substring is called with no arguments. + + // this is a string object + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); typeof s.substring()", + "string", + eval("var s = new String('this is a string object'); typeof s.substring()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(''); s.substring()", + "", + eval("var s = new String(''); s.substring()") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring()", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring()") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(NaN)", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring(NaN)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(-0.01)", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring(-0.01)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(s.length)", + "", + eval("var s = new String('this is a string object'); s.substring(s.length)") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(s.length+1)", + "", + eval("var s = new String('this is a string object'); s.substring(s.length+1)") ); + + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(Infinity)", + "", + eval("var s = new String('this is a string object'); s.substring(Infinity)") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('this is a string object'); s.substring(-Infinity)", + "this is a string object", + eval("var s = new String('this is a string object'); s.substring(-Infinity)") ); + + // this is not a String object, start is not an integer + + + array[item++] = new TestCase( SECTION, + "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()", + "1,2,3,4,5", + eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") ); + + array[item++] = new TestCase( SECTION, + "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)", + ",2,3,4,5", + eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") ); + + array[item++] = new TestCase( SECTION, + "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')", + "3,4,5", + eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") ); + + array[item++] = new TestCase( SECTION, + "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')", + "", + eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") ); + + // this is an object object + array[item++] = new TestCase( SECTION, + "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)", + "Object]", + eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") ); + + // this is a function object + array[item++] = new TestCase( SECTION, + "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)", + "Function]", + eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") ); + // this is a number object + array[item++] = new TestCase( SECTION, + "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)", + "NaN", + eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") ); + + // this is the Math object + array[item++] = new TestCase( SECTION, + "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)", + "ject Math]", + eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") ); + + // this is a Boolean object + + array[item++] = new TestCase( SECTION, + "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())", + "false", + eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") ); + + // this is a user defined object + + array[item++] = new TestCase( SECTION, + "var obj = new MyObject( null ); obj.substring(0)", + "null", + eval( "var obj = new MyObject( null ); obj.substring(0)") ); + + return array; +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.substring = String.prototype.substring; + this.toString = new Function ( "return this.value+''" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js new file mode 100644 index 0000000..3456a09 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.4.js + ECMA Section: 15.5.4 Properties of the String prototype object + + Description: + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var SECTION = "15.5.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the String Prototype objecta"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()", + "[object String]", + eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") ); + + array[item++] = new TestCase( SECTION, "typeof String.prototype", "object", typeof String.prototype ); + array[item++] = new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() ); + array[item++] = new TestCase( SECTION, "String.prototype +''", "", String.prototype + '' ); + array[item++] = new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length ); +// array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ ); + + + return ( array ); +} +function test( array ) { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + + } + + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js new file mode 100644 index 0000000..5f0fe29 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.5.5.1 + ECMA Section: String.length + Description: + + The number of characters in the String value represented by this String + object. + + Once a String object is created, this property is unchanging. It has the + attributes { DontEnum, DontDelete, ReadOnly }. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.5.5.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "String.length"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var s = new String(); s.length", + 0, + eval("var s = new String(); s.length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(); s.length = 10; s.length", + 0, + eval("var s = new String(); s.length = 10; s.length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props", + "", + eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") ); + + array[item++] = new TestCase( SECTION, + "var s = new String(); delete s.length", + false, + eval("var s = new String(); delete s.length") ); + + array[item++] = new TestCase( SECTION, + "var s = new String('hello'); delete s.length; s.length", + 5, + eval("var s = new String('hello'); delete s.length; s.length") ); + return array; + +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js new file mode 100644 index 0000000..c0cb331 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.2.js + ECMA Section: 9.2 Type Conversion: ToBoolean + Description: rules for converting an argument to a boolean. + undefined false + Null false + Boolean input argument( no conversion ) + Number returns false for 0, -0, and NaN + otherwise return true + String return false if the string is empty + (length is 0) otherwise the result is + true + Object all return true + + Author: christine@netscape.com + Date: 14 july 1997 +*/ + var SECTION = "9.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "ToBoolean"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // special cases here + + testcases[tc++] = new TestCase( SECTION, "Boolean()", false, Boolean() ); + testcases[tc++] = new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); + testcases[tc++] = new TestCase( SECTION, "Boolean('')", false, Boolean("") ); + + // normal test cases here + + testcases[tc++] = new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); + testcases[tc++] = new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") ); + testcases[tc++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); + testcases[tc++] = new TestCase( SECTION, "Boolean('string')", true, Boolean("string") ); + + // ToBoolean (object) should always return true. + testcases[tc++] = new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) ); + + testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) ); + + testcases[tc++] = new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) ); + + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) ); + + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) ); + + testcases[tc++] = new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) ); + testcases[tc++] = new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js new file mode 100644 index 0000000..39af328 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.3-1.js + ECMA Section: 9.3 Type Conversion: ToNumber + Description: rules for converting an argument to a number. + see 9.3.1 for cases for converting strings to numbers. + special cases: + undefined NaN + Null NaN + Boolean 1 if true; +0 if false + Number the argument ( no conversion ) + String see test 9.3.1 + Object see test 9.3-1 + + + This tests ToNumber applied to the object type, except + if object is string. See 9.3-2 for + ToNumber( String object). + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + var SECTION = "9.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TYPE = "number"; + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " ToNumber"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + TYPE, + typeof(testcases[tc].actual), + "typeof( " + testcases[tc].description + + " ) = " + typeof(testcases[tc].actual) ) + ? testcases[tc].passed + : false; + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // object is Number + array[item++] = new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) ); + array[item++] = new TestCase( SECTION, "Number(new Number(Number.NaN))",Number.NaN, Number(new Number(Number.NaN)) ); + array[item++] = new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) ); + array[item++] = new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) ); +// array[item++] = new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) ); + array[item++] = new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) ); + array[item++] = new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) ); + + // object is boolean + + array[item++] = new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) ); + + // object is array + array[item++] = new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js new file mode 100644 index 0000000..4cc8ce0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js @@ -0,0 +1,323 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.3.1-1.js + ECMA Section: 9.3 Type Conversion: ToNumber + Description: rules for converting an argument to a number. + see 9.3.1 for cases for converting strings to numbers. + special cases: + undefined NaN + Null NaN + Boolean 1 if true; +0 if false + Number the argument ( no conversion ) + String see test 9.3.1 + Object see test 9.3-1 + + + This tests ToNumber applied to the string type + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + var SECTION = "9.3.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "ToNumber applied to the String type"; + var BUGNUMBER="77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace::: + // + // Name Unicode Value Escape Sequence + // <TAB> 0X0009 \t + // <SP> 0X0020 + // <FF> 0X000C \f + // <VT> 0X000B + // <CR> 0X000D \r + // <LF> 0X000A \n + array[item++] = new TestCase( SECTION, "Number('')", 0, Number("") ); + array[item++] = new TestCase( SECTION, "Number(' ')", 0, Number(" ") ); + array[item++] = new TestCase( SECTION, "Number(\\t)", 0, Number("\t") ); + array[item++] = new TestCase( SECTION, "Number(\\n)", 0, Number("\n") ); + array[item++] = new TestCase( SECTION, "Number(\\r)", 0, Number("\r") ); + array[item++] = new TestCase( SECTION, "Number(\\f)", 0, Number("\f") ); + + array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) ); + + // a StringNumericLiteral may be preceeded or followed by whitespace and/or + // line terminators + + array[item++] = new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) ); + array[item++] = new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) ); + array[item++] = new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) ); + array[item++] = new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) ); + array[item++] = new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) ); + + array[item++] = new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') ); + array[item++] = new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) ); + array[item++] = new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) ); + array[item++] = new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) ); + array[item++] = new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) ); + + array[item++] = new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) ); + array[item++] = new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) ); + array[item++] = new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) ); + array[item++] = new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) ); + + array[item++] = new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') ); + array[item++] = new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') ); + array[item++] = new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') ); + array[item++] = new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') ); + array[item++] = new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') ); + + array[item++] = new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') ); + array[item++] = new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) ); + array[item++] = new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) ); + array[item++] = new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) ); + array[item++] = new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) ); + + array[item++] = new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) ); + array[item++] = new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) ); + array[item++] = new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) ); + array[item++] = new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) ); + + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) ); + + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); + + array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) ); + + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) ); + + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); + + array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) ); + array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) ); + array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) ); + array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) ); + array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) ); + array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) ); + + + // StrNumericLiteral:::StrDecimalLiteral:::Infinity + + array[item++] = new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") ); + array[item++] = new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") ); + array[item++] = new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") ); + + // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt + + array[item++] = new TestCase( SECTION, "Number('0')", 0, Number("0") ); + array[item++] = new TestCase( SECTION, "Number('-0')", -0, Number("-0") ); + array[item++] = new TestCase( SECTION, "Number('+0')", 0, Number("+0") ); + + array[item++] = new TestCase( SECTION, "Number('1')", 1, Number("1") ); + array[item++] = new TestCase( SECTION, "Number('-1')", -1, Number("-1") ); + array[item++] = new TestCase( SECTION, "Number('+1')", 1, Number("+1") ); + + array[item++] = new TestCase( SECTION, "Number('2')", 2, Number("2") ); + array[item++] = new TestCase( SECTION, "Number('-2')", -2, Number("-2") ); + array[item++] = new TestCase( SECTION, "Number('+2')", 2, Number("+2") ); + + array[item++] = new TestCase( SECTION, "Number('3')", 3, Number("3") ); + array[item++] = new TestCase( SECTION, "Number('-3')", -3, Number("-3") ); + array[item++] = new TestCase( SECTION, "Number('+3')", 3, Number("+3") ); + + array[item++] = new TestCase( SECTION, "Number('4')", 4, Number("4") ); + array[item++] = new TestCase( SECTION, "Number('-4')", -4, Number("-4") ); + array[item++] = new TestCase( SECTION, "Number('+4')", 4, Number("+4") ); + + array[item++] = new TestCase( SECTION, "Number('5')", 5, Number("5") ); + array[item++] = new TestCase( SECTION, "Number('-5')", -5, Number("-5") ); + array[item++] = new TestCase( SECTION, "Number('+5')", 5, Number("+5") ); + + array[item++] = new TestCase( SECTION, "Number('6')", 6, Number("6") ); + array[item++] = new TestCase( SECTION, "Number('-6')", -6, Number("-6") ); + array[item++] = new TestCase( SECTION, "Number('+6')", 6, Number("+6") ); + + array[item++] = new TestCase( SECTION, "Number('7')", 7, Number("7") ); + array[item++] = new TestCase( SECTION, "Number('-7')", -7, Number("-7") ); + array[item++] = new TestCase( SECTION, "Number('+7')", 7, Number("+7") ); + + array[item++] = new TestCase( SECTION, "Number('8')", 8, Number("8") ); + array[item++] = new TestCase( SECTION, "Number('-8')", -8, Number("-8") ); + array[item++] = new TestCase( SECTION, "Number('+8')", 8, Number("+8") ); + + array[item++] = new TestCase( SECTION, "Number('9')", 9, Number("9") ); + array[item++] = new TestCase( SECTION, "Number('-9')", -9, Number("-9") ); + array[item++] = new TestCase( SECTION, "Number('+9')", 9, Number("+9") ); + + array[item++] = new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") ); + array[item++] = new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") ); + array[item++] = new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") ); + + array[item++] = new TestCase( SECTION, "Number('3.')", 3, Number("3.") ); + array[item++] = new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") ); + array[item++] = new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") ); + + array[item++] = new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") ); + array[item++] = new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") ); + array[item++] = new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") ); + + array[item++] = new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") ); + array[item++] = new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") ); + array[item++] = new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") ); + + array[item++] = new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") ); + array[item++] = new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") ); + array[item++] = new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") ); + + // StrDecimalLiteral::: .DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") ); + array[item++] = new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") ); + array[item++] = new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") ); + + array[item++] = new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") ); + array[item++] = new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") ); + array[item++] = new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") ); + + array[item++] = new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") ); + array[item++] = new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") ); + array[item++] = new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") ); + + array[item++] = new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") ); + array[item++] = new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") ); + array[item++] = new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") ); + + // StrDecimalLiteral::: DecimalDigits ExponentPart opt + + array[item++] = new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") ); + array[item++] = new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") ); + array[item++] = new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") ); + + array[item++] = new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") ); + array[item++] = new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") ); + array[item++] = new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") ); + + array[item++] = new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") ); + array[item++] = new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") ); + array[item++] = new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") ); + + // StrNumericLiteral::: HexIntegerLiteral + + array[item++] = new TestCase( SECTION, "Number('0x0')", 0, Number("0x0")); + array[item++] = new TestCase( SECTION, "Number('0x1')", 1, Number("0x1")); + array[item++] = new TestCase( SECTION, "Number('0x2')", 2, Number("0x2")); + array[item++] = new TestCase( SECTION, "Number('0x3')", 3, Number("0x3")); + array[item++] = new TestCase( SECTION, "Number('0x4')", 4, Number("0x4")); + array[item++] = new TestCase( SECTION, "Number('0x5')", 5, Number("0x5")); + array[item++] = new TestCase( SECTION, "Number('0x6')", 6, Number("0x6")); + array[item++] = new TestCase( SECTION, "Number('0x7')", 7, Number("0x7")); + array[item++] = new TestCase( SECTION, "Number('0x8')", 8, Number("0x8")); + array[item++] = new TestCase( SECTION, "Number('0x9')", 9, Number("0x9")); + array[item++] = new TestCase( SECTION, "Number('0xa')", 10, Number("0xa")); + array[item++] = new TestCase( SECTION, "Number('0xb')", 11, Number("0xb")); + array[item++] = new TestCase( SECTION, "Number('0xc')", 12, Number("0xc")); + array[item++] = new TestCase( SECTION, "Number('0xd')", 13, Number("0xd")); + array[item++] = new TestCase( SECTION, "Number('0xe')", 14, Number("0xe")); + array[item++] = new TestCase( SECTION, "Number('0xf')", 15, Number("0xf")); + array[item++] = new TestCase( SECTION, "Number('0xA')", 10, Number("0xA")); + array[item++] = new TestCase( SECTION, "Number('0xB')", 11, Number("0xB")); + array[item++] = new TestCase( SECTION, "Number('0xC')", 12, Number("0xC")); + array[item++] = new TestCase( SECTION, "Number('0xD')", 13, Number("0xD")); + array[item++] = new TestCase( SECTION, "Number('0xE')", 14, Number("0xE")); + array[item++] = new TestCase( SECTION, "Number('0xF')", 15, Number("0xF")); + + array[item++] = new TestCase( SECTION, "Number('0X0')", 0, Number("0X0")); + array[item++] = new TestCase( SECTION, "Number('0X1')", 1, Number("0X1")); + array[item++] = new TestCase( SECTION, "Number('0X2')", 2, Number("0X2")); + array[item++] = new TestCase( SECTION, "Number('0X3')", 3, Number("0X3")); + array[item++] = new TestCase( SECTION, "Number('0X4')", 4, Number("0X4")); + array[item++] = new TestCase( SECTION, "Number('0X5')", 5, Number("0X5")); + array[item++] = new TestCase( SECTION, "Number('0X6')", 6, Number("0X6")); + array[item++] = new TestCase( SECTION, "Number('0X7')", 7, Number("0X7")); + array[item++] = new TestCase( SECTION, "Number('0X8')", 8, Number("0X8")); + array[item++] = new TestCase( SECTION, "Number('0X9')", 9, Number("0X9")); + array[item++] = new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa")); + array[item++] = new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb")); + array[item++] = new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc")); + array[item++] = new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd")); + array[item++] = new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe")); + array[item++] = new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf")); + array[item++] = new TestCase( SECTION, "Number('0XA')", 10, Number("0XA")); + array[item++] = new TestCase( SECTION, "Number('0XB')", 11, Number("0XB")); + array[item++] = new TestCase( SECTION, "Number('0XC')", 12, Number("0XC")); + array[item++] = new TestCase( SECTION, "Number('0XD')", 13, Number("0XD")); + array[item++] = new TestCase( SECTION, "Number('0XE')", 14, Number("0XE")); + array[item++] = new TestCase( SECTION, "Number('0XF')", 15, Number("0XF")); + + return ( array ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js new file mode 100644 index 0000000..c675e57 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js @@ -0,0 +1,89 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.3.1-2.js + ECMA Section: 9.3 Type Conversion: ToNumber + Description: rules for converting an argument to a number. + see 9.3.1 for cases for converting strings to numbers. + special cases: + undefined NaN + Null NaN + Boolean 1 if true; +0 if false + Number the argument ( no conversion ) + String see test 9.3.1 + Object see test 9.3-1 + + This tests special cases of ToNumber(string) that are + not covered in 9.3.1-1.js. + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + var SECTION = "9.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "ToNumber applied to the String type"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // A StringNumericLiteral may not use octal notation + + array[item++] = new TestCase( SECTION, "Number(00)", 0, Number("00")); + array[item++] = new TestCase( SECTION, "Number(01)", 1, Number("01")); + array[item++] = new TestCase( SECTION, "Number(02)", 2, Number("02")); + array[item++] = new TestCase( SECTION, "Number(03)", 3, Number("03")); + array[item++] = new TestCase( SECTION, "Number(04)", 4, Number("04")); + array[item++] = new TestCase( SECTION, "Number(05)", 5, Number("05")); + array[item++] = new TestCase( SECTION, "Number(06)", 6, Number("06")); + array[item++] = new TestCase( SECTION, "Number(07)", 7, Number("07")); + array[item++] = new TestCase( SECTION, "Number(010)", 10, Number("010")); + array[item++] = new TestCase( SECTION, "Number(011)", 11, Number("011")); + + // A StringNumericLIteral may have any number of leading 0 digits + + array[item++] = new TestCase( SECTION, "Number(001)", 1, Number("001")); + array[item++] = new TestCase( SECTION, "Number(0001)", 1, Number("0001")); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js new file mode 100644 index 0000000..69407fb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js @@ -0,0 +1,726 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.3.1-3.js + ECMA Section: 9.3 Type Conversion: ToNumber + Description: rules for converting an argument to a number. + see 9.3.1 for cases for converting strings to numbers. + special cases: + undefined NaN + Null NaN + Boolean 1 if true; +0 if false + Number the argument ( no conversion ) + String see test 9.3.1 + Object see test 9.3-1 + + + Test cases provided by waldemar. + + + Author: christine@netscape.com + Date: 10 june 1998 + +*/ + +var SECTION = "9.3.1-3"; +var VERSION = "ECMA_1"; + startTest(); +var BUGNUMBER="129087"; + +var TITLE = "Number To String, String To Number"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcases = new Array(); + + +// test case from http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312954 +var z = 0; + +testcases[tc++] = new TestCase( + SECTION, + "var z = 0; print(1/-z)", + -Infinity, + 1/-z ); + + + + + +// test cases from bug http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122882 + + + +testcases[tc++] = new TestCase( SECTION, + '- -"0x80000000"', + 2147483648, + - -"0x80000000" ); + +testcases[tc++] = new TestCase( SECTION, + '- -"0x100000000"', + 4294967296, + - -"0x100000000" ); + +testcases[tc++] = new TestCase( SECTION, + '- "-0x123456789abcde8"', + 81985529216486880, + - "-0x123456789abcde8" ); + +// Convert some large numbers to string + + +testcases[tc++] = new TestCase( SECTION, + "1e2000 +''", + "Infinity", + 1e2000 +"" ); + +testcases[tc++] = new TestCase( SECTION, + "1e2000", + Infinity, + 1e2000 ); + +testcases[tc++] = new TestCase( SECTION, + "-1e2000 +''", + "-Infinity", + -1e2000 +"" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"1e2000\"", + -Infinity, + -"1e2000" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"-1e2000\" +''", + "Infinity", + -"-1e2000" +"" ); + +testcases[tc++] = new TestCase( SECTION, + "1e-2000", + 0, + 1e-2000 ); + +testcases[tc++] = new TestCase( SECTION, + "1/1e-2000", + Infinity, + 1/1e-2000 ); + +// convert some strings to large numbers + +testcases[tc++] = new TestCase( SECTION, + "1/-1e-2000", + -Infinity, + 1/-1e-2000 ); + +testcases[tc++] = new TestCase( SECTION, + "1/\"1e-2000\"", + Infinity, + 1/"1e-2000" ); + +testcases[tc++] = new TestCase( SECTION, + "1/\"-1e-2000\"", + -Infinity, + 1/"-1e-2000" ); + +testcases[tc++] = new TestCase( SECTION, + "parseFloat(\"1e2000\")", + Infinity, + parseFloat("1e2000") ); + +testcases[tc++] = new TestCase( SECTION, + "parseFloat(\"1e-2000\")", + 0, + parseFloat("1e-2000") ); + +testcases[tc++] = new TestCase( SECTION, + "1.7976931348623157E+308", + 1.7976931348623157e+308, + 1.7976931348623157E+308 ); + +testcases[tc++] = new TestCase( SECTION, + "1.7976931348623158e+308", + 1.7976931348623157e+308, + 1.7976931348623158e+308 ); + +testcases[tc++] = new TestCase( SECTION, + "1.7976931348623159e+308", + Infinity, + 1.7976931348623159e+308 ); + +s = +"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068"; + +testcases[tc++] = new TestCase( SECTION, + "s = " + s +"; s +="+ +"\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+ + ++"; s", +"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779", +s += +"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779" +); + +s1 = s+1; + +testcases[tc++] = new TestCase( SECTION, +"s1 = s+1; s1", +"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791", +s1 ); + +/***** This answer is preferred but -Infinity is also acceptable here *****/ + +testcases[tc++] = new TestCase( SECTION, +"-s1 == Infinity || s1 == 1.7976931348623157e+308", +true, +-s1 == Infinity || s1 == 1.7976931348623157e+308 ); + +s2 = s + 2; + +testcases[tc++] = new TestCase( SECTION, +"s2 = s+2; s2", +"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792", +s2 ); + +// ***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here ***** +testcases[tc++] = new TestCase( SECTION, +"-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ", +true, +-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ); + +s3 = s+3; + +testcases[tc++] = new TestCase( SECTION, +"s3 = s+3; s3", +"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793", +s3 ); + +//***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here ***** + +testcases[tc++] = new TestCase( SECTION, +"-s3 == -Infinity || -s3 == -1.7976931348623157e+308", +true, +-s3 == -Infinity || -s3 == -1.7976931348623157e+308 ); + + +//***** This answer is preferred but Infinity is also acceptable here ***** + +testcases[tc++] = new TestCase( SECTION, +"parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity", +true, +parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity ); + +//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here ***** +testcases[tc++] = new TestCase( SECTION, +"parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308", +true , +parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 ); + +//***** This answer is preferred but Infinity is also acceptable here ***** + +testcases[tc++] = new TestCase( SECTION, +"parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity", +true, +parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity); + +//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here ***** +testcases[tc++] = new TestCase( SECTION, +"parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308", +true, +parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 ); + +testcases[tc++] = new TestCase( SECTION, + "0x12345678", + 305419896, + 0x12345678 ); + +testcases[tc++] = new TestCase( SECTION, + "0x80000000", + 2147483648, + 0x80000000 ); + +testcases[tc++] = new TestCase( SECTION, + "0xffffffff", + 4294967295, + 0xffffffff ); + +testcases[tc++] = new TestCase( SECTION, + "0x100000000", + 4294967296, + 0x100000000 ); + +testcases[tc++] = new TestCase( SECTION, + "077777777777777777", + 2251799813685247, + 077777777777777777 ); + +testcases[tc++] = new TestCase( SECTION, + "077777777777777776", + 2251799813685246, + 077777777777777776 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1fffffffffffff", + 9007199254740991, + 0x1fffffffffffff ); + +testcases[tc++] = new TestCase( SECTION, + "0x20000000000000", + 9007199254740992, + 0x20000000000000 ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abc", + 9027215253084860, + 0x20123456789abc ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abd", + 9027215253084860, + 0x20123456789abd ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abe", + 9027215253084862, + 0x20123456789abe ); + +testcases[tc++] = new TestCase( SECTION, + "0x20123456789abf", + 9027215253084864, + 0x20123456789abf ); + +/***** These test the round-to-nearest-or-even-if-equally-close rule *****/ + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000080", + 1152921504606847000, + 0x1000000000000080 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000081", + 1152921504606847200, + 0x1000000000000081 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000100", + 1152921504606847200, + 0x1000000000000100 ); +testcases[tc++] = new TestCase( SECTION, + "0x100000000000017f", + 1152921504606847200, + 0x100000000000017f ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000180", + 1152921504606847500, + 0x1000000000000180 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000181", + 1152921504606847500, + 0x1000000000000181 ); + +testcases[tc++] = new TestCase( SECTION, + "0x10000000000001f0", + 1152921504606847500, + 0x10000000000001f0 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000200", + 1152921504606847500, + 0x1000000000000200 ); + +testcases[tc++] = new TestCase( SECTION, + "0x100000000000027f", + 1152921504606847500, + 0x100000000000027f ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000280", + 1152921504606847500, + 0x1000000000000280 ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000281", + 1152921504606847700, + 0x1000000000000281 ); + +testcases[tc++] = new TestCase( SECTION, + "0x10000000000002ff", + 1152921504606847700, + 0x10000000000002ff ); + +testcases[tc++] = new TestCase( SECTION, + "0x1000000000000300", + 1152921504606847700, + 0x1000000000000300 ); + +testcases[tc++] = new TestCase( SECTION, + "0x10000000000000000", + 18446744073709552000, + 0x10000000000000000 ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)", +9027215253084860, +parseInt("000000100000000100100011010001010110011110001001101010111100",2) ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)", +9027215253084860, +parseInt("000000100000000100100011010001010110011110001001101010111101",2) ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)", +9027215253084864, +parseInt("000000100000000100100011010001010110011110001001101010111111",2) ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)", +18054430506169720, +parseInt("0000001000000001001000110100010101100111100010011010101111010",2)); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)", +18054430506169724, +parseInt("0000001000000001001000110100010101100111100010011010101111011",2) ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)", +18054430506169724, +parseInt("0000001000000001001000110100010101100111100010011010101111100",2)); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)", +18054430506169728, +parseInt("0000001000000001001000110100010101100111100010011010101111110",2)); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"yz\",35)", + 34, + parseInt("yz",35) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"yz\",36)", + 1259, + parseInt("yz",36) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"yz\",37)", + NaN, + parseInt("yz",37) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"+77\")", + 77, + parseInt("+77") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"-77\",9)", + -70, + parseInt("-77",9) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"\\u20001234\\u2000\")", + 1234, + parseInt("\u20001234\u2000") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"123456789012345678\")", + 123456789012345680, + parseInt("123456789012345678") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"9\",8)", + NaN, + parseInt("9",8) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"1e2\")", + 1, + parseInt("1e2") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"1.9999999999999999999\")", + 1, + parseInt("1.9999999999999999999") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"0x10\")", + 16, + parseInt("0x10") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"0x10\",10)", + 0, + parseInt("0x10",10) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"0022\")", + 18, + parseInt("0022") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"0022\",10)", + 22, + parseInt("0022",10) ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"0x1000000000000080\")", + 1152921504606847000, + parseInt("0x1000000000000080") ); + +testcases[tc++] = new TestCase( SECTION, + "parseInt(\"0x1000000000000081\")", + 1152921504606847200, + parseInt("0x1000000000000081") ); + +s = +"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +testcases[tc++] = new TestCase( SECTION, "s = "+ +"\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ +"s", +"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", +s ); + + +testcases[tc++] = new TestCase( SECTION, "s +="+ +"\"0000000000000000000000000000000000000\"; s", +"0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", +s += "0000000000000000000000000000000000000" ); + +testcases[tc++] = new TestCase( SECTION, "-s", +-1.7976931348623157e+308, +-s ); + +s = +"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +testcases[tc++] = new TestCase( SECTION, "s ="+ +"\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ +"s", +"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", +s ); + +testcases[tc++] = new TestCase( SECTION, +"s += \"0000000000000000000000000000000000001\"", +"0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", +s += "0000000000000000000000000000000000001" ); + +testcases[tc++] = new TestCase( SECTION, +"-s", +-1.7976931348623157e+308, +-s ); + +s = +"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +testcases[tc++] = new TestCase( SECTION, +"s ="+ +"\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ +"s", +"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", +s ); + + +testcases[tc++] = new TestCase( SECTION, +"s += \"0000000000000000000000000000000000000\"", +"0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", +s += "0000000000000000000000000000000000000"); + + +testcases[tc++] = new TestCase( SECTION, +"-s", +-Infinity, +-s ); + +s = +"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +testcases[tc++] = new TestCase( SECTION, +"s = "+ +"\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s", +"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", +s); + +testcases[tc++] = new TestCase( SECTION, +"s += \"0000000000000000000000000000000000001\"", +"0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", +s += "0000000000000000000000000000000000001" ); + +testcases[tc++] = new TestCase( SECTION, +"-s", +-1.7976931348623157e+308, +-s ); + +testcases[tc++] = new TestCase( SECTION, +"s += \"0\"", +"0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010", +s += "0" ); + +testcases[tc++] = new TestCase( SECTION, +"-s", +-Infinity, +-s ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(s)", +Infinity, +parseInt(s) ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(s,32)", +0, +parseInt(s,32) ); + +testcases[tc++] = new TestCase( SECTION, +"parseInt(s,36)", +Infinity, +parseInt(s,36) ); + +testcases[tc++] = new TestCase( SECTION, + "-\"\"", + 0, + -"" ); + +testcases[tc++] = new TestCase( SECTION, + "-\" \"", + 0, + -" " ); + +testcases[tc++] = new TestCase( SECTION, + "-\"999\"", + -999, + -"999" ); + +testcases[tc++] = new TestCase( SECTION, + "-\" 999\"", + -999, + -" 999" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"\\t999\"", + -999, + -"\t999" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"013 \"", + -13, + -"013 " ); + +testcases[tc++] = new TestCase( SECTION, + "-\"999\\t\"", + -999, + -"999\t" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"-Infinity\"", + Infinity, + -"-Infinity" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"-infinity\"", + NaN, + -"-infinity" ); + + +testcases[tc++] = new TestCase( SECTION, + "-\"+Infinity\"", + -Infinity, + -"+Infinity" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"+Infiniti\"", + NaN, + -"+Infiniti" ); + +testcases[tc++] = new TestCase( SECTION, + "- -\"0x80000000\"", + 2147483648, + - -"0x80000000" ); + +testcases[tc++] = new TestCase( SECTION, + "- -\"0x100000000\"", + 4294967296, + - -"0x100000000" ); + +testcases[tc++] = new TestCase( SECTION, + "- \"-0x123456789abcde8\"", + 81985529216486880, + - "-0x123456789abcde8" ); + +// the following two tests are not strictly ECMA 1.0 + +testcases[tc++] = new TestCase( SECTION, + "-\"\\u20001234\\u2001\"", + -1234, + -"\u20001234\u2001" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"\\u20001234\\0\"", + NaN, + -"\u20001234\0" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"0x10\"", + -16, + -"0x10" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"+\"", + NaN, + -"+" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"-\"", + NaN, + -"-" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"-0-\"", + NaN, + -"-0-" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"1e-\"", + NaN, + -"1e-" ); + +testcases[tc++] = new TestCase( SECTION, + "-\"1e-1\"", + -0.1, + -"1e-1" ); + +test(); + +function test(){ + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js new file mode 100644 index 0000000..4645692 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js @@ -0,0 +1,89 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.3.js + ECMA Section: 9.3 Type Conversion: ToNumber + Description: rules for converting an argument to a number. + see 9.3.1 for cases for converting strings to numbers. + special cases: + undefined NaN + Null NaN + Boolean 1 if true; +0 if false + Number the argument ( no conversion ) + String see test 9.3.1 + Object see test 9.3-1 + + For ToNumber applied to the String type, see test 9.3.1. + For ToNumber applied to the object type, see test 9.3-1. + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + var SECTION = "9.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "ToNumber"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // special cases here + + array[item++] = new TestCase( SECTION, "Number()", 0, Number() ); + array[item++] = new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) ); + array[item++] = new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); + array[item++] = new TestCase( SECTION, "Number(null)", 0, Number(null) ); + array[item++] = new TestCase( SECTION, "Number(true)", 1, Number(true) ); + array[item++] = new TestCase( SECTION, "Number(false)", 0, Number(false) ); + array[item++] = new TestCase( SECTION, "Number(0)", 0, Number(0) ); + array[item++] = new TestCase( SECTION, "Number(-0)", -0, Number(-0) ); + array[item++] = new TestCase( SECTION, "Number(1)", 1, Number(1) ); + array[item++] = new TestCase( SECTION, "Number(-1)", -1, Number(-1) ); + array[item++] = new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) ); + + array[item++] = new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js new file mode 100644 index 0000000..4dd331d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.4-1.js + ECMA Section: 9.4 ToInteger + Description: 1. Call ToNumber on the input argument + 2. If Result(1) is NaN, return +0 + 3. If Result(1) is +0, -0, Infinity, or -Infinity, + return Result(1). + 4. Compute sign(Result(1)) * floor(abs(Result(1))). + 5. Return Result(4). + + To test ToInteger, this test uses new Date(value), + 15.9.3.7. The Date constructor sets the [[Value]] + property of the new object to TimeClip(value), which + uses the rules: + + TimeClip(time) + 1. If time is not finite, return NaN + 2. If abs(Result(1)) > 8.64e15, return NaN + 3. Return an implementation dependent choice of either + ToInteger(Result(2)) or ToInteger(Result(2)) + (+0) + (Adding a positive 0 converts -0 to +0). + + This tests ToInteger for values -8.64e15 > value > 8.64e15, + not including -0 and +0. + + For additional special cases (0, +0, Infinity, -Infinity, + and NaN, see 9.4-2.js). For value is String, see 9.4-3.js. + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + var SECTION = "9.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "ToInteger"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // some special cases + + array[item++] = new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) ); + array[item++] = new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") ); + + // value is not an integer + + array[item++] = new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") ); + + array[item++] = new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") ); + + // value is not a number + + array[item++] = new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) ); + array[item++] = new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") ); + + array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); + + // edge cases + array[item++] = new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js new file mode 100644 index 0000000..4dd331d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.4-1.js + ECMA Section: 9.4 ToInteger + Description: 1. Call ToNumber on the input argument + 2. If Result(1) is NaN, return +0 + 3. If Result(1) is +0, -0, Infinity, or -Infinity, + return Result(1). + 4. Compute sign(Result(1)) * floor(abs(Result(1))). + 5. Return Result(4). + + To test ToInteger, this test uses new Date(value), + 15.9.3.7. The Date constructor sets the [[Value]] + property of the new object to TimeClip(value), which + uses the rules: + + TimeClip(time) + 1. If time is not finite, return NaN + 2. If abs(Result(1)) > 8.64e15, return NaN + 3. Return an implementation dependent choice of either + ToInteger(Result(2)) or ToInteger(Result(2)) + (+0) + (Adding a positive 0 converts -0 to +0). + + This tests ToInteger for values -8.64e15 > value > 8.64e15, + not including -0 and +0. + + For additional special cases (0, +0, Infinity, -Infinity, + and NaN, see 9.4-2.js). For value is String, see 9.4-3.js. + + Author: christine@netscape.com + Date: 10 july 1997 + +*/ + var SECTION = "9.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "ToInteger"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + // some special cases + + array[item++] = new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) ); + array[item++] = new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") ); + + // value is not an integer + + array[item++] = new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") ); + + array[item++] = new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") ); + + // value is not a number + + array[item++] = new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) ); + array[item++] = new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") ); + + array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); + + // edge cases + array[item++] = new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") ); + array[item++] = new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js new file mode 100644 index 0000000..598cce7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js @@ -0,0 +1,171 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.5-2.js + ECMA Section: 9.5 Type Conversion: ToInt32 + Description: rules for converting an argument to a signed 32 bit integer + + this test uses << 0 to convert the argument to a 32bit + integer. + + The operator ToInt32 converts its argument to one of 2^32 + integer values in the range -2^31 through 2^31 inclusive. + This operator functions as follows: + + 1 call ToNumber on argument + 2 if result is NaN, 0, -0, return 0 + 3 compute (sign (result(1)) * floor(abs(result 1))) + 4 compute result(3) modulo 2^32: + 5 if result(4) is greater than or equal to 2^31, return + result(5)-2^32. otherwise, return result(5) + + special cases: + -0 returns 0 + Infinity returns 0 + -Infinity returns 0 + ToInt32(ToUint32(x)) == ToInt32(x) for all values of x + Numbers greater than 2^31 (see step 5 above) + (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083) + + Author: christine@netscape.com + Date: 17 july 1997 +*/ + var SECTION = "9.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " ToInt32"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function ToInt32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + + n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); + if ( sign == -1 ) { + n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n; + } else{ + n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; + } + + return ( n ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "0 << 0", 0, 0 << 0 ); + array[item++] = new TestCase( SECTION, "-0 << 0", 0, -0 << 0 ); + array[item++] = new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 ); + array[item++] = new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 ); + array[item++] = new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 ); + + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 ); + array[item++] = new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 ); + array[item++] = new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 ); + array[item++] = new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 ); + array[item++] = new TestCase( SECTION, "1 << 0", 1, 1 << 0 ); + array[item++] = new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 ); + array[item++] = new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 ); + + + array[item++] = new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 ); + array[item++] = new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 ); + array[item++] = new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 ); + + array[item++] = new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 ); + array[item++] = new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 ); + array[item++] = new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 ); + + array[item++] = new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 ); + array[item++] = new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 ); + array[item++] = new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 ); + + array[item++] = new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 ); + array[item++] = new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 ); + array[item++] = new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 ); + + array[item++] = new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 ); + array[item++] = new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 ); + array[item++] = new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 ); + + array[item++] = new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 ); + array[item++] = new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 ); + array[item++] = new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 ); + + array[item++] = new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 ); + array[item++] = new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 ); + array[item++] = new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 ); + + array[item++] = new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 ); + array[item++] = new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 ); + array[item++] = new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 ); + + /* + * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction) + * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083) + */ + array[item++] = new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 ); + array[item++] = new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 ); + array[item++] = new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 ); + array[item++] = new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 ); + array[item++] = new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 ); + array[item++] = new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 ); + array[item++] = new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 ); + array[item++] = new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 ); + array[item++] = new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 ); + + /* + * Numbers between - 2^31 and - 2^32 + */ + array[item++] = new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 ); + array[item++] = new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 ); + array[item++] = new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 ); + array[item++] = new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 ); + array[item++] = new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 ); + array[item++] = new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 ); + array[item++] = new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 ); + array[item++] = new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 ); + array[item++] = new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js new file mode 100644 index 0000000..c4c3bff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js @@ -0,0 +1,139 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.6.js + ECMA Section: 9.6 Type Conversion: ToUint32 + Description: rules for converting an argument to an unsigned + 32 bit integer + + this test uses >>> 0 to convert the argument to + an unsigned 32bit integer. + + 1 call ToNumber on argument + 2 if result is NaN, 0, -0, Infinity, -Infinity + return 0 + 3 compute (sign (result(1)) * floor(abs(result 1))) + 4 compute result(3) modulo 2^32: + 5 return result(4) + + special cases: + -0 returns 0 + Infinity returns 0 + -Infinity returns 0 + 0 returns 0 + ToInt32(ToUint32(x)) == ToInt32(x) for all values of x + ** NEED TO DO THIS PART IN A SEPARATE TEST FILE ** + + + Author: christine@netscape.com + Date: 17 july 1997 +*/ + + var SECTION = "9.6"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Type Conversion: ToUint32"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 ); +// array[item++] = new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0); + array[item++] = new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 ); + array[item++] = new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 ); + array[item++] = new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0); + array[item++] = new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 ); + array[item++] = new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 ); + + array[item++] = new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 ); + array[item++] = new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 ); + array[item++] = new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 ); + array[item++] = new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 ); + array[item++] = new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 ); + array[item++] = new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 ); + + array[item++] = new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 ); + array[item++] = new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 ); + + array[item++] = new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 ); + array[item++] = new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 ); + array[item++] = new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 ); + + array[item++] = new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 ); + array[item++] = new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 ); + array[item++] = new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 ); + + array[item++] = new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 ); + array[item++] = new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 ); + array[item++] = new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 ); + + array[item++] = new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 ); + array[item++] = new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 ); + array[item++] = new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 ); + + array[item++] = new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 ); + array[item++] = new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 ); + array[item++] = new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 ); + + array[item++] = new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 ); + array[item++] = new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 ); + array[item++] = new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 ); + + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js new file mode 100644 index 0000000..60322d4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js @@ -0,0 +1,158 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.7.js + ECMA Section: 9.7 Type Conversion: ToInt16 + Description: rules for converting an argument to an unsigned + 16 bit integer in the range 0 to 2^16-1. + + this test uses String.prototype.fromCharCode() and + String.prototype.charCodeAt() to test ToInt16. + + special cases: + -0 returns 0 + Infinity returns 0 + -Infinity returns 0 + 0 returns 0 + + Author: christine@netscape.com + Date: 17 july 1997 +*/ + var SECTION = "9.7"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Type Conversion: ToInt16"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function ToInt16( num ) { + num = Number( num ); + if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) { + return 0; + } + + var sign = ( num < 0 ) ? -1 : 1; + + num = sign * Math.floor( Math.abs( num ) ); + + num = num % Math.pow(2,16); + + num = ( num > -65536 && num < 0) ? 65536 + num : num; + + return num; +} + +function getTestCases() { + var array = new Array(); + var item = 0; +/* + array[item++] = new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) ); +*/ + + + array[item++] = new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) ); + + array[item++] = new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) ); + array[item++] = new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) ); + + +// array[item++] = new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) ); + + + +// the following test cases cause a runtime error. see: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=78878 + +// array[item++] = new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) ); +// array[item++] = new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) ); +// array[item++] = new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) ); +// array[item++] = new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) ); +// array[item++] = new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) ); + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js new file mode 100644 index 0000000..38cbb0a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js @@ -0,0 +1,166 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.8.1.js + ECMA Section: 9.8.1 ToString Applied to the Number Type + Description: The operator ToString convers a number m to string + as follows: + + 1. if m is NaN, return the string "NaN" + 2. if m is +0 or -0, return the string "0" + 3. if m is less than zero, return the string + concatenation of the string "-" and ToString(-m). + 4. If m is Infinity, return the string "Infinity". + 5. Otherwise, let n, k, and s be integers such that + k >= 1, 10k1 <= s < 10k, the number value for s10nk + is m, and k is as small as possible. Note that k is + the number of digits in the decimal representation + of s, that s is not divisible by 10, and that the + least significant digit of s is not necessarily + uniquely determined by these criteria. + 6. If k <= n <= 21, return the string consisting of the + k digits of the decimal representation of s (in order, + with no leading zeroes), followed by n-k occurences + of the character '0'. + 7. If 0 < n <= 21, return the string consisting of the + most significant n digits of the decimal + representation of s, followed by a decimal point + '.', followed by the remaining kn digits of the + decimal representation of s. + 8. If 6 < n <= 0, return the string consisting of the + character '0', followed by a decimal point '.', + followed by n occurences of the character '0', + followed by the k digits of the decimal + representation of s. + 9. Otherwise, if k = 1, return the string consisting + of the single digit of s, followed by lowercase + character 'e', followed by a plus sign '+' or minus + sign '' according to whether n1 is positive or + negative, followed by the decimal representation + of the integer abs(n1) (with no leading zeros). + 10. Return the string consisting of the most significant + digit of the decimal representation of s, followed + by a decimal point '.', followed by the remaining k1 + digits of the decimal representation of s, followed + by the lowercase character 'e', followed by a plus + sign '+' or minus sign '' according to whether n1 is + positive or negative, followed by the decimal + representation of the integer abs(n1) (with no + leading zeros). + + Note that if x is any number value other than 0, then + ToNumber(ToString(x)) is exactly the same number value as x. + + As noted, the least significant digit of s is not always + uniquely determined by the requirements listed in step 5. + The following specification for step 5 was considered, but + not adopted: + + Author: christine@netscape.com + Date: 10 july 1997 +*/ + + var SECTION = "9.8.1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " ToString applied to the Number type"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" ); + array[item++] = new TestCase( SECTION, "0", "0", 0 + "" ); + array[item++] = new TestCase( SECTION, "-0", "0", -0 + "" ); + array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" ); + array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" ); + array[item++] = new TestCase( SECTION, "-1", "-1", -1 + "" ); + + // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21 + + array[item++] = new TestCase( SECTION, "1", "1", 1 + "" ); + array[item++] = new TestCase( SECTION, "10", "10", 10 + "" ); + array[item++] = new TestCase( SECTION, "100", "100", 100 + "" ); + array[item++] = new TestCase( SECTION, "1000", "1000", 1000 + "" ); + array[item++] = new TestCase( SECTION, "10000", "10000", 10000 + "" ); + array[item++] = new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" ); + array[item++] = new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" ); + array[item++] = new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" ); + + array[item++] = new TestCase( SECTION, "12345", "12345", 12345 + "" ); + array[item++] = new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" ); + + array[item++] = new TestCase( SECTION, "-1", "-1", -1 + "" ); + array[item++] = new TestCase( SECTION, "-10", "-10", -10 + "" ); + array[item++] = new TestCase( SECTION, "-100", "-100", -100 + "" ); + array[item++] = new TestCase( SECTION, "-1000", "-1000", -1000 + "" ); + array[item++] = new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" ); + array[item++] = new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" ); + array[item++] = new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" ); + array[item++] = new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" ); + + array[item++] = new TestCase( SECTION, "-12345", "-12345", -12345 + "" ); + array[item++] = new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" ); + + // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21, + array[item++] = new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" ); + + // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0 + + // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6 + + array[item++] = new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" ); + array[item++] = new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" ); + + // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6 + + array[item++] = new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345)); + array[item++] = new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 )); + + + array[item++] = new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) ); + array[item++] = new TestCase( SECTION, ".012345", "0.012345", String(.012345) ); + array[item++] = new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) ); + array[item++] = new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) ); + array[item++] = new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) ); + array[item++] = new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) ); + array[item++] = new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345)); + + array[item++] = new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) ); + return ( array ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js new file mode 100644 index 0000000..0df39f3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js @@ -0,0 +1,143 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 9.9-1.js + ECMA Section: 9.9 Type Conversion: ToObject + Description: + + undefined generate a runtime error + null generate a runtime error + boolean create a new Boolean object whose default + value is the value of the boolean. + number Create a new Number object whose default + value is the value of the number. + string Create a new String object whose default + value is the value of the string. + object Return the input argument (no conversion). + Author: christine@netscape.com + Date: 17 july 1997 +*/ + + var VERSION = "ECMA_1"; + startTest(); + var SECTION = "9.9-1"; + + writeHeaderToLog( SECTION + " Type Conversion: ToObject" ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) ); + array[item++] = new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) ); + array[item++] = new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) ); + array[item++] = new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) ); + array[item++] = new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) ); + array[item++] = new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) ); + array[item++] = new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) ); + array[item++] = new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) ); + array[item++] = new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) ); + array[item++] = new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) ); + array[item++] = new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") ); + array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ ); + + array[item++] = new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") ); + array[item++] = new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") ); + array[item++] = new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += + ( testcases[tc].passed ) ? "" : "wrong value "; + + } + stopTest(); + + // all tests must return an array of TestCase objects + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.valueOf = new Function ( "return this.value" ); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js new file mode 100644 index 0000000..efc4792 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 8.1.js + ECMA Section: The undefined type + Description: + + The Undefined type has exactly one value, called undefined. Any variable + that has not been assigned a value is of type Undefined. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "8.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The undefined type"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "var x; typeof x", + "undefined", + eval("var x; typeof x") ); + + testcases[tc++] = new TestCase( SECTION, + "var x; typeof x == 'undefined", + true, + eval("var x; typeof x == 'undefined'") ); + + testcases[tc++] = new TestCase( SECTION, + "var x; x == void 0", + true, + eval("var x; x == void 0") ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js new file mode 100644 index 0000000..c18f744 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js @@ -0,0 +1,125 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 8.4.js + ECMA Section: The String type + Description: + + The String type is the set of all finite ordered sequences of zero or more + Unicode characters. Each character is regarded as occupying a position + within the sequence. These positions are identified by nonnegative + integers. The leftmost character (if any) is at position 0, the next + character (if any) at position 1, and so on. The length of a string is the + number of distinct positions within it. The empty string has length zero + and therefore contains no characters. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "8.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The String type"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "var s = ''; s.length", + 0, + eval("var s = ''; s.length") ); + + testcases[tc++] = new TestCase( SECTION, + "var s = ''; s.charAt(0)", + "", + eval("var s = ''; s.charAt(0)") ); + + + for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) { + TEST_STRING += ("\\u"+ DecimalToHexString( i ) ); + EXPECT_STRING += String.fromCharCode(i); + } + + testcases[tc++] = new TestCase( SECTION, + "var s = '" + TEST_STRING+ "'; s", + EXPECT_STRING, + eval("var s = '" + TEST_STRING+ "'; s") ); + + testcases[tc++] = new TestCase( SECTION, + "var s = '" + TEST_STRING+ "'; s.length", + 0x007B-0x0041, + eval("var s = '" + TEST_STRING+ "'; s.length") ); + + test(); +function DecimalToHexString( n ) { + n = Number( n ); + var h = ""; + + for ( var i = 3; i >= 0; i-- ) { + if ( n >= Math.pow(16, i) ){ + var t = Math.floor( n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { + h += "A"; + } + if ( t == 11 ) { + h += "B"; + } + if ( t == 12 ) { + h += "C"; + } + if ( t == 13 ) { + h += "D"; + } + if ( t == 14 ) { + h += "E"; + } + if ( t == 15 ) { + h += "F"; + } + } else { + h += String( t ); + } + } else { + h += "0"; + } + } + + return h; +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js new file mode 100644 index 0000000..05b9400 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 8.6.2.1-1.js + ECMA Section: 8.6.2.1 Get (Value) + Description: + + When the [[Get]] method of O is called with property name P, the following + steps are taken: + + 1. If O doesn't have a property with name P, go to step 4. + 2. Get the value of the property. + 3. Return Result(2). + 4. If the [[Prototype]] of O is null, return undefined. + 5. Call the [[Get]] method of [[Prototype]] with property name P. + 6. Return Result(5). + + This tests [[Get]] (Value). + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "8.6.2.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " [[Get]] (Value)"); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") ); +// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); + + array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); +// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); + + array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") ); +// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") ); + array[item++] = new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") ); + + return ( array ); +} +function MyProtoValuelessObject(value) { + this.valueOf = new Function ( "" ); + this.__proto__ = null; +} + +function MyProtolessObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.__proto__ = null; + this.value = value; +} +function MyValuelessObject(value) { + this.__proto__ = new MyPrototypeObject(value); +} +function MyPrototypeObject(value) { + this.valueOf = new Function( "return this.value;" ); + this.toString = new Function( "return (this.value + '');" ); + this.value = value; +} +function MyObject( value ) { + this.valueOf = new Function( "return this.value" ); + this.value = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/browser.js b/Source/JavaScriptCore/tests/mozilla/ecma/browser.js new file mode 100644 index 0000000..5bbdf7c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/browser.js @@ -0,0 +1,80 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/* + * JavaScript test library shared functions file for running the tests + * in the browser. Overrides the shell's print function with document.write + * and make everything HTML pretty. + * + * To run the tests in the browser, use the mkhtml.pl script to generate + * html pages that include the shell.js, browser.js (this file), and the + * test js file in script tags. + * + * The source of the page that is generated should look something like this: + * <script src="./../shell.js"></script> + * <script src="./../browser.js"></script> + * <script src="./mytest.js"></script> + */ + +onerror = err; + +function startTest() { + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + +function writeLineToLog( string ) { + document.write( string + "<br>\n"); +} +function writeHeaderToLog( string ) { + document.write( "<h2>" + string + "</h2>" ); +} +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } + document.write( "<hr>" ); +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = "<tt>"+ string ; + s += "<b>" ; + s += ( passed ) ? "<font color=#009900> " + PASSED + : "<font color=#aa0000> " + FAILED + expect + "</tt>"; + writeLineToLog( s + "</font></b></tt>" ); + return passed; +} +function err( msg, page, line ) { + writeLineToLog( "Test failed with the message: " + msg ); + + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/jsref.js b/Source/JavaScriptCore/tests/mozilla/ecma/jsref.js new file mode 100644 index 0000000..51b5a83 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/jsref.js @@ -0,0 +1,669 @@ +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; +TITLE = ""; + +/* + * constant strings + */ +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; +var DEBUG = false; + +TZ_DIFF = -8; + +var TT = ""; +var TT_ = ""; +var BR = ""; +var NBSP = " "; +var CR = "\n"; +var FONT = ""; +var FONT_ = ""; +var FONT_RED = ""; +var FONT_GREEN = ""; +var B = ""; +var B_ = "" +var H2 = ""; +var H2_ = ""; +var HR = ""; +var DEBUG = false; + +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} + +/* + * Set up test environment. + * + */ +function startTest() { + if ( version ) { + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.3" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.2" ) { + version ( "120" ); + } + if ( VERSION == "JS_1.1" ) { + version ( "110" ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). + } + + // print out bugnumber + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + + +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = TT + string ; + + for ( k = 0; + k < (60 - string.length >= 0 ? 60 - string.length : 5) ; + k++ ) { + } + + s += B ; + s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; + + writeLineToLog( s + FONT_ + B_ + TT_ ); + + return passed; +} + +function writeLineToLog( string ) { + print( string + BR + CR ); +} +function writeHeaderToLog( string ) { + print( H2 + string + H2_ ); +} +function stopTest() +{ + var sizeTag = "<#TEST CASES SIZE>"; + var doneTag = "<#TEST CASES DONE>"; + var beginTag = "<#TEST CASE "; + var endTag = ">"; + + print(sizeTag); + print(testcases.length); + for (tc = 0; tc < testcases.length; tc++) + { + print(beginTag + 'PASSED' + endTag); + print(testcases[tc].passed); + print(beginTag + 'NAME' + endTag); + print(testcases[tc].name); + print(beginTag + 'EXPECTED' + endTag); + print(testcases[tc].expect); + print(beginTag + 'ACTUAL' + endTag); + print(testcases[tc].actual); + print(beginTag + 'DESCRIPTION' + endTag); + print(testcases[tc].description); + print(beginTag + 'REASON' + endTag); + print(( testcases[tc].passed ) ? "" : "wrong value "); + print(beginTag + 'BUGNUMBER' + endTag); + print( BUGNUMBER ); + } + print(doneTag); + print( HR ); + gc(); +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} +function err( msg, page, line ) { + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} + +/** + * Type Conversion functions used by Type Conversion + * + */ + + + + /* + * Date functions used by tests in Date suite + * + */ +var msPerDay = 86400000; +var HoursPerDay = 24; +var MinutesPerHour = 60; +var SecondsPerMinute = 60; +var msPerSecond = 1000; +var msPerMinute = 60000; // msPerSecond * SecondsPerMinute +var msPerHour = 3600000; // msPerMinute * MinutesPerHour + +var TIME_1970 = 0; +var TIME_2000 = 946684800000; +var TIME_1900 = -2208988800000; + +function Day( t ) { + return ( Math.floor(t/msPerDay ) ); +} +function DaysInYear( y ) { + if ( y % 4 != 0 ) { + return 365; + } + if ( (y % 4 == 0) && (y % 100 != 0) ) { + return 366; + } + if ( (y % 100 == 0) && (y % 400 != 0) ) { + return 365; + } + if ( (y % 400 == 0) ){ + return 366; + } else { + return "ERROR: DaysInYear(" + y + ") case not covered"; + } +} +function TimeInYear( y ) { + return ( DaysInYear(y) * msPerDay ); +} +function DayNumber( t ) { + return ( Math.floor( t / msPerDay ) ); +} +function TimeWithinDay( t ) { + if ( t < 0 ) { + return ( (t % msPerDay) + msPerDay ); + } else { + return ( t % msPerDay ); + } +} +function YearNumber( t ) { +} +function TimeFromYear( y ) { + return ( msPerDay * DayFromYear(y) ); +} +function DayFromYear( y ) { + return ( 365*(y-1970) + + Math.floor((y-1969)/4) - + Math.floor((y-1901)/100) + + Math.floor((y-1601)/400) ); +} +function InLeapYear( t ) { + if ( DaysInYear(YearFromTime(t)) == 365 ) { + return 0; + } + if ( DaysInYear(YearFromTime(t)) == 366 ) { + return 1; + } else { + return "ERROR: InLeapYear("+t+") case not covered"; + } +} +function YearFromTime( t ) { + t = Number( t ); + var sign = ( t < 0 ) ? -1 : 1; + var year = ( sign < 0 ) ? 1969 : 1970; + for ( var timeToTimeZero = t; ; ) { + // subtract the current year's time from the time that's left. + timeToTimeZero -= sign * TimeInYear(year) + + // if there's less than the current year's worth of time left, then break. + if ( sign < 0 ) { + if ( sign * timeToTimeZero <= 0 ) { + break; + } else { + year += sign; + } + } else { + if ( sign * timeToTimeZero < 0 ) { + break; + } else { + year += sign; + } + } + } + return ( year ); +} +function MonthFromTime( t ) { + // i know i could use switch but i'd rather not until it's part of ECMA + var day = DayWithinYear( t ); + var leap = InLeapYear(t); + + if ( (0 <= day) && (day < 31) ) { + return 0; + } + if ( (31 <= day) && (day < (59+leap)) ) { + return 1; + } + if ( ((59+leap) <= day) && (day < (90+leap)) ) { + return 2; + } + if ( ((90+leap) <= day) && (day < (120+leap)) ) { + return 3; + } + if ( ((120+leap) <= day) && (day < (151+leap)) ) { + return 4; + } + if ( ((151+leap) <= day) && (day < (181+leap)) ) { + return 5; + } + if ( ((181+leap) <= day) && (day < (212+leap)) ) { + return 6; + } + if ( ((212+leap) <= day) && (day < (243+leap)) ) { + return 7; + } + if ( ((243+leap) <= day) && (day < (273+leap)) ) { + return 8; + } + if ( ((273+leap) <= day) && (day < (304+leap)) ) { + return 9; + } + if ( ((304+leap) <= day) && (day < (334+leap)) ) { + return 10; + } + if ( ((334+leap) <= day) && (day < (365+leap)) ) { + return 11; + } else { + return "ERROR: MonthFromTime("+t+") not known"; + } +} +function DayWithinYear( t ) { + return( Day(t) - DayFromYear(YearFromTime(t))); +} +function DateFromTime( t ) { + var day = DayWithinYear(t); + var month = MonthFromTime(t); + + if ( month == 0 ) { + return ( day + 1 ); + } + if ( month == 1 ) { + return ( day - 30 ); + } + if ( month == 2 ) { + return ( day - 58 - InLeapYear(t) ); + } + if ( month == 3 ) { + return ( day - 89 - InLeapYear(t)); + } + if ( month == 4 ) { + return ( day - 119 - InLeapYear(t)); + } + if ( month == 5 ) { + return ( day - 150- InLeapYear(t)); + } + if ( month == 6 ) { + return ( day - 180- InLeapYear(t)); + } + if ( month == 7 ) { + return ( day - 211- InLeapYear(t)); + } + if ( month == 8 ) { + return ( day - 242- InLeapYear(t)); + } + if ( month == 9 ) { + return ( day - 272- InLeapYear(t)); + } + if ( month == 10 ) { + return ( day - 303- InLeapYear(t)); + } + if ( month == 11 ) { + return ( day - 333- InLeapYear(t)); + } + + return ("ERROR: DateFromTime("+t+") not known" ); +} +function WeekDay( t ) { + var weekday = (Day(t)+4) % 7; + return( weekday < 0 ? 7 + weekday : weekday ); +} + +// missing daylight savins time adjustment + +function HourFromTime( t ) { + var h = Math.floor( t / msPerHour ) % HoursPerDay; + return ( (h<0) ? HoursPerDay + h : h ); +} +function MinFromTime( t ) { + var min = Math.floor( t / msPerMinute ) % MinutesPerHour; + return( ( min < 0 ) ? MinutesPerHour + min : min ); +} +function SecFromTime( t ) { + var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute; + return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); +} +function msFromTime( t ) { + var ms = t % msPerSecond; + return ( (ms < 0 ) ? msPerSecond + ms : ms ); +} +function LocalTZA() { + return ( TZ_DIFF * msPerHour ); +} +function UTC( t ) { + return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); +} +function DaylightSavingTA( t ) { + t = t - LocalTZA(); + + var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour; + var dst_end = GetFirstSundayInNovember(t)+ 2*msPerHour; + + if ( t >= dst_start && t < dst_end ) { + return msPerHour; + } else { + return 0; + } + + // Daylight Savings Time starts on the first Sunday in April at 2:00AM in + // PST. Other time zones will need to override this function. + + print( new Date( UTC(dst_start + LocalTZA())) ); + + return UTC(dst_start + LocalTZA()); +} +function GetFirstSundayInApril( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + + TimeInMonth(2,leap); + + for ( var first_sunday = april; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + + return first_sunday; +} +function GetLastSundayInOctober( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { + oct += TimeInMonth(m, leap); + } + for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; + last_sunday -= msPerDay ) + { + ; + } + return last_sunday; +} + +// Added these two functions because DST rules changed for the US. +function GetSecondSundayInMarch( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap); + + var sundayCount = 0; + var flag = true; + for ( var second_sunday = march; flag; second_sunday += msPerDay ) + { + if (WeekDay(second_sunday) == 0) { + if(++sundayCount == 2) + flag = false; + } + } + + return second_sunday; +} +function GetFirstSundayInNovember( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) { + nov += TimeInMonth(m, leap); + } + for ( var first_sunday = nov; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + return first_sunday; +} +function LocalTime( t ) { + return ( t + LocalTZA() + DaylightSavingTA(t) ); +} +function MakeTime( hour, min, sec, ms ) { + if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { + return Number.NaN; + } + + hour = ToInteger(hour); + min = ToInteger( min); + sec = ToInteger( sec); + ms = ToInteger( ms ); + + return( (hour*msPerHour) + (min*msPerMinute) + + (sec*msPerSecond) + ms ); +} +function MakeDay( year, month, date ) { + if ( isNaN(year) || isNaN(month) || isNaN(date) ) { + return Number.NaN; + } + year = ToInteger(year); + month = ToInteger(month); + date = ToInteger(date ); + + var sign = ( year < 1970 ) ? -1 : 1; + var t = ( year < 1970 ) ? 1 : 0; + var y = ( year < 1970 ) ? 1969 : 1970; + + var result5 = year + Math.floor( month/12 ); + var result6 = month % 12; + + if ( year < 1970 ) { + for ( y = 1969; y >= year; y += sign ) { + t += sign * TimeInYear(y); + } + } else { + for ( y = 1970 ; y < year; y += sign ) { + t += sign * TimeInYear(y); + } + } + + var leap = InLeapYear( t ); + + for ( var m = 0; m < month; m++ ) { + t += TimeInMonth( m, leap ); + } + + if ( YearFromTime(t) != result5 ) { + return Number.NaN; + } + if ( MonthFromTime(t) != result6 ) { + return Number.NaN; + } + if ( DateFromTime(t) != 1 ) { + return Number.NaN; + } + + return ( (Day(t)) + date - 1 ); +} +function TimeInMonth( month, leap ) { + // september april june november + // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 + // aug 7 sep 8 oct 9 nov 10 dec 11 + + if ( month == 3 || month == 5 || month == 8 || month == 10 ) { + return ( 30*msPerDay ); + } + + // all the rest + if ( month == 0 || month == 2 || month == 4 || month == 6 || + month == 7 || month == 9 || month == 11 ) { + return ( 31*msPerDay ); + } + + // save february + return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); +} +function MakeDate( day, time ) { + if ( day == Number.POSITIVE_INFINITY || + day == Number.NEGATIVE_INFINITY || + day == Number.NaN ) { + return Number.NaN; + } + if ( time == Number.POSITIVE_INFINITY || + time == Number.POSITIVE_INFINITY || + day == Number.NaN) { + return Number.NaN; + } + return ( day * msPerDay ) + time; +} +function TimeClip( t ) { + if ( isNaN( t ) ) { + return ( Number.NaN ); + } + if ( Math.abs( t ) > 8.64e15 ) { + return ( Number.NaN ); + } + + return ( ToInteger( t ) ); +} +function ToInteger( t ) { + t = Number( t ); + + if ( isNaN( t ) ){ + return ( Number.NaN ); + } + if ( t == 0 || t == -0 || + t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { + return 0; + } + + var sign = ( t < 0 ) ? -1 : 1; + + return ( sign * Math.floor( Math.abs( t ) ) ); +} +function Enumerate ( o ) { + var properties = new Array(); + for ( p in o ) { + properties[ properties.length ] = new Array( p, o[p] ); + } + return properties; +} +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma/shell.js new file mode 100644 index 0000000..1c82aed --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma/shell.js @@ -0,0 +1,712 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/* + * JavaScript shared functions file for running the tests in either + * stand-alone JavaScript engine. To run a test, first load this file, + * then load the test script. + */ + +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; + +/* + * constant strings + */ +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +var DEBUG = false; + + + +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + +/* + * TestCase constructor + * + */ + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} + +/* + * Set up test environment. + * + */ +function startTest() { + if ( version ) { + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.3" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.2" ) { + version ( "120" ); + } + if ( VERSION == "JS_1.1" ) { + version ( "110" ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). + } + + // print out bugnumber + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +/* + * Compare expected result to the actual result and figure out whether + * the test case passed. + */ +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} + +/* + * Begin printing functions. These functions use the shell's + * print function. When running tests in the browser, these + * functions, override these functions with functions that use + * document.write. + */ + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +/* end of print functions */ + + +/* + * When running in the shell, run the garbage collector after the + * test has completed. + */ + +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } +} + +/* + * Convenience function for displaying failed test cases. Useful + * when running tests manually. + * + */ +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} + /* + * Date functions used by tests in Date suite + * + */ +var msPerDay = 86400000; +var HoursPerDay = 24; +var MinutesPerHour = 60; +var SecondsPerMinute = 60; +var msPerSecond = 1000; +var msPerMinute = 60000; // msPerSecond * SecondsPerMinute +var msPerHour = 3600000; // msPerMinute * MinutesPerHour +var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC +var TZ_PST = -8; // offset of Pacific Standard Time from UTC +var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST +var TIME_1970 = 0; +var TIME_2000 = 946684800000; +var TIME_1900 = -2208988800000; +var TIME_YEAR_0 = -62167219200000; + + +/* + * Originally, the test suite used a hard-coded value TZ_DIFF = -8. + * But that was only valid for testers in the Pacific Standard Time Zone! + * We calculate the proper number dynamically for any tester. We just + * have to be careful not to use a date subject to Daylight Savings Time... +*/ +function getTimeZoneDiff() +{ + return -((new Date(2000, 1, 1)).getTimezoneOffset())/60; +} + + +/* + * Date test "ResultArrays" are hard-coded for Pacific Standard Time. + * We must adjust them for the tester's own timezone - + */ +function adjustResultArray(ResultArray, msMode) +{ + // If the tester's system clock is in PST, no need to continue - + if (!PST_DIFF) {return;} + + /* The date testcases instantiate Date objects in two different ways: + * + * millisecond mode: e.g. dt = new Date(10000000); + * year-month-day mode: dt = new Date(2000, 5, 1, ...); + * + * In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC). + * In the second case, it is measured with reference to the tester's local timezone. + * + * In the first case we must correct those values expected for local measurements, + * like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc. + * + * In the second case, it is exactly the other way around - + */ + if (msMode) + { + // The hard-coded UTC milliseconds from Time 0 derives from a UTC date. + // Shift to the right by the offset between UTC and the tester. + var t = ResultArray[TIME] + TZ_DIFF*msPerHour; + + // Use our date arithmetic functions to determine the local hour, day, etc. + ResultArray[HOURS] = HourFromTime(t); + ResultArray[DAY] = WeekDay(t); + ResultArray[DATE] = DateFromTime(t); + ResultArray[MONTH] = MonthFromTime(t); + ResultArray[YEAR] = YearFromTime(t); + } + else + { + // The hard-coded UTC milliseconds from Time 0 derives from a PST date. + // Shift to the left by the offset between PST and the tester. + var t = ResultArray[TIME] - PST_DIFF*msPerHour; + + // Use our date arithmetic functions to determine the UTC hour, day, etc. + ResultArray[TIME] = t; + ResultArray[UTC_HOURS] = HourFromTime(t); + ResultArray[UTC_DAY] = WeekDay(t); + ResultArray[UTC_DATE] = DateFromTime(t); + ResultArray[UTC_MONTH] = MonthFromTime(t); + ResultArray[UTC_YEAR] = YearFromTime(t); + } +} + + +function Day( t ) { + return ( Math.floor(t/msPerDay ) ); +} +function DaysInYear( y ) { + if ( y % 4 != 0 ) { + return 365; + } + if ( (y % 4 == 0) && (y % 100 != 0) ) { + return 366; + } + if ( (y % 100 == 0) && (y % 400 != 0) ) { + return 365; + } + if ( (y % 400 == 0) ){ + return 366; + } else { + return "ERROR: DaysInYear(" + y + ") case not covered"; + } +} +function TimeInYear( y ) { + return ( DaysInYear(y) * msPerDay ); +} +function DayNumber( t ) { + return ( Math.floor( t / msPerDay ) ); +} +function TimeWithinDay( t ) { + if ( t < 0 ) { + return ( (t % msPerDay) + msPerDay ); + } else { + return ( t % msPerDay ); + } +} +function YearNumber( t ) { +} +function TimeFromYear( y ) { + return ( msPerDay * DayFromYear(y) ); +} +function DayFromYear( y ) { + return ( 365*(y-1970) + + Math.floor((y-1969)/4) - + Math.floor((y-1901)/100) + + Math.floor((y-1601)/400) ); +} +function InLeapYear( t ) { + if ( DaysInYear(YearFromTime(t)) == 365 ) { + return 0; + } + if ( DaysInYear(YearFromTime(t)) == 366 ) { + return 1; + } else { + return "ERROR: InLeapYear("+ t + ") case not covered"; + } +} +function YearFromTime( t ) { + t = Number( t ); + var sign = ( t < 0 ) ? -1 : 1; + var year = ( sign < 0 ) ? 1969 : 1970; + for ( var timeToTimeZero = t; ; ) { + // subtract the current year's time from the time that's left. + timeToTimeZero -= sign * TimeInYear(year) + + // if there's less than the current year's worth of time left, then break. + if ( sign < 0 ) { + if ( sign * timeToTimeZero <= 0 ) { + break; + } else { + year += sign; + } + } else { + if ( sign * timeToTimeZero < 0 ) { + break; + } else { + year += sign; + } + } + } + return ( year ); +} +function MonthFromTime( t ) { + // i know i could use switch but i'd rather not until it's part of ECMA + var day = DayWithinYear( t ); + var leap = InLeapYear(t); + + if ( (0 <= day) && (day < 31) ) { + return 0; + } + if ( (31 <= day) && (day < (59+leap)) ) { + return 1; + } + if ( ((59+leap) <= day) && (day < (90+leap)) ) { + return 2; + } + if ( ((90+leap) <= day) && (day < (120+leap)) ) { + return 3; + } + if ( ((120+leap) <= day) && (day < (151+leap)) ) { + return 4; + } + if ( ((151+leap) <= day) && (day < (181+leap)) ) { + return 5; + } + if ( ((181+leap) <= day) && (day < (212+leap)) ) { + return 6; + } + if ( ((212+leap) <= day) && (day < (243+leap)) ) { + return 7; + } + if ( ((243+leap) <= day) && (day < (273+leap)) ) { + return 8; + } + if ( ((273+leap) <= day) && (day < (304+leap)) ) { + return 9; + } + if ( ((304+leap) <= day) && (day < (334+leap)) ) { + return 10; + } + if ( ((334+leap) <= day) && (day < (365+leap)) ) { + return 11; + } else { + return "ERROR: MonthFromTime("+t+") not known"; + } +} +function DayWithinYear( t ) { + return( Day(t) - DayFromYear(YearFromTime(t))); +} +function DateFromTime( t ) { + var day = DayWithinYear(t); + var month = MonthFromTime(t); + + if ( month == 0 ) { + return ( day + 1 ); + } + if ( month == 1 ) { + return ( day - 30 ); + } + if ( month == 2 ) { + return ( day - 58 - InLeapYear(t) ); + } + if ( month == 3 ) { + return ( day - 89 - InLeapYear(t)); + } + if ( month == 4 ) { + return ( day - 119 - InLeapYear(t)); + } + if ( month == 5 ) { + return ( day - 150- InLeapYear(t)); + } + if ( month == 6 ) { + return ( day - 180- InLeapYear(t)); + } + if ( month == 7 ) { + return ( day - 211- InLeapYear(t)); + } + if ( month == 8 ) { + return ( day - 242- InLeapYear(t)); + } + if ( month == 9 ) { + return ( day - 272- InLeapYear(t)); + } + if ( month == 10 ) { + return ( day - 303- InLeapYear(t)); + } + if ( month == 11 ) { + return ( day - 333- InLeapYear(t)); + } + + return ("ERROR: DateFromTime("+t+") not known" ); +} +function WeekDay( t ) { + var weekday = (Day(t)+4) % 7; + return( weekday < 0 ? 7 + weekday : weekday ); +} + +// missing daylight savins time adjustment + +function HourFromTime( t ) { + var h = Math.floor( t / msPerHour ) % HoursPerDay; + return ( (h<0) ? HoursPerDay + h : h ); +} +function MinFromTime( t ) { + var min = Math.floor( t / msPerMinute ) % MinutesPerHour; + return( ( min < 0 ) ? MinutesPerHour + min : min ); +} +function SecFromTime( t ) { + var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute; + return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); +} +function msFromTime( t ) { + var ms = t % msPerSecond; + return ( (ms < 0 ) ? msPerSecond + ms : ms ); +} +function LocalTZA() { + return ( TZ_DIFF * msPerHour ); +} +function UTC( t ) { + return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); +} + +function DaylightSavingTA( t ) { + t = t - LocalTZA(); + + var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour; + var dst_end = GetFirstSundayInNovember(t)+ 2*msPerHour; + + if ( t >= dst_start && t < dst_end ) { + return msPerHour; + } else { + return 0; + } + + // Daylight Savings Time starts on the first Sunday in April at 2:00AM in + // PST. Other time zones will need to override this function. + + print( new Date( UTC(dst_start + LocalTZA())) ); + + return UTC(dst_start + LocalTZA()); +} + +function GetFirstSundayInApril( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + + TimeInMonth(2,leap); + + for ( var first_sunday = april; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + + return first_sunday; +} +function GetLastSundayInOctober( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { + oct += TimeInMonth(m, leap); + } + for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; + last_sunday -= msPerDay ) + { + ; + } + return last_sunday; +} + +// Added these two functions because DST rules changed for the US. +function GetSecondSundayInMarch( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap); + + var sundayCount = 0; + var flag = true; + for ( var second_sunday = march; flag; second_sunday += msPerDay ) + { + if (WeekDay(second_sunday) == 0) { + if(++sundayCount == 2) + flag = false; + } + } + + return second_sunday; +} +function GetFirstSundayInNovember( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) { + nov += TimeInMonth(m, leap); + } + for ( var first_sunday = nov; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + return first_sunday; +} +function LocalTime( t ) { + return ( t + LocalTZA() + DaylightSavingTA(t) ); +} +function MakeTime( hour, min, sec, ms ) { + if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { + return Number.NaN; + } + + hour = ToInteger(hour); + min = ToInteger( min); + sec = ToInteger( sec); + ms = ToInteger( ms ); + + return( (hour*msPerHour) + (min*msPerMinute) + + (sec*msPerSecond) + ms ); +} +function MakeDay( year, month, date ) { + if ( isNaN(year) || isNaN(month) || isNaN(date) ) { + return Number.NaN; + } + year = ToInteger(year); + month = ToInteger(month); + date = ToInteger(date ); + + var sign = ( year < 1970 ) ? -1 : 1; + var t = ( year < 1970 ) ? 1 : 0; + var y = ( year < 1970 ) ? 1969 : 1970; + + var result5 = year + Math.floor( month/12 ); + var result6 = month % 12; + + if ( year < 1970 ) { + for ( y = 1969; y >= year; y += sign ) { + t += sign * TimeInYear(y); + } + } else { + for ( y = 1970 ; y < year; y += sign ) { + t += sign * TimeInYear(y); + } + } + + var leap = InLeapYear( t ); + + for ( var m = 0; m < month; m++ ) { + t += TimeInMonth( m, leap ); + } + + if ( YearFromTime(t) != result5 ) { + return Number.NaN; + } + if ( MonthFromTime(t) != result6 ) { + return Number.NaN; + } + if ( DateFromTime(t) != 1 ) { + return Number.NaN; + } + + return ( (Day(t)) + date - 1 ); +} +function TimeInMonth( month, leap ) { + // september april june november + // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 + // aug 7 sep 8 oct 9 nov 10 dec 11 + + if ( month == 3 || month == 5 || month == 8 || month == 10 ) { + return ( 30*msPerDay ); + } + + // all the rest + if ( month == 0 || month == 2 || month == 4 || month == 6 || + month == 7 || month == 9 || month == 11 ) { + return ( 31*msPerDay ); + } + + // save february + return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); +} +function MakeDate( day, time ) { + if ( day == Number.POSITIVE_INFINITY || + day == Number.NEGATIVE_INFINITY || + day == Number.NaN ) { + return Number.NaN; + } + if ( time == Number.POSITIVE_INFINITY || + time == Number.POSITIVE_INFINITY || + day == Number.NaN) { + return Number.NaN; + } + return ( day * msPerDay ) + time; +} +function TimeClip( t ) { + if ( isNaN( t ) ) { + return ( Number.NaN ); + } + if ( Math.abs( t ) > 8.64e15 ) { + return ( Number.NaN ); + } + + return ( ToInteger( t ) ); +} +function ToInteger( t ) { + t = Number( t ); + + if ( isNaN( t ) ){ + return ( Number.NaN ); + } + if ( t == 0 || t == -0 || + t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { + return 0; + } + + var sign = ( t < 0 ) ? -1 : 1; + + return ( sign * Math.floor( Math.abs( t ) ) ); +} +function Enumerate ( o ) { + var p; + for ( p in o ) { + print( p +": " + o[p] ); + } +} + +/* these functions are useful for running tests manually in Rhino */ + +function GetContext() { + return Packages.com.netscape.javascript.Context.getCurrentContext(); +} +function OptLevel( i ) { + i = Number(i); + var cx = GetContext(); + cx.setOptimizationLevel(i); +} +/* end of Rhino functions */ diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js new file mode 100644 index 0000000..1645ad4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js @@ -0,0 +1,43 @@ +/** + File Name: boolean-001.js + Description: Corresponds to ecma/Boolean/15.6.4.2-4-n.js + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + var SECTION = "boolean-001.js"; + var VERSION = "JS1_4"; + var TITLE = "Boolean.prototype.toString()"; + startTest(); + writeHeaderToLog( SECTION +" "+ TITLE ); + + var tc = 0; + var testcases = new Array(); + + var exception = "No exception thrown"; + var result = "Failed"; + + var TO_STRING = Boolean.prototype.toString; + + try { + var s = new String("Not a Boolean"); + s.toString = TO_STRING; + s.toString(); + } catch ( e ) { + result = "Passed!"; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "Assigning Boolean.prototype.toString to a String object "+ + "(threw " +exception +")", + "Passed!", + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js new file mode 100644 index 0000000..be31b99 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js @@ -0,0 +1,47 @@ +/** + File Name: boolean-001.js + Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js + + 15.6.4.3 Boolean.prototype.valueOf() + Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 09 september 1998 +*/ + var SECTION = "boolean-002.js"; + var VERSION = "JS1_4"; + var TITLE = "Boolean.prototype.valueOf()"; + startTest(); + writeHeaderToLog( SECTION +" "+ TITLE ); + + var tc = 0; + var testcases = new Array(); + + var exception = "No exception thrown"; + var result = "Failed"; + + var VALUE_OF = Boolean.prototype.valueOf; + + try { + var s = new String("Not a Boolean"); + s.valueOf = VALUE_0F; + s.valueOf(); + } catch ( e ) { + result = "Passed!"; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "Assigning Boolean.prototype.valueOf to a String object "+ + "(threw " +exception +")", + "Passed!", + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js new file mode 100644 index 0000000..60ef3a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js @@ -0,0 +1,57 @@ +/** + File Name: date-001.js + Corresponds To: 15.9.5.2-2.js + ECMA Section: 15.9.5.2 Date.prototype.toString + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the Date in a + convenient, human-readable form in the current time zone. + + The toString function is not generic; it generates a runtime error if its + this value is not a Date object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + + This verifies that calling toString on an object that is not a string + generates a runtime error. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "date-001"; + var VERSION = "JS1_4"; + var TITLE = "Date.prototype.toString"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var OBJ = new MyObject( new Date(0) ); + result = OBJ.toString(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + this.toString = Date.prototype.toString; + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js new file mode 100644 index 0000000..6fd5a64 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js @@ -0,0 +1,51 @@ +/** + File Name: date-002.js + Corresponds To: 15.9.5.23-3-n.js + ECMA Section: 15.9.5.23 + Description: Date.prototype.setTime + + 1. If the this value is not a Date object, generate a runtime error. + 2. Call ToNumber(time). + 3. Call TimeClip(Result(1)). + 4. Set the [[Value]] property of the this value to Result(2). + 5. Return the value of the [[Value]] property of the this value. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "date-002"; + var VERSION = "JS1_4"; + var TITLE = "Date.prototype.setTime()"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var MYDATE = new MyDate(); + result = MYDATE.setTime(0); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "MYDATE = new MyDate(); MYDATE.setTime(0)" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyDate(value) { + this.value = value; + this.setTime = Date.prototype.setTime; + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js new file mode 100644 index 0000000..b675fdd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js @@ -0,0 +1,53 @@ +/** + File Name: date-003.js + Corresponds To 15.9.5.3-1.js + ECMA Section: 15.9.5.3-1 Date.prototype.valueOf + Description: + + The valueOf function returns a number, which is this time value. + + The valueOf function is not generic; it generates a runtime error if + its this value is not a Date object. Therefore it cannot be transferred + to other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "date-003"; + var VERSION = "JS1_4"; + var TITLE = "Date.prototype.valueOf"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var OBJ = new MyObject( new Date(0) ); + result = OBJ.valueOf(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyObject( value ) { + this.value = value; + this.valueOf = Date.prototype.valueOf; +// The following line causes an infinte loop +// this.toString = new Function( "return this+\"\";"); + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js new file mode 100644 index 0000000..fc2e419 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js @@ -0,0 +1,47 @@ +/** + File Name: date-004.js + Corresponds To: 15.9.5.4-2-n.js + ECMA Section: 15.9.5.4-1 Date.prototype.getTime + Description: + + 1. If the this value is not an object whose [[Class]] property is "Date", + generate a runtime error. + 2. Return this time value. + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "date-004"; + var VERSION = "JS1_4"; + var TITLE = "Date.prototype.getTime"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var MYDATE = new MyDate(); + result = MYDATE.getTime(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "MYDATE = new MyDate(); MYDATE.getTime()" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyDate( value ) { + this.value = value; + this.getTime = Date.prototype.getTime; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js new file mode 100644 index 0000000..eeeaa86 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js @@ -0,0 +1,42 @@ +/** + * File Name: exception-001 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * Call error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-001"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: CallError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + Call_1(); + + test(); + + function Call_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + Math(); + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "Math() [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js new file mode 100644 index 0000000..680fcbf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js @@ -0,0 +1,42 @@ +/** + * File Name: exception-002 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * Construct error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-002"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: ConstructError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + Construct_1(); + + test(); + + function Construct_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + result = new Math(); + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "new Math() [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js new file mode 100644 index 0000000..d073fbc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js @@ -0,0 +1,46 @@ +/** + * File Name: exception-003 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * Target error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-003"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: TargetError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + Target_1(); + + test(); + + function Target_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + string = new String("hi"); + string.toString = Boolean.prototype.toString; + string.toString(); + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "string = new String(\"hi\");"+ + "string.toString = Boolean.prototype.toString" + + "string.toString() [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js new file mode 100644 index 0000000..1fde959 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js @@ -0,0 +1,42 @@ +/** + * File Name: exception-004 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * ToObject error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-004"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + ToObject_1(); + + test(); + + function ToObject_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + result = foo["bar"]; + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "foo[\"bar\"] [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js new file mode 100644 index 0000000..2fbb984 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js @@ -0,0 +1,42 @@ +/** + * File Name: exception-005 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * ToObject error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-005"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + ToObject_1(); + + test(); + + function ToObject_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + result = foo["bar"]; + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "foo[\"bar\"] [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js new file mode 100644 index 0000000..583e976 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js @@ -0,0 +1,53 @@ +/** + * File Name: exception-006 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * ToPrimitive error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-006"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: TypeError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + ToPrimitive_1(); + + test(); + + + /** + * Getting the [[DefaultValue]] of any instances of MyObject + * should result in a runtime error in ToPrimitive. + */ + + function MyObject() { + this.toString = void 0; + this.valueOf = void 0; + } + + function ToPrimitive_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + result = new MyObject() + new MyObject(); + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "new MyObject() + new MyObject() [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js new file mode 100644 index 0000000..e26a40e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js @@ -0,0 +1,54 @@ +/** + * File Name: exception-007 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * DefaultValue error. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-007"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: TypeError"; + var BUGNUMBER="318250"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DefaultValue_1(); + + test(); + + + /** + * Getting the [[DefaultValue]] of any instances of MyObject + * should result in a runtime error in ToPrimitive. + */ + + function MyObject() { + this.toString = void 0; + this.valueOf = new Object(); + } + + function DefaultValue_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + result = new MyObject() + new MyObject(); + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "new MyObject() + new MyObject() [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js new file mode 100644 index 0000000..797f125 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js @@ -0,0 +1,41 @@ +/** + * File Name: exception-008 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * SyntaxError. + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-008"; + var VERSION = "js1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + Syntax_1(); + + test(); + + function Syntax_1() { + result = "failed: no exception thrown"; + exception = null; + + try { + result = eval("continue;"); + } catch ( e ) { + result = "passed: threw exception", + exception = e.toString(); + } finally { + testcases[tc++] = new TestCase( + SECTION, + "eval(\"continue\") [ exception is " + exception +" ]", + "passed: threw exception", + result ); + } + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js new file mode 100644 index 0000000..b153532 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js @@ -0,0 +1,50 @@ +/** + * File Name: exception-009 + * ECMA Section: + * Description: Tests for JavaScript Standard Exceptions + * + * Regression test for nested try blocks. + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312964 + * + * Author: christine@netscape.com + * Date: 31 August 1998 + */ + var SECTION = "exception-009"; + var VERSION = "JS1_4"; + var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError"; + var BUGNUMBER= "312964"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + try { + expect = "passed: no exception thrown"; + result = expect; + Nested_1(); + } catch ( e ) { + result = "failed: threw " + e; + } finally { + testcases[tc++] = new TestCase( + SECTION, + "nested try", + expect, + result ); + } + + + test(); + + function Nested_1() { + try { + try { + } catch (a) { + } finally { + } + } catch (b) { + } finally { + } + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js new file mode 100644 index 0000000..3b4ec82 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + print ("Null throw test."); + print ("BUGNUMBER: 21799"); + + throw null; + + print ("FAILED!: Should have exited with uncaught exception."); + +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js new file mode 100644 index 0000000..9088420 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + print ("Undefined throw test."); + + throw (void 0); + + print ("FAILED!: Should have exited with uncaught exception."); + +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js new file mode 100644 index 0000000..b1baf6f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js @@ -0,0 +1,47 @@ +/** + File Name: expression-001.js + Corresponds to: ecma/Expressions/11.12-2-n.js + ECMA Section: 11.12 + Description: + + The grammar for a ConditionalExpression in ECMAScript is a little bit + different from that in C and Java, which each allow the second + subexpression to be an Expression but restrict the third expression to + be a ConditionalExpression. The motivation for this difference in + ECMAScript is to allow an assignment expression to be governed by either + arm of a conditional and to eliminate the confusing and fairly useless + case of a comma expression as the center expression. + + Author: christine@netscape.com + Date: 09 september 1998 +*/ + var SECTION = "expression-001"; + var VERSION = "JS1_4"; + var TITLE = "Conditional operator ( ? : )" + startTest(); + writeHeaderToLog( SECTION + " " + TITLE ); + + var tc = 0; + var testcases = new Array(); + + // the following expression should be an error in JS. + + var result = "Failed" + var exception = "No exception was thrown"; + + try { + eval("var MY_VAR = true ? \"EXPR1\", \"EXPR2\" : \"EXPR3\""); + } catch ( e ) { + result = "Passed"; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "comma expression in a conditional statement "+ + "(threw "+ exception +")", + "Passed", + result ); + + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js new file mode 100644 index 0000000..1a73ebe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js @@ -0,0 +1,57 @@ +/** + File Name: expressions-002.js + Corresponds to: ecma/Expressions/11.2.1-3-n.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Try to access properties of an object whose value is undefined. + + Author: christine@netscape.com + Date: 09 september 1998 +*/ + var SECTION = "expressions-002.js"; + var VERSION = "JS1_4"; + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + startTest(); + + var tc = 0; + var testcases = new Array(); + + // go through all Native Function objects, methods, and properties and get their typeof. + + var PROPERTY = new Array(); + var p = 0; + + // try to access properties of primitive types + + OBJECT = new Property( "undefined", void 0, "undefined", NaN ); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = OBJECT.value.valueOf(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + + testcases[tc++] = new TestCase( + SECTION, + "Get the value of an object whose value is undefined "+ + "(threw " + exception +")", + expect, + result ); + + test(); + +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.valueOf = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js new file mode 100644 index 0000000..30b5369 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js @@ -0,0 +1,52 @@ +/** + File Name: expressions-003.js + Corresponds to: ecma/Expressions/11.2.1-3-n.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Try to access properties of an object whose value is undefined. + + Author: christine@netscape.com + Date: 09 september 1998 +*/ + var SECTION = "expressions-003.js"; + var VERSION = "JS1_4"; + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + + startTest(); + + var tc = 0; + var testcases = new Array(); + + // try to access properties of primitive types + + OBJECT = new Property( "undefined", void 0, "undefined", NaN ); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = OBJECT.value.toString(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + + testcases[tc++] = new TestCase( + SECTION, + "Get the toString value of an object whose value is undefined "+ + "(threw " + exception +")", + expect, + result ); + + test(); + +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.value = value; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js new file mode 100644 index 0000000..0ce3864 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js @@ -0,0 +1,46 @@ +/** + File Name: expression-004.js + Corresponds To: 11.2.1-4-n.js + ECMA Section: 11.2.1 Property Accessors + Description: + + Author: christine@netscape.com + Date: 09 september 1998 +*/ + var SECTION = "expression-004"; + var VERSION = "JS1_4"; + var TITLE = "Property Accessors"; + writeHeaderToLog( SECTION + " "+TITLE ); + startTest(); + + var tc = 0; + var testcases = new Array(); + + var OBJECT = new Property( "null", null, "null", 0 ); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = OBJECT.value.toString(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "Get the toString value of an object whose value is null "+ + "(threw " + exception +")", + expect, + result ); + + test(); + +function Property( object, value, string, number ) { + this.object = object; + this.string = String(value); + this.number = Number(value); + this.value = value; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js new file mode 100644 index 0000000..df69144 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js @@ -0,0 +1,38 @@ +/** + File Name: expression-005.js + Corresponds To: 11.2.2-10-n.js + ECMA Section: 11.2.2. The new operator + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "expression-005"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var expect = "Passed"; + var exception = "No exception thrown"; + + try { + result = new Math(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "result= new Math() (threw " + exception + ")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js new file mode 100644 index 0000000..1bf0798 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js @@ -0,0 +1,43 @@ +/** + File Name: expression-006.js + Corresponds to: 11.2.2-1-n.js + ECMA Section: 11.2.2. The new operator + Description: + + http://scopus/bugsplat/show_bug.cgi?id=327765 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-006.js"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + var BUGNUMBER="327765"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var OBJECT = new Object(); + result = new OBJECT(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "OBJECT = new Object; result = new OBJECT()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js new file mode 100644 index 0000000..988109b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js @@ -0,0 +1,41 @@ +/** + File Name: expression-007.js + Corresponds To: 11.2.2-2-n.js + ECMA Section: 11.2.2. The new operator + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-007"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + UNDEFINED = void 0; + result = new UNDEFINED(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "UNDEFINED = void 0; result = new UNDEFINED()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js new file mode 100644 index 0000000..caa8912 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js @@ -0,0 +1,38 @@ +/** + File Name: expression-008 + Corresponds To: 11.2.2-3-n.js + ECMA Section: 11.2.2. The new operator + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-008"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var NULL = null; + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new NULL(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "NULL = null; result = new NULL()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js new file mode 100644 index 0000000..2aa63b6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js @@ -0,0 +1,39 @@ +/** + File Name: expression-009 + Corresponds to: ecma/Expressions/11.2.2-4-n.js + ECMA Section: 11.2.2. The new operator + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-009"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var STRING = ""; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new STRING(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "STRING = ''; result = new STRING()" + + " (threw " + exception +")", + expect, + result ); + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js new file mode 100644 index 0000000..bb21aba --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js @@ -0,0 +1,40 @@ +/** + File Name: expression-010.js + Corresponds To: 11.2.2-5-n.js + ECMA Section: 11.2.2. The new operator + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-010"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var NUMBER = 0; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new NUMBER(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "NUMBER=0, result = new NUMBER()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js new file mode 100644 index 0000000..71c601a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js @@ -0,0 +1,40 @@ +/** + File Name: expression-011.js + Corresponds To: ecma/Expressions/11.2.2-6-n.js + ECMA Section: 11.2.2. The new operator + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-011"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var BOOLEAN = true; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var OBJECT = new BOOLEAN(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "BOOLEAN = true; result = new BOOLEAN()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js new file mode 100644 index 0000000..31eb099 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js @@ -0,0 +1,41 @@ +/** + File Name: expression-012.js + Corresponds To: ecma/Expressions/11.2.2-6-n.js + ECMA Section: 11.2.2. The new operator + Description: + http://scopus/bugsplat/show_bug.cgi?id=327765 + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-012"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + var BUGNUMBER= "327765"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var STRING = new String("hi"); + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new STRING(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "STRING = new String(\"hi\"); result = new STRING()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js new file mode 100644 index 0000000..cc75a77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js @@ -0,0 +1,41 @@ +/** + File Name: expression-013.js + Corresponds To: ecma/Expressions/11.2.2-8-n.js + ECMA Section: 11.2.2. The new operator + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-013"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + var BUGNUMBER= "327765"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var NUMBER = new Number(1); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new NUMBER(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "NUMBER = new Number(1); result = new NUMBER()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js new file mode 100644 index 0000000..4a09cd1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js @@ -0,0 +1,43 @@ +/** + File Name: expression-014.js + Corresponds To: ecma/Expressions/11.2.2-9-n.js + ECMA Section: 11.2.2. The new operator + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-014.js"; + var VERSION = "ECMA_1"; + var TITLE = "The new operator"; + var BUGNUMBER= "327765"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var BOOLEAN = new Boolean(); + + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new BOOLEAN(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "BOOLEAN = new Boolean(); result = new BOOLEAN()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js new file mode 100644 index 0000000..09577fc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js @@ -0,0 +1,37 @@ +/** + File Name: expression-015.js + Corresponds To: ecma/Expressions/11.2.3-2-n.js + ECMA Section: 11.2.3. Function Calls + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-015"; + var VERSION = "JS1_4"; + var TITLE = "Function Calls"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("result = 3.valueOf();"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "3.valueOf()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js new file mode 100644 index 0000000..4a55110 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js @@ -0,0 +1,37 @@ +/** + File Name: expression-016.js + Corresponds To: ecma/Expressions/11.2.3-3-n.js + ECMA Section: 11.2.3. Function Calls + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-016"; + var VERSION = "JS1_4"; + var TITLE = "Function Calls"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = (void 0).valueOf(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "(void 0).valueOf()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js new file mode 100644 index 0000000..949cf3f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js @@ -0,0 +1,37 @@ +/** + File Name: expression-07.js + Corresponds To: ecma/Expressions/11.2.3-4-n.js + ECMA Section: 11.2.3. Function Calls + Description: + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-017"; + var VERSION = "JS1_4"; + var TITLE = "Function Calls"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = nullvalueOf(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "null.valueOf()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js new file mode 100644 index 0000000..0ef02cb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js @@ -0,0 +1,41 @@ +/** + File Name: expression-019.js + Corresponds To: 11.2.2-7-n.js + ECMA Section: 11.2.2. The new operator + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "expression-019"; + var VERSION = "JS1_4"; + var TITLE = "The new operator"; + var BUGNUMBER= "327765"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var STRING = new String("hi"); + result = new STRING(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var STRING = new String(\"hi\"); result = new STRING();" + + " (threw " + exception + ")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js new file mode 100644 index 0000000..3cbd19e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js @@ -0,0 +1,64 @@ +/** + * File Name: boolean-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 + * + * eval("function f(){}function g(){}") at top level is an error for JS1.2 + * and above (missing ; between named function expressions), but declares f + * and g as functions below 1.2. + * + * Fails to produce error regardless of version: + * js> version(100) + * 120 + * js> eval("function f(){}function g(){}") + * js> version(120); + * 100 + * js> eval("function f(){}function g(){}") + * js> + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "function-001.js"; + var VERSION = "JS_12"; + var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; + var BUGNUMBER="10278"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "fail"; + var exception = "no exception thrown"; + + try { + eval("function f(){}function g(){}"); + } catch ( e ) { + result = "pass" + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "eval(\"function f(){}function g(){}\") (threw "+exception, + "pass", + result ); + + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js new file mode 100644 index 0000000..3b1bd98 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js @@ -0,0 +1,43 @@ +/** + File Name: global-001 + Corresponds To: ecma/GlobalObject/15.1-1-n.js + ECMA Section: The global object + Description: + + The global object does not have a [[Construct]] property; it is not + possible to use the global object as a constructor with the new operator. + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "global-001"; + var VERSION = "ECMA_1"; + var TITLE = "The Global Object"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = new this(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "result = new this()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js new file mode 100644 index 0000000..2453c29 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js @@ -0,0 +1,43 @@ +/** + File Name: global-002 + Corresponds To: ecma/GlobalObject/15.1-2-n.js + ECMA Section: The global object + Description: + + The global object does not have a [[Construct]] property; it is not + possible to use the global object as a constructor with the new operator. + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "global-002"; + var VERSION = "JS1_4"; + var TITLE = "The Global Object"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = this(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "result = this()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js new file mode 100644 index 0000000..528a573 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js @@ -0,0 +1,49 @@ +/** + File Name: lexical-001.js + CorrespondsTo: ecma/LexicalConventions/7.2.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + this test uses onerror to capture line numbers. because + we use on error, we can only have one test case per file. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "lexical-001"; + var VERSION = "JS1_4"; + var TITLE = "Line Terminators"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = eval("\r\n\expect"); + } catch ( e ) { + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "OBJECT = new Object; result = new OBJECT()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js new file mode 100644 index 0000000..b1521c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js @@ -0,0 +1,49 @@ +/** + File Name: lexical-002.js + Corresponds To: ecma/LexicalConventions/7.2-3-n.js + ECMA Section: 7.2 Line Terminators + Description: - readability + - separate tokens + - may occur between any two tokens + - cannot occur within any token, not even a string + - affect the process of automatic semicolon insertion. + + white space characters are: + unicode name formal name string representation + \u000A line feed <LF> \n + \u000D carriage return <CR> \r + + this test uses onerror to capture line numbers. because + we use on error, we can only have one test case per file. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "lexical-002"; + var VERSION = "JS1_4"; + var TITLE = "Line Terminators"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + result = eval("\r\n\expect"); + } catch ( e ) { + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "result=eval(\"\r\nexpect\")" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js new file mode 100644 index 0000000..a622d12 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js @@ -0,0 +1,41 @@ +/** + File Name: lexical-003.js + Corresponds To: 7.3-13-n.js + ECMA Section: 7.3 Comments + Description: + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-003.js"; + var VERSION = "JS1_4"; + var TITLE = "Comments"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("/*\n/* nested comment */\n*/\n"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "/*/*nested comment*/ */" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js new file mode 100644 index 0000000..6475838 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js @@ -0,0 +1,49 @@ +/** + File Name: lexical-004.js + Corresponds To: ecma/LexicalExpressions/7.4.1-1-n.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-004"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var null = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var null = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js new file mode 100644 index 0000000..a9cdd6b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-005.js + Corresponds To: 7.4.1-2.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-005"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("true = false;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "true = false" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js new file mode 100644 index 0000000..89c45f3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js @@ -0,0 +1,55 @@ +/** + File Name: lexical-006.js + Corresponds To: 7.4.2-1.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-006"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("break = new Object();"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "break = new Object()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js new file mode 100644 index 0000000..d34afe4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js @@ -0,0 +1,48 @@ +/** + File Name: lexical-005.js + Corresponds To: 7.4.1-3-n.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-005"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("false = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "false = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js new file mode 100644 index 0000000..f819eae --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-008.js + Corresponds To: 7.4.3-1-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-008.js"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("case = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "case = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js new file mode 100644 index 0000000..39fc71a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js @@ -0,0 +1,49 @@ +/** + File Name: lexical-009 + Corresponds To: 7.4.3-2-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-009"; + var VERSION = "ECMA_1"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("debugger = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "debugger = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js new file mode 100644 index 0000000..9e9f664 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js @@ -0,0 +1,48 @@ +/** + File Name: lexical-010.js + Corresponds To: 7.4.3-3-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-010"; + var VERSION = "ECMA_1"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("export = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "export = true" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js new file mode 100644 index 0000000..1c054f2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-011.js + Corresponds To: 7.4.3-4-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-011"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("super = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "super = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js new file mode 100644 index 0000000..e4579fd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-012.js + Corresponds To: 7.4.3-5-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-012"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("catch = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "catch = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js new file mode 100644 index 0000000..699d06a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js @@ -0,0 +1,49 @@ +/** + File Name: lexical-013.js + Corresponds To: 7.4.3-6-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-013"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("default = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "default = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js new file mode 100644 index 0000000..41b12ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-014.js + Corresponds To: 7.4.3-7-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-014.js"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("extends = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "extends = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js new file mode 100644 index 0000000..7cbcc04 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-015.js + Corresponds To: 7.4.3-8-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-015"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("switch = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "switch = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js new file mode 100644 index 0000000..8126550 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js @@ -0,0 +1,48 @@ +/** + File Name: lexical-016 + Corresponds To: 7.4.3-9-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-016"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("class = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "class = true" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js new file mode 100644 index 0000000..96849b7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-017.js + Corresponds To: 7.4.3-10-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-017"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("do = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "do = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js new file mode 100644 index 0000000..5d46c5f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-018 + Corresponds To: 7.4.3-11-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-018"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("finally = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "finally = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js new file mode 100644 index 0000000..9f01fc0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-019.js + Corresponds To: 7.4.3-12-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-019"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("throw = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "throw = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js new file mode 100644 index 0000000..362a3d5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-020.js + Corresponds To 7.4.3-13-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-020"; + var VERSION = "JS1_4"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("const = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "const = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js new file mode 100644 index 0000000..9fb3ede --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-021.js + Corresponds To: 7.4.3-14-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-021.js"; + var VERSION = "ECMA_1"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("enum = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "enum = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js new file mode 100644 index 0000000..54f256a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js @@ -0,0 +1,50 @@ +/** + File Name: lexical-022 + Corresponds To 7.4.3-15-n.js + ECMA Section: 7.4.3 + + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-022.js"; + var VERSION = "ECMA_1"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("import = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "import = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js new file mode 100644 index 0000000..0715a3d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js @@ -0,0 +1,49 @@ +/** + File Name: lexical-023.js + Corresponds To: 7.4.3-16-n.js + ECMA Section: 7.4.3 + Description: + The following words are used as keywords in proposed extensions and are + therefore reserved to allow for the possibility of future adoption of + those extensions. + + FutureReservedWord :: one of + case debugger export super + catch default extends switch + class do finally throw + const enum import try + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "lexical-023.js"; + var VERSION = "ECMA_1"; + var TITLE = "Future Reserved Words"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("try = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "try = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js new file mode 100644 index 0000000..d731791 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-024 + Corresponds To: 7.4.2-1-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-024"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var break;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var break" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js new file mode 100644 index 0000000..16a44d6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-025.js + Corresponds To 7.4.2-2-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-025"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var for;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var for" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js new file mode 100644 index 0000000..73aea73 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-026.js + Corresponds To: 7.4.2-3-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-026"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var new;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var new" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js new file mode 100644 index 0000000..b8f8593 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js @@ -0,0 +1,58 @@ +/** + File Name: lexical-027.js + Corresponds To: 7.4.2-4-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + var + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-027"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var var;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var var" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js new file mode 100644 index 0000000..a985527 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-028.js + Corresponds To: 7.4.2-5-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-028"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var continue=true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var continue=true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js new file mode 100644 index 0000000..0b38cbe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-029.js + Corresponds To: 7.4.2-6.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-029"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var function = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var function = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js new file mode 100644 index 0000000..bc85472 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-030.js + Corresponds To: 7.4.2-7-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-030"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var return = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var return = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js new file mode 100644 index 0000000..d2251ba --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-031.js + Corresponds To: 7.4.2-8-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-031"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var return;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var return" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js new file mode 100644 index 0000000..5ac71cb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-032.js + Corresponds To: 7.4.2-9-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-032"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("delete = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "delete = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js new file mode 100644 index 0000000..2a357fe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-033.js + Corresponds To: 7.4.2-10.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-033"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("if = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "if = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js new file mode 100644 index 0000000..d6c03a2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js @@ -0,0 +1,55 @@ +/** + File Name: 7.4.2-11-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-034"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("this = true"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "this = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js new file mode 100644 index 0000000..f5fca59 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-035.js + Correpsonds To: 7.4.2-12-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-035"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var while"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var while" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js new file mode 100644 index 0000000..3512c9b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-036.js + Corresponds To: 7.4.2-13-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-036"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("else = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "else = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js new file mode 100644 index 0000000..641c9de --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-037.js + Corresponds To: 7.4.2-14-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-028"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var in;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var in" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js new file mode 100644 index 0000000..f44b6b3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js @@ -0,0 +1,56 @@ +/** + File Name: lexical-038.js + Corresponds To: 7.4.2-15-n.js + ECMA Section: 7.4.2 + + Description: + The following tokens are ECMAScript keywords and may not be used as + identifiers in ECMAScript programs. + + Syntax + + Keyword :: one of + break for new var + continue function return void + delete if this while + else in typeof with + + This test verifies that the keyword cannot be used as an identifier. + Functioinal tests of the keyword may be found in the section corresponding + to the function of the keyword. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "lexical-038"; + var VERSION = "JS1_4"; + var TITLE = "Keywords"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("typeof = true;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "typeof = true" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js new file mode 100644 index 0000000..e40b21b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js @@ -0,0 +1,43 @@ +/** + File Name: lexical-039 + Corresponds To: 7.5-2-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "lexical-039"; + var VERSION = "JS1_4"; + var TITLE = "Identifiers"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var 0abc;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var 0abc" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js new file mode 100644 index 0000000..fb306c1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js @@ -0,0 +1,43 @@ +/** + File Name: lexical-040.js + Corresponds To: 7.5-2.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "lexical-040"; + var VERSION = "JS1_4"; + var TITLE = "Identifiers"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var 1abc;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var 1abc" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js new file mode 100644 index 0000000..da830f8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js @@ -0,0 +1,45 @@ +/** + File Name: lexical-041.js + Corresponds To: 7.5-8-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "lexical-041"; + var VERSION = "ECMA_1"; + var TITLE = "Identifiers"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var @abc;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var @abc" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js new file mode 100644 index 0000000..88ee509 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js @@ -0,0 +1,46 @@ +/** + File Name: lexical-042.js + Corresponds To: 7.5-9-n.js + ECMA Section: 7.5 Identifiers + Description: Identifiers are of unlimited length + - can contain letters, a decimal digit, _, or $ + - the first character cannot be a decimal digit + - identifiers are case sensitive + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "lexical-042"; + var VERSION = "JS1_4"; + var TITLE = "Identifiers"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("var 123;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "var 123" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js new file mode 100644 index 0000000..b5e3548 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js @@ -0,0 +1,47 @@ +/** + File Name: lexical-047.js + Corresponds To: 7.8.1-7-n.js + ECMA Section: 7.8.1 + Description: + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-047"; + var VERSION = "JS1_4"; + var TITLE = "for loops"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var counter = 0; + eval("for ( counter = 0\n" + + "counter <= 1\n" + + "counter++ )\n" + + "{\n" + + "result += \": got to inner loop\";\n" + + "}\n"); + + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "line breaks within a for expression" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js new file mode 100644 index 0000000..39a0600 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js @@ -0,0 +1,41 @@ + /** + File Name: lexical-048.js + Corresponds To: 7.8.1-1.js + ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertion + Description: + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-048"; + var VERSION = "JS1_4"; + var TITLE = "The Rules of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var counter = 0; + eval( "for ( counter = 0;\ncounter <= 1\ncounter++ ) {\nresult += \": got inside for loop\")"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "line breaks within a for expression" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js new file mode 100644 index 0000000..e03cfec --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js @@ -0,0 +1,46 @@ + /** + File Name: lexical-049 + Corresponds To: 7.8.1-1.js + ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertioin + Description: + Author: christine@netscape.com + Date: 15 september 1997 +*/ + var SECTION = "lexical-049"; + var VERSION = "JS1_4"; + var TITLE = "The Rules of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var counter = 0; + eval("for ( counter = 0\n" + + "counter <= 1;\n" + + "counter++ )\n" + + "{\n" + + "result += \": got inside for loop\";\n" + + "}\n"); + + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "line breaks within a for expression" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js new file mode 100644 index 0000000..bc871a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js @@ -0,0 +1,42 @@ +/** + File Name: lexical-050.js + Corresponds to: 7.8.2-1-n.js + ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion + Description: compare some specific examples of the automatic + insertion rules in the EMCA specification. + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-050"; + var VERSION = "JS1_4"; + var TITLE = "Examples of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("{ 1 2 } 3"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "{ 1 2 } 3" + + " (threw " + exception +")", + expect, + result ); + + test(); + + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js new file mode 100644 index 0000000..68e6b44 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js @@ -0,0 +1,42 @@ +/** + File Name: lexical-051.js + Corresponds to: 7.8.2-3-n.js + ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion + Description: compare some specific examples of the automatic + insertion rules in the EMCA specification. + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-051"; + var VERSION = "JS1_4"; + var TITLE = "Examples of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("for (a; b\n) result += \": got to inner loop\";") + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "for (a; b\n)" + + " (threw " + exception +")", + expect, + result ); + + test(); + + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js new file mode 100644 index 0000000..49aa7c7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js @@ -0,0 +1,44 @@ +/** + File Name: lexical-052.js + Corresponds to: 7.8.2-4-n.js + ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion + Description: compare some specific examples of the automatic + insertion rules in the EMCA specification. + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-052"; + var VERSION = "JS1_4"; + var TITLE = "Examples of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + MyFunction(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "calling return indirectly" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyFunction() { + var s = "return"; + eval(s); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js new file mode 100644 index 0000000..6e3ae99 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js @@ -0,0 +1,42 @@ +/** + File Name: lexical-053.js + Corresponds to: 7.8.2-7-n.js + ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion + Description: compare some specific examples of the automatic + insertion rules in the EMCA specification. + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-053"; + var VERSION = "JS1_4"; + var TITLE = "Examples of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + a = true + b = false + + eval('if (a > b)\nelse result += ": got to else statement"'); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "calling return indirectly" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js new file mode 100644 index 0000000..c4b9e9f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js @@ -0,0 +1,43 @@ +/** + File Name: lexical-054.js + Corresponds to: 7.8.2-7-n.js + ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion + Description: compare some specific examples of the automatic + insertion rules in the EMCA specification. + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "lexical-054"; + var VERSION = "JS1_4"; + var TITLE = "Examples of Automatic Semicolon Insertion"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + a=0; + b=1; + c=2; + d=3; + eval("if (a > b)\nelse c = d"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "if (a > b)\nelse c = d" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js new file mode 100644 index 0000000..1f45603 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js @@ -0,0 +1,52 @@ +/** + File Name: number-001 + Corresponds To: 15.7.4.2-2-n.js + ECMA Section: 15.7.4.2.2 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "number-001"; + var VERSION = "JS1_4"; + var TITLE = "Exceptions for Number.toString()"; + + startTest(); + writeHeaderToLog( SECTION + " Number.prototype.toString()"); + + var testcases = new Array(); + var tc = 0; + + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + + try { + object= new Object(); + object.toString = Number.prototype.toString; + result = object.toString(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "object = new Object(); object.toString = Number.prototype.toString; object.toString()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js new file mode 100644 index 0000000..5e84ebf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js @@ -0,0 +1,45 @@ +/** + File Name: number-002.js + Corresponds To: ecma/Number/15.7.4.3-2-n.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "number-002"; + var VERSION = "JS1_4"; + var TITLE = "Exceptions for Number.valueOf()"; + + startTest(); + writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + + var testcases = new Array(); + var tc = 0; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + object= new Object(); + object.toString = Number.prototype.valueOf; + result = object.toString(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js new file mode 100644 index 0000000..947d3d2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js @@ -0,0 +1,47 @@ +/** + File Name: number-003.js + Corresponds To: 15.7.4.3-3.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "number-003"; + var VERSION = "JS1_4"; + var TITLE = "Exceptions for Number.valueOf()"; + + var tc = 0; + var testcases = new Array(); + + startTest(); + writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + VALUE_OF = Number.prototype.valueOf; + OBJECT = new String("Infinity"); + OBJECT.valueOf = VALUE_OF; + result = OBJECT.valueOf(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "Assigning Number.prototype.valueOf as the valueOf of a String object " + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js new file mode 100644 index 0000000..928a04d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js @@ -0,0 +1,44 @@ +/** + File Name: statement-001.js + Corresponds To: 12.6.2-9-n.js + ECMA Section: 12.6.2 The for Statement + + 1. first expression is not present. + 2. second expression is not present + 3. third expression is not present + + + Author: christine@netscape.com + Date: 15 september 1997 +*/ + + var SECTION = "statement-001.js"; +// var SECTION = "12.6.2-9-n"; + var VERSION = "ECMA_1"; + var TITLE = "The for statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + var tc = 0; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("for (i) {\n}"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "for(i) {}" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js new file mode 100644 index 0000000..83c642c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js @@ -0,0 +1,66 @@ +/** + File Name: statement-002.js + Corresponds To: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "statement-002"; + var VERSION = "JS1_4"; + var TITLE = "The for..in statment"; + + var testcases = new Array(); + var tc = 0; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval(" for ( var i, p in this) { result += this[p]; }"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "more than one member expression" + + " (threw " + exception +")", + expect, + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js new file mode 100644 index 0000000..c7ffc7f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js @@ -0,0 +1,77 @@ +/** + File Name: statement-003 + Corresponds To: 12.6.3-7-n.js + ECMA Section: 12.6.3 The for...in Statement + Description: + The production IterationStatement : for ( LeftHandSideExpression in Expression ) + Statement is evaluated as follows: + + 1. Evaluate the Expression. + 2. Call GetValue(Result(1)). + 3. Call ToObject(Result(2)). + 4. Let C be "normal completion". + 5. Get the name of the next property of Result(3) that doesn't have the + DontEnum attribute. If there is no such property, go to step 14. + 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). + 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): + 1. If Type(V) is not Reference, generate a runtime error. + 2. Call GetBase(V). + 3. If Result(2) is null, go to step 6. + 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) + for the property name and W for the value. + 5. Return. + 6. Call the [[Put]] method for the global object, passing + GetPropertyName(V) for the property name and W for the value. + 7. Return. + 8. Evaluate Statement. + 9. If Result(8) is a value completion, change C to be "normal completion + after value V" where V is the value carried by Result(8). + 10. If Result(8) is a break completion, go to step 14. + 11. If Result(8) is a continue completion, go to step 5. + 12. If Result(8) is a return completion, return Result(8). + 13. Go to step 5. + 14. Return C. + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "statement-003"; + var VERSION = "JS1_4"; + var TITLE = "The for..in statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + var tc = 0; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var o = new MyObject(); + var result = 0; + + eval("for ( this in o) {\n" + + "result += this[p];\n" + + "}\n"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "bad left-hand side expression" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js new file mode 100644 index 0000000..9eee4e6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js @@ -0,0 +1,49 @@ +/** + File Name: statement-004.js + Corresponds To: 12.6.3-1.js + ECMA Section: 12.6.3 The for...in Statement + Description: + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "statement-004"; + var VERSION = "JS1_4"; + var TITLE = "The for..in statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + var tc = 0; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var o = new MyObject(); + + eval("for ( \"a\" in o) {\n" + + "result += this[p];\n" + + "}"); + + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "bad left-hand side expression" + + " (threw " + exception +")", + expect, + result ); + + test(); + + +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js new file mode 100644 index 0000000..50933b0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js @@ -0,0 +1,48 @@ +/** + File Name: statement-005.js + Corresponds To: 12.6.3-8-n.js + ECMA Section: 12.6.3 The for...in Statement + Description: + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "statement-005"; + var VERSION = "JS1_4"; + var TITLE = "The for..in statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + var tc = 0; + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var o = new MyObject(); + result = 0; + + eval("for (1 in o) {\n" + + "result += this[p];" + + "}\n"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "bad left-hand side expression" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js new file mode 100644 index 0000000..1fe0325 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js @@ -0,0 +1,48 @@ +/** + File Name: statement-006.js + Corresponds To: 12.6.3-9-n.js + ECMA Section: 12.6.3 The for...in Statement + Description: + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + var SECTION = "statement-006"; + var VERSION = "JS1_4"; + var TITLE = "The for..in statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var o = new MyObject(); + var result = 0; + for ( var o in foo) { + result += this[o]; + } + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "object is not defined" + + " (threw " + exception +")", + expect, + result ); + + test(); + +function MyObject() { + this.value = 2; + this[0] = 4; + return this; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js new file mode 100644 index 0000000..506578b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js @@ -0,0 +1,39 @@ +/** + File Name: statement-007.js + Corresponds To: 12.7-1-n.js + ECMA Section: 12.7 The continue statement + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "statement-007"; + var VERSION = "JS1_4"; + var TITLE = "The continue statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("continue;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "continue outside of an iteration statement" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js new file mode 100644 index 0000000..e293964 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js @@ -0,0 +1,39 @@ +/** + File Name: statement-008.js + Corresponds To: 12.8-1-n.js + ECMA Section: 12.8 The break statement + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "statement-008"; + var VERSION = "JS1_4"; + var TITLE = "The break in statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("break;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "break outside of an iteration statement" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js new file mode 100644 index 0000000..136d3f1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js @@ -0,0 +1,38 @@ +/** + File Name: 12.9-1-n.js + ECMA Section: 12.9 The return statement + Description: + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "12.9-1-n"; + var VERSION = "ECMA_1"; + var TITLE = "The return statment"; + + startTest(); + writeHeaderToLog( SECTION + " The return statement"); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + eval("return;"); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "return outside of a function" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js new file mode 100644 index 0000000..9ba39af --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js @@ -0,0 +1,50 @@ +/** + File Name: string-001.js + Corresponds To: 15.5.4.2-2-n.js + ECMA Section: 15.5.4.2 String.prototype.toString() + + Description: Returns this string value. Note that, for a String + object, the toString() method happens to return the same + thing as the valueOf() method. + + The toString function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + var SECTION = "string-001"; + var VERSION = "JS1_4"; + var TITLE = "String.prototype.toString"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + OBJECT = new Object(); + OBJECT.toString = String.prototype.toString(); + result = OBJECT.toString(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "OBJECT = new Object; "+ + " OBJECT.toString = String.prototype.toString; OBJECT.toString()" + + " (threw " + exception +")", + expect, + result ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js new file mode 100644 index 0000000..857271e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js @@ -0,0 +1,49 @@ +/** + File Name: string-002.js + Corresponds To: 15.5.4.3-3-n.js + ECMA Section: 15.5.4.3 String.prototype.valueOf() + + Description: Returns this string value. + + The valueOf function is not generic; it generates a + runtime error if its this value is not a String object. + Therefore it connot be transferred to the other kinds of + objects for use as a method. + + Author: christine@netscape.com + Date: 1 october 1997 +*/ + var SECTION = "string-002"; + var VERSION = "JS1_4"; + var TITLE = "String.prototype.valueOf"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var result = "Failed"; + var exception = "No exception thrown"; + var expect = "Passed"; + + try { + var OBJECT =new Object(); + OBJECT.valueOf = String.prototype.valueOf; + result = OBJECT.valueOf(); + } catch ( e ) { + result = expect; + exception = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+ + "result = OBJECT.valueOf();" + + " (threw " + exception +")", + expect, + result ); + + test(); + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js new file mode 100644 index 0000000..c3ac507 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js @@ -0,0 +1,70 @@ +/** + * File Name: StrictEquality-001.js + * ECMA Section: 11.9.6.js + * Description: + * + * Author: christine@netscape.com + * Date: 4 september 1998 + */ + var SECTION = "StrictEquality-001 - 11.9.6"; + var VERSION = "ECMA_2"; + var TITLE = "The strict equality operator ( === )"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + // 1. If Type(x) is different from Type(y) return false + + StrictEquality( true, new Boolean(true), false ); + StrictEquality( new Boolean(), false, false ); + StrictEquality( "", new String(), false ); + StrictEquality( new String("hi"), "hi", false ); + + // 2. If Type(x) is not Number go to step 9. + + // 3. If x is NaN, return false + StrictEquality( NaN, NaN, false ); + StrictEquality( NaN, 0, false ); + + // 4. If y is NaN, return false. + StrictEquality( 0, NaN, false ); + + // 5. if x is the same number value as y, return true + + // 6. If x is +0 and y is -0, return true + + // 7. If x is -0 and y is +0, return true + + // 8. Return false. + + + // 9. If Type(x) is String, then return true if x and y are exactly + // the same sequence of characters ( same length and same characters + // in corresponding positions.) Otherwise return false. + + // 10. If Type(x) is Boolean, return true if x and y are both true or + // both false. otherwise return false. + + + // Return true if x and y refer to the same object. Otherwise return + // false. + + // Return false. + + + test(); + +function StrictEquality( x, y, expect ) { + result = ( x === y ); + + testcases[tc++] = new TestCase( + SECTION, + x +" === " + y, + expect, + result ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js new file mode 100644 index 0000000..2e7412a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js @@ -0,0 +1,117 @@ +/** + * File Name: instanceof-001.js + * ECMA Section: 11.8.6 + * Description: + * + * RelationalExpression instanceof Identifier + * + * Author: christine@netscape.com + * Date: 2 September 1998 + */ + var SECTION = "instanceof-001"; + var VERSION = "ECMA_2"; + var TITLE = "instanceof" + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function InstanceOf( object_1, object_2, expect ) { + result = object_1 instanceof object_2; + + testcases[tc++] = new TestCase( + SECTION, + "(" + object_1 + ") instanceof " + object_2, + expect, + result ); + } + + function Gen3(value) { + this.value = value; + this.generation = 3; + this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); + } + Gen3.name = 3; + Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); + + function Gen2(value) { + this.value = value; + this.generation = 2; + } + Gen2.name = 2; + Gen2.prototype = new Gen3(); + + function Gen1(value) { + this.value = value; + this.generation = 1; + } + Gen1.name = 1; + Gen1.prototype = new Gen2(); + + function Gen0(value) { + this.value = value; + this.generation = 0; + } + Gen0.name = 0; + Gen0.prototype = new Gen1(); + + + function GenA(value) { + this.value = value; + this.generation = "A"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + + } + GenA.prototype = new Gen0(); + GenA.name = "A"; + + function GenB(value) { + this.value = value; + this.generation = "B"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + } + GenB.name = "B" + GenB.prototype = void 0; + + // RelationalExpression is not an object. + + InstanceOf( true, Boolean, false ); + InstanceOf( new Boolean(false), Boolean, true ); + + // Identifier is not a function + +// InstanceOf( true, true, false ); +// InstanceOf( new Boolean(true), false, false ); + + // Identifier is a function, prototype of Identifier is not an object + +// InstanceOf( new GenB(), GenB, false ); + + // __proto__ of RelationalExpression is null. should return false + genA = new GenA(); + genA.__proto__ = null; + + InstanceOf( genA, GenA, false ); + + // RelationalExpression.__proto__ == (but not ===) Identifier.prototype + + InstanceOf( new Gen2(), Gen0, false ); + InstanceOf( new Gen2(), Gen1, false ); + InstanceOf( new Gen2(), Gen2, true ); + InstanceOf( new Gen2(), Gen3, true ); + + // RelationalExpression.__proto__.__proto__ === Identifier.prototype + InstanceOf( new Gen0(), Gen0, true ); + InstanceOf( new Gen0(), Gen1, true ); + InstanceOf( new Gen0(), Gen2, true ); + InstanceOf( new Gen0(), Gen3, true ); + + InstanceOf( new Gen0(), Object, true ); + InstanceOf( new Gen0(), Function, false ); + + InstanceOf( Gen0, Function, true ); + InstanceOf( Gen0, Object, true ); + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js new file mode 100644 index 0000000..68697d0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js @@ -0,0 +1,124 @@ +/** + File Name: instanceof-002.js + Section: + Description: Determining Instance Relationships + + This test is the same as js1_3/inherit/proto-002, except that it uses + the builtin instanceof operator rather than a user-defined function + called InstanceOf. + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +// onerror = err; + + var SECTION = "instanceof-002"; + var VERSION = "ECMA_2"; + var TITLE = "Determining Instance Relationships"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + +function InstanceOf( object, constructor ) { + while ( object != null ) { + if ( object == constructor.prototype ) { + return true; + } + object = object.__proto__; + } + return false; +} + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} + +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer ( name, projs, machine ) { + this.base = WorkerBee; + this.base( name, "engineering", projs ) + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +var pat = new Engineer() + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__ == Engineer.prototype", + true, + pat.__proto__ == Engineer.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__ == WorkerBee.prototype", + true, + pat.__proto__.__proto__ == WorkerBee.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__.__proto__ == Employee.prototype", + true, + pat.__proto__.__proto__.__proto__ == Employee.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype", + true, + pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null", + true, + pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null ); + + testcases[tc++] = new TestCase( SECTION, + "pat instanceof Engineer", + true, + pat instanceof Engineer ); + + testcases[tc++] = new TestCase( SECTION, + "pat instanceof WorkerBee )", + true, + pat instanceof WorkerBee ); + + testcases[tc++] = new TestCase( SECTION, + "pat instanceof Employee )", + true, + pat instanceof Employee ); + + testcases[tc++] = new TestCase( SECTION, + "pat instanceof Object )", + true, + pat instanceof Object ); + + testcases[tc++] = new TestCase( SECTION, + "pat instanceof SalesPerson )", + false, + pat instanceof SalesPerson ); + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js new file mode 100644 index 0000000..f48108e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js @@ -0,0 +1,93 @@ +/** + * File Name: instanceof-001.js + * ECMA Section: 11.8.6 + * Description: + * + * RelationalExpression instanceof Identifier + * + * Author: christine@netscape.com + * Date: 2 September 1998 + */ + var SECTION = "instanceof-001"; + var VERSION = "ECMA_2"; + var TITLE = "instanceof" + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function InstanceOf( object_1, object_2, expect ) { + result = object_1 instanceof object_2; + + testcases[tc++] = new TestCase( + SECTION, + "(" + object_1 + ") instanceof " + object_2, + expect, + result ); + } + + function Gen3(value) { + this.value = value; + this.generation = 3; + this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); + } + Gen3.name = 3; + Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); + + function Gen2(value) { + this.value = value; + this.generation = 2; + } + Gen2.name = 2; + Gen2.prototype = new Gen3(); + + function Gen1(value) { + this.value = value; + this.generation = 1; + } + Gen1.name = 1; + Gen1.prototype = new Gen2(); + + function Gen0(value) { + this.value = value; + this.generation = 0; + } + Gen0.name = 0; + Gen0.prototype = new Gen1(); + + + function GenA(value) { + this.value = value; + this.generation = "A"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + + } + GenA.prototype = new Gen0(); + GenA.name = "A"; + + function GenB(value) { + this.value = value; + this.generation = "B"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + } + GenB.name = "B" + GenB.prototype = void 0; + + // RelationalExpression is not an object. + + InstanceOf( true, Boolean, false ); +// InstanceOf( new Boolean(false), Boolean, true ); + + // Identifier is not a function + + InstanceOf( true, true, false ); +// InstanceOf( new Boolean(true), false, false ); + + // Identifier is a function, prototype of Identifier is not an object + +// InstanceOf( new GenB(), GenB, false ); + + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js new file mode 100644 index 0000000..664a553 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js @@ -0,0 +1,92 @@ +/** + * File Name: instanceof-001.js + * ECMA Section: 11.8.6 + * Description: + * + * RelationalExpression instanceof Identifier + * + * Author: christine@netscape.com + * Date: 2 September 1998 + */ + var SECTION = "instanceof-001"; + var VERSION = "ECMA_2"; + var TITLE = "instanceof" + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function InstanceOf( object_1, object_2, expect ) { + result = object_1 instanceof object_2; + + testcases[tc++] = new TestCase( + SECTION, + "(" + object_1 + ") instanceof " + object_2, + expect, + result ); + } + + function Gen3(value) { + this.value = value; + this.generation = 3; + this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); + } + Gen3.name = 3; + Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); + + function Gen2(value) { + this.value = value; + this.generation = 2; + } + Gen2.name = 2; + Gen2.prototype = new Gen3(); + + function Gen1(value) { + this.value = value; + this.generation = 1; + } + Gen1.name = 1; + Gen1.prototype = new Gen2(); + + function Gen0(value) { + this.value = value; + this.generation = 0; + } + Gen0.name = 0; + Gen0.prototype = new Gen1(); + + + function GenA(value) { + this.value = value; + this.generation = "A"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + + } + GenA.prototype = new Gen0(); + GenA.name = "A"; + + function GenB(value) { + this.value = value; + this.generation = "B"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + } + GenB.name = "B" + GenB.prototype = void 0; + + // RelationalExpression is not an object. + + InstanceOf( true, Boolean, false ); + InstanceOf( new Boolean(false), Boolean, true ); + + // Identifier is not a function + + InstanceOf( new Boolean(true), false, false ); + + // Identifier is a function, prototype of Identifier is not an object + +// InstanceOf( new GenB(), GenB, false ); + + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js new file mode 100644 index 0000000..c3a621d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js @@ -0,0 +1,84 @@ +/** + * File Name: instanceof-001.js + * ECMA Section: 11.8.6 + * Description: + * + * RelationalExpression instanceof Identifier + * + * Author: christine@netscape.com + * Date: 2 September 1998 + */ + var SECTION = "instanceof-001"; + var VERSION = "ECMA_2"; + var TITLE = "instanceof" + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function InstanceOf( object_1, object_2, expect ) { + result = object_1 instanceof object_2; + + testcases[tc++] = new TestCase( + SECTION, + "(" + object_1 + ") instanceof " + object_2, + expect, + result ); + } + + function Gen3(value) { + this.value = value; + this.generation = 3; + this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); + } + Gen3.name = 3; + Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); + + function Gen2(value) { + this.value = value; + this.generation = 2; + } + Gen2.name = 2; + Gen2.prototype = new Gen3(); + + function Gen1(value) { + this.value = value; + this.generation = 1; + } + Gen1.name = 1; + Gen1.prototype = new Gen2(); + + function Gen0(value) { + this.value = value; + this.generation = 0; + } + Gen0.name = 0; + Gen0.prototype = new Gen1(); + + + function GenA(value) { + this.value = value; + this.generation = "A"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + + } + GenA.prototype = new Gen0(); + GenA.name = "A"; + + function GenB(value) { + this.value = value; + this.generation = "B"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + } + GenB.name = "B" + GenB.prototype = void 0; + + + // Identifier is a function, prototype of Identifier is not an object + + InstanceOf( new GenB(), GenB, false ); + + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js new file mode 100644 index 0000000..f1be0b4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js @@ -0,0 +1,83 @@ +/** + * File Name: instanceof-001.js + * ECMA Section: 11.8.6 + * Description: + * + * RelationalExpression instanceof Identifier + * + * Author: christine@netscape.com + * Date: 2 September 1998 + */ + var SECTION = "instanceof-001"; + var VERSION = "ECMA_2"; + var TITLE = "instanceof" + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function InstanceOf( object_1, object_2, expect ) { + result = object_1 instanceof object_2; + + testcases[tc++] = new TestCase( + SECTION, + "(" + object_1 + ") instanceof " + object_2, + expect, + result ); + } + + function Gen3(value) { + this.value = value; + this.generation = 3; + this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); + } + Gen3.name = 3; + Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); + + function Gen2(value) { + this.value = value; + this.generation = 2; + } + Gen2.name = 2; + Gen2.prototype = new Gen3(); + + function Gen1(value) { + this.value = value; + this.generation = 1; + } + Gen1.name = 1; + Gen1.prototype = new Gen2(); + + function Gen0(value) { + this.value = value; + this.generation = 0; + } + Gen0.name = 0; + Gen0.prototype = new Gen1(); + + + function GenA(value) { + this.value = value; + this.generation = "A"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + + } + GenA.prototype = new Gen0(); + GenA.name = "A"; + + function GenB(value) { + this.value = value; + this.generation = "B"; + this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); + } + GenB.name = "B" + GenB.prototype = void 0; + + // RelationalExpression is not an object. + +// InstanceOf( true, Boolean, false ); + InstanceOf( new Boolean(false), Boolean, true ); + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js new file mode 100644 index 0000000..2a2bf40 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +print ("STATUS: f.apply crash test."); + +print ("BUGNUMBER: 21836"); + +function f () +{ +} + +test (); + +function test () +{ + f.apply(2,2); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js new file mode 100644 index 0000000..9ea9074 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js @@ -0,0 +1,40 @@ +/** + File Name: call-1.js + Section: Function.prototype.call + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "call-1"; + var VERSION = "ECMA_2"; + var TITLE = "Function.prototype.call"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + testcases[tc++] = new TestCase( SECTION, + "ToString.call( this, this )", + GLOBAL, + ToString.call( this, this ) ); + + testcases[tc++] = new TestCase( SECTION, + "ToString.call( Boolean, Boolean.prototype )", + "false", + ToString.call( Boolean, Boolean.prototype ) ); + + testcases[tc++] = new TestCase( SECTION, + "ToString.call( Boolean, Boolean.prototype.valueOf() )", + "false", + ToString.call( Boolean, Boolean.prototype.valueOf() ) ); + + test(); + +function ToString( obj ) { + return obj +""; +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js new file mode 100644 index 0000000..19e930d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js @@ -0,0 +1,31 @@ +/** + * File Name: + * ECMA Section: + * Description: + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = ""; + var VERSION = "ECMA_2"; + var TITLE = "Keywords"; + + startTest(); + + var result = "failed"; + + try { + eval("super;"); + } + catch (x) { + if (x instanceof SyntaxError) + result = x.name; + } + + AddTestCase( + "using the expression \"super\" shouldn't cause js to crash", + "SyntaxError", + result ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js new file mode 100644 index 0000000..6af945b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js @@ -0,0 +1,38 @@ +/** + * File Name: LexicalConventions/regexp-literals-001.js + * ECMA Section: 7.8.5 + * Description: + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "LexicalConventions/regexp-literals-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "Regular Expression Literals"; + + startTest(); + + // Regular Expression Literals may not be empty; // should be regarded + // as a comment, not a RegExp literal. + + s = //; + + "passed"; + + AddTestCase( + "// should be a comment, not a regular expression literal", + "passed", + String(s)); + + AddTestCase( + "// typeof object should be type of object declared on following line", + "passed", + (typeof s) == "string" ? "passed" : "failed" ); + + AddTestCase( + "// should not return an object of the type RegExp", + "passed", + (typeof s == "object") ? "failed" : "passed" ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js new file mode 100644 index 0000000..c67184b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js @@ -0,0 +1,22 @@ +/** + * File Name: LexicalConventions/regexp-literals-002.js + * ECMA Section: 7.8.5 + * Description: Based on ECMA 2 Draft 8 October 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "LexicalConventions/regexp-literals-002.js"; + var VERSION = "ECMA_2"; + var TITLE = "Regular Expression Literals"; + + startTest(); + + // A regular expression literal represents an object of type RegExp. + + AddTestCase( + "// A regular expression literal represents an object of type RegExp.", + "true", + (/x*/ instanceof RegExp).toString() ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js new file mode 100644 index 0000000..be904e5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js @@ -0,0 +1,66 @@ +/** + * File Name: RegExp/constructor-001.js + * ECMA Section: 15.7.3.3 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/constructor-001"; + var VERSION = "ECMA_2"; + var TITLE = "new RegExp()"; + + startTest(); + + /* + * for each test case, verify: + * - verify that [[Class]] property is RegExp + * - prototype property should be set to RegExp.prototype + * - source is set to the empty string + * - global property is set to false + * - ignoreCase property is set to false + * - multiline property is set to false + * - lastIndex property is set to 0 + */ + + RegExp.prototype.getClassProperty = Object.prototype.toString; + var re = new RegExp(); + + AddTestCase( + "new RegExp().__proto__", + RegExp.prototype, + re.__proto__ + ); + + AddTestCase( + "RegExp.prototype.getClassProperty = Object.prototype.toString; " + + "(new RegExp()).getClassProperty()", + "[object RegExp]", + re.getClassProperty() ); + + AddTestCase( + "(new RegExp()).source", + "", + re.source ); + + AddTestCase( + "(new RegExp()).global", + false, + re.global ); + + AddTestCase( + "(new RegExp()).ignoreCase", + false, + re.ignoreCase ); + + AddTestCase( + "(new RegExp()).multiline", + false, + re.multiline ); + + AddTestCase( + "(new RegExp()).lastIndex", + 0, + re.lastIndex ); + + test() diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js new file mode 100644 index 0000000..69edc11 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js @@ -0,0 +1,34 @@ +/** + * File Name: RegExp/exec-001.js + * ECMA Section: 15.7.5.3 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/exec-001"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp.prototype.exec(string)"; + + startTest(); + + /* + * for each test case, verify: + * - type of object returned + * - length of the returned array + * - value of lastIndex + * - value of index + * - value of input + * - value of the array indices + */ + + // test cases without subpatterns + // test cases with subpatterns + // global property is true + // global property is false + // test cases in which the exec returns null + + testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" }; + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js new file mode 100644 index 0000000..c811b61 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js @@ -0,0 +1,182 @@ +/** + * File Name: RegExp/exec-002.js + * ECMA Section: 15.7.5.3 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Test cases provided by rogerl@netscape.com + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/exec-002"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp.prototype.exec(string)"; + + startTest(); + + /* + * for each test case, verify: + * - type of object returned + * - length of the returned array + * - value of lastIndex + * - value of index + * - value of input + * - value of the array indices + */ + + AddRegExpCases( + /(a|d|q|)x/i, + "bcaDxqy", + 3, + ["Dx", "D"] ); + + AddRegExpCases( + /(a|(e|q))(x|y)/, + "bcaddxqy", + 6, + ["qy","q","q","y"] ); + + + AddRegExpCases( + /a+b+d/, + "aabbeeaabbs", + 0, + null ); + + AddRegExpCases( + /a*b/, + "aaadaabaaa", + 4, + ["aab"] ); + + AddRegExpCases( + /a*b/, + "dddb", + 3, + ["b"] ); + + AddRegExpCases( + /a*b/, + "xxx", + 0, + null ); + + AddRegExpCases( + /x\d\dy/, + "abcx45ysss235", + 3, + ["x45y"] ); + + AddRegExpCases( + /[^abc]def[abc]+/, + "abxdefbb", + 2, + ["xdefbb"] ); + + AddRegExpCases( + /(a*)baa/, + "ccdaaabaxaabaa", + 9, + ["aabaa", "aa"] ); + + AddRegExpCases( + /(a*)baa/, + "aabaa", + 0, + ["aabaa", "aa"] ); + + AddRegExpCases( + /q(a|b)*q/, + "xxqababqyy", + 2, + ["qababq", "b"] ); + + AddRegExpCases( + /(a(.|[^d])c)*/, + "adcaxc", + 0, + ["adcaxc", "axc", "x"] ); + + AddRegExpCases( + /(a*)b\1/, + "abaaaxaabaayy", + 0, + ["aba", "a"] ); + + AddRegExpCases( + /(a*)b\1/, + "abaaaxaabaayy", + 0, + ["aba", "a"] ); + + AddRegExpCases( + /(a*)b\1/, + "cccdaaabaxaabaayy", + 6, + ["aba", "a"] ); + + AddRegExpCases( + /(a*)b\1/, + "cccdaaabqxaabaayy", + 7, + ["b", ""] ); + + AddRegExpCases( + /"(.|[^"\\\\])*"/, + 'xx\"makudonarudo\"yy', + 2, + ["\"makudonarudo\"", "o"] ); + + AddRegExpCases( + /"(.|[^"\\\\])*"/, + "xx\"ma\"yy", + 2, + ["\"ma\"", "a"] ); + + test(); + +function AddRegExpCases( + regexp, pattern, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(pattern) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + pattern +")", + matches_array, + regexp.exec(pattern) ); + + return; + } + AddTestCase( + regexp + ".exec(" + pattern +").length", + matches_array.length, + regexp.exec(pattern).length ); + + AddTestCase( + regexp + ".exec(" + pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + regexp + ".exec(" + pattern +").input", + pattern, + regexp.exec(pattern).input ); + + AddTestCase( + regexp + ".exec(" + pattern +").toString()", + matches_array.toString(), + regexp.exec(pattern).toString() ); +/* + var limit = matches_array.length > regexp.exec(pattern).length + ? matches_array.length + : regexp.exec(pattern).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + regexp + ".exec(" + pattern +")[" + matches +"]", + matches_array[matches], + regexp.exec(pattern)[matches] ); + } +*/ +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js new file mode 100644 index 0000000..67c4f21 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js @@ -0,0 +1,66 @@ +/** + * File Name: RegExp/function-001.js + * ECMA Section: 15.7.2.1 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/function-001"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp( pattern, flags )"; + + startTest(); + + /* + * for each test case, verify: + * - verify that [[Class]] property is RegExp + * - prototype property should be set to RegExp.prototype + * - source is set to the empty string + * - global property is set to false + * - ignoreCase property is set to false + * - multiline property is set to false + * - lastIndex property is set to 0 + */ + + RegExp.prototype.getClassProperty = Object.prototype.toString; + var re = new RegExp(); + + AddTestCase( + "new RegExp().__proto__", + RegExp.prototype, + re.__proto__ + ); + + AddTestCase( + "RegExp.prototype.getClassProperty = Object.prototype.toString; " + + "(new RegExp()).getClassProperty()", + "[object RegExp]", + re.getClassProperty() ); + + AddTestCase( + "(new RegExp()).source", + "", + re.source ); + + AddTestCase( + "(new RegExp()).global", + false, + re.global ); + + AddTestCase( + "(new RegExp()).ignoreCase", + false, + re.ignoreCase ); + + AddTestCase( + "(new RegExp()).multiline", + false, + re.multiline ); + + AddTestCase( + "(new RegExp()).lastIndex", + 0, + re.lastIndex ); + + test() diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js new file mode 100644 index 0000000..122d59c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js @@ -0,0 +1,63 @@ +/** + * File Name: RegExp/hex-001.js + * ECMA Section: 15.7.3.1 + * Description: Based on ECMA 2 Draft 7 February 1999 + * Positive test cases for constructing a RegExp object + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/hex-001"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences"; + + startTest(); + + // These examples come from 15.7.1, HexidecimalEscapeSequence + + AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] ); + AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] ); + AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] ); + + AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] ); + AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] ); + AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]); + AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] ); + + test(); + +function AddRegExpCases( + regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(pattern) == null || matches_array == null ) { + AddTestCase( + str_regexp + ".exec(" + pattern +")", + matches_array, + regexp.exec(pattern) ); + + return; + } + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").length", + length, + regexp.exec(pattern).length ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").input", + pattern, + regexp.exec(pattern).input ); + + for ( var matches = 0; matches < matches_array.length; matches++ ) { + AddTestCase( + str_regexp + ".exec(" + str_pattern +")[" + matches +"]", + matches_array[matches], + regexp.exec(pattern)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js new file mode 100644 index 0000000..51a601c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js @@ -0,0 +1,62 @@ +/** + * File Name: RegExp/multiline-001.js + * ECMA Section: + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Date: 19 February 1999 + */ + + var SECTION = "RegExp/multiline-001"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp: multiline flag"; + var BUGNUMBER="343901"; + + startTest(); + + var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" + + "northern flicker\npileated\n"; + + AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] ); + + AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] ); + + test(); + + +function AddRegExpCases + ( regexp, pattern, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(pattern) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + pattern +")", + matches_array, + regexp.exec(pattern) ); + + return; + } + + AddTestCase( + regexp.toString() + ".exec(" + pattern +").length", + matches_array.length, + regexp.exec(pattern).length ); + + AddTestCase( + regexp.toString() + ".exec(" + pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + regexp + ".exec(" + pattern +").input", + pattern, + regexp.exec(pattern).input ); + + + for ( var matches = 0; matches < matches_array.length; matches++ ) { + AddTestCase( + regexp + ".exec(" + pattern +")[" + matches +"]", + matches_array[matches], + regexp.exec(pattern)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js new file mode 100644 index 0000000..d9d0571 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js @@ -0,0 +1,72 @@ +/** + * File Name: RegExp/octal-001.js + * ECMA Section: 15.7.1 + * Description: Based on ECMA 2 Draft 7 February 1999 + * Simple test cases for matching OctalEscapeSequences. + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/octal-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp patterns that contain OctalEscapeSequences"; + var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196"; + + startTest(); + + +// backreference + AddRegExpCases( + /(.)\1/, + "/(.)\\1/", + "HI!!", + "HI!", + 2, + ["!!", "!"] ); + + test(); + +function AddRegExpCases( + regexp, str_regexp, pattern, str_pattern, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(pattern) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + str_pattern +")", + matches_array, + regexp.exec(pattern) ); + + return; + } + AddTestCase( + str_regexp + ".exec(" + str_pattern +").length", + matches_array.length, + regexp.exec(pattern).length ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").input", + pattern, + regexp.exec(pattern).input ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").toString()", + matches_array.toString(), + regexp.exec(pattern).toString() ); +/* + var limit = matches_array.length > regexp.exec(pattern).length + ? matches_array.length + : regexp.exec(pattern).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + str_regexp + ".exec(" + str_pattern +")[" + matches +"]", + matches_array[matches], + regexp.exec(pattern)[matches] ); + } +*/ +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js new file mode 100644 index 0000000..69c8100 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js @@ -0,0 +1,87 @@ +/** + * File Name: RegExp/octal-002.js + * ECMA Section: 15.7.1 + * Description: Based on ECMA 2 Draft 7 February 1999 + * Simple test cases for matching OctalEscapeSequences. + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/octal-002.js"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp patterns that contain OctalEscapeSequences"; + var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189"; + + startTest(); + +// backreference + AddRegExpCases( + /(.)(.)(.)(.)(.)(.)(.)(.)\8/, + "/(.)(.)(.)(.)(.)(.)(.)(.)\\8", + "aabbccaaabbbccc", + "aabbccaaabbbccc", + 0, + ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] ); + + AddRegExpCases( + /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/, + "/(.)(.)(.)(.)(.)(.)(.)(.)\\9", + "aabbccaabbcc", + "aabbccaabbcc", + 0, + ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] ); + + AddRegExpCases( + /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/, + "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8", + "aabbccaababcc", + "aabbccaababcc", + 0, + ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] ); + + test(); + +function AddRegExpCases( + regexp, str_regexp, pattern, str_pattern, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(pattern) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + str_pattern +")", + matches_array, + regexp.exec(pattern) ); + + return; + } + AddTestCase( + str_regexp + ".exec(" + str_pattern +").length", + matches_array.length, + regexp.exec(pattern).length ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").input", + pattern, + regexp.exec(pattern).input ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").toString()", + matches_array.toString(), + regexp.exec(pattern).toString() ); +/* + var limit = matches_array.length > regexp.exec(pattern).length + ? matches_array.length + : regexp.exec(pattern).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + str_regexp + ".exec(" + str_pattern +")[" + matches +"]", + matches_array[matches], + regexp.exec(pattern)[matches] ); + } +*/ +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js new file mode 100644 index 0000000..ac6de01 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js @@ -0,0 +1,81 @@ +/** + * File Name: RegExp/octal-003.js + * ECMA Section: 15.7.1 + * Description: Based on ECMA 2 Draft 7 February 1999 + * Simple test cases for matching OctalEscapeSequences. + * Author: christine@netscape.com + * Date: 19 February 1999 + * + * Revised: 02 August 2002 + * Author: pschwartau@netscape.com + * + * WHY: the original test expected the regexp /.\011/ + * to match 'a' + String.fromCharCode(0) + '11' + * + * This is incorrect: the string is a 4-character string consisting of + * the characters <'a'>, <nul>, <'1'>, <'1'>. By contrast, the \011 in the + * regexp should be parsed as a single token: it is the octal escape sequence + * for the horizontal tab character '\t' === '\u0009' === '\x09' === '\011'. + * + * So the regexp consists of 2 characters: <any-character>, <'\t'>. + * There is no match between the regexp and the string. + * + * See the testcase ecma_3/RegExp/octal-002.js for an elaboration. + * + */ + var SECTION = "RegExp/octal-003.js"; + var VERSION = "ECMA_2"; + var TITLE = "RegExp patterns that contain OctalEscapeSequences"; + var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132"; + + startTest(); + + AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null ); + + test(); + +function AddRegExpCases( + regexp, str_regexp, pattern, str_pattern, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(pattern) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + str_pattern +")", + matches_array, + regexp.exec(pattern) ); + + return; + } + AddTestCase( + str_regexp + ".exec(" + str_pattern +").length", + matches_array.length, + regexp.exec(pattern).length ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").input", + escape(pattern), + escape(regexp.exec(pattern).input) ); + + AddTestCase( + str_regexp + ".exec(" + str_pattern +").toString()", + matches_array.toString(), + escape(regexp.exec(pattern).toString()) ); + + var limit = matches_array.length > regexp.exec(pattern).length + ? matches_array.length + : regexp.exec(pattern).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + str_regexp + ".exec(" + str_pattern +")[" + matches +"]", + matches_array[matches], + escape(regexp.exec(pattern)[matches]) ); + } + +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js new file mode 100644 index 0000000..3eb51cb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js @@ -0,0 +1,85 @@ +/** + * File Name: RegExp/properties-001.js + * ECMA Section: 15.7.6.js + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/properties-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "Properties of RegExp Instances"; + var BUGNUMBER ="http://scopus/bugsplat/show_bug.cgi?id=346000"; + + startTest(); + + AddRegExpCases( new RegExp, "", false, false, false, 0 ); + AddRegExpCases( /.*/, ".*", false, false, false, 0 ); + AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 ); + AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 ); + AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 ); + AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 ); + AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 ); + AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 ); + + AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 ); + AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 ); + AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 ); + + test(); + +function AddRegExpCases( re, s, g, i, m, l ) { + + AddTestCase( re + ".test == RegExp.prototype.test", + true, + re.test == RegExp.prototype.test ); + + AddTestCase( re + ".toString == RegExp.prototype.toString", + true, + re.toString == RegExp.prototype.toString ); + + AddTestCase( re + ".contructor == RegExp.prototype.constructor", + true, + re.constructor == RegExp.prototype.constructor ); + + AddTestCase( re + ".compile == RegExp.prototype.compile", + true, + re.compile == RegExp.prototype.compile ); + + AddTestCase( re + ".exec == RegExp.prototype.exec", + true, + re.exec == RegExp.prototype.exec ); + + // properties + + AddTestCase( re + ".source", + s, + re.source ); + +/* + * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed + * the behavior of toString() and toSource() on empty regexps. + * So branch if |s| is the empty string - + */ + var S = s? s : '(?:)'; + + AddTestCase( re + ".toString()", + "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), + re.toString() ); + + AddTestCase( re + ".global", + g, + re.global ); + + AddTestCase( re + ".ignoreCase", + i, + re.ignoreCase ); + + AddTestCase( re + ".multiline", + m, + re.multiline); + + AddTestCase( re + ".lastIndex", + l, + re.lastIndex ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js new file mode 100644 index 0000000..2496d5f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js @@ -0,0 +1,125 @@ +/** + * File Name: RegExp/properties-002.js + * ECMA Section: 15.7.6.js + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + //----------------------------------------------------------------------------- +var SECTION = "RegExp/properties-002.js"; +var VERSION = "ECMA_2"; +var TITLE = "Properties of RegExp Instances"; +var BUGNUMBER ="http://scopus/bugsplat/show_bug.cgi?id=346032"; +// ALSO SEE http://bugzilla.mozilla.org/show_bug.cgi?id=124339 + + +startTest(); + +re_1 = /\cA?/g; +re_1.lastIndex = Math.pow(2,31); +AddRegExpCases( re_1, "\\cA?", true, false, false, Math.pow(2,31) ); + +re_2 = /\w*/i; +re_2.lastIndex = Math.pow(2,32) -1; +AddRegExpCases( re_2, "\\w*", false, true, false, Math.pow(2,32)-1 ); + +re_3 = /\*{0,80}/m; +re_3.lastIndex = Math.pow(2,31) -1; +AddRegExpCases( re_3, "\\*{0,80}", false, false, true, Math.pow(2,31) -1 ); + +re_4 = /^./gim; +re_4.lastIndex = Math.pow(2,30) -1; +AddRegExpCases( re_4, "^.", true, true, true, Math.pow(2,30) -1 ); + +re_5 = /\B/; +re_5.lastIndex = Math.pow(2,30); +AddRegExpCases( re_5, "\\B", false, false, false, Math.pow(2,30) ); + +/* + * Brendan: "need to test cases Math.pow(2,32) and greater to see + * whether they round-trip." Reason: thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + * + */ +re_6 = /\B/; +re_6.lastIndex = Math.pow(2,32); +AddRegExpCases( re_6, "\\B", false, false, false, Math.pow(2,32) ); + +re_7 = /\B/; +re_7.lastIndex = Math.pow(2,32) + 1; +AddRegExpCases( re_7, "\\B", false, false, false, Math.pow(2,32) + 1 ); + +re_8 = /\B/; +re_8.lastIndex = Math.pow(2,32) * 2; +AddRegExpCases( re_8, "\\B", false, false, false, Math.pow(2,32) * 2 ); + +re_9 = /\B/; +re_9.lastIndex = Math.pow(2,40); +AddRegExpCases( re_9, "\\B", false, false, false, Math.pow(2,40) ); + +re_10 = /\B/; +re_10.lastIndex = Number.MAX_VALUE; +AddRegExpCases( re_10, "\\B", false, false, false, Number.MAX_VALUE ); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function AddRegExpCases( re, s, g, i, m, l ){ + + AddTestCase( re + ".test == RegExp.prototype.test", + true, + re.test == RegExp.prototype.test ); + + AddTestCase( re + ".toString == RegExp.prototype.toString", + true, + re.toString == RegExp.prototype.toString ); + + AddTestCase( re + ".contructor == RegExp.prototype.constructor", + true, + re.constructor == RegExp.prototype.constructor ); + + AddTestCase( re + ".compile == RegExp.prototype.compile", + true, + re.compile == RegExp.prototype.compile ); + + AddTestCase( re + ".exec == RegExp.prototype.exec", + true, + re.exec == RegExp.prototype.exec ); + + // properties + + AddTestCase( re + ".source", + s, + re.source ); + + AddTestCase( re + ".toString()", + "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), + re.toString() ); + + AddTestCase( re + ".global", + g, + re.global ); + + AddTestCase( re + ".ignoreCase", + i, + re.ignoreCase ); + + AddTestCase( re + ".multiline", + m, + re.multiline); + + AddTestCase( re + ".lastIndex", + l, + re.lastIndex ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js new file mode 100644 index 0000000..9752fa1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js @@ -0,0 +1,98 @@ +/** + File Name: regexp-enumerate-001.js + ECMA V2 Section: + Description: Regression Test. + + If instance Native Object have properties that are enumerable, + JavaScript enumerated through the properties twice. This only + happened if objects had been instantiated, but their properties + had not been enumerated. ie, the object inherited properties + from its prototype that are enumerated. + + In the core JavaScript, this is only a problem with RegExp + objects, since the inherited properties of most core JavaScript + objects are not enumerated. + + Author: christine@netscape.com, pschwartau@netscape.com + Date: 12 November 1997 + Modified: 14 July 2002 + Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291 + ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5 + RegExp properties should be DontEnum +* +*/ +// onerror = err; + + var SECTION = "regexp-enumerate-001"; + var VERSION = "ECMA_2"; + var TITLE = "Regression Test for Enumerating Properties"; + + var BUGNUMBER="339403"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + /* + * This test expects RegExp instances to have four enumerated properties: + * source, global, ignoreCase, and lastIndex + * + * 99.01.25: now they also have a multiLine instance property. + * + */ + + + var r = new RegExp(); + + var e = new Array(); + + var t = new TestRegExp(); + + for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) }; + + testcases[testcases.length] = new TestCase( SECTION, + "r = new RegExp(); e = new Array(); "+ + "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length", + 0, + e.length ); + + test(); + +function TestRegExp() { + this.addProperty = addProperty; +} +function addProperty(name, value) { + var pass = false; + + if ( eval("this."+name) != void 0 ) { + pass = true; + } else { + eval( "this."+ name+" = "+ false ); + } + + testcases[testcases.length] = new TestCase( SECTION, + "Property: " + name +" already enumerated?", + false, + pass ); + + if ( testcases[ testcases.length-1].passed == false ) { + testcases[testcases.length-1].reason = "property already enumerated"; + + } + +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js new file mode 100644 index 0000000..afd45fe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js @@ -0,0 +1,39 @@ +/** + * File Name: RegExp/regress-001.js + * ECMA Section: N/A + * Description: Regression test case: + * JS regexp anchoring on empty match bug + * http://bugzilla.mozilla.org/show_bug.cgi?id=2157 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/hex-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "JS regexp anchoring on empty match bug"; + var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=2157"; + + startTest(); + + AddRegExpCases( /a||b/(''), + "//a||b/('')", + 1, + [''] ); + + test(); + +function AddRegExpCases( regexp, str_regexp, length, matches_array ) { + + AddTestCase( + "( " + str_regexp + " ).length", + regexp.length, + regexp.length ); + + + for ( var matches = 0; matches < matches_array.length; matches++ ) { + AddTestCase( + "( " + str_regexp + " )[" + matches +"]", + matches_array[matches], + regexp[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js new file mode 100644 index 0000000..17d0582 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js @@ -0,0 +1,53 @@ +/** + * File Name: RegExp/unicode-001.js + * ECMA Section: 15.7.3.1 + * Description: Based on ECMA 2 Draft 7 February 1999 + * Positive test cases for constructing a RegExp object + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + var SECTION = "RegExp/unicode-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "new RegExp( pattern, flags )"; + + startTest(); + + // These examples come from 15.7.1, UnicodeEscapeSequence + + AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] ); + AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] ); + AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] ); + AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] ); + + AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] ); + AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] ); + AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]); + AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] ); + + test(); + +function AddRegExpCases( + regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) { + + AddTestCase( + str_regexp + " .exec(" + str_pattern +").length", + length, + regexp.exec(pattern).length ); + + AddTestCase( + str_regexp + " .exec(" + str_pattern +").index", + index, + regexp.exec(pattern).index ); + + AddTestCase( + str_regexp + " .exec(" + str_pattern +").input", + pattern, + regexp.exec(pattern).input ); + + for ( var matches = 0; matches < matches_array.length; matches++ ) { + AddTestCase( + str_regexp + " .exec(" + str_pattern +")[" + matches +"]", + matches_array[matches], + regexp.exec(pattern)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js new file mode 100644 index 0000000..ffd5300 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js @@ -0,0 +1,41 @@ +/** + * File Name: dowhile-001 + * ECMA Section: + * Description: do...while statements + * + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "dowhile-002"; + var VERSION = "ECMA_2"; + var TITLE = "do...while with a labeled continue statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + LabeledContinue( 0, 1 ); + LabeledContinue( 1, 1 ); + LabeledContinue( -1, 1 ); + LabeledContinue( 5, 5 ); + + test(); + +function LabeledContinue( limit, expect ) { + i = 0; + woohoo: + do { + i++; + continue woohoo; + } while ( i < limit ); + + testcases[tc++] = new TestCase( + SECTION, + "do while ( " + i +" < " + limit +" )", + expect, + i ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js new file mode 100644 index 0000000..e921b49 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js @@ -0,0 +1,68 @@ +/** + * File Name: dowhile-002 + * ECMA Section: + * Description: do...while statements + * + * Verify that code after a labeled break is not executed. Verify that + * a labeled break breaks you out of the whole labeled block, and not + * just the current iteration statement. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "dowhile-002"; + var VERSION = "ECMA_2"; + var TITLE = "do...while with a labeled continue statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + LabeledContinue( 0, 1 ); + LabeledContinue( 1, 1 ); + LabeledContinue( -1, 1 ); + LabeledContinue( 5, 5 ); + + test(); + +// The labeled statment contains statements after the labeled break. +// Verify that the statements after the break are not executed. + +function LabeledContinue( limit, expect ) { + i = 0; + result1 = "pass"; + result2 = "pass"; + + woohoo: { + do { + i++; + if ( ! (i < limit) ) { + break woohoo; + result1 = "fail: evaluated statement after a labeled break"; + } + } while ( true ); + + result2 = "failed: broke out of loop, but not out of labeled block"; + } + + testcases[tc++] = new TestCase( + SECTION, + "do while ( " + i +" < " + limit +" )", + expect, + i ); + + testcases[tc++] = new TestCase( + SECTION, + "breaking out of a do... while loop", + "pass", + result1 ); + + + testcases[tc++] = new TestCase( + SECTION, + "breaking out of a labeled do...while loop", + "pass", + result2 ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js new file mode 100644 index 0000000..a1ca517 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js @@ -0,0 +1,60 @@ +/** + * File Name: dowhile-003 + * ECMA Section: + * Description: do...while statements + * + * Test do while, when the while expression is a JavaScript Number object. + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "dowhile-003"; + var VERSION = "ECMA_2"; + var TITLE = "do...while with a labeled continue statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile( new DoWhileObject( 1, 1, 0 )); + DoWhile( new DoWhileObject( 1000, 1000, 0 )); + DoWhile( new DoWhileObject( 1001, 1001, 0 )); + DoWhile( new DoWhileObject( 1002, 1001, 1 )); + DoWhile( new DoWhileObject( -1, 1001, -1002 )); + + test(); + +function DoWhileObject( value, iterations, endvalue ) { + this.value = value; + this.iterations = iterations; + this.endvalue = endvalue; +} + +function DoWhile( object ) { + var i = 0; + + do { + object.value = --object.value; + i++; + if ( i > 1000 ) + break; + } while( object.value ); + + testcases[tc++] = new TestCase( + SECTION, + "loop iterations", + object.iterations, + i + ); + + testcases[tc++] = new TestCase( + SECTION, + "object.value", + object.endvalue, + Number( object.value ) + ); + +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js new file mode 100644 index 0000000..3c96fc4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js @@ -0,0 +1,64 @@ +/** + * File Name: dowhile-004 + * ECMA Section: + * Description: do...while statements + * + * Test a labeled do...while. Break out of the loop with no label + * should break out of the loop, but not out of the label. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "dowhile-004"; + var VERSION = "ECMA_2"; + var TITLE = "do...while with a labeled continue statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile( 0, 1 ); + DoWhile( 1, 1 ); + DoWhile( -1, 1 ); + DoWhile( 5, 5 ); + + test(); + +function DoWhile( limit, expect ) { + i = 0; + result1 = "pass"; + result2 = "failed: broke out of labeled statement unexpectedly"; + + foo: { + do { + i++; + if ( ! (i < limit) ) { + break; + result1 = "fail: evaluated statement after a labeled break"; + } + } while ( true ); + + result2 = "pass"; + } + + testcases[tc++] = new TestCase( + SECTION, + "do while ( " + i +" < " + limit +" )", + expect, + i ); + + testcases[tc++] = new TestCase( + SECTION, + "breaking out of a do... while loop", + "pass", + result1 ); + + + testcases[tc++] = new TestCase( + SECTION, + "breaking out of a labeled do...while loop", + "pass", + result2 ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js new file mode 100644 index 0000000..ce56cb9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js @@ -0,0 +1,70 @@ +/** + * File Name: dowhile-005 + * ECMA Section: + * Description: do...while statements + * + * Test a labeled do...while. Break out of the loop with no label + * should break out of the loop, but not out of the label. + * + * Currently causes an infinite loop in the monkey. Uncomment the + * print statement below and it works OK. + * + * Author: christine@netscape.com + * Date: 26 August 1998 + */ + var SECTION = "dowhile-005"; + var VERSION = "ECMA_2"; + var TITLE = "do...while with a labeled continue statement"; + var BUGNUMBER = "316293"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + NestedLabel(); + + + test(); + + function NestedLabel() { + i = 0; + result1 = "pass"; + result2 = "fail: did not hit code after inner loop"; + result3 = "pass"; + + outer: { + do { + inner: { +// print( i ); + break inner; + result1 = "fail: did break out of inner label"; + } + result2 = "pass"; + break outer; + print (i); + } while ( i++ < 100 ); + + } + + result3 = "fail: did not break out of outer label"; + + testcases[tc++] = new TestCase( + SECTION, + "number of loop iterations", + 0, + i ); + + testcases[tc++] = new TestCase( + SECTION, + "break out of inner loop", + "pass", + result1 ); + + testcases[tc++] = new TestCase( + SECTION, + "break out of outer loop", + "pass", + result2 ); + }
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js new file mode 100644 index 0000000..67dce64 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js @@ -0,0 +1,86 @@ +/** + * File Name: dowhile-006 + * ECMA Section: + * Description: do...while statements + * + * A general do...while test. + * + * Author: christine@netscape.com + * Date: 26 August 1998 + */ + var SECTION = "dowhile-006"; + var VERSION = "ECMA_2"; + var TITLE = "do...while"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile( new DoWhileObject( false, false, 10 ) ); + DoWhile( new DoWhileObject( true, false, 2 ) ); + DoWhile( new DoWhileObject( false, true, 3 ) ); + DoWhile( new DoWhileObject( true, true, 4 ) ); + + test(); + +function looping( object ) { + object.iterations--; + + if ( object.iterations <= 0 ) { + return false; + } else { + return true; + } +} +function DoWhileObject( breakOut, breakIn, iterations, loops ) { + this.iterations = iterations; + this.loops = loops; + this.breakOut = breakOut; + this.breakIn = breakIn; + this.looping = looping; +} +function DoWhile( object ) { + var result1 = false; + var result2 = false; + + outie: { + innie: { + do { + if ( object.breakOut ) + break outie; + + if ( object.breakIn ) + break innie; + + } while ( looping(object) ); + + // statements should be executed if: + // do...while exits normally + // do...while exits abruptly with no label + + result1 = true; + + } + + // statements should be executed if: + // do...while breaks out with label "innie" + // do...while exits normally + // do...while does not break out with "outie" + + result2 = true; + } + + testcases[tc++] = new TestCase( + SECTION, + "hit code after loop in inner loop", + ( object.breakIn || object.breakOut ) ? false : true , + result1 ); + + testcases[tc++] = new TestCase( + SECTION, + "hit code after loop in outer loop", + ( object.breakOut ) ? false : true, + result2 ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js new file mode 100644 index 0000000..849e70e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js @@ -0,0 +1,94 @@ +/** + * File Name: dowhile-007 + * ECMA Section: + * Description: do...while statements + * + * A general do...while test. + * + * Author: christine@netscape.com + * Date: 26 August 1998 + */ + var SECTION = "dowhile-007"; + var VERSION = "ECMA_2"; + var TITLE = "do...while"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile( new DoWhileObject( false, false, false, false )); + DoWhile( new DoWhileObject( true, false, false, false )); + DoWhile( new DoWhileObject( true, true, false, false )); + DoWhile( new DoWhileObject( true, true, true, false )); + DoWhile( new DoWhileObject( true, true, true, true )); + DoWhile( new DoWhileObject( false, false, false, true )); + DoWhile( new DoWhileObject( false, false, true, true )); + DoWhile( new DoWhileObject( false, true, true, true )); + DoWhile( new DoWhileObject( false, false, true, false )); + + test(); + +function DoWhileObject( out1, out2, out3, in1 ) { + this.breakOutOne = out1; + this.breakOutTwo = out2; + this.breakOutThree = out3; + this.breakIn = in1; +} +function DoWhile( object ) { + result1 = false; + result2 = false; + result3 = false; + result4 = false; + + outie: + do { + if ( object.breakOutOne ) { + break outie; + } + result1 = true; + + innie: + do { + if ( object.breakOutTwo ) { + break outie; + } + result2 = true; + + if ( object.breakIn ) { + break innie; + } + result3 = true; + + } while ( false ); + if ( object.breakOutThree ) { + break outie; + } + result4 = true; + } while ( false ); + + testcases[tc++] = new TestCase( + SECTION, + "break one: ", + (object.breakOutOne) ? false : true, + result1 ); + + testcases[tc++] = new TestCase( + SECTION, + "break two: ", + (object.breakOutOne||object.breakOutTwo) ? false : true, + result2 ); + + testcases[tc++] = new TestCase( + SECTION, + "break three: ", + (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true, + result3 ); + + testcases[tc++] = new TestCase( + SECTION, + "break four: ", + (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true, + result4 ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js new file mode 100644 index 0000000..63119af --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js @@ -0,0 +1,294 @@ +/** + * File Name: forin-001.js + * ECMA Section: + * Description: The forin-001 statement + * + * Verify that the property name is assigned to the property on the left + * hand side of the for...in expression. + * + * Author: christine@netscape.com + * Date: 28 August 1998 + */ + var SECTION = "forin-001"; + var VERSION = "ECMA_2"; + var TITLE = "The for...in statement"; + var BUGNUMBER="330890"; + var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + ForIn_1( { length:4, company:"netscape", year:2000, 0:"zero" } ); + ForIn_2( { length:4, company:"netscape", year:2000, 0:"zero" } ); + ForIn_3( { length:4, company:"netscape", year:2000, 0:"zero" } ); + +// ForIn_6({ length:4, company:"netscape", year:2000, 0:"zero" }); +// ForIn_7({ length:4, company:"netscape", year:2000, 0:"zero" }); + ForIn_8({ length:4, company:"netscape", year:2000, 0:"zero" }); + + test(); + + /** + * Verify that the left side argument is evaluated with every iteration. + * Verify that the name of each property of the object is assigned to a + * a property. + * + */ + function ForIn_1( object ) { + PropertyArray = new Array(); + ValueArray = new Array(); + + for ( PropertyArray[PropertyArray.length] in object ) { + ValueArray[ValueArray.length] = + object[PropertyArray[PropertyArray.length-1]]; + } + + for ( var i = 0; i < PropertyArray.length; i++ ) { + testcases[tc++] = new TestCase( + SECTION, + "object[" + PropertyArray[i] +"]", + object[PropertyArray[i]], + ValueArray[i] + ); + } + + testcases[tc++] = new TestCase( + SECTION, + "object.length", + PropertyArray.length, + object.length ); + } + + /** + * Similar to ForIn_1, except it should increment the counter variable + * every time the left hand expression is evaluated. + */ + function ForIn_2( object ) { + PropertyArray = new Array(); + ValueArray = new Array(); + var i = 0; + + for ( PropertyArray[i++] in object ) { + ValueArray[ValueArray.length] = + object[PropertyArray[PropertyArray.length-1]]; + } + + for ( i = 0; i < PropertyArray.length; i++ ) { + testcases[tc++] = new TestCase( + SECTION, + "object[" + PropertyArray[i] +"]", + object[PropertyArray[i]], + ValueArray[i] + ); + } + + testcases[tc++] = new TestCase( + SECTION, + "object.length", + PropertyArray.length, + object.length ); + } + + /** + * Break out of a for...in loop + * + * + */ + function ForIn_3( object ) { + var checkBreak = "pass"; + var properties = new Array(); + var values = new Array(); + + for ( properties[properties.length] in object ) { + values[values.length] = object[properties[properties.length-1]]; + break; + checkBreak = "fail"; + } + + testcases[tc++] = new TestCase( + SECTION, + "check break out of for...in", + "pass", + checkBreak ); + + testcases[tc++] = new TestCase( + SECTION, + "properties.length", + 1, + properties.length ); + + testcases[tc++] = new TestCase( + SECTION, + "object["+properties[0]+"]", + values[0], + object[properties[0]] ); + } + + /** + * Break out of a labeled for...in loop. + */ + function ForIn_4( object ) { + var result1 = 0; + var result2 = 0; + var result3 = 0; + var result4 = 0; + var i = 0; + var property = new Array(); + + butterbean: { + result1++; + + for ( property[i++] in object ) { + result2++; + break; + result4++; + } + result3++; + } + + testcases[tc++] = new TestCase( + SECTION, + "verify labeled statement is only executed once", + true, + result1 == 1 ); + + testcases[tc++] = new TestCase( + SECTION, + "verify statements in for loop are evaluated", + true, + result2 == i ); + + testcases[tc++] = new TestCase( + SECTION, + "verify break out of labeled for...in loop", + true, + result4 == 0 ); + + testcases[tc++] = new TestCase( + SECTION, + "verify break out of labeled block", + true, + result3 == 0 ); + } + + /** + * Labeled break out of a labeled for...in loop. + */ + function ForIn_5 (object) { + var result1 = 0; + var result2 = 0; + var result3 = 0; + var result4 = 0; + var i = 0; + var property = new Array(); + + bigredbird: { + result1++; + for ( property[i++] in object ) { + result2++; + break bigredbird; + result4++; + } + result3++; + } + + testcases[tc++] = new TestCase( + SECTION, + "verify labeled statement is only executed once", + true, + result1 == 1 ); + + testcases[tc++] = new TestCase( + SECTION, + "verify statements in for loop are evaluated", + true, + result2 == i ); + + testcases[tc++] = new TestCase( + SECTION, + "verify break out of labeled for...in loop", + true, + result4 == 0 ); + + testcases[tc++] = new TestCase( + SECTION, + "verify break out of labeled block", + true, + result3 == 0 ); + } + + /** + * Labeled continue from a labeled for...in loop + */ + function ForIn_7( object ) { + var result1 = 0; + var result2 = 0; + var result3 = 0; + var result4 = 0; + var i = 0; + var property = new Array(); + + bigredbird: + for ( property[i++] in object ) { + result2++; + continue bigredbird; + result4++; + } + + testcases[tc++] = new TestCase( + SECTION, + "verify statements in for loop are evaluated", + true, + result2 == i ); + + testcases[tc++] = new TestCase( + SECTION, + "verify break out of labeled for...in loop", + true, + result4 == 0 ); + + testcases[tc++] = new TestCase( + SECTION, + "verify break out of labeled block", + true, + result3 == 1 ); + } + + + /** + * continue in a for...in loop + * + */ + function ForIn_8( object ) { + var checkBreak = "pass"; + var properties = new Array(); + var values = new Array(); + + for ( properties[properties.length] in object ) { + values[values.length] = object[properties[properties.length-1]]; + break; + checkBreak = "fail"; + } + + testcases[tc++] = new TestCase( + SECTION, + "check break out of for...in", + "pass", + checkBreak ); + + testcases[tc++] = new TestCase( + SECTION, + "properties.length", + 1, + properties.length ); + + testcases[tc++] = new TestCase( + SECTION, + "object["+properties[0]+"]", + values[0], + object[properties[0]] ); + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js new file mode 100644 index 0000000..1f527a9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js @@ -0,0 +1,73 @@ +/** + * File Name: forin-002.js + * ECMA Section: + * Description: The forin-001 statement + * + * Verify that the property name is assigned to the property on the left + * hand side of the for...in expression. + * + * Author: christine@netscape.com + * Date: 28 August 1998 + */ + var SECTION = "forin-002"; + var VERSION = "ECMA_2"; + var TITLE = "The for...in statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function MyObject( value ) { + this.value = value; + this.valueOf = new Function ( "return this.value" ); + this.toString = new Function ( "return this.value + \"\"" ); + this.toNumber = new Function ( "return this.value + 0" ); + this.toBoolean = new Function ( "return Boolean( this.value )" ); + } + + ForIn_1(this); + ForIn_2(this); + + ForIn_1(new MyObject(true)); + ForIn_2(new MyObject(new Boolean(true))); + + ForIn_2(3); + + test(); + + /** + * For ... In in a With Block + * + */ + function ForIn_1( object) { + with ( object ) { + for ( property in object ) { + testcases[tc++] = new TestCase( + SECTION, + "with loop in a for...in loop. ("+object+")["+property +"] == "+ + "eval ( " + property +" )", + true, + object[property] == eval(property) ); + } + } + } + + /** + * With block in a For...In loop + * + */ + function ForIn_2(object) { + for ( property in object ) { + with ( object ) { + testcases[tc++] = new TestCase( + SECTION, + "with loop in a for...in loop. ("+object+")["+property +"] == "+ + "eval ( " + property +" )", + true, + object[property] == eval(property) ); + } + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js new file mode 100644 index 0000000..0da212d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js @@ -0,0 +1,39 @@ +/** + * File Name: if-001.js + * ECMA Section: + * Description: The if statement + * + * Verify that assignment in the if expression is evaluated correctly. + * Verifies the fix for bug http://scopus/bugsplat/show_bug.cgi?id=148822. + * + * Author: christine@netscape.com + * Date: 28 August 1998 + */ + var SECTION = "for-001"; + var VERSION = "ECMA_2"; + var TITLE = "The if statement"; + var BUGNUMBER="148822"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var a = 0; + var b = 0; + var result = "passed"; + + if ( a = b ) { + result = "failed: a = b should return 0"; + } + + testcases[tc++] = new TestCase( + SECTION, + "if ( a = b ), where a and b are both equal to 0", + "passed", + result ); + + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js new file mode 100644 index 0000000..83b51ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js @@ -0,0 +1,39 @@ +/** + * File Name: label-001.js + * ECMA Section: + * Description: Labeled statements + * + * Labeled break and continue within a for loop. + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "label-003"; + var VERSION = "ECMA_2"; + var TITLE = "Labeled statements"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + LabelTest(0, 0); + LabelTest(1, 1) + LabelTest(-1, 1000); + LabelTest(false, 0); + LabelTest(true, 1); + + test(); + + function LabelTest( limit, expect) { + woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } }; + + testcases[tc++] = new TestCase( + SECTION, + "break out of a labeled for loop: "+ limit, + expect, + result ); + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js new file mode 100644 index 0000000..64b01a8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js @@ -0,0 +1,53 @@ +/** + * File Name: label-002.js + * ECMA Section: + * Description: Labeled statements + * + * Labeled break and continue within a for-in loop. + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "label-002"; + var VERSION = "ECMA_2"; + var TITLE = "Labeled statements"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," ); + LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" ); + + LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" ); + LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" ); + + test(); + + function LabelTest( object, expect1, expect2 ) { + result = ""; + + yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo }; + + testcases[tc++] = new TestCase( + SECTION, + "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }", + true, + result == expect1 || result == expect2 ); + } + + function LabelTest2( object, expect1, expect2 ) { + result = ""; + + yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ; + + testcases[tc++] = new TestCase( + SECTION, + "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}", + true, + result == expect1 || result == expect2 ); + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js new file mode 100644 index 0000000..6336518 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js @@ -0,0 +1,64 @@ +/** + * File Name: switch-001.js + * ECMA Section: + * Description: The switch Statement + * + * A simple switch test with no abrupt completions. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + */ + var SECTION = "switch-001"; + var VERSION = "ECMA_2"; + var TITLE = "The switch statement"; + + var BUGNUMBER="315767"; + + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + SwitchTest( 0, 126 ); + SwitchTest( 1, 124 ); + SwitchTest( 2, 120 ); + SwitchTest( 3, 112 ); + SwitchTest( 4, 64 ); + SwitchTest( 5, 96 ); + SwitchTest( true, 96 ); + SwitchTest( false, 96 ); + SwitchTest( null, 96 ); + SwitchTest( void 0, 96 ); + SwitchTest( "0", 96 ); + + test(); + + function SwitchTest( input, expect ) { + var result = 0; + + switch ( input ) { + case 0: + result += 2; + case 1: + result += 4; + case 2: + result += 8; + case 3: + result += 16; + default: + result += 32; + case 4: + result +=64; + } + + testcases[tc++] = new TestCase( + SECTION, + "switch with no breaks, case expressions are numbers. input is "+ + input, + expect, + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js new file mode 100644 index 0000000..20746a8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js @@ -0,0 +1,60 @@ +/** + * File Name: switch-002.js + * ECMA Section: + * Description: The switch Statement + * + * A simple switch test with no abrupt completions. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + */ + var SECTION = "switch-002"; + var VERSION = "ECMA_2"; + var TITLE = "The switch statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + SwitchTest( 0, 6 ); + SwitchTest( 1, 4 ); + SwitchTest( 2, 56 ); + SwitchTest( 3, 48 ); + SwitchTest( 4, 64 ); + SwitchTest( true, 32 ); + SwitchTest( false, 32 ); + SwitchTest( null, 32 ); + SwitchTest( void 0, 32 ); + SwitchTest( "0", 32 ); + + test(); + + function SwitchTest( input, expect ) { + var result = 0; + + switch ( input ) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case 4: + result += 64; + } + + testcases[tc++] = new TestCase( + SECTION, + "switch with no breaks: input is " + input, + expect, + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js new file mode 100644 index 0000000..6a1389c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js @@ -0,0 +1,54 @@ +/** + * File Name: switch-003.js + * ECMA Section: + * Description: The switch Statement + * + * Attempt to verify that case statements are evaluated in source order + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + */ + var SECTION = "switch-003"; + var VERSION = "ECMA_2"; + var TITLE = "The switch statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + SwitchTest( "a", "abc" ); + SwitchTest( "b", "bc" ); + SwitchTest( "c", "c" ); + SwitchTest( "d", "*abc" ); + SwitchTest( "v", "*abc" ); + SwitchTest( "w", "w*abc" ); + SwitchTest( "x", "xw*abc" ); + SwitchTest( "y", "yxw*abc" ); + SwitchTest( "z", "zyxw*abc" ); +// SwitchTest( new java.lang.String("z"), "*abc" ); + + test(); + + function SwitchTest( input, expect ) { + var result = ""; + + switch ( input ) { + case "z": result += "z"; + case "y": result += "y"; + case "x": result += "x"; + case "w": result += "w"; + default: result += "*"; + case "a": result += "a"; + case "b": result += "b"; + case "c": result += "c"; + } + + testcases[tc++] = new TestCase( + SECTION, + "switch with no breaks: input is " + input, + expect, + result ); + }
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js new file mode 100644 index 0000000..23da926 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js @@ -0,0 +1,91 @@ +/** + * File Name: switch-003.js + * ECMA Section: + * Description: The switch Statement + * + * This uses variables and objects as case expressions in switch statements. + * This verifies a bunch of bugs: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315988 + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315975 + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315954 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + */ + var SECTION = "switch-003"; + var VERSION = "ECMA_2"; + var TITLE = "The switch statement"; + var BUGNUMBER= "315988"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + ONE = new Number(1); + ZERO = new Number(0); + var A = new String("A"); + var B = new String("B"); + TRUE = new Boolean( true ); + FALSE = new Boolean( false ); + UNDEFINED = void 0; + NULL = null; + + SwitchTest( ZERO, "ZERO" ); + SwitchTest( NULL, "NULL" ); + SwitchTest( UNDEFINED, "UNDEFINED" ); + SwitchTest( FALSE, "FALSE" ); + SwitchTest( false, "false" ); + SwitchTest( 0, "0" ); + + SwitchTest ( TRUE, "TRUE" ); + SwitchTest( 1, "1" ); + SwitchTest( ONE, "ONE" ); + SwitchTest( true, "true" ); + + SwitchTest( "a", "a" ); + SwitchTest( A, "A" ); + SwitchTest( "b", "b" ); + SwitchTest( B, "B" ); + + SwitchTest( new Boolean( true ), "default" ); + SwitchTest( new Boolean(false ), "default" ); + SwitchTest( new String( "A" ), "default" ); + SwitchTest( new Number( 0 ), "default" ); + + test(); + + function SwitchTest( input, expect ) { + var result = ""; + + switch ( input ) { + default: result += "default"; break; + case "a": result += "a"; break; + case "b": result += "b"; break; + case A: result += "A"; break; + case B: result += "B"; break; + case new Boolean(true): result += "new TRUE"; break; + case new Boolean(false): result += "new FALSE"; break; + case NULL: result += "NULL"; break; + case UNDEFINED: result += "UNDEFINED"; break; + case true: result += "true"; break; + case false: result += "false"; break; + case TRUE: result += "TRUE"; break; + case FALSE: result += "FALSE"; break; + case 0: result += "0"; break; + case 1: result += "1"; break; + case new Number(0) : result += "new ZERO"; break; + case new Number(1) : result += "new ONE"; break; + case ONE: result += "ONE"; break; + case ZERO: result += "ZERO"; break; + } + + testcases[tc++] = new TestCase( + SECTION, + "switch with no breaks: input is " + input, + expect, + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js new file mode 100644 index 0000000..bcd0eac --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js @@ -0,0 +1,82 @@ +/** + * File Name: try-001.js + * ECMA Section: + * Description: The try statement + * + * This test contains try, catch, and finally blocks. An exception is + * sometimes thrown by a function called from within the try block. + * + * This test doesn't actually make any LiveConnect calls. + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = ""; + var VERSION = "ECMA_2"; + var TITLE = "The try statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var INVALID_JAVA_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor"; + + TryNewJavaInteger( "3.14159", INVALID_JAVA_INTEGER_VALUE ); + TryNewJavaInteger( NaN, INVALID_JAVA_INTEGER_VALUE ); + TryNewJavaInteger( 0, 0 ); + TryNewJavaInteger( -1, -1 ); + TryNewJavaInteger( 1, 1 ); + TryNewJavaInteger( Infinity, Infinity ); + + test(); + + /** + * Check to see if the input is valid for java.lang.Integer. If it is + * not valid, throw INVALID_JAVA_INTEGER_VALUE. If input is valid, + * return Number( v ) + * + */ + + function newJavaInteger( v ) { + value = Number( v ); + if ( Math.floor(value) != value || isNaN(value) ) { + throw ( INVALID_JAVA_INTEGER_VALUE ); + } else { + return value; + } + } + + /** + * Call newJavaInteger( value ) from within a try block. Catch any + * exception, and store it in result. Verify that we got the right + * return value from newJavaInteger in cases in which we do not expect + * exceptions, and that we got the exception in cases where an exception + * was expected. + */ + function TryNewJavaInteger( value, expect ) { + var finalTest = false; + + try { + result = newJavaInteger( value ); + } catch ( e ) { + result = String( e ); + } finally { + finalTest = true; + } + testcases[tc++] = new TestCase( + SECTION, + "newJavaValue( " + value +" )", + expect, + result); + + testcases[tc++] = new TestCase( + SECTION, + "newJavaValue( " + value +" ) hit finally block", + true, + finalTest); + + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js new file mode 100644 index 0000000..de1e213 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js @@ -0,0 +1,79 @@ +/** + * File Name: try-003.js + * ECMA Section: + * Description: The try statement + * + * This test has a try with no catch, and a finally. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-003"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement"; + var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + // Tests start here. + + TrySomething( "x = \"hi\"", false ); + TrySomething( "throw \"boo\"", true ); + TrySomething( "throw 3", true ); + + test(); + + /** + * This function contains a try block with no catch block, + * but it does have a finally block. Try to evaluate expressions + * that do and do not throw exceptions. + */ + + function TrySomething( expression, throwing ) { + innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK"; + if (throwing) { + outerCatch = "FAILED: NO EXCEPTION CAUGHT"; + } else { + outerCatch = "PASS"; + } + outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK"; + + try { + try { + eval( expression ); + } finally { + innerFinally = "PASS"; + } + } catch ( e ) { + if (throwing) { + outerCatch = "PASS"; + } else { + outerCatch = "FAIL: HIT OUTER CATCH BLOCK"; + } + } finally { + outerFinally = "PASS"; + } + + + testcases[tc++] = new TestCase( + SECTION, + "eval( " + expression +" )", + "PASS", + innerFinally ); + testcases[tc++] = new TestCase( + SECTION, + "eval( " + expression +" )", + "PASS", + outerCatch ); + testcases[tc++] = new TestCase( + SECTION, + "eval( " + expression +" )", + "PASS", + outerFinally ); + + + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js new file mode 100644 index 0000000..b36dc44 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js @@ -0,0 +1,51 @@ +/** + * File Name: try-004.js + * ECMA Section: + * Description: The try statement + * + * This test has a try with one catch block but no finally. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-004"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + TryToCatch( "Math.PI", Math.PI ); + TryToCatch( "Thrower(5)", "Caught 5" ); + TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" ); + + test(); + + function Thrower( v ) { + throw "Caught " + v; + } + + /** + * Evaluate a string. Catch any exceptions thrown. If no exception is + * expected, verify the result of the evaluation. If an exception is + * expected, verify that we got the right exception. + */ + + function TryToCatch( value, expect ) { + try { + result = eval( value ); + } catch ( e ) { + result = e; + } + + testcases[tc++] = new TestCase( + SECTION, + "eval( " + value +" )", + expect, + result ); + } + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js new file mode 100644 index 0000000..94b5beb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js @@ -0,0 +1,54 @@ +/** + * File Name: try-005.js + * ECMA Section: + * Description: The try statement + * + * This test has a try with one catch block but no finally. Same + * as try-004, but the eval statement is called from a function, not + * directly from within the try block. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-005"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + TryToCatch( "Math.PI", Math.PI ); + TryToCatch( "Thrower(5)", "Caught 5" ); + TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" ); + + test(); + + function Thrower( v ) { + throw "Caught " + v; + } + function Eval( v ) { + return eval( v ); + } + + /** + * Evaluate a string. Catch any exceptions thrown. If no exception is + * expected, verify the result of the evaluation. If an exception is + * expected, verify that we got the right exception. + */ + + function TryToCatch( value, expect ) { + try { + result = Eval( value ); + } catch ( e ) { + result = e; + } + + testcases[tc++] = new TestCase( + SECTION, + "eval( " + value +" )", + expect, + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js new file mode 100644 index 0000000..924f24d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js @@ -0,0 +1,84 @@ +/** + * File Name: try-006.js + * ECMA Section: + * Description: The try statement + * + * Throw an exception from within a With block in a try block. Verify + * that any expected exceptions are caught. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-006"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + /** + * This is the "check" function for test objects that will + * throw an exception. + */ + function throwException() { + throw EXCEPTION_STRING +": " + this.valueOf(); + } + var EXCEPTION_STRING = "Exception thrown:"; + + /** + * This is the "check" function for test objects that do not + * throw an exception + */ + function noException() { + return this.valueOf(); + } + + /** + * Add test cases here + */ + TryWith( new TryObject( "hello", throwException, true )); + TryWith( new TryObject( "hola", noException, false )); + + /** + * Run the test. + */ + + test(); + + /** + * This is the object that will be the "this" in a with block. + */ + function TryObject( value, fun, exception ) { + this.value = value; + this.exception = exception; + + this.valueOf = new Function ( "return this.value" ); + this.check = fun; + } + + /** + * This function has the try block that has a with block within it. + * Test cases are added in this function. Within the with block, the + * object's "check" function is called. If the test object's exception + * property is true, we expect the result to be the exception value. + * If exception is false, then we expect the result to be the value of + * the object. + */ + function TryWith( object ) { + try { + with ( object ) { + result = check(); + } + } catch ( e ) { + result = e; + } + + testcases[tc++] = new TestCase( + SECTION, + "TryWith( " + object.value +" )", + (object.exception ? EXCEPTION_STRING +": " + object.valueOf() : object.valueOf()), + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js new file mode 100644 index 0000000..14a960a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js @@ -0,0 +1,89 @@ +/** + * File Name: try-007.js + * ECMA Section: + * Description: The try statement + * + * This test has a for-in statement within a try block. + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-007"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement: for-in"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + /** + * This is the "check" function for test objects that will + * throw an exception. + */ + function throwException() { + throw EXCEPTION_STRING +": " + this.valueOf(); + } + var EXCEPTION_STRING = "Exception thrown:"; + + /** + * This is the "check" function for test objects that do not + * throw an exception + */ + function noException() { + return this.valueOf(); + } + + /** + * Add test cases here + */ + TryForIn( new TryObject( "hello", throwException, true )); + TryForIn( new TryObject( "hola", noException, false )); + + /** + * Run the test. + */ + + test(); + +/** + * This is the object that will be the "this" in a with block. + * The check function is either throwExeption() or noException(). + * See above. + * + */ +function TryObject( value, fun, exception ) { + this.value = value; + this.exception = exception; + + this.check = fun; + this.valueOf = function () { return this.value; } +} + +/** + * This function has a for-in statement within a try block. Test cases + * are added after the try-catch-finally statement. Within the for-in + * block, call a function that can throw an exception. Verify that any + * exceptions are properly caught. + */ + + function TryForIn( object ) { + try { + for ( p in object ) { + if ( typeof object[p] == "function" ) { + result = object[p](); + } + } + } catch ( e ) { + result = e; + } + + testcases[tc++] = new TestCase( + SECTION, + "TryForIn( " + object+ " )", + (object.exception ? EXCEPTION_STRING +": " + object.value : object.value), + result ); + + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js new file mode 100644 index 0000000..78092b6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js @@ -0,0 +1,56 @@ +/** + * File Name: try-008.js + * ECMA Section: + * Description: The try statement + * + * This test has a try block in a constructor. + * + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-008"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement: try in a constructor"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + function Integer( value, exception ) { + try { + this.value = checkValue( value ); + } catch ( e ) { + this.value = e.toString(); + } + + testcases[tc++] = new TestCase( + SECTION, + "Integer( " + value +" )", + (exception ? INVALID_INTEGER_VALUE +": " + value : this.value), + this.value ); + } + + var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor"; + + function checkValue( value ) { + if ( Math.floor(value) != value || isNaN(value) ) { + throw ( INVALID_INTEGER_VALUE +": " + value ); + } else { + return value; + } + } + + // add test cases + + new Integer( 3, false ); + new Integer( NaN, true ); + new Integer( 0, false ); + new Integer( Infinity, false ); + new Integer( -2.12, true ); + new Integer( Math.LN2, true ); + + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js new file mode 100644 index 0000000..778e647 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js @@ -0,0 +1,63 @@ +/** + * File Name: try-009.js + * ECMA Section: + * Description: The try statement + * + * This test has a try block within a while block. Verify that an exception + * breaks out of the while. I don't really know why this is an interesting + * test case but Mike Shaver had two of these so what the hey. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-009"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement: try in a while block"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var EXCEPTION_STRING = "Exception thrown: "; + var NO_EXCEPTION_STRING = "No exception thrown: "; + + + TryInWhile( new TryObject( "hello", ThrowException, true ) ); + TryInWhile( new TryObject( "aloha", NoException, false )); + + test(); + + function TryObject( value, throwFunction, result ) { + this.value = value; + this.thrower = throwFunction; + this.result = result; + } + function ThrowException() { + throw EXCEPTION_STRING + this.value; + } + function NoException() { + return NO_EXCEPTION_STRING + this.value; + } + function TryInWhile( object ) { + result = null; + while ( true ) { + try { + object.thrower(); + result = NO_EXCEPTION_STRING + object.value; + break; + } catch ( e ) { + result = e; + break; + } + } + + testcases[tc++] = new TestCase( + SECTION, + "( "+ object +".thrower() )", + (object.result + ? EXCEPTION_STRING + object.value : + NO_EXCEPTION_STRING + object.value), + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js new file mode 100644 index 0000000..eeb7f88 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js @@ -0,0 +1,70 @@ +/** + * File Name: try-010.js + * ECMA Section: + * Description: The try statement + * + * This has a try block nested in the try block. Verify that the + * exception is caught by the right try block, and all finally blocks + * are executed. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-010"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement: try in a tryblock"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var EXCEPTION_STRING = "Exception thrown: "; + var NO_EXCEPTION_STRING = "No exception thrown: "; + + + NestedTry( new TryObject( "No Exceptions Thrown", NoException, NoException, 43 ) ); + NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 )); + NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 )); + NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 )); + + test(); + + function TryObject( description, tryOne, tryTwo, result ) { + this.description = description; + this.tryOne = tryOne; + this.tryTwo = tryTwo; + this.result = result; + } + function ThrowException() { + throw EXCEPTION_STRING + this.value; + } + function NoException() { + return NO_EXCEPTION_STRING + this.value; + } + function NestedTry( object ) { + result = 0; + try { + object.tryOne(); + result += 1; + try { + object.tryTwo(); + result += 2; + } catch ( e ) { + result +=4; + } finally { + result += 8; + } + } catch ( e ) { + result += 16; + } finally { + result += 32; + } + + testcases[tc++] = new TestCase( + SECTION, + object.description, + object.result, + result ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js new file mode 100644 index 0000000..f8c8e00 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js @@ -0,0 +1,92 @@ +/** + * File Name: try-012.js + * ECMA Section: + * Description: The try statement + * + * This test has a try with no catch, and a finally. This is like try-003, + * but throws from a finally block, not the try block. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "try-012"; + var VERSION = "ECMA_2"; + var TITLE = "The try statement"; + var BUGNUMBER="336872"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + // Tests start here. + + TrySomething( "x = \"hi\"", true ); + TrySomething( "throw \"boo\"", true ); + TrySomething( "throw 3", true ); + + test(); + + /** + * This function contains a try block with no catch block, + * but it does have a finally block. Try to evaluate expressions + * that do and do not throw exceptions. + * + * The productioni TryStatement Block Finally is evaluated as follows: + * 1. Evaluate Block + * 2. Evaluate Finally + * 3. If Result(2).type is normal return result 1 (in the test case, result 1 has + * the completion type throw) + * 4. return result 2 (does not get hit in this case) + * + */ + + function TrySomething( expression, throwing ) { + innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK"; + if (throwing) { + outerCatch = "FAILED: NO EXCEPTION CAUGHT"; + } else { + outerCatch = "PASS"; + } + outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK"; + + + // If the inner finally does not throw an exception, the result + // of the try block should be returned. (Type of inner return + // value should be throw if finally executes correctly + + try { + try { + throw 0; + } finally { + innerFinally = "PASS"; + eval( expression ); + } + } catch ( e ) { + if (throwing) { + outerCatch = "PASS"; + } else { + outerCatch = "FAIL: HIT OUTER CATCH BLOCK"; + } + } finally { + outerFinally = "PASS"; + } + + + testcases[tc++] = new TestCase( + SECTION, + "eval( " + expression +" ): evaluated inner finally block", + "PASS", + innerFinally ); + testcases[tc++] = new TestCase( + SECTION, + "eval( " + expression +" ): evaluated outer catch block ", + "PASS", + outerCatch ); + testcases[tc++] = new TestCase( + SECTION, + "eval( " + expression +" ): evaluated outer finally block", + "PASS", + outerFinally ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js new file mode 100644 index 0000000..f9c0d64 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js @@ -0,0 +1,39 @@ +/** + * File Name: while-001 + * ECMA Section: + * Description: while statement + * + * Verify that the while statement is not executed if the while expression is + * false + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "while-001"; + var VERSION = "ECMA_2"; + var TITLE = "while statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile(); + test(); + + function DoWhile() { + result = "pass"; + + while (false) { + result = "fail"; + break; + } + + testcases[tc++] = new TestCase( + SECTION, + "while statement: don't evaluate statement is expression is false", + "pass", + result ); + + }
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js new file mode 100644 index 0000000..3fda04b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js @@ -0,0 +1,83 @@ +/** + * File Name: while-002 + * ECMA Section: + * Description: while statement + * + * Verify that the while statement is not executed if the while expression is + * false + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "while-002"; + var VERSION = "ECMA_2"; + var TITLE = "while statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile( new DoWhileObject( + "while expression is null", + null, + "result = \"fail: should not have evaluated statements in while block;break" + ) ); + + DoWhile( new DoWhileObject( + "while expression is undefined", + void 0, + "result = \"fail: should not have evaluated statements in while block; break" + )); + + DoWhile( new DoWhileObject( + "while expression is 0", + 0, + "result = \"fail: should not have evaluated statements in while block; break;" + )); + + DoWhile( new DoWhileObject( + "while expression is eval(\"\")", + eval(""), + "result = \"fail: should not have evaluated statements in while block; break" + )); + + DoWhile( new DoWhileObject( + "while expression is NaN", + NaN, + "result = \"fail: should not have evaluated statements in while block; break" + )); + + test(); + + function DoWhileObject( d, e, s ) { + this.description = d; + this.whileExpression = e; + this.statements = s; + } + + function DoWhile( object ) { + result = "pass"; + + while ( expression = object.whileExpression ) { + eval( object.statements ); + } + + // verify that the while expression was evaluated + + testcases[tc++] = new TestCase( + SECTION, + "verify that while expression was evaluated (should be "+ + object.whileExpression +")", + "pass", + (object.whileExpression == expression || + ( isNaN(object.whileExpression) && isNaN(expression) ) + ) ? "pass" : "fail" ); + + testcases[tc++] = new TestCase( + SECTION, + object.description, + "pass", + result ); + }
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js new file mode 100644 index 0000000..0164f05 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js @@ -0,0 +1,84 @@ +/** + * File Name: while-003 + * ECMA Section: + * Description: while statement + * + * The while expression evaluates to true, Statement returns abrupt completion. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "while-003"; + var VERSION = "ECMA_2"; + var TITLE = "while statement"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile( new DoWhileObject( + "while expression is true", + true, + "result = \"pass\";" )); + + DoWhile( new DoWhileObject( + "while expression is 1", + 1, + "result = \"pass\";" )); + + DoWhile( new DoWhileObject( + "while expression is new Boolean(false)", + new Boolean(false), + "result = \"pass\";" )); + + DoWhile( new DoWhileObject( + "while expression is new Object()", + new Object(), + "result = \"pass\";" )); + + DoWhile( new DoWhileObject( + "while expression is \"hi\"", + "hi", + "result = \"pass\";" )); +/* + DoWhile( new DoWhileObject( + "while expression has a continue in it", + "true", + "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";" + )); +*/ + test(); + + function DoWhileObject( d, e, s ) { + this.description = d; + this.whileExpression = e; + this.statements = s; + } + + function DoWhile( object ) { + result = "fail: statements in while block were not evaluated"; + + while ( expression = object.whileExpression ) { + eval( object.statements ); + break; + } + + // verify that the while expression was evaluated + + testcases[tc++] = new TestCase( + SECTION, + "verify that while expression was evaluated (should be "+ + object.whileExpression +")", + "pass", + (object.whileExpression == expression || + ( isNaN(object.whileExpression) && isNaN(expression) ) + ) ? "pass" : "fail" ); + + testcases[tc++] = new TestCase( + SECTION, + object.description, + "pass", + result ); + }
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js new file mode 100644 index 0000000..48faeb0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js @@ -0,0 +1,214 @@ +/** + * File Name: while-004 + * ECMA Section: + * Description: while statement + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "while-004"; + var VERSION = "ECMA_2"; + var TITLE = "while statement"; + var BUGNUMBER="316725"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + DoWhile_1(); + DoWhile_2(); + DoWhile_3(); + DoWhile_4(); + DoWhile_5(); + + test(); + + /** + * Break out of a while by calling return. + * + * Tests: 12.6.2 step 6. + */ + function dowhile() { + result = "pass"; + + while (true) { + return result; + result = "fail: hit code after return statement"; + break; + } + } + + function DoWhile_1() { + description = "return statement in a while block"; + + result = dowhile(); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_1" + description, + "pass", + result ); + } + + /** + * While with a labeled continue statement. Verify that statements + * after the continue statement are not evaluated. + * + * Tests: 12.6.2 step 8. + * + */ + function DoWhile_2() { + var description = "while with a labeled continue statement"; + var result1 = "pass"; + var result2 = "fail: did not execute code after loop, but inside label"; + var i = 0; + var j = 0; + + theloop: + while( i++ < 10 ) { + j++; + continue theloop; + result1 = "failed: hit code after continue statement"; + } + result2 = "pass"; + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")", + true, + j == 10 ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_2: " +description +" - code after labeled continue should not be executed", + "pass", + result1 ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_2: " +description +" - code after loop but inside label should be executed", + "pass", + result2 ); + } + + /** + * While with a labeled break. + * + */ + function DoWhile_3() { + var description = "while with a labeled break statement"; + var result1 = "pass"; + var result2 = "pass"; + var result3 = "fail: did not get to code after label"; + + woohoo: { + while( true ) { + break woohoo; + result1 = "fail: got to code after a break"; + } + result2 = "fail: got to code outside of loop but inside label"; + } + + result3 = "pass"; + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_3: " +description +" - verify break out of loop", + "pass", + result1 ); + + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_3: " +description +" - verify break out of label", + "pass", + result2 ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_3: " +description + " - verify correct exit from label", + "pass", + result3 ); + } + + + /** + * Labled while with an unlabeled break + * + */ + function DoWhile_4() { + var description = "labeled while with an unlabeled break"; + var result1 = "pass"; + var result2 = "pass"; + var result3 = "fail: did not evaluate statement after label"; + + woohooboy: { + while( true ) { + break woohooboy; + result1 = "fail: got to code after the break"; + } + result2 = "fail: broke out of while, but not out of label"; + } + result3 = "pass"; + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_4: " +description +" - verify break out of while loop", + "pass", + result1 ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_4: " +description + " - verify break out of label", + "pass", + result2 ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_4: " +description +" - verify that statements after label are evaluated", + "pass", + result3 ); + } + + /** + * in this case, should behave the same way as + * + * + */ + function DoWhile_5() { + var description = "while with a labeled continue statement"; + var result1 = "pass"; + var result2 = "fail: did not execute code after loop, but inside label"; + var i = 0; + var j = 0; + + theloop: { + j++; + while( i++ < 10 ) { + continue; + result1 = "failed: hit code after continue statement"; + } + result2 = "pass"; + } + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_5: " +description + " - continue should not execute statements above the loop", + true, + ( j == 1 ) ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_5: " +description +" - code after labeled continue should not be executed", + "pass", + result1 ); + + testcases[tc++] = new TestCase( + SECTION, + "DoWhile_5: " +description +" - code after loop but inside label should be executed", + "pass", + result2 ); + } + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js new file mode 100644 index 0000000..738264e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js @@ -0,0 +1,100 @@ +/** + * File Name: String/match-001.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * String.match( regexp ) + * + * If regexp is not an object of type RegExp, it is replaced with result + * of the expression new RegExp(regexp). Let string denote the result of + * converting the this value to a string. If regexp.global is false, + * return the result obtained by invoking RegExp.prototype.exec (see + * section 15.7.5.3) on regexp with string as parameter. + * + * Otherwise, set the regexp.lastIndex property to 0 and invoke + * RegExp.prototype.exec repeatedly until there is no match. If there is a + * match with an empty string (in other words, if the value of + * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. + * The value returned is an array with the properties 0 through n-1 + * corresponding to the first element of the result of each matching + * invocation of RegExp.prototype.exec. + * + * Note that the match function is intentionally generic; it does not + * require that its this value be a string object. Therefore, it can be + * transferred to other kinds of objects for use as a method. + */ + + var SECTION = "String/match-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.match( regexp )"; + + startTest(); + + // the regexp argument is not a RegExp object + // this is not a string object + + // cases in which the regexp global property is false + + AddRegExpCases( 3, "3", "1234567890", 1, 2, ["3"] ); + + // cases in which the regexp object global property is true + + AddGlobalRegExpCases( /34/g, "/34/g", "343443444", 3, ["34", "34", "34"] ); + AddGlobalRegExpCases( /\d{1}/g, "/d{1}/g", "123456abcde7890", 10, + ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] ); + + AddGlobalRegExpCases( /\d{2}/g, "/d{2}/g", "123456abcde7890", 5, + ["12", "34", "56", "78", "90"] ); + + AddGlobalRegExpCases( /\D{2}/g, "/d{2}/g", "123456abcde7890", 2, + ["ab", "cd"] ); + + test(); + + +function AddRegExpCases( + regexp, str_regexp, string, length, index, matches_array ) { + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + length, + string.match(regexp).length ); + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").index", + index, + string.match(regexp).index ); + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").input", + string, + string.match(regexp).input ); + + for ( var matches = 0; matches < matches_array.length; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} + +function AddGlobalRegExpCases( + regexp, str_regexp, string, length, matches_array ) { + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + length, + string.match(regexp).length ); + + for ( var matches = 0; matches < matches_array.length; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js new file mode 100644 index 0000000..83ac2fa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js @@ -0,0 +1,168 @@ +/** + * File Name: String/match-002.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * String.match( regexp ) + * + * If regexp is not an object of type RegExp, it is replaced with result + * of the expression new RegExp(regexp). Let string denote the result of + * converting the this value to a string. If regexp.global is false, + * return the result obtained by invoking RegExp.prototype.exec (see + * section 15.7.5.3) on regexp with string as parameter. + * + * Otherwise, set the regexp.lastIndex property to 0 and invoke + * RegExp.prototype.exec repeatedly until there is no match. If there is a + * match with an empty string (in other words, if the value of + * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. + * The value returned is an array with the properties 0 through n-1 + * corresponding to the first element of the result of each matching + * invocation of RegExp.prototype.exec. + * + * Note that the match function is intentionally generic; it does not + * require that its this value be a string object. Therefore, it can be + * transferred to other kinds of objects for use as a method. + * + * This file tests cases in which regexp.global is false. Therefore, + * results should behave as regexp.exec with string passed as a parameter. + * + */ + + var SECTION = "String/match-002.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.match( regexp )"; + + startTest(); + + // the regexp argument is not a RegExp object + // this is not a string object + + AddRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/, + "/([\d]{5})([-\ ]?[\d]{4})?$/", + "Boston, Mass. 02134", + 14, + ["02134", "02134", undefined]); + + AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g, + "/([\d]{5})([-\ ]?[\d]{4})?$/g", + "Boston, Mass. 02134", + ["02134"]); + + // set the value of lastIndex + re = /([\d]{5})([-\ ]?[\d]{4})?$/; + re.lastIndex = 0; + + s = "Boston, MA 02134"; + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0", + s, + s.lastIndexOf("0"), + ["02134", "02134", undefined]); + + + re.lastIndex = s.length; + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + + s.length, + s, + s.lastIndexOf("0"), + ["02134", "02134", undefined] ); + + re.lastIndex = s.lastIndexOf("0"); + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + + s.lastIndexOf("0"), + s, + s.lastIndexOf("0"), + ["02134", "02134", undefined]); + + re.lastIndex = s.lastIndexOf("0") + 1; + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + + s.lastIndexOf("0") +1, + s, + s.lastIndexOf("0"), + ["02134", "02134", undefined]); + + test(); + +function AddRegExpCases( + regexp, str_regexp, string, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(string) == null || matches_array == null ) { + AddTestCase( + string + ".match(" + regexp +")", + matches_array, + string.match(regexp) ); + + return; + } + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + matches_array.length, + string.match(regexp).length ); + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").index", + index, + string.match(regexp).index ); + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").input", + string, + string.match(regexp).input ); + + var limit = matches_array.length > string.match(regexp).length ? + matches_array.length : + string.match(regexp).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} + +function AddGlobalRegExpCases( + regexp, str_regexp, string, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(string) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + string +")", + matches_array, + regexp.exec(string) ); + + return; + } + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + matches_array.length, + string.match(regexp).length ); + + var limit = matches_array.length > string.match(regexp).length ? + matches_array.length : + string.match(regexp).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js new file mode 100644 index 0000000..f63e9e2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js @@ -0,0 +1,126 @@ +/** + * File Name: String/match-003.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * String.match( regexp ) + * + * If regexp is not an object of type RegExp, it is replaced with result + * of the expression new RegExp(regexp). Let string denote the result of + * converting the this value to a string. If regexp.global is false, + * return the result obtained by invoking RegExp.prototype.exec (see + * section 15.7.5.3) on regexp with string as parameter. + * + * Otherwise, set the regexp.lastIndex property to 0 and invoke + * RegExp.prototype.exec repeatedly until there is no match. If there is a + * match with an empty string (in other words, if the value of + * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. + * The value returned is an array with the properties 0 through n-1 + * corresponding to the first element of the result of each matching + * invocation of RegExp.prototype.exec. + * + * Note that the match function is intentionally generic; it does not + * require that its this value be a string object. Therefore, it can be + * transferred to other kinds of objects for use as a method. + */ + + var SECTION = "String/match-003.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.match( regexp )"; + + startTest(); + + // the regexp argument is not a RegExp object + // this is not a string object + + +// [if regexp.global is true] set the regexp.lastIndex property to 0 and +// invoke RegExp.prototype.exec repeatedly until there is no match. If +// there is a match with an empty string (in other words, if the value of +// regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. +// The value returned is an array with the properties 0 through n-1 +// corresponding to the first element of the result of each matching invocation +// of RegExp.prototype.exec. + + + // set the value of lastIndex + re = /([\d]{5})([-\ ]?[\d]{4})?$/g; + + + s = "Boston, MA 02134"; + + AddGlobalRegExpCases( re, + "re = " + re, + s, + ["02134" ]); + + re.lastIndex = 0; + + AddGlobalRegExpCases( + re, + "re = " + re + "; re.lastIndex = 0 ", + s, + ["02134"]); + + + re.lastIndex = s.length; + + AddGlobalRegExpCases( + re, + "re = " + re + "; re.lastIndex = " + s.length, + s, + ["02134"] ); + + re.lastIndex = s.lastIndexOf("0"); + + AddGlobalRegExpCases( + re, + "re = "+ re +"; re.lastIndex = " + s.lastIndexOf("0"), + s, + ["02134"]); + + re.lastIndex = s.lastIndexOf("0") + 1; + + AddGlobalRegExpCases( + re, + "re = " +re+ "; re.lastIndex = " + (s.lastIndexOf("0") +1), + s, + ["02134"]); + + test(); + +function AddGlobalRegExpCases( + regexp, str_regexp, string, matches_array ) { + + // prevent a runtime error + + if ( string.match(regexp) == null || matches_array == null ) { + AddTestCase( + string + ".match(" + str_regexp +")", + matches_array, + string.match(regexp) ); + + return; + } + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + matches_array.length, + string.match(regexp).length ); + + var limit = matches_array.length > string.match(regexp).length ? + matches_array.length : + string.match(regexp).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js new file mode 100644 index 0000000..c35d988 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js @@ -0,0 +1,167 @@ +/** + * File Name: String/match-004.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * String.match( regexp ) + * + * If regexp is not an object of type RegExp, it is replaced with result + * of the expression new RegExp(regexp). Let string denote the result of + * converting the this value to a string. If regexp.global is false, + * return the result obtained by invoking RegExp.prototype.exec (see + * section 15.7.5.3) on regexp with string as parameter. + * + * Otherwise, set the regexp.lastIndex property to 0 and invoke + * RegExp.prototype.exec repeatedly until there is no match. If there is a + * match with an empty string (in other words, if the value of + * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. + * The value returned is an array with the properties 0 through n-1 + * corresponding to the first element of the result of each matching + * invocation of RegExp.prototype.exec. + * + * Note that the match function is intentionally generic; it does not + * require that its this value be a string object. Therefore, it can be + * transferred to other kinds of objects for use as a method. + * + * + * The match function should be intentionally generic, and not require + * this to be a string. + * + */ + + var SECTION = "String/match-004.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.match( regexp )"; + + var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=345818"; + + startTest(); + + // set the value of lastIndex + re = /0./; + s = 10203040506070809000; + + Number.prototype.match = String.prototype.match; + + AddRegExpCases( re, + "re = " + re , + s, + String(s), + 1, + ["02"]); + + + re.lastIndex = 0; + AddRegExpCases( re, + "re = " + re +" [lastIndex is " + re.lastIndex+"]", + s, + String(s), + 1, + ["02"]); +/* + + re.lastIndex = s.length; + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + + s.length, + s, + s.lastIndexOf("0"), + null ); + + re.lastIndex = s.lastIndexOf("0"); + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + + s.lastIndexOf("0"), + s, + s.lastIndexOf("0"), + ["02134"]); + + re.lastIndex = s.lastIndexOf("0") + 1; + + AddRegExpCases( re, + "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + + s.lastIndexOf("0") +1, + s, + 0, + null); +*/ + test(); + +function AddRegExpCases( + regexp, str_regexp, string, str_string, index, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(string) == null || matches_array == null ) { + AddTestCase( + string + ".match(" + regexp +")", + matches_array, + string.match(regexp) ); + + return; + } + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + matches_array.length, + string.match(regexp).length ); + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").index", + index, + string.match(regexp).index ); + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").input", + str_string, + string.match(regexp).input ); + + var limit = matches_array.length > string.match(regexp).length ? + matches_array.length : + string.match(regexp).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} + +function AddGlobalRegExpCases( + regexp, str_regexp, string, matches_array ) { + + // prevent a runtime error + + if ( regexp.exec(string) == null || matches_array == null ) { + AddTestCase( + regexp + ".exec(" + string +")", + matches_array, + regexp.exec(string) ); + + return; + } + + AddTestCase( + "( " + string + " ).match(" + str_regexp +").length", + matches_array.length, + string.match(regexp).length ); + + var limit = matches_array.length > string.match(regexp).length ? + matches_array.length : + string.match(regexp).length; + + for ( var matches = 0; matches < limit; matches++ ) { + AddTestCase( + "( " + string + " ).match(" + str_regexp +")[" + matches +"]", + matches_array[matches], + string.match(regexp)[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js new file mode 100644 index 0000000..5ff8dc0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js @@ -0,0 +1,60 @@ +/** + * File Name: String/replace-001.js + * ECMA Section: 15.6.4.10 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + + var SECTION = "String/replace-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.replace( regexp, replaceValue )"; + + startTest(); + + /* + * If regexp is not an object of type RegExp, it is replaced with the + * result of the expression new RegExp(regexp). Let string denote the + * result of converting the this value to a string. String is searched + * for the first occurrence of the regular expression pattern regexp if + * regexp.global is false, or all occurrences if regexp.global is true. + * + * The match is performed as in String.prototype.match, including the + * update of regexp.lastIndex. Let m be the number of matched + * parenthesized subexpressions as specified in section 15.7.5.3. + * + * If replaceValue is a function, then for each matched substring, call + * the function with the following m + 3 arguments. Argument 1 is the + * substring that matched. The next m arguments are all of the matched + * subexpressions. Argument m + 2 is the length of the left context, and + * argument m + 3 is string. + * + * The result is a string value derived from the original input by + * replacing each matched substring with the corresponding return value + * of the function call, converted to a string if need be. + * + * Otherwise, let newstring denote the result of converting replaceValue + * to a string. The result is a string value derived from the original + * input string by replacing each matched substring with a string derived + * from newstring by replacing characters in newstring by replacement text + * as specified in the following table: + * + * $& The matched substring. + * $‘ The portion of string that precedes the matched substring. + * $’ The portion of string that follows the matched substring. + * $+ The substring matched by the last parenthesized subexpressions in + * the regular expression. + * $n The corresponding matched parenthesized subexpression n, where n + * is a single digit 0-9. If there are fewer than n subexpressions, “$n + * is left unchanged. + * + * Note that the replace function is intentionally generic; it does not + * require that its this value be a string object. Therefore, it can be + * transferred to other kinds of objects for use as a method. + */ + + + testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" }; + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js new file mode 100644 index 0000000..b2d7c9c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js @@ -0,0 +1,106 @@ +/** + * File Name: String/split-001.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * Since regular expressions have been part of JavaScript since 1.2, there + * are already tests for regular expressions in the js1_2/regexp folder. + * + * These new tests try to supplement the existing tests, and verify that + * our implementation of RegExp conforms to the ECMA specification, but + * does not try to be as exhaustive as in previous tests. + * + * The [,limit] argument to String.split is new, and not covered in any + * existing tests. + * + * String.split cases are covered in ecma/String/15.5.4.8-*.js. + * String.split where separator is a RegExp are in + * js1_2/regexp/string_split.js + * + */ + + var SECTION = "ecma_2/String/split-001.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.split( regexp, [,limit] )"; + + startTest(); + + // the separator is not supplied + // separator is undefined + // separator is an empty string + + AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] ); + AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] ); + + // separartor is a regexp + // separator regexp value global setting is set + // string is an empty string + // if separator is an empty string, split each by character + + // this is not a String object + + // limit is not a number + // limit is undefined + // limit is larger than 2^32-1 + // limit is a negative number + + test(); + +function AddSplitCases( string, separator, str_sep, split_array ) { + + // verify that the result of split is an object of type Array + AddTestCase( + "( " + string + " ).split(" + str_sep +").constructor == Array", + true, + string.split(separator).constructor == Array ); + + // check the number of items in the array + AddTestCase( + "( " + string + " ).split(" + str_sep +").length", + split_array.length, + string.split(separator).length ); + + // check the value of each array item + var limit = (split_array.length > string.split(separator).length ) + ? split_array.length : string.split(separator).length; + + for ( var matches = 0; matches < split_array.length; matches++ ) { + AddTestCase( + "( " + string + " ).split(" + str_sep +")[" + matches +"]", + split_array[matches], + string.split( separator )[matches] ); + } +} + +function AddLimitedSplitCases( + string, separator, str_sep, limit, str_limit, split_array ) { + + // verify that the result of split is an object of type Array + + AddTestCase( + "( " + string + " ).split(" + str_sep +", " + str_limit + + " ).constructor == Array", + true, + string.split(separator, limit).constructor == Array ); + + // check the length of the array + + AddTestCase( + "( " + string + " ).split(" + str_sep +", " + str_limit + " ).length", + length, + string.split(separator).length ); + + // check the value of each array item + + for ( var matches = 0; matches < split_array.length; matches++ ) { + AddTestCase( + "( " + string + " ).split(" + str_sep +", " + str_limit + " )[" + matches +"]", + split_array[matches], + string.split( separator )[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js new file mode 100644 index 0000000..1007a31 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js @@ -0,0 +1,264 @@ +/** + * File Name: String/split-002.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * Since regular expressions have been part of JavaScript since 1.2, there + * are already tests for regular expressions in the js1_2/regexp folder. + * + * These new tests try to supplement the existing tests, and verify that + * our implementation of RegExp conforms to the ECMA specification, but + * does not try to be as exhaustive as in previous tests. + * + * The [,limit] argument to String.split is new, and not covered in any + * existing tests. + * + * String.split cases are covered in ecma/String/15.5.4.8-*.js. + * String.split where separator is a RegExp are in + * js1_2/regexp/string_split.js + * + */ + + var SECTION = "ecma_2/String/split-002.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.split( regexp, [,limit] )"; + + startTest(); + + // the separator is not supplied + // separator is undefined + // separator is an empty string + +// AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] ); +// AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] ); + + // separator is an empty regexp + // separator is not supplied + + CompareSplit( "hello", "ll" ); + + CompareSplit( "hello", "l" ); + CompareSplit( "hello", "x" ); + CompareSplit( "hello", "h" ); + CompareSplit( "hello", "o" ); + CompareSplit( "hello", "hello" ); + CompareSplit( "hello", undefined ); + + CompareSplit( "hello", ""); + CompareSplit( "hello", "hellothere" ); + + CompareSplit( new String("hello" ) ); + + + Number.prototype.split = String.prototype.split; + + CompareSplit( new Number(100111122133144155), 1 ); + CompareSplitWithLimit(new Number(100111122133144155), 1, 1 ); + + CompareSplitWithLimit(new Number(100111122133144155), 1, 2 ); + CompareSplitWithLimit(new Number(100111122133144155), 1, 0 ); + CompareSplitWithLimit(new Number(100111122133144155), 1, 100 ); + CompareSplitWithLimit(new Number(100111122133144155), 1, void 0 ); + CompareSplitWithLimit(new Number(100111122133144155), 1, Math.pow(2,32)-1 ); + CompareSplitWithLimit(new Number(100111122133144155), 1, "boo" ); + CompareSplitWithLimit(new Number(100111122133144155), 1, -(Math.pow(2,32)-1) ); + CompareSplitWithLimit( "hello", "l", NaN ); + CompareSplitWithLimit( "hello", "l", 0 ); + CompareSplitWithLimit( "hello", "l", 1 ); + CompareSplitWithLimit( "hello", "l", 2 ); + CompareSplitWithLimit( "hello", "l", 3 ); + CompareSplitWithLimit( "hello", "l", 4 ); + + +/* + CompareSplitWithLimit( "hello", "ll", 0 ); + CompareSplitWithLimit( "hello", "ll", 1 ); + CompareSplitWithLimit( "hello", "ll", 2 ); + CompareSplit( "", " " ); + CompareSplit( "" ); +*/ + + // separartor is a regexp + // separator regexp value global setting is set + // string is an empty string + // if separator is an empty string, split each by character + + // this is not a String object + + // limit is not a number + // limit is undefined + // limit is larger than 2^32-1 + // limit is a negative number + + test(); + +function CompareSplit( string, separator ) { + split_1 = string.split( separator ); + split_2 = string_split( string, separator ); + + AddTestCase( + "( " + string +".split(" + separator + ") ).length" , + split_2.length, + split_1.length ); + + var limit = split_1.length > split_2.length ? + split_1.length : split_2.length; + + for ( var split_item = 0; split_item < limit; split_item++ ) { + AddTestCase( + string + ".split(" + separator + ")["+split_item+"]", + split_2[split_item], + split_1[split_item] ); + } +} + +function CompareSplitWithLimit( string, separator, splitlimit ) { + split_1 = string.split( separator, splitlimit ); + split_2 = string_split( string, separator, splitlimit ); + + AddTestCase( + "( " + string +".split(" + separator + ", " + splitlimit+") ).length" , + split_2.length, + split_1.length ); + + var limit = split_1.length > split_2.length ? + split_1.length : split_2.length; + + for ( var split_item = 0; split_item < limit; split_item++ ) { + AddTestCase( + string + ".split(" + separator + ", " + splitlimit+")["+split_item+"]", + split_2[split_item], + split_1[split_item] ); + } +} + +function string_split ( __this, separator, limit ) { + var S = String(__this ); // 1 + + var A = new Array(); // 2 + + if ( limit == undefined ) { // 3 + lim = Math.pow(2, 31 ) -1; + } else { + lim = ToUint32( limit ); + } + + var s = S.length; // 4 + var p = 0; // 5 + + if ( separator == undefined ) { // 8 + A[0] = S; + return A; + } + + if ( separator.constructor == RegExp ) // 6 + R = separator; + else + R = separator.toString(); + + if (lim == 0) return A; // 7 + + if ( separator == undefined ) { // 8 + A[0] = S; + return A; + } + + if (s == 0) { // 9 + z = SplitMatch(R, S, 0); + if (z != false) return A; + A[0] = S; + return A; + } + + var q = p; // 10 +loop: + while (true ) { + + if ( q == s ) break; // 11 + + z = SplitMatch(R, S, q); // 12 + +//print("Returned ", z); + + if (z != false) { // 13 + e = z.endIndex; // 14 + cap = z.captures; // 14 + if (e != p) { // 15 +//print("S = ", S, ", p = ", p, ", q = ", q); + T = S.slice(p, q); // 16 +//print("T = ", T); + A[A.length] = T; // 17 + if (A.length == lim) return A; // 18 + p = e; // 19 + i = 0; // 20 + while (true) { // 25 + if (i == cap.length) { // 21 + q = p; // 10 + continue loop; + } + i = i + 1; // 22 + A[A.length] = cap[i] // 23 + if (A.length == lim) return A; // 24 + } + } + } + + q = q + 1; // 26 + } + + T = S.slice(p, q); + A[A.length] = T; + return A; +} + +function SplitMatch(R, S, q) +{ + if (R.constructor == RegExp) { // 1 + var reResult = R.match(S, q); // 8 + if (reResult == undefined) + return false; + else { + a = new Array(reResult.length - 1); + for (var i = 1; i < reResult.length; i++) + a[a.length] = reResult[i]; + return { endIndex : reResult.index + reResult[0].length, captures : cap }; + } + } + else { + var r = R.length; // 2 + s = S.length; // 3 + if ((q + r) > s) return false; // 4 + for (var i = 0; i < r; i++) { +//print("S.charAt(", q + i, ") = ", S.charAt(q + i), ", R.charAt(", i, ") = ", R.charAt(i)); + if (S.charAt(q + i) != R.charAt(i)) // 5 + return false; + } + cap = new Array(); // 6 + return { endIndex : q + r, captures : cap }; // 7 + } +} + +function ToUint32( n ) { + n = Number( n ); + var sign = ( n < 0 ) ? -1 : 1; + + if ( Math.abs( n ) == 0 + || Math.abs( n ) == Number.POSITIVE_INFINITY + || n != n) { + return 0; + } + n = sign * Math.floor( Math.abs(n) ) + + n = n % Math.pow(2,32); + + if ( n < 0 ){ + n += Math.pow(2,32); + } + + return ( n ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js new file mode 100644 index 0000000..e2f2b92 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js @@ -0,0 +1,117 @@ +/** + * File Name: String/split-003.js + * ECMA Section: 15.6.4.9 + * Description: Based on ECMA 2 Draft 7 February 1999 + * + * Author: christine@netscape.com + * Date: 19 February 1999 + */ + +/* + * Since regular expressions have been part of JavaScript since 1.2, there + * are already tests for regular expressions in the js1_2/regexp folder. + * + * These new tests try to supplement the existing tests, and verify that + * our implementation of RegExp conforms to the ECMA specification, but + * does not try to be as exhaustive as in previous tests. + * + * The [,limit] argument to String.split is new, and not covered in any + * existing tests. + * + * String.split cases are covered in ecma/String/15.5.4.8-*.js. + * String.split where separator is a RegExp are in + * js1_2/regexp/string_split.js + * + */ + + var SECTION = "ecma_2/String/split-003.js"; + var VERSION = "ECMA_2"; + var TITLE = "String.prototype.split( regexp, [,limit] )"; + + startTest(); + + // separartor is a regexp + // separator regexp value global setting is set + // string is an empty string + // if separator is an empty string, split each by character + + + AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] ); + + AddSplitCases( "hello", /l/, "/l/", ["he","","o"] ); + AddLimitedSplitCases( "hello", /l/, "/l/", 0, [] ); + AddLimitedSplitCases( "hello", /l/, "/l/", 1, ["he"] ); + AddLimitedSplitCases( "hello", /l/, "/l/", 2, ["he",""] ); + AddLimitedSplitCases( "hello", /l/, "/l/", 3, ["he","","o"] ); + AddLimitedSplitCases( "hello", /l/, "/l/", 4, ["he","","o"] ); + AddLimitedSplitCases( "hello", /l/, "/l/", void 0, ["he","","o"] ); + AddLimitedSplitCases( "hello", /l/, "/l/", "hi", [] ); + AddLimitedSplitCases( "hello", /l/, "/l/", undefined, ["he","","o"] ); + + AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 0, [] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 1, ["h"] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 2, ["h","e"] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 3, ["h","e","l"] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 4, ["h","e","l","l"] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", void 0, ["h","e","l","l","o"] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", "hi", [] ); + AddLimitedSplitCases( "hello", new RegExp, "new RegExp", undefined, ["h","e","l","l","o"] ); + + test(); + +function AddSplitCases( string, separator, str_sep, split_array ) { + // verify that the result of split is an object of type Array + AddTestCase( + "( " + string + " ).split(" + str_sep +").constructor == Array", + true, + string.split(separator).constructor == Array ); + + // check the number of items in the array + AddTestCase( + "( " + string + " ).split(" + str_sep +").length", + split_array.length, + string.split(separator).length ); + + // check the value of each array item + var limit = (split_array.length > string.split(separator).length ) + ? split_array.length : string.split(separator).length; + + for ( var matches = 0; matches < split_array.length; matches++ ) { + AddTestCase( + "( " + string + " ).split(" + str_sep +")[" + matches +"]", + split_array[matches], + string.split( separator )[matches] ); + } +} + +function AddLimitedSplitCases( + string, separator, str_sep, limit, split_array ) { + + // verify that the result of split is an object of type Array + + AddTestCase( + "( " + string + " ).split(" + str_sep +", " + limit + + " ).constructor == Array", + true, + string.split(separator, limit).constructor == Array ); + + // check the length of the array + + AddTestCase( + "( " + string + " ).split(" + str_sep +", " + limit + " ).length", + split_array.length, + string.split(separator, limit).length ); + + // check the value of each array item + + var slimit = (split_array.length > string.split(separator).length ) + ? split_array.length : string.split(separator, limit).length; + + for ( var matches = 0; matches < slimit; matches++ ) { + AddTestCase( + "( " + string + " ).split(" + str_sep +", " + limit + " )[" + matches +"]", + split_array[matches], + string.split( separator, limit )[matches] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js new file mode 100644 index 0000000..ccc1bb4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js @@ -0,0 +1,83 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/* + * JavaScript test library shared functions file for running the tests + * in the browser. Overrides the shell's print function with document.write + * and make everything HTML pretty. + * + * To run the tests in the browser, use the mkhtml.pl script to generate + * html pages that include the shell.js, browser.js (this file), and the + * test js file in script tags. + * + * The source of the page that is generated should look something like this: + * <script src="./../shell.js"></script> + * <script src="./../browser.js"></script> + * <script src="./mytest.js"></script> + */ + +onerror = err; + +var GLOBAL = "[object Window]"; + +function startTest() { + writeHeaderToLog( SECTION + " "+ TITLE); + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + +function writeLineToLog( string ) { + document.write( string + "<br>\n"); +} +function writeHeaderToLog( string ) { + document.write( "<h2>" + string + "</h2>" ); +} +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } + document.write( "<hr>" ); +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = "<tt>"+ string ; + s += "<b>" ; + s += ( passed ) ? "<font color=#009900> " + PASSED + : "<font color=#aa0000> " + FAILED + expect + "</tt>"; + writeLineToLog( s + "</font></b></tt>" ); + return passed; +} +function err( msg, page, line ) { + writeLineToLog( "Test failed on line " + line + " with the message: " + msg ); + + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js new file mode 100644 index 0000000..897c2e3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js @@ -0,0 +1,31 @@ +/** + File Name: instanceof-1.js + ECMA Section: + Description: instanceof operator + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = ""; + var VERSION = "ECMA_2"; + var TITLE = "instanceof operator"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var b = new Boolean(); + + testcases[tc++] = new TestCase( SECTION, + "var b = new Boolean(); b instanceof Boolean", + true, + b instanceof Boolean ); + + testcases[tc++] = new TestCase( SECTION, + "b instanceof Object", + true, + b instanceof Object ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js new file mode 100644 index 0000000..d07292d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js @@ -0,0 +1,61 @@ +/** + File Name: + ECMA Section: + Description: Call Objects + + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = ""; + var VERSION = "ECMA_2"; + var TITLE = "The Call Constructor"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + var b = new Boolean(); + + testcases[tc++] = new TestCase( SECTION, + "var b = new Boolean(); b instanceof Boolean", + true, + b instanceof Boolean ); + + testcases[tc++] = new TestCase( SECTION, + "b instanceof Object", + true, + b instanceof Object ); + + testcases[tc++] = new TestCase( SECTION, + "b instanceof Array", + false, + b instanceof Array ); + + testcases[tc++] = new TestCase( SECTION, + "true instanceof Boolean", + false, + true instanceof Boolean ); + + testcases[tc++] = new TestCase( SECTION, + "Boolean instanceof Object", + true, + Boolean instanceof Object ); + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js new file mode 100644 index 0000000..c8f84ba --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js @@ -0,0 +1,57 @@ +/** + File Name: instanceof-003.js + ECMA Section: + Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 + +js> function Foo() {} +js> theproto = {}; +[object Object] +js> Foo.prototype = theproto +[object Object] +js> theproto instanceof Foo +true + +I think this should be 'false' + + + Author: christine@netscape.com + Date: 12 november 1997 + + +The test case described above is correct, however the second test case in this file is not, +'o instanceof o' should thow an exception. According to ECMA-262: + + 8.6.2 Internal Properties and Methods: + "... only Function objects implement [[HasInstance]]" + 11.8.6 The instanceof operator: + "6.If Result(4) does not have a [[HasInstance]] method, throw a TypeError exception." + +{} does not implement [[HasInstance]] (since it is not a function), so passing it as the +constructor to be tested to instanceof should result in a TypeError being thrown. + +*/ + var SECTION = "instanceof-003"; + var VERSION = "ECMA_2"; + var TITLE = "instanceof operator"; + var BUGNUMBER ="http://bugzilla.mozilla.org/show_bug.cgi?id=7635"; + + startTest(); + + function Foo() {}; + theproto = {}; + Foo.prototype = theproto; + + AddTestCase( + "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " + + "theproto instanceof Foo", + false, + theproto instanceof Foo ); + + + AddTestCase( + "o = {}; o instanceof o", + "EXCEPTION", + (function(){ try { var o = {}; o instanceof o; return "no exception"; } catch (e) { return "EXCEPTION"; } } )() ); + + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js new file mode 100644 index 0000000..cab6ed9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js @@ -0,0 +1,70 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: regress-7635.js + * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 + * Description: instanceof tweaks + * Author: + */ + +var SECTION = "instanceof"; // provide a document reference (ie, ECMA section) +var VERSION = "ECMA_2"; // Version of JavaScript or ECMA +var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description +var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7635"; // Provide URL to bugsplat or bugzilla report + +startTest(); // leave this alone + +/* + * Calls to AddTestCase here. AddTestCase is a function that is defined + * in shell.js and takes three arguments: + * - a string representation of what is being tested + * - the expected result + * - the actual result + * + * For example, a test might look like this: + * + * var zip = /[\d]{5}$/; + * + * AddTestCase( + * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test + * "02134", // expected result + * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result + * + */ + +function Foo() {} +theproto = {}; +Foo.prototype = theproto +theproto instanceof Foo + + +AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo", + false, + theproto instanceof Foo ); + +var f = new Function(); + +AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f ); + + +test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js new file mode 100644 index 0000000..7dc729d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js @@ -0,0 +1,629 @@ +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; +EXCLUDE = ""; +BUGNUMBER = ""; + + +TZ_DIFF = -8; + +var TT = ""; +var TT_ = ""; +var BR = ""; +var NBSP = " "; +var CR = "\n"; +var FONT = ""; +var FONT_ = ""; +var FONT_RED = ""; +var FONT_GREEN = ""; +var B = ""; +var B_ = "" +var H2 = ""; +var H2_ = ""; +var HR = ""; +var DEBUG = false; + + +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} +function startTest() { + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( "130" ); + } + if ( VERSION == "JS_13" ) { + version ( "130" ); + } + if ( VERSION == "JS_12" ) { + version ( "120" ); + } + if ( VERSION == "JS_11" ) { + version ( "110" ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). + writeHeaderToLog( SECTION + " "+ TITLE); + testcases = new Array(); + tc = 0; + +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = TT + string ; + + for ( k = 0; + k < (60 - string.length >= 0 ? 60 - string.length : 5) ; + k++ ) { + } + + s += B ; + s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; + + writeLineToLog( s + FONT_ + B_ + TT_ ); + + return passed; +} + +function writeLineToLog( string ) { + print( string + BR + CR ); +} +function writeHeaderToLog( string ) { + print( H2 + string + H2_ ); +} +function stopTest() +{ + var sizeTag = "<#TEST CASES SIZE>"; + var doneTag = "<#TEST CASES DONE>"; + var beginTag = "<#TEST CASE "; + var endTag = ">"; + + print(sizeTag); + print(testcases.length); + for (tc = 0; tc < testcases.length; tc++) + { + print(beginTag + 'PASSED' + endTag); + print(testcases[tc].passed); + print(beginTag + 'NAME' + endTag); + print(testcases[tc].name); + print(beginTag + 'EXPECTED' + endTag); + print(testcases[tc].expect); + print(beginTag + 'ACTUAL' + endTag); + print(testcases[tc].actual); + print(beginTag + 'DESCRIPTION' + endTag); + print(testcases[tc].description); + print(beginTag + 'REASON' + endTag); + print(( testcases[tc].passed ) ? "" : "wrong value "); + print(beginTag + 'BUGNUMBER' + endTag); + print( BUGNUMBER ); + } + print(doneTag); + print( HR ); + gc(); +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} +function err( msg, page, line ) { + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} + +/** + * Type Conversion functions used by Type Conversion + * + */ + + + + /* + * Date functions used by tests in Date suite + * + */ +var msPerDay = 86400000; +var HoursPerDay = 24; +var MinutesPerHour = 60; +var SecondsPerMinute = 60; +var msPerSecond = 1000; +var msPerMinute = 60000; // msPerSecond * SecondsPerMinute +var msPerHour = 3600000; // msPerMinute * MinutesPerHour + +var TIME_1970 = 0; +var TIME_2000 = 946684800000; +var TIME_1900 = -2208988800000; + +function Day( t ) { + return ( Math.floor(t/msPerDay ) ); +} +function DaysInYear( y ) { + if ( y % 4 != 0 ) { + return 365; + } + if ( (y % 4 == 0) && (y % 100 != 0) ) { + return 366; + } + if ( (y % 100 == 0) && (y % 400 != 0) ) { + return 365; + } + if ( (y % 400 == 0) ){ + return 366; + } else { + return "ERROR: DaysInYear(" + y + ") case not covered"; + } +} +function TimeInYear( y ) { + return ( DaysInYear(y) * msPerDay ); +} +function DayNumber( t ) { + return ( Math.floor( t / msPerDay ) ); +} +function TimeWithinDay( t ) { + if ( t < 0 ) { + return ( (t % msPerDay) + msPerDay ); + } else { + return ( t % msPerDay ); + } +} +function YearNumber( t ) { +} +function TimeFromYear( y ) { + return ( msPerDay * DayFromYear(y) ); +} +function DayFromYear( y ) { + return ( 365*(y-1970) + + Math.floor((y-1969)/4) - + Math.floor((y-1901)/100) + + Math.floor((y-1601)/400) ); +} +function InLeapYear( t ) { + if ( DaysInYear(YearFromTime(t)) == 365 ) { + return 0; + } + if ( DaysInYear(YearFromTime(t)) == 366 ) { + return 1; + } else { + return "ERROR: InLeapYear("+t+") case not covered"; + } +} +function YearFromTime( t ) { + t = Number( t ); + var sign = ( t < 0 ) ? -1 : 1; + var year = ( sign < 0 ) ? 1969 : 1970; + for ( var timeToTimeZero = t; ; ) { + // subtract the current year's time from the time that's left. + timeToTimeZero -= sign * TimeInYear(year) + + // if there's less than the current year's worth of time left, then break. + if ( sign < 0 ) { + if ( sign * timeToTimeZero <= 0 ) { + break; + } else { + year += sign; + } + } else { + if ( sign * timeToTimeZero < 0 ) { + break; + } else { + year += sign; + } + } + } + return ( year ); +} +function MonthFromTime( t ) { + // i know i could use switch but i'd rather not until it's part of ECMA + var day = DayWithinYear( t ); + var leap = InLeapYear(t); + + if ( (0 <= day) && (day < 31) ) { + return 0; + } + if ( (31 <= day) && (day < (59+leap)) ) { + return 1; + } + if ( ((59+leap) <= day) && (day < (90+leap)) ) { + return 2; + } + if ( ((90+leap) <= day) && (day < (120+leap)) ) { + return 3; + } + if ( ((120+leap) <= day) && (day < (151+leap)) ) { + return 4; + } + if ( ((151+leap) <= day) && (day < (181+leap)) ) { + return 5; + } + if ( ((181+leap) <= day) && (day < (212+leap)) ) { + return 6; + } + if ( ((212+leap) <= day) && (day < (243+leap)) ) { + return 7; + } + if ( ((243+leap) <= day) && (day < (273+leap)) ) { + return 8; + } + if ( ((273+leap) <= day) && (day < (304+leap)) ) { + return 9; + } + if ( ((304+leap) <= day) && (day < (334+leap)) ) { + return 10; + } + if ( ((334+leap) <= day) && (day < (365+leap)) ) { + return 11; + } else { + return "ERROR: MonthFromTime("+t+") not known"; + } +} +function DayWithinYear( t ) { + return( Day(t) - DayFromYear(YearFromTime(t))); +} +function DateFromTime( t ) { + var day = DayWithinYear(t); + var month = MonthFromTime(t); + + if ( month == 0 ) { + return ( day + 1 ); + } + if ( month == 1 ) { + return ( day - 30 ); + } + if ( month == 2 ) { + return ( day - 58 - InLeapYear(t) ); + } + if ( month == 3 ) { + return ( day - 89 - InLeapYear(t)); + } + if ( month == 4 ) { + return ( day - 119 - InLeapYear(t)); + } + if ( month == 5 ) { + return ( day - 150- InLeapYear(t)); + } + if ( month == 6 ) { + return ( day - 180- InLeapYear(t)); + } + if ( month == 7 ) { + return ( day - 211- InLeapYear(t)); + } + if ( month == 8 ) { + return ( day - 242- InLeapYear(t)); + } + if ( month == 9 ) { + return ( day - 272- InLeapYear(t)); + } + if ( month == 10 ) { + return ( day - 303- InLeapYear(t)); + } + if ( month == 11 ) { + return ( day - 333- InLeapYear(t)); + } + + return ("ERROR: DateFromTime("+t+") not known" ); +} +function WeekDay( t ) { + var weekday = (Day(t)+4) % 7; + return( weekday < 0 ? 7 + weekday : weekday ); +} + +// missing daylight savins time adjustment + +function HourFromTime( t ) { + var h = Math.floor( t / msPerHour ) % HoursPerDay; + return ( (h<0) ? HoursPerDay + h : h ); +} +function MinFromTime( t ) { + var min = Math.floor( t / msPerMinute ) % MinutesPerHour; + return( ( min < 0 ) ? MinutesPerHour + min : min ); +} +function SecFromTime( t ) { + var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute; + return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); +} +function msFromTime( t ) { + var ms = t % msPerSecond; + return ( (ms < 0 ) ? msPerSecond + ms : ms ); +} +function LocalTZA() { + return ( TZ_DIFF * msPerHour ); +} +function UTC( t ) { + return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); +} +function DaylightSavingTA( t ) { + t = t - LocalTZA(); + + var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour; + var dst_end = GetFirstSundayInNovember(t)+ 2*msPerHour; + + if ( t >= dst_start && t < dst_end ) { + return msPerHour; + } else { + return 0; + } + + // Daylight Savings Time starts on the first Sunday in April at 2:00AM in + // PST. Other time zones will need to override this function. + + print( new Date( UTC(dst_start + LocalTZA())) ); + + return UTC(dst_start + LocalTZA()); +} + +function GetFirstSundayInApril( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + + TimeInMonth(2,leap); + + for ( var first_sunday = april; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + + return first_sunday; +} +function GetLastSundayInOctober( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { + oct += TimeInMonth(m, leap); + } + for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; + last_sunday -= msPerDay ) + { + ; + } + return last_sunday; +} + +// Added these two functions because DST rules changed for the US. +function GetSecondSundayInMarch( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap); + + var sundayCount = 0; + var flag = true; + for ( var second_sunday = march; flag; second_sunday += msPerDay ) + { + if (WeekDay(second_sunday) == 0) { + if(++sundayCount == 2) + flag = false; + } + } + + return second_sunday; +} +function GetFirstSundayInNovember( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) { + nov += TimeInMonth(m, leap); + } + for ( var first_sunday = nov; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + return first_sunday; +} +function LocalTime( t ) { + return ( t + LocalTZA() + DaylightSavingTA(t) ); +} +function MakeTime( hour, min, sec, ms ) { + if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { + return Number.NaN; + } + + hour = ToInteger(hour); + min = ToInteger( min); + sec = ToInteger( sec); + ms = ToInteger( ms ); + + return( (hour*msPerHour) + (min*msPerMinute) + + (sec*msPerSecond) + ms ); +} +function MakeDay( year, month, date ) { + if ( isNaN(year) || isNaN(month) || isNaN(date) ) { + return Number.NaN; + } + year = ToInteger(year); + month = ToInteger(month); + date = ToInteger(date ); + + var sign = ( year < 1970 ) ? -1 : 1; + var t = ( year < 1970 ) ? 1 : 0; + var y = ( year < 1970 ) ? 1969 : 1970; + + var result5 = year + Math.floor( month/12 ); + var result6 = month % 12; + + if ( year < 1970 ) { + for ( y = 1969; y >= year; y += sign ) { + t += sign * TimeInYear(y); + } + } else { + for ( y = 1970 ; y < year; y += sign ) { + t += sign * TimeInYear(y); + } + } + + var leap = InLeapYear( t ); + + for ( var m = 0; m < month; m++ ) { + t += TimeInMonth( m, leap ); + } + + if ( YearFromTime(t) != result5 ) { + return Number.NaN; + } + if ( MonthFromTime(t) != result6 ) { + return Number.NaN; + } + if ( DateFromTime(t) != 1 ) { + return Number.NaN; + } + + return ( (Day(t)) + date - 1 ); +} +function TimeInMonth( month, leap ) { + // september april june november + // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 + // aug 7 sep 8 oct 9 nov 10 dec 11 + + if ( month == 3 || month == 5 || month == 8 || month == 10 ) { + return ( 30*msPerDay ); + } + + // all the rest + if ( month == 0 || month == 2 || month == 4 || month == 6 || + month == 7 || month == 9 || month == 11 ) { + return ( 31*msPerDay ); + } + + // save february + return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); +} +function MakeDate( day, time ) { + if ( day == Number.POSITIVE_INFINITY || + day == Number.NEGATIVE_INFINITY || + day == Number.NaN ) { + return Number.NaN; + } + if ( time == Number.POSITIVE_INFINITY || + time == Number.POSITIVE_INFINITY || + day == Number.NaN) { + return Number.NaN; + } + return ( day * msPerDay ) + time; +} +function TimeClip( t ) { + if ( isNaN( t ) ) { + return ( Number.NaN ); + } + if ( Math.abs( t ) > 8.64e15 ) { + return ( Number.NaN ); + } + + return ( ToInteger( t ) ); +} +function ToInteger( t ) { + t = Number( t ); + + if ( isNaN( t ) ){ + return ( Number.NaN ); + } + if ( t == 0 || t == -0 || + t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { + return 0; + } + + var sign = ( t < 0 ) ? -1 : 1; + + return ( sign * Math.floor( Math.abs( t ) ) ); +} +function Enumerate ( o ) { + var properties = new Array(); + for ( p in o ) { + properties[ properties.length ] = new Array( p, o[p] ); + } + return properties; +} +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js new file mode 100644 index 0000000..eb70069 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js @@ -0,0 +1,216 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + + +/* + * JavaScript shared functions file for running the tests in either + * stand-alone JavaScript engine. To run a test, first load this file, + * then load the test script. + */ + +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER=""; + +var TZ_DIFF = getTimeZoneDiff(); + +var DEBUG = false; + +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} +function startTest() { + if ( version ) { + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( 130 ); + } + if ( VERSION == "JS_13" ) { + version ( 130 ); + } + if ( VERSION == "JS_12" ) { + version ( 120 ); + } + if ( VERSION == "JS_11" ) { + version ( 110 ); + } + } + + + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). + + writeHeaderToLog( SECTION + " "+ TITLE); + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} + +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} + +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} +function err( msg, page, line ) { + writeLineToLog( page + " failed with error: " + msg + " on line " + line ); + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} + +function Enumerate ( o ) { + var properties = new Array(); + for ( p in o ) { + properties[ properties.length ] = new Array( p, o[p] ); + } + return properties; +} + +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + writeLineToLog( testcases[i].description +" = " +testcases[i].actual + + " expected: "+ testcases[i].expect ); + } + } +} +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + + +/* + * Originally, the test suite used a hard-coded value TZ_DIFF = -8. + * But that was only valid for testers in the Pacific Standard Time Zone! + * We calculate the proper number dynamically for any tester. We just + * have to be careful to use a date not subject to Daylight Savings Time... +*/ +function getTimeZoneDiff() +{ + return -((new Date(2000, 1, 1)).getTimezoneOffset())/60; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/template.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/template.js new file mode 100644 index 0000000..a30cb77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/template.js @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/** + * File Name: template.js + * Reference: ** replace with bugzilla URL or document reference ** + * Description: ** replace with description of test ** + * Author: ** replace with your e-mail address ** + */ + + var SECTION = ""; // if ECMA test, provide section number + var VERSION = "ECMA_2"; // Version of JavaScript or ECMA + var TITLE = ""; // Provide ECMA section title or description + var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + + /* Calls to AddTestCase here */ + + test(); // leave this alone diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js new file mode 100644 index 0000000..7b5fdbd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js @@ -0,0 +1,66 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 12 Mar 2001 +* +* +* SUMMARY: Testing Array.prototype.toLocaleString() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56883 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58031 +* +* By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString() +* should be applied to each element of the array, and the results should be +* concatenated with an implementation-specific delimiter. For example: +* +* myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc. +* +* In this testcase toLocaleString is a user-defined property of each array element; +* therefore it is the function that should be invoked. This function increments a +* global variable. Therefore the end value of this variable should be myArray.length. +*/ +//------------------------------------------------------------------------------------------------- +var bug = 56883; +var summary = 'Testing Array.prototype.toLocaleString() -'; +var actual = ''; +var expect = ''; +var n = 0; +var obj = {toLocaleString: function() {n++}}; +var myArray = [obj, obj, obj]; + + +myArray.toLocaleString(); +actual = n; +expect = 3; // (see explanation above) + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js new file mode 100644 index 0000000..6d99159 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js @@ -0,0 +1,148 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): george@vanous.com, igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 September 2002 +* SUMMARY: Testing Array.prototype.concat() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169795 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 169795; +var summary = 'Testing Array.prototype.concat()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var x; + + +status = inSection(1); +x = "Hello"; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(2); +x = 999; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(3); +x = /Hello/g; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(4); +x = new Error("Hello"); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(5); +x = function() {return "Hello";}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(6); +x = [function() {return "Hello";}]; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(7); +x = [1,2,3].concat([4,5,6]); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(8); +x = eval('this'); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +/* + * The next two sections are by igor@icesoft.no; see + * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3 + */ +status = inSection(9); +x={length:0}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(10); +x={length:2, 0:0, 1:1}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js new file mode 100644 index 0000000..73c22c9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js @@ -0,0 +1,151 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* Date: 24 September 2001 +* +* SUMMARY: Try assigning arr.length = new Number(n) +* From correspondence with Igor Bukanov <igor@icesoft.no> +* See http://bugzilla.mozilla.org/show_bug.cgi?id=101488 +* +* Without the "new" keyword, assigning arr.length = Number(n) worked. +* But with it, Rhino was giving an error "Inappropriate array length" +* and SpiderMonkey was exiting without giving any error or return value - +* +* Comments on the Rhino code by igor@icesoft.no: +* +* jsSet_length requires that the new length value should be an instance +* of Number. But according to Ecma 15.4.5.1, item 12-13, an error should +* be thrown only if ToUint32(length_value) != ToNumber(length_value) +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 101488; +var summary = 'Try assigning arr.length = new Number(n)'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr = []; + + +status = inSection(1); +arr = Array(); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(2); +arr = Array(5); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(3); +arr = Array(); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + +status = inSection(4); +arr = Array(5); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + + +/* + * Also try the above with the "new" keyword before Array(). + * Array() and new Array() should be equivalent, by ECMA 15.4.1.1 + */ +status = inSection(5); +arr = new Array(); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(6); +arr = new Array(5); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +arr = new Array(); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + +status = inSection(7); +arr = new Array(5); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function tryThis(s) +{ + try + { + eval(s); + } + catch(e) + { + // keep going + } +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js new file mode 100644 index 0000000..7cc5051 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js @@ -0,0 +1,214 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 25 Mar 2002 +* SUMMARY: Array.prototype.sort() should not (re-)define .length +* See http://bugzilla.mozilla.org/show_bug.cgi?id=130451 +* +* From the ECMA-262 Edition 3 Final spec: +* +* NOTE: The sort function is intentionally generic; it does not require that +* its |this| value be an Array object. Therefore, it can be transferred to +* other kinds of objects for use as a method. Whether the sort function can +* be applied successfully to a host object is implementation-dependent. +* +* The interesting parts of this testcase are the contrasting expectations for +* Brendan's test below, when applied to Array objects vs. non-Array objects. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 130451; +var summary = 'Array.prototype.sort() should not (re-)define .length'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr = []; +var cmp = new Function(); + + +/* + * First: test Array.prototype.sort() on Array objects + */ +status = inSection(1); +arr = [0,1,2,3]; +cmp = function(x,y) {return x-y;}; +actual = arr.sort(cmp).length; +expect = 4; +addThis(); + +status = inSection(2); +arr = [0,1,2,3]; +cmp = function(x,y) {return y-x;}; +actual = arr.sort(cmp).length; +expect = 4; +addThis(); + +status = inSection(3); +arr = [0,1,2,3]; +cmp = function(x,y) {return x-y;}; +arr.length = 1; +actual = arr.sort(cmp).length; +expect = 1; +addThis(); + +/* + * This test is by Brendan. Setting arr.length to + * 2 and then 4 should cause elements to be deleted. + */ +arr = [0,1,2,3]; +cmp = function(x,y) {return x-y;}; +arr.sort(cmp); + +status = inSection(4); +actual = arr.join(); +expect = '0,1,2,3'; +addThis(); + +status = inSection(5); +actual = arr.length; +expect = 4; +addThis(); + +status = inSection(6); +arr.length = 2; +actual = arr.join(); +expect = '0,1'; +addThis(); + +status = inSection(7); +arr.length = 4; +actual = arr.join(); +expect = '0,1,,'; //<---- see how 2,3 have been lost +addThis(); + + + +/* + * Now test Array.prototype.sort() on non-Array objects + */ +status = inSection(8); +var obj = new Object(); +obj.sort = Array.prototype.sort; +obj.length = 4; +obj[0] = 0; +obj[1] = 1; +obj[2] = 2; +obj[3] = 3; +cmp = function(x,y) {return x-y;}; +actual = obj.sort(cmp).length; +expect = 4; +addThis(); + + +/* + * Here again is Brendan's test. Unlike the array case + * above, the setting of obj.length to 2 and then 4 + * should NOT cause elements to be deleted + */ +obj = new Object(); +obj.sort = Array.prototype.sort; +obj.length = 4; +obj[0] = 3; +obj[1] = 2; +obj[2] = 1; +obj[3] = 0; +cmp = function(x,y) {return x-y;}; +obj.sort(cmp); //<---- this is what triggered the buggy behavior below +obj.join = Array.prototype.join; + +status = inSection(9); +actual = obj.join(); +expect = '0,1,2,3'; +addThis(); + +status = inSection(10); +actual = obj.length; +expect = 4; +addThis(); + +status = inSection(11); +obj.length = 2; +actual = obj.join(); +expect = '0,1'; +addThis(); + +/* + * Before this bug was fixed, |actual| held the value '0,1,,' + * as in the Array-object case at top. This bug only occurred + * if Array.prototype.sort() had been applied to |obj|, + * as we have done higher up. + */ +status = inSection(12); +obj.length = 4; +actual = obj.join(); +expect = '0,1,2,3'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js new file mode 100644 index 0000000..a68cb89 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js @@ -0,0 +1,149 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.3.js + ECMA Section: 15.9.5.3 Date.prototype.toDateString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "date" + portion of the Date in the current time zone in a convenient, + human-readable form. We can't test the content of the string, + but can verify that the string is parsable by Date.parse + + The toDateString function is not generic; it generates a runtime error + if its 'this' value is not a Date object. Therefore it cannot be transferred + to other kinds of objects for use as a method. + + Author: pschwartau@netscape.com + Date: 14 november 2000 (adapted from ecma/Date/15.9.5.2.js) +*/ + + var SECTION = "15.9.5.3"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toDateString()"; + + var status = ''; + var actual = ''; + var expect = ''; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, some generic tests - + + status = "typeof (now.toDateString())"; + actual = typeof (now.toDateString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toDateString.length"; + actual = Date.prototype.toDateString.length; + expect = 0; + addTestCase(); + + /* Date.parse is accurate to the second; valueOf() to the millisecond. + Here we expect them to coincide, as we expect a time of exactly midnight - */ + status = "(Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0"; + actual = (Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0; + expect = true; + addTestCase(); + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + var givenDate = new Date(date_given_in_milliseconds); + + status = 'Date.parse(' + givenDate + ').toDateString())'; + actual = Date.parse(givenDate.toDateString()); + expect = Date.parse(midnight(givenDate)); + addTestCase(); +} + + +function midnight(givenDate) +{ + // midnight on the given date - + return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate()); +} + + +function test() +{ + for ( tc=0; tc < testcases.length; tc++ ) + { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description + " = " + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return (testcases); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js new file mode 100644 index 0000000..abff98a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js @@ -0,0 +1,194 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.4.js + ECMA Section: 15.9.5.4 Date.prototype.toTimeString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "time" + portion of the Date in the current time zone in a convenient, + human-readable form. We test the content of the string by checking + that d.toDateString() + d.toTimeString() == d.toString() + + Author: pschwartau@netscape.com + Date: 14 november 2000 + Revised: 07 january 2002 because of a change in JS Date format: + + See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) +*/ +//----------------------------------------------------------------------------- + var SECTION = "15.9.5.4"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toTimeString()"; + + var status = ''; + var actual = ''; + var expect = ''; + var givenDate; + var year = ''; + var regexp = ''; + var reducedDateString = ''; + var hopeThisIsTimeString = ''; + var cnEmptyString = ''; + var cnERR ='OOPS! FATAL ERROR: no regexp match in extractTimeString()'; + + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, a couple of generic tests - + + status = "typeof (now.toTimeString())"; + actual = typeof (now.toTimeString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toTimeString.length"; + actual = Date.prototype.toTimeString.length; + expect = 0; + addTestCase(); + + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // Now + addDateTestCase( TIME_NOW); + addDateTestCase( TIME_NOW - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + givenDate = new Date(date_given_in_milliseconds); + + status = '(' + givenDate + ').toTimeString()'; + actual = givenDate.toTimeString(); + expect = extractTimeString(givenDate); + addTestCase(); +} + + +/* + * As of 2002-01-07, the format for JavaScript dates changed. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) + * + * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002 + * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time) + * + * Thus, use a regexp of the form /date.toDateString()(.*)$/ + * to capture the TimeString into the first backreference - + */ +function extractTimeString(date) +{ + regexp = new RegExp(date.toDateString() + '(.*)' + '$'); + + try + { + hopeThisIsTimeString = date.toString().match(regexp)[1]; + } + catch(e) + { + return cnERR; + } + + // trim any leading or trailing spaces - + return trimL(trimR(hopeThisIsTimeString)); + } + + +function trimL(s) +{ + if (!s) {return cnEmptyString;}; + for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}} + return s.substring(i); +} + + +function trimR(s) +{ + if (!s) {return cnEmptyString;}; + for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}} + return s.substring(0, i+1); +} + + +function test() +{ + for ( tc=0; tc < testcases.length; tc++ ) + { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description + " = " + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return (testcases); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js new file mode 100644 index 0000000..c16002b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js @@ -0,0 +1,94 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.5.js + ECMA Section: 15.9.5.5 Date.prototype.toLocaleString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "date" + portion of the Date in the current time zone in a convenient, + human-readable form. We can't test the content of the string, + but can verify that the object returned is a string. + + The toLocaleString function is not generic; it generates a runtime error + if its 'this' value is not a Date object. Therefore it cannot be transferred + to other kinds of objects for use as a method. + + Author: pschwartau@netscape.com + Date: 14 november 2000 +*/ + + var SECTION = "15.9.5.5"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toLocaleString()"; + + var status = ''; + var actual = ''; + var expect = ''; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, some generic tests - + + status = "typeof (now.toLocaleString())"; + actual = typeof (now.toLocaleString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toLocaleString.length"; + actual = Date.prototype.toLocaleString.length; + expect = 0; + addTestCase(); + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function test() +{ + for ( tc=0; tc < testcases.length; tc++ ) + { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description + " = " + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return (testcases); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js new file mode 100644 index 0000000..073d828 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js @@ -0,0 +1,149 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.6.js + ECMA Section: 15.9.5.6 Date.prototype.toLocaleDateString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "date" + portion of the Date in the current time zone in a convenient, + human-readable form. We can't test the content of the string, + but can verify that the string is parsable by Date.parse + + The toLocaleDateString function is not generic; it generates a runtime error + if its 'this' value is not a Date object. Therefore it cannot be transferred + to other kinds of objects for use as a method. + + Author: pschwartau@netscape.com + Date: 14 november 2000 +*/ + + var SECTION = "15.9.5.6"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toLocaleDateString()"; + + var status = ''; + var actual = ''; + var expect = ''; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, some generic tests - + + status = "typeof (now.toLocaleDateString())"; + actual = typeof (now.toLocaleDateString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toLocaleDateString.length"; + actual = Date.prototype.toLocaleDateString.length; + expect = 0; + addTestCase(); + + /* Date.parse is accurate to the second; valueOf() to the millisecond. + Here we expect them to coincide, as we expect a time of exactly midnight - */ + status = "(Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0"; + actual = (Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0; + expect = true; + addTestCase(); + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + var givenDate = new Date(date_given_in_milliseconds); + + status = 'Date.parse(' + givenDate + ').toLocaleDateString())'; + actual = Date.parse(givenDate.toLocaleDateString()); + expect = Date.parse(midnight(givenDate)); + addTestCase(); +} + + +function midnight(givenDate) +{ + // midnight on the given date - + return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate()); +} + + +function test() +{ + for ( tc=0; tc < testcases.length; tc++ ) + { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description + " = " + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return (testcases); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js new file mode 100644 index 0000000..14b2574 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js @@ -0,0 +1,211 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.9.5.7.js + ECMA Section: 15.9.5.7 Date.prototype.toLocaleTimeString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "time" + portion of the Date in the current time zone in a convenient, + human-readable form. We test the content of the string by checking + that d.toDateString() + d.toLocaleTimeString() == d.toString() + + The only headache is that as of this writing the "GMT ..." portion of + d.toString() is NOT included in d.toLocaleTimeString() as it is in + d.toTimeString(). So we have to take that into account. + + Author: pschwartau@netscape.com + Date: 14 november 2000 + Revised: 07 january 2002 because of a change in JS Date format: + + See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) +*/ +//----------------------------------------------------------------------------- + var SECTION = "15.9.5.7"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toLocaleTimeString()"; + + var status = ''; + var actual = ''; + var expect = ''; + var givenDate; + var year = ''; + var regexp = ''; + var TimeString = ''; + var reducedDateString = ''; + var hopeThisIsLocaleTimeString = ''; + var cnERR ='OOPS! FATAL ERROR: no regexp match in extractLocaleTimeString()'; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, a couple generic tests - + + status = "typeof (now.toLocaleTimeString())"; + actual = typeof (now.toLocaleTimeString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toLocaleTimeString.length"; + actual = Date.prototype.toLocaleTimeString.length; + expect = 0; + addTestCase(); + + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // Now + addDateTestCase( TIME_NOW); + addDateTestCase( TIME_NOW - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + givenDate = new Date(date_given_in_milliseconds); + + status = '(' + givenDate + ').toLocaleTimeString()'; + actual = givenDate.toLocaleTimeString(); + expect = extractLocaleTimeString(givenDate); + addTestCase(); +} + + +/* + * As of 2002-01-07, the format for JavaScript dates changed. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) + * + * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002 + * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time) + * + * So first, use a regexp of the form /date.toDateString()(.*)$/ + * to capture the TimeString into the first backreference. + * + * Then remove the GMT string from TimeString (see introduction above) + */ +function extractLocaleTimeString(date) +{ + regexp = new RegExp(date.toDateString() + '(.*)' + '$'); + try + { + TimeString = date.toString().match(regexp)[1]; + } + catch(e) + { + return cnERR; + } + + /* + * Now remove the GMT part of the TimeString. + * Guard against dates with two "GMT"s, like: + * Jan 01 00:00:00 GMT+0000 (GMT Standard Time) + */ + regexp= /([^G]*)GMT.*/; + try + { + hopeThisIsLocaleTimeString = TimeString.match(regexp)[1]; + } + catch(e) + { + return TimeString; + } + + // trim any leading or trailing spaces - + return trimL(trimR(hopeThisIsLocaleTimeString)); +} + + +function trimL(s) +{ + if (!s) {return cnEmptyString;}; + for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}} + return s.substring(i); +} + +function trimR(s) +{ + for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}} + return s.substring(0, i+1); +} + + +function test() +{ + for ( tc=0; tc < testcases.length; tc++ ) + { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description + " = " + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return (testcases); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js new file mode 100644 index 0000000..43721a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js @@ -0,0 +1,676 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/* + * JavaScript shared functions file for running the tests in either + * stand-alone JavaScript engine. To run a test, first load this file, + * then load the test script. + */ + +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; + +/* + * constant strings + */ +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; +var DEBUG = false; + + +/* +* Wrapper for test case constructor that doesn't require the SECTION argument. + */ +function AddTestCase( description, expect, actual ) +{ + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + + +/* + * TestCase constructor +*/ +function TestCase( n, d, e, a ) +{ + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) {writeLineToLog("added " + this.description);} +} + + +/* + * Set up test environment. +*/ +function startTest() +{ + if ( version ) + { + // JavaScript 1.3 is supposed to be compliant ECMA version 1.0 + if (VERSION == "ECMA_1" ) {version ("130");} + if (VERSION == "JS_1.3" ) {version ( "130");} + if (VERSION == "JS_1.2" ) {version ( "120");} + if (VERSION == "JS_1.1" ) {version( "110");} + + // for ECMA version 2.0, we will leave the JavaScript version + // to the default ( for now ). + } + + // print out bugnumber + if ( BUGNUMBER ) + { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + + +function test() +{ + for ( tc=0; tc < testcases.length; tc++ ) + { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + + stopTest(); + return ( testcases ); +} + + +/* + * Compare expected result to the actual result and figure out whether + * the test case passed. + */ +function getTestCaseResult(expect, actual ) +{ + //because ( NaN == NaN ) always returns false, need to do + //a special compare to see if we got the right result. + if ( actual != actual ) + { + if ( typeof actual == "object" ) {actual = "NaN object";} + else {actual = "NaN number";} + } + + if ( expect != expect ) + { + if ( typeof expect == "object" ) {expect = "NaN object";} + else {expect = "NaN number";} + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, need to replace w/ IEEE standard for rounding + if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" ) + { + if ( Math.abs(actual-expect) < 0.0000001 ) {passed = true;} + } + + //verify type is the same + if ( typeof(expect) != typeof(actual) ) {passed = false;} + + return passed; +} + + +/* + * Begin printing functions. These functions use the shell's print function. +* When running tests in the browser, override these functions with functions +* that use document.write. + */ +function writeTestCaseResult( expect, actual, string ) +{ + var passed = getTestCaseResult(expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} + + +function writeFormattedResult( expect, actual, string, passed ) +{ + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} + + +function writeLineToLog( string ) +{ + print( string ); +} + + +function writeHeaderToLog( string ) +{ + print( string ); +} +/* End of printing functions */ + + +/* + * When running in the shell, run the garbage collector after the test has completed. + */ +function stopTest() +{ + var gc; + if ( gc != undefined ) + { + gc(); + } +} + + +/* + * Convenience function for displaying failed test cases. + * Useful when running tests manually. +*/ +function getFailedCases() +{ + for (var i = 0; i < testcases.length; i++ ) + { + if ( !testcases[i].passed ) + { + print( testcases[i].description + " = " + testcases[i].actual + " expected: " + testcases[i].expect ); + } + } +} + + + /* + * Date constants and functions used by tests in Date suite +*/ +var msPerDay = 86400000; +var HoursPerDay = 24; +var MinutesPerHour = 60; +var SecondsPerMinute = 60; +var msPerSecond = 1000; +var msPerMinute = 60000; // msPerSecond * SecondsPerMinute +var msPerHour = 3600000; // msPerMinute * MinutesPerHour +var TZ_DIFF = getTimeZoneDiff(); +var TZ_ADJUST = TZ_DIFF * msPerHour; +var TIME_1970 = 0; +var TIME_2000 = 946684800000; +var TIME_1900 = -2208988800000; +var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; +var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); +var now = new Date(); +var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond + //Date.parse() is accurate only to the second + + + +/* + * Originally, the test suite used a hard-coded value TZ_DIFF = -8. + * But that was only valid for testers in the Pacific Standard Time Zone! + * We calculate the proper number dynamically for any tester. We just + * have to be careful to use a date not subject to Daylight Savings Time... +*/ +function getTimeZoneDiff() +{ + return -((new Date(2000, 1, 1)).getTimezoneOffset())/60; +} + + +function Day( t) +{ + return ( Math.floor( t/msPerDay ) ); +} + + +function DaysInYear( y ) +{ + if ( y % 4 != 0 ) {return 365;} + + if ( (y%4 == 0) && (y%100 != 0) ) {return 366;} + + if ( (y%100 == 0) && (y%400 != 0) ) {return 365;} + + if ( (y%400 == 0)){return 366;} + else {return "ERROR: DaysInYear(" + y + ") case not covered";} +} + + +function TimeInYear( y ) +{ + return ( DaysInYear(y) * msPerDay ); +} + + +function DayNumber( t ) +{ + return ( Math.floor( t / msPerDay ) ); +} + + +function TimeWithinDay( t ) +{ + if ( t < 0 ) {return ( (t%msPerDay) + msPerDay );} + else {return ( t % msPerDay );} +} + + +function YearNumber( t ) +{ +} + + +function TimeFromYear( y ) +{ + return ( msPerDay * DayFromYear(y) ); +} + + +function DayFromYear( y ) +{ + return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100) + + Math.floor((y-1601)/400) ); +} + + +function InLeapYear( t ) +{ + if ( DaysInYear(YearFromTime(t)) == 365 ) {return 0;} + + if ( DaysInYear(YearFromTime(t)) == 366 ) {return 1;} + else {return "ERROR: InLeapYear(" + t + ") case not covered";} +} + + +function YearFromTime( t ) +{ + t =Number( t ); + var sign = ( t < 0 ) ? -1 : 1; + var year = ( sign < 0 ) ? 1969 : 1970; + + for (var timeToTimeZero = t; ; ) + { + // subtract the current year's time from the time that's left. + timeToTimeZero -= sign * TimeInYear(year) + + // if there's less than the current year's worth of time left, then break. + if ( sign < 0 ) + { + if ( sign * timeToTimeZero <= 0 ) {break;} + else {year += sign;} + } + else + { + if ( sign * timeToTimeZero < 0 ) {break;} + else {year += sign;} + } + } + + return ( year ); +} + + +function MonthFromTime( t ) +{ + var day = DayWithinYear( t ); + var leap = InLeapYear(t); + + // I know I could use switch but I'd rather not until it's part of ECMA + if ( (0 <= day) && (day < 31) ) {return 0;} + if ( (31 <= day) && (day < (59+leap) )) {return 1;} + if ( ((59+leap) <= day) && (day < (90+leap) )) {return 2;} + if ( ((90+leap) <= day) && (day < (120+leap) )) {return 3;} + if ( ((120+leap) <= day) && (day < (151+leap) )) {return 4;} + if ( ((151+leap) <= day) && (day < (181+leap) )) {return 5;} + if ( ((181+leap) <= day) && (day < (212+leap) )) {return 6;} + if ( ((212+leap) <= day) && (day < (243+leap)) ) {return 7;} + if ( ((243+leap) <= day) && (day < (273+leap) )) {return 8;} + if ( ((273+leap) <= day) && (day < (304+leap)) ) {return 9;} + if ( ((304+leap) <= day) && (day < (334+leap)) ) {return 10;} + if ( ((334+leap) <= day) && (day < (365+leap)) ) {return 11;} + else {return "ERROR: MonthFromTime(" + t + ") not known";} +} + + +function DayWithinYear( t ) +{ + return(Day(t) - DayFromYear(YearFromTime(t)) ); +} + + +function DateFromTime( t ) +{ + var day = DayWithinYear(t); + var month = MonthFromTime(t); + + if ( month == 0) {return ( day + 1 );} + if ( month == 1) {return ( day - 30 );} + if ( month == 2) {return ( day - 58 - InLeapYear(t) );} + if ( month == 3) {return ( day - 89 - InLeapYear(t));} + if ( month == 4) {return ( day - 119 - InLeapYear(t));} + if ( month == 5) {return ( day - 150 - InLeapYear(t));} + if ( month == 6) {return ( day - 180 - InLeapYear(t));} + if ( month == 7) {return ( day - 211 - InLeapYear(t));} + if ( month == 8) {return ( day - 242 - InLeapYear(t));} + if ( month == 9) {return ( day - 272 - InLeapYear(t));} + if ( month == 10) {return ( day - 303 - InLeapYear(t));} + if ( month == 11) {return ( day - 333 - InLeapYear(t));} + return ("ERROR: DateFromTime("+t+") not known" ); +} + + +function WeekDay( t ) +{ + var weekday = (Day(t)+4)%7; + return( weekday < 0 ? 7+weekday : weekday ); +} + + +// missing daylight savings time adjustment + + +function HourFromTime( t ) +{ + var h = Math.floor( t / msPerHour )%HoursPerDay; + return ( (h<0) ? HoursPerDay + h : h ); +} + + +function MinFromTime( t ) +{ + var min = Math.floor( t / msPerMinute )%MinutesPerHour; + return( (min < 0 ) ? MinutesPerHour + min : min ); +} + + +function SecFromTime( t ) +{ + var sec = Math.floor( t / msPerSecond )%SecondsPerMinute; + return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); +} + + +function msFromTime( t ) +{ + var ms = t%msPerSecond; + return ( (ms < 0 ) ? msPerSecond + ms : ms ); +} + + +function LocalTZA() +{ + return ( TZ_DIFF * msPerHour ); +} + + +function UTC( t ) +{ + return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); +} + + +function DaylightSavingTA( t ) +{ + t = t - LocalTZA(); + + var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour; + var dst_end = GetFirstSundayInNovember(t) + 2*msPerHour; + + if ( t >= dst_start && t < dst_end ) {return msPerHour;} + else {return 0;} + + // Daylight Savings Time starts on the first Sunday in April at 2:00AM in PST. + // Other time zones will need to override this function. + +print( new Date( UTC(dst_start + LocalTZA())) ); +return UTC(dst_start + LocalTZA()); +} + +function GetFirstSundayInApril( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + + TimeInMonth(2,leap); + + for ( var first_sunday = april; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + + return first_sunday; +} +function GetLastSundayInOctober( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { + oct += TimeInMonth(m, leap); + } + for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; + last_sunday -= msPerDay ) + { + ; + } + return last_sunday; +} + +// Added these two functions because DST rules changed for the US. +function GetSecondSundayInMarch( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap); + + var sundayCount = 0; + var flag = true; + for ( var second_sunday = march; flag; second_sunday += msPerDay ) + { + if (WeekDay(second_sunday) == 0) { + if(++sundayCount == 2) + flag = false; + } + } + + return second_sunday; +} +function GetFirstSundayInNovember( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) { + nov += TimeInMonth(m, leap); + } + for ( var first_sunday = nov; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + return first_sunday; +} + + +function LocalTime( t ) +{ + return ( t + LocalTZA() + DaylightSavingTA(t) ); +} + + +function MakeTime( hour, min, sec, ms ) +{ + if ( isNaN(hour) || isNaN(min) || isNaN(sec) || isNaN(ms) ){return Number.NaN;} + + hour = ToInteger(hour); + min = ToInteger( min); + sec = ToInteger( sec); + ms = ToInteger( ms ); + + return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); +} + + +function MakeDay( year, month, date ) +{ + if ( isNaN(year) || isNaN(month) || isNaN(date)) {return Number.NaN;} + + year = ToInteger(year); + month = ToInteger(month); + date = ToInteger(date ); + + var sign = ( year < 1970 ) ? -1 : 1; + var t = ( year < 1970 ) ? 1 : 0; + var y = ( year < 1970 ) ? 1969 : 1970; + + var result5 = year + Math.floor( month/12 ); + var result6= month%12; + + if ( year < 1970 ) + { + for ( y = 1969; y >= year; y += sign ) + { + t += sign * TimeInYear(y); + } + } + else + { + for ( y = 1970 ; y < year; y += sign ) + { + t += sign * TimeInYear(y); + } + } + + var leap = InLeapYear( t ); + + for ( var m = 0; m < month; m++) + { + t += TimeInMonth( m, leap ); + } + + if ( YearFromTime(t) != result5 ) {return Number.NaN;} + if ( MonthFromTime(t) != result6 ) {return Number.NaN;} + if ( DateFromTime(t) != 1 ){return Number.NaN;} + + return ( (Day(t)) + date - 1 ); +} + + +function TimeInMonth( month, leap ) +{ + // Jan 0 Feb 1 Mar 2 Apr 3 May 4 June 5 Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec11 + + // April June September November + if ( month == 3 || month == 5 || month == 8 || month == 10 ) {return ( 30*msPerDay );} + + // all the rest + if ( month == 0 || month == 2 || month == 4 || month == 6 || + month == 7 || month == 9 || month == 11 ) {return ( 31*msPerDay );} + + // save February + return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); +} + + +function MakeDate( day, time ) +{ + if (day == Number.POSITIVE_INFINITY || + day == Number.NEGATIVE_INFINITY || + day == Number.NaN ) + { + return Number.NaN; + } + + if ( time == Number.POSITIVE_INFINITY || + time == Number.POSITIVE_INFINITY || + day == Number.NaN) + { + return Number.NaN; + } + + return ( day * msPerDay ) + time; +} + + +function TimeClip( t ) +{ + if ( isNaN( t )) {return ( Number.NaN);} + if ( Math.abs( t ) > 8.64e15 ) {return ( Number.NaN);} + + return ( ToInteger( t ) ); +} + + +function ToInteger( t ) +{ + t = Number( t ); + + if ( isNaN( t )) {return ( Number.NaN);} + + if ( t == 0 || t == -0 || + t == Number.POSITIVE_INFINITY || + t == Number.NEGATIVE_INFINITY) + { + return 0; + } + + var sign = ( t < 0 ) ? -1 : 1; + + return ( sign * Math.floor( Math.abs( t ) ) ); +} + + +function Enumerate( o ) +{ + var p; + for ( p in o ) {print( p + ": " + o[p] );} +} + + +/* these functions are useful for running tests manually in Rhino */ + +function GetContext() +{ + return Packages.com.netscape.javascript.Context.getCurrentContext(); +} + + +function OptLevel( i ) +{ + i = Number(i); + var cx = GetContext(); + cx.setOptimizationLevel(i); +} + +/* end of Rhino functions */ + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js new file mode 100644 index 0000000..3aab137 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js @@ -0,0 +1,132 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): joerg.schaible@gmx.de +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 27 Nov 2002 +* SUMMARY: Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1). +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = ''; +var summary = 'Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1)'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +function otherScope(msg) +{ + return Error(msg); +} + + +status = inSection(1); +var err1 = Error('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = otherScope('msg2'); +actual = examineThis(err2, 'msg2'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = otherScope(); +actual = examineThis(err3, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = eval("Error('msg4')"); +actual = examineThis(err4, 'msg4'); +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Searches err.toString() for err.name + ':' + err.message, + * with possible whitespace on each side of the colon sign. + * + * We allow for no colon in case err.message was not provided by the user. + * In such a case, SpiderMonkey and Rhino currently set err.message = '', + * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. + * + * If this is ever changed to a non-empty string, e.g. 'undefined', + * you may have to modify |pattern| to take that into account - + * + */ +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js new file mode 100644 index 0000000..ca05e7e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js @@ -0,0 +1,169 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributors: d-russo@ti.com, pschwartau@netscape.com, joerg.schaible@gmx.de +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 22 Jan 2002 +* SUMMARY: Testing Error.prototype.toString() +* +* Revised: 25 Nov 2002 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181909 +* +* Note that ECMA-262 3rd Edition Final, Section 15.11.4.4 states that +* Error.prototype.toString() returns an implementation-dependent string. +* Therefore any testcase on this property is somewhat arbitrary. +* +* However, d-russo@ti.com pointed out that Rhino was returning this: +* +* js> err = new Error() +* undefined: undefined +* +* js> err = new Error("msg") +* undefined: msg +* +* +* We expect Rhino to return what SpiderMonkey currently does: +* +* js> err = new Error() +* Error +* +* js> err = new Error("msg") +* Error: msg +* +* +* i.e. we expect err.toString() === err.name if err.message is not defined; +* otherwise, we expect err.toString() === err.name + ': ' + err.message. +* +* See also ECMA 15.11.4.2, 15.11.4.3 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Error.prototype.toString()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +status = inSection(1); +var err1 = new Error('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = new Error(err1); +actual = examineThis(err2, err1); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = new Error(); +actual = examineThis(err3, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = new Error(EMPTY_STRING); +actual = examineThis(err4, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +// now generate a run-time error - +status = inSection(5); +try +{ + eval('1=2'); +} +catch(err5) +{ + actual = examineThis(err5, '.*'); +} +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Searches err.toString() for err.name + ':' + err.message, + * with possible whitespace on each side of the colon sign. + * + * We allow for no colon in case err.message was not provided by the user. + * In such a case, SpiderMonkey and Rhino currently set err.message = '', + * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. + * + * If this is ever changed to a non-empty string, e.g. 'undefined', + * you may have to modify |pattern| to take that into account - + * + */ +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js new file mode 100644 index 0000000..a8097f5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js @@ -0,0 +1,125 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: Prototype of predefined error objects should be DontEnum +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201989; +var summary = 'Prototype of predefined error objects should be DontEnum'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Tests that |F.prototype| is not enumerable in |F| + */ +function testDontEnum(F) +{ + var proto = F.prototype; + + for (var prop in F) + { + if (F[prop] === proto) + return false; + } + return true; +} + + +var list = [ + "Error", + "ConversionError", + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError" +]; + + +for (i in list) +{ + var F = this[list[i]]; + + // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. + if (F) + { + status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|'; + actual = testDontEnum(F); + expect = true; + addThis(); + } +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js new file mode 100644 index 0000000..f0fae24 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: Prototype of predefined error objects should be DontDelete +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201989; +var summary = 'Prototype of predefined error objects should be DontDelete'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Tests that |F.prototype| is DontDelete + */ +function testDontDelete(F) +{ + var orig = F.prototype; + delete F.prototype; + return F.prototype === orig; +} + + +var list = [ + "Error", + "ConversionError", + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError" +]; + + +for (i in list) +{ + var F = this[list[i]]; + + // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. + if (F) + { + status = 'Testing DontDelete attribute of |' + list[i] + '.prototype|'; + actual = testDontDelete(F); + expect = true; + addThis(); + } +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js new file mode 100644 index 0000000..5840427 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: Prototype of predefined error objects should be ReadOnly +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201989; +var summary = 'Prototype of predefined error objects should be ReadOnly'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Tests that |F.prototype| is ReadOnly + */ +function testReadOnly(F) +{ + var orig = F.prototype; + F.prototype = new Object(); + return F.prototype === orig; +} + + +var list = [ + "Error", + "ConversionError", + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError" +]; + + +for (i in list) +{ + var F = this[list[i]]; + + // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. + if (F) + { + status = 'Testing ReadOnly attribute of |' + list[i] + '.prototype|'; + actual = testReadOnly(F); + expect = true; + addThis(); + } +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js new file mode 100644 index 0000000..72ff55e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js @@ -0,0 +1,106 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 2001-08-27 +* +* SUMMARY: Testing binding of function names +* +* Brendan: +* +* "... the question is, does Rhino bind 'sum' in the global object +* for the following test? If it does, it's buggy. +* +* var f = function sum(){}; +* print(sum); // should fail with 'sum is not defined' " +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing binding of function names'; +var ERR_REF_YES = 'ReferenceError'; +var ERR_REF_NO = 'did NOT generate a ReferenceError'; +var statusitems = []; +var actualvalues = []; +var expectedvalues = []; +var status = summary; +var actual = ERR_REF_NO; +var expect= ERR_REF_YES; + + +try +{ + var f = function sum(){}; + print(sum); +} +catch (e) +{ + status = 'Section 1 of test'; + actual = e instanceof ReferenceError; + expect = true; + addThis(); + + + /* + * This test is more literal, and one day may not be valid. + * Searching for literal string "ReferenceError" in e.toString() + */ + status = 'Section 2 of test'; + var match = e.toString().search(/ReferenceError/); + actual = (match > -1); + expect = true; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isReferenceError(actual); + expectedvalues[UBound] = isReferenceError(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +// converts a Boolean result into a textual result - +function isReferenceError(bResult) +{ + return bResult? ERR_REF_YES : ERR_REF_NO; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js new file mode 100644 index 0000000..d65efff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js @@ -0,0 +1,150 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): joerg.schaible@gmx.de +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 23 Nov 2002 +* SUMMARY: Calling toString for an object derived from the Error class +* results in an TypeError (Rhino only) +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181654 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '181654'; +var summary = 'Calling toString for an object derived from the Error class should be possible.'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +// derive MyError from Error +function MyError( msg ) +{ + this.message = msg; +} +MyError.prototype = new Error(); +MyError.prototype.name = "MyError"; + + +status = inSection(1); +var err1 = new MyError('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = new MyError(err1); +actual = examineThis(err2, err1); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = new MyError(); +actual = examineThis(err3, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = new MyError(EMPTY_STRING); +actual = examineThis(err4, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +// now generate an error - +status = inSection(5); +try +{ + throw new MyError("thrown"); +} +catch(err5) +{ + actual = examineThis(err5, "thrown"); +} +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Searches err.toString() for err.name + ':' + err.message, + * with possible whitespace on each side of the colon sign. + * + * We allow for no colon in case err.message was not provided by the user. + * In such a case, SpiderMonkey and Rhino currently set err.message = '', + * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. + * + * If this is ever changed to a non-empty string, e.g. 'undefined', + * you may have to modify |pattern| to take that into account - + * + */ +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js new file mode 100644 index 0000000..adf0b46 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js @@ -0,0 +1,189 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): joerg.schaible@gmx.de, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 25 Nov 2002 +* SUMMARY: Calling a user-defined superconstructor +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181914, esp. Comment 10. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '181914'; +var summary = 'Calling a user-defined superconstructor'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +// make a user-defined version of the Error constructor +function _Error(msg) +{ + this.message = msg; +} +_Error.prototype = new Error(); +_Error.prototype.name = '_Error'; + + +// derive MyApplyError from _Error +function MyApplyError(msg) +{ + if(this instanceof MyApplyError) + _Error.apply(this, arguments); + else + return new MyApplyError(msg); +} +MyApplyError.prototype = new _Error(); +MyApplyError.prototype.name = "MyApplyError"; + + +// derive MyCallError from _Error +function MyCallError(msg) +{ + if(this instanceof MyCallError) + _Error.call(this, msg); + else + return new MyCallError(msg); +} +MyCallError.prototype = new _Error(); +MyCallError.prototype.name = "MyCallError"; + + +function otherScope(msg) +{ + return MyApplyError(msg); +} + + +status = inSection(1); +var err1 = new MyApplyError('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = new MyCallError('msg2'); +actual = examineThis(err2, 'msg2'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = MyApplyError('msg3'); +actual = examineThis(err3, 'msg3'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = MyCallError('msg4'); +actual = examineThis(err4, 'msg4'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(5); +var err5 = otherScope('msg5'); +actual = examineThis(err5, 'msg5'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(6); +var err6 = otherScope(); +actual = examineThis(err6, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(7); +var err7 = eval("MyApplyError('msg7')"); +actual = examineThis(err7, 'msg7'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(8); +var err8; +try +{ + throw MyApplyError('msg8'); +} +catch(e) +{ + if(e instanceof Error) + err8 = e; +} +actual = examineThis(err8, 'msg8'); +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +// Searches |err.toString()| for |err.name + ':' + err.message| +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js new file mode 100644 index 0000000..e2fc798 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js @@ -0,0 +1,56 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* +*This test arose from Bugzilla bug 58946. +*The bug was filed when we got the following error (see code below): +* +* "ReferenceError: e is not defined" +* +*There was no error if we replaced "return e" in the code below with "print(e)". +*There should be no error with "return e", either - +*/ +//------------------------------------------------------------------------------------------------- +var bug = '58946'; +var stat = 'Testing a return statement inside a catch statement inside a function'; + + +test(); + + +function test() { + enterFunc ("test"); + printBugNumber (bug); + printStatus (stat); + + + try + { + throw 'PASS'; + } + + catch(e) + { + return e; + } + + + exitFunc ("test"); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js new file mode 100644 index 0000000..59b5209 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js @@ -0,0 +1,97 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 13 August 2001 +* +* SUMMARY: Invoking an undefined function should produce a ReferenceError +* See http://bugzilla.mozilla.org/show_bug.cgi?id=95101 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 95101; +var summary = 'Invoking an undefined function should produce a ReferenceError'; +var msgERR_REF_YES = 'ReferenceError'; +var msgERR_REF_NO = 'did NOT generate a ReferenceError'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +try +{ + xxxyyyzzz(); +} +catch (e) +{ + status = 'Section 1 of test'; + actual = e instanceof ReferenceError; + expect = true; + addThis(); + + + /* + * This test is more literal, and may one day be invalid. + * Searching for literal string "ReferenceError" in e.toString() + */ + status = 'Section 2 of test'; + var match = e.toString().search(/ReferenceError/); + actual = (match > -1); + expect = true; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isReferenceError(actual); + expectedvalues[UBound] = isReferenceError(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +// converts a Boolean result into a textual result - +function isReferenceError(bResult) +{ + return bResult? msgERR_REF_YES : msgERR_REF_NO; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js new file mode 100644 index 0000000..a29d2a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js @@ -0,0 +1,196 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 11 Feb 2002 +* SUMMARY: Testing functions having duplicate formal parameter names +* +* Note: given function f(x,x,x,x) {return x;}; f(1,2,3,4) should return 4. +* See ECMA-262 3rd Edition Final Section 10.1.3: Variable Instantiation +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=124900 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 124900; +var summary = 'Testing functions having duplicate formal parameter names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f1(x,x) +{ + return x; +} +status = inSection(1); +actual = f1(1,2); +expect = 2; +addThis(); + + +function f2(x,x,x) +{ + return x*x*x; +} +status = inSection(2); +actual = f2(1,2,3); +expect = 27; +addThis(); + + +function f3(x,x,x,x) +{ + return 'a' + x + 'b' + x + 'c' + x ; +} +status = inSection(3); +actual = f3(1,2,3,4); +expect = 'a4b4c4'; +addThis(); + + +/* + * If the value of the last duplicate parameter is not provided by + * the function caller, the value of this parameter is undefined + */ +function f4(x,a,b,x,z) +{ + return x; +} +status = inSection(4); +actual = f4(1,2); +expect = undefined; +addThis(); + + +/* + * f.toString() should preserve any duplicate formal parameter names that exist + */ +function f5(x,x,x,x) +{ +} +status = inSection(5); +actual = f5.toString().match(/\((.*)\)/)[1]; +actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space +expect = 'x,x,x,x'; +addThis(); + + +function f6(x,x,x,x) +{ + var ret = []; + + for (var i=0; i<arguments.length; i++) + ret.push(arguments[i]); + + return ret.toString(); +} +status = inSection(6); +actual = f6(1,2,3,4); +expect = '1,2,3,4'; +addThis(); + + +/* + * This variation (assigning to x inside f) is from nboyd@atg.com + * See http://bugzilla.mozilla.org/show_bug.cgi?id=124900 + */ +function f7(x,x,x,x) +{ + x = 999; + var ret = []; + + for (var i=0; i<arguments.length; i++) + ret.push(arguments[i]); + + return ret.toString(); +} +status = inSection(7); +actual = f7(1,2,3,4); +expect = '1,2,3,999'; +addThis(); + + +/* + * Same as above, but with |var| keyword added - + */ +function f8(x,x,x,x) +{ + var x = 999; + var ret = []; + + for (var i=0; i<arguments.length; i++) + ret.push(arguments[i]); + + return ret.toString(); +} +status = inSection(8); +actual = f8(1,2,3,4); +expect = '1,2,3,999'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js new file mode 100644 index 0000000..f969ca0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js @@ -0,0 +1,157 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 11 Feb 2002 +* SUMMARY: Testing functions having duplicate formal parameter names +* +* SpiderMonkey was crashing on each case below if the parameters had +* the same name. But duplicate parameter names are permitted by ECMA; +* see ECMA-262 3rd Edition Final Section 10.1.3 +* +* NOTE: Rhino does not have toSource() and uneval(); they are non-ECMA +* extensions to the language. So we include a test for them at the beginning - +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing functions having duplicate formal parameter names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var OBJ = new Object(); +var OBJ_TYPE = OBJ.toString(); + +/* + * Exit if the implementation doesn't support toSource() or uneval(), + * since these are non-ECMA extensions to the language - + */ +try +{ + if (!OBJ.toSource || !uneval(OBJ)) + quit(); +} +catch(e) +{ + quit(); +} + + +/* + * OK, now begin the test. Just checking that we don't crash on these - + */ +function f1(x,x,x,x) +{ + var ret = eval(arguments.toSource()); + return ret.toString(); +} +status = inSection(1); +actual = f1(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + +/* + * Same thing, but preface |arguments| with the function name + */ +function f2(x,x,x,x) +{ + var ret = eval(f2.arguments.toSource()); + return ret.toString(); +} +status = inSection(2); +actual = f2(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + +function f3(x,x,x,x) +{ + var ret = eval(uneval(arguments)); + return ret.toString(); +} +status = inSection(3); +actual = f3(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + +/* + * Same thing, but preface |arguments| with the function name + */ +function f4(x,x,x,x) +{ + var ret = eval(uneval(f4.arguments)); + return ret.toString(); +} +status = inSection(4); +actual = f4(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js new file mode 100644 index 0000000..468589a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +/** + ECMA Section: 10.1.3: Variable Instantiation + FunctionDeclarations are processed before VariableDeclarations, and + VariableDeclarations don't replace existing values with undefined +*/ + +test(); + +function f() +{ + var x; + + return typeof x; + + function x() + { + return 7; + } +} + +function test() +{ + enterFunc ("test"); + + printStatus ("ECMA Section: 10.1.3: Variable Instantiation."); + printBugNumber (17290); + + reportCompare ("function", f(), "Declaration precedence test"); + + exitFunc("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js new file mode 100644 index 0000000..f4b6f5d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +/** + ECMA Section: 10.1.4.1 Entering An Execution Context + ECMA says: + * Global Code, Function Code + Variable instantiation is performed using the global object as the + variable object and using property attributes { DontDelete }. + + * Eval Code + Variable instantiation is performed using the calling context's + variable object and using empty property attributes. +*/ + +test(); + +function test() +{ + enterFunc ("test"); + + var y; + eval("var x = 1"); + + if (delete y) + reportFailure ("Expected *NOT* to be able to delete y"); + + if (typeof x == "undefined") + reportFailure ("x did not remain defined after eval()"); + else if (x != 1) + reportFailure ("x did not retain it's value after eval()"); + + if (!delete x) + reportFailure ("Expected to be able to delete x"); + + exitFunc("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js new file mode 100644 index 0000000..d831720 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +var CALL_CALLED = "PASSED"; + +test(); + +function f(x) +{ + if (x) + return call(); + + return "FAILED!"; +} + +function call() +{ + return CALL_CALLED; +} + +function test() +{ + enterFunc ("test"); + + printStatus ("ECMA Section: 10.1.3: Variable Instantiation."); + printBugNumber (23346); + + reportCompare ("PASSED", f(true), + "Unqualified reference should not see Function.prototype"); + + exitFunc("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js new file mode 100644 index 0000000..0963ef7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js @@ -0,0 +1,171 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): bzbarsky@mit.edu, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 Mar 2003 +* SUMMARY: Testing left-associativity of the + operator +* +* See ECMA-262 Ed.3, Section 11.6.1, "The Addition operator" +* See http://bugzilla.mozilla.org/show_bug.cgi?id=196290 +* +* The upshot: |a + b + c| should always equal |(a + b) + c| +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 196290; +var summary = 'Testing left-associativity of the + operator'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = 1 + 1 + 'px'; +expect = '2px'; +addThis(); + +status = inSection(2); +actual = 'px' + 1 + 1; +expect = 'px11'; +addThis(); + +status = inSection(3); +actual = 1 + 1 + 1 + 'px'; +expect = '3px'; +addThis(); + +status = inSection(4); +actual = 1 + 1 + 'a' + 1 + 1 + 'b'; +expect = '2a11b'; +addThis(); + +/* + * The next sections test the + operator via eval() + */ +status = inSection(5); +actual = sumThese(1, 1, 'a', 1, 1, 'b'); +expect = '2a11b'; +addThis(); + +status = inSection(6); +actual = sumThese(new Number(1), new Number(1), 'a'); +expect = '2a'; +addThis(); + +status = inSection(7); +actual = sumThese('a', new Number(1), new Number(1)); +expect = 'a11'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + +/* + * Applies the + operator to the provided arguments via eval(). + * + * Form an eval string of the form 'arg1 + arg2 + arg3', but + * remember to add double-quotes inside the eval string around + * any argument that is of string type. For example, suppose the + * arguments were 11, 'a', 22. Then the eval string should be + * + * arg1 + quoteThis(arg2) + arg3 + * + * If we didn't put double-quotes around the string argument, + * we'd get this for an eval string: + * + * '11 + a + 22' + * + * If we eval() this, we get 'ReferenceError: a is not defined'. + * With proper quoting, we get eval('11 + "a" + 22') as desired. + */ +function sumThese() +{ + var sEval = ''; + var arg; + var i; + + var L = arguments.length; + for (i=0; i<L; i++) + { + arg = arguments[i]; + if (typeof arg === 'string') + arg = quoteThis(arg); + + if (i < L-1) + sEval += arg + ' + '; + else + sEval += arg; + } + + return eval(sEval); +} + + +function quoteThis(x) +{ + return '"' + x + '"'; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js new file mode 100644 index 0000000..8153585 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js @@ -0,0 +1,208 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 20 Feb 2002 +* SUMMARY: Testing the comparison |undefined === null| +* See http://bugzilla.mozilla.org/show_bug.cgi?id=126722 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 126722; +var summary = 'Testing the comparison |undefined === null|'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +if (undefined === null) + actual = true; +else + actual = false; +expect = false; +addThis(); + + + +status = inSection(2); +switch(true) +{ + case (undefined === null) : + actual = true; + break; + + default: + actual = false; +} +expect = false; +addThis(); + + + +status = inSection(3); +function f3(x) +{ + var res = false; + + switch(true) + { + case (x === null) : + res = true; + break; + + default: + // do nothing + } + + return res; +} + +actual = f3(undefined); +expect = false; +addThis(); + + + +status = inSection(4); +function f4(arr) +{ + var elt = ''; + var res = false; + + for (i=0; i<arr.length; i++) + { + elt = arr[i]; + + switch(true) + { + case (elt === null) : + res = true; + break; + + default: + // do nothing + } + } + + return res; +} + +var arr = Array('a', undefined); +actual = f4(arr); +expect = false; +addThis(); + + + +status = inSection(5); +function f5(arr) +{ + var len = arr.length; + + for(var i=0; (arr[i]===undefined) && (i<len); i++) + ; //do nothing + + return i; +} + +/* + * An array of 5 undefined elements. Note: + * + * The return value of eval(a STATEMENT) is undefined. + * A non-existent PROPERTY is undefined, not a ReferenceError. + * No undefined element exists AFTER trailing comma at end. + * + */ +var arrUndef = [ , undefined, eval('var x = 0'), this.NOT_A_PROPERTY, , ]; +actual = f5(arrUndef); +expect = 5; +addThis(); + + + +status = inSection(6); +function f6(arr) +{ + var len = arr.length; + + for(var i=0; (arr[i]===null) && (i<len); i++) + ; //do nothing + + return i; +} + +/* + * Use same array as above. This time we're comparing to |null|, so we expect 0 + */ +actual = f6(arrUndef); +expect = 0; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js new file mode 100644 index 0000000..34c37e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + printStatus ("Function Expression test."); + + var x = function f(){return "inner";}(); + var y = f(); + reportFailure ("Previous statement should have thrown a ReferenceError"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js new file mode 100644 index 0000000..569a636 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +if (1) function f() {return 1;} +if (0) function f() {return 0;} + +function test() +{ + enterFunc ("test"); + + printStatus ("Function Expression Statements basic test."); + + reportCompare (1, f(), "Both functions were defined."); + + exitFunc ("test"); +} + +test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js new file mode 100644 index 0000000..35a9925 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +function f() +{ + return "outer"; +} + +function test() +{ + enterFunc ("test"); + printStatus ("Function Expression test."); + + var x = function f(){return "inner";}(); + + reportCompare ("outer", f(), + "Inner function statement should not have been called."); + + exitFunc ("test"); +} + +test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js new file mode 100644 index 0000000..123b944 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js @@ -0,0 +1,205 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor3@apochta.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 May 2002 +* SUMMARY: ECMA conformance of Function.prototype.apply +* +* Function.prototype.apply(thisArg, argArray) +* +* See ECMA-262 Edition 3 Final, Section 15.3.4.3 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 145791; +var summary = 'Testing ECMA conformance of Function.prototype.apply'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function F0(a) +{ + return "" + this + arguments.length; +} + +function F1(a) +{ + return "" + this + a; +} + +function F2() +{ + return "" + this; +} + + + +/* + * Function.prototype.apply.length should return 2 + */ +status = inSection(1); +actual = Function.prototype.apply.length; +expect = 2; +addThis(); + + +/* + * When |thisArg| is not provided to the apply() method, the + * called function must be passed the global object as |this| + */ +status = inSection(2); +actual = F0.apply(); +expect = "" + this + 0; +addThis(); + + +/* + * If |argArray| is not provided to the apply() method, the + * called function should be invoked with an empty argument list + */ +status = inSection(3); +actual = F0.apply(""); +expect = "" + "" + 0; +addThis(); + +status = inSection(4); +actual = F0.apply(true); +expect = "" + true + 0; +addThis(); + + +/* + * Function.prototype.apply(x) and + * Function.prototype.apply(x, undefined) should return the same result + */ +status = inSection(5); +actual = F1.apply(0, undefined); +expect = F1.apply(0); +addThis(); + +status = inSection(6); +actual = F1.apply("", undefined); +expect = F1.apply(""); +addThis(); + +status = inSection(7); +actual = F1.apply(null, undefined); +expect = F1.apply(null); +addThis(); + +status = inSection(8); +actual = F1.apply(undefined, undefined); +expect = F1.apply(undefined); +addThis(); + + +/* + * Function.prototype.apply(x) and + * Function.prototype.apply(x, null) should return the same result + */ +status = inSection(9); +actual = F1.apply(0, null); +expect = F1.apply(0); +addThis(); + +status = inSection(10); +actual = F1.apply("", null); +expect = F1.apply(""); +addThis(); + +status = inSection(11); +actual = F1.apply(null, null); +expect = F1.apply(null); +addThis(); + +status = inSection(12); +actual = F1.apply(undefined, null); +expect = F1.apply(undefined); +addThis(); + + +/* + * Function.prototype.apply() and + * Function.prototype.apply(undefined) should return the same result + */ +status = inSection(13); +actual = F2.apply(undefined); +expect = F2.apply(); +addThis(); + + +/* + * Function.prototype.apply() and + * Function.prototype.apply(null) should return the same result + */ +status = inSection(14); +actual = F2.apply(null); +expect = F2.apply(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js new file mode 100644 index 0000000..e9e2b64 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js @@ -0,0 +1,180 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor3@apochta.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 May 2002 +* SUMMARY: ECMA conformance of Function.prototype.call +* +* Function.prototype.call(thisArg [,arg1 [,arg2, ...]]) +* +* See ECMA-262 Edition 3 Final, Section 15.3.4.4 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 145791; +var summary = 'Testing ECMA conformance of Function.prototype.call'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function F0(a) +{ + return "" + this + arguments.length; +} + +function F1(a) +{ + return "" + this + a; +} + +function F2() +{ + return "" + this; +} + + + +/* + * Function.prototype.call.length should return 1 + */ +status = inSection(1); +actual = Function.prototype.call.length; +expect = 1; +addThis(); + + +/* + * When |thisArg| is not provided to the call() method, the + * called function must be passed the global object as |this| + */ +status = inSection(2); +actual = F0.call(); +expect = "" + this + 0; +addThis(); + + +/* + * If [,arg1 [,arg2, ...]] are not provided to the call() method, + * the called function should be invoked with an empty argument list + */ +status = inSection(3); +actual = F0.call(""); +expect = "" + "" + 0; +addThis(); + +status = inSection(4); +actual = F0.call(true); +expect = "" + true + 0; +addThis(); + + +/* + * Function.prototype.call(x) and + * Function.prototype.call(x, undefined) should return the same result + */ +status = inSection(5); +actual = F1.call(0, undefined); +expect = F1.call(0); +addThis(); + +status = inSection(6); +actual = F1.call("", undefined); +expect = F1.call(""); +addThis(); + +status = inSection(7); +actual = F1.call(null, undefined); +expect = F1.call(null); +addThis(); + +status = inSection(8); +actual = F1.call(undefined, undefined); +expect = F1.call(undefined); +addThis(); + + +/* + * Function.prototype.call() and + * Function.prototype.call(undefined) should return the same result + */ +status = inSection(9); +actual = F2.call(undefined); +expect = F2.call(); +addThis(); + + +/* + * Function.prototype.call() and + * Function.prototype.call(null) should return the same result + */ +status = inSection(10); +actual = F2.call(null); +expect = F2.call(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js new file mode 100644 index 0000000..98aca18 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js @@ -0,0 +1,148 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 07 May 2001 +* +* SUMMARY: Testing the arguments object +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72884 +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 72884; +var summary = 'Testing the arguments object'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var a = ''; + + +status = inSection(1); +function f() +{ + delete arguments.length; + return arguments; +} + +a = f(); +actual = a instanceof Object; +expect = true; +addThis(); + +actual = a instanceof Array; +expect = false; +addThis(); + +actual = a.length; +expect = undefined; +addThis(); + + + +status = inSection(2); +a = f(1,2,3); +actual = a instanceof Object; +expect = true; +addThis(); + +actual = a instanceof Array; +expect = false; +addThis(); + +actual = a.length; +expect = undefined; +addThis(); + +actual = a[0]; +expect = 1; +addThis(); + +actual = a[1]; +expect = 2; +addThis(); + +actual = a[2]; +expect = 3; +addThis(); + + + +status = inSection(3); +/* + * Brendan: + * + * Note that only callee and length can be overridden, so deleting an indexed + * property and asking for it again causes it to be recreated by args_resolve: + * + * function g(){delete arguments[0]; return arguments[0]} + * g(42) // should this print 42? + * + * I'm not positive this violates ECMA, which allows in chapter 16 for extensions + * including properties (does it allow for magically reappearing properties?). The + * delete operator successfully deletes arguments[0] and results in true, but that + * is not distinguishable from the case where arguments[0] was delegated to + * Arguments.prototype[0], which was how the bad old code worked. + * + * I'll ponder this last detail... + * + * UPDATE: Per ECMA-262, delete on an arguments[i] should succeed + * and remove that property from the arguments object, leaving any get + * of it after the delete to evaluate to undefined. + */ +function g() +{ + delete arguments[0]; + return arguments[0]; +} +actual = g(42); +expect = undefined; // not 42... +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js new file mode 100644 index 0000000..f9bdf62 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js @@ -0,0 +1,131 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-13 +* +* SUMMARY: Applying Function.prototype.call to the Function object itself +* +* +* ECMA-262 15.3.4.4 Function.prototype.call (thisArg [,arg1 [,arg2,…] ] ) +* +* When applied to the Function object itself, thisArg should be ignored. +* As explained by Waldemar (waldemar@netscape.com): +* +* Function.call(obj, "print(this)") is equivalent to invoking +* Function("print(this)") with this set to obj. Now, Function("print(this)") +* is equivalent to new Function("print(this)") (see 15.3.1.1), and the latter +* ignores the this value that you passed it and constructs a function +* (which we'll call F) which will print the value of the this that will be +* passed in when F will be invoked. +* +* With the last set of () you're invoking F(), which means you're calling it +* with no this value. When you don't provide a this value, it defaults to the +* global object. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Applying Function.prototype.call to the Function object itself'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var self = this; // capture a reference to the global object +var cnOBJECT_GLOBAL = self.toString(); +var cnOBJECT_OBJECT = (new Object).toString(); +var cnHello = 'Hello'; +var cnRed = 'red'; +var objTEST = {color:cnRed}; +var f = new Function(); +var g = new Function(); + + +f = Function.call(self, 'return cnHello'); +g = Function.call(objTEST, 'return cnHello'); + +status = 'Section A of test'; +actual = f(); +expect = cnHello; +captureThis(); + +status = 'Section B of test'; +actual = g(); +expect = cnHello; +captureThis(); + + +f = Function.call(self, 'return this.toString()'); +g = Function.call(objTEST, 'return this.toString()'); + +status = 'Section C of test'; +actual = f(); +expect = cnOBJECT_GLOBAL; +captureThis(); + +status = 'Section D of test'; +actual = g(); +expect = cnOBJECT_GLOBAL; +captureThis(); + + +f = Function.call(self, 'return this.color'); +g = Function.call(objTEST, 'return this.color'); + +status = 'Section E of test'; +actual = f(); +expect = undefined; +captureThis(); + +status = 'Section F of test'; +actual = g(); +expect = undefined; +captureThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js new file mode 100644 index 0000000..db984a2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js @@ -0,0 +1,56 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): jband@netscape.com, pschwartau@netscape.com +* Date: 14 October 2001 +* +* SUMMARY: Regression test for Bugzilla bug 104584 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=104584 +* +* Testing that we don't crash on this code. The idea is to +* call F,G WITHOUT providing an argument. This caused a crash +* on the second call to obj.toString() or print(obj) below - +*/ +//----------------------------------------------------------------------------- +var bug = 104584; +var summary = "Testing that we don't crash on this code -"; + +printBugNumber (bug); +printStatus (summary); + +F(); +G(); + +function F(obj) +{ + if(!obj) + obj = {}; + obj.toString(); + gc(); + obj.toString(); +} + + +function G(obj) +{ + if(!obj) + obj = {}; + print(obj); + gc(); + print(obj); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js new file mode 100644 index 0000000..d90aa17 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js @@ -0,0 +1,191 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 Mar 2002 +* SUMMARY: Function declarations in global or function scope are {DontDelete}. +* Function declarations in eval scope are not {DontDelete}. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131964 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 131964; +var summary = 'Functions defined in global or function scope are {DontDelete}'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +function f() +{ + return 'f lives!'; +} +delete f; + +try +{ + actual = f(); +} +catch(e) +{ + actual = 'f was deleted'; +} + +expect = 'f lives!'; +addThis(); + + + +/* + * Try the same test in function scope - + */ +status = inSection(2); +function g() +{ + function f() + { + return 'f lives!'; + } + delete f; + + try + { + actual = f(); + } + catch(e) + { + actual = 'f was deleted'; + } + + expect = 'f lives!'; + addThis(); +} +g(); + + + +/* + * Try the same test in eval scope - here we EXPECT the function to be deleted (?) + */ +status = inSection(3); +var s = ''; +s += 'function h()'; +s += '{ '; +s += ' return "h lives!";'; +s += '}'; +s += 'delete h;'; + +s += 'try'; +s += '{'; +s += ' actual = h();'; +s += '}'; +s += 'catch(e)'; +s += '{'; +s += ' actual = "h was deleted";'; +s += '}'; + +s += 'expect = "h was deleted";'; +s += 'addThis();'; +eval(s); + + +/* + * Define the function in eval scope, but delete it in global scope - + */ +status = inSection(4); +s = ''; +s += 'function k()'; +s += '{ '; +s += ' return "k lives!";'; +s += '}'; +eval(s); + +delete k; + +try +{ + actual = k(); +} +catch(e) +{ + actual = 'k was deleted'; +} + +expect = 'k was deleted'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function wasDeleted(functionName) +{ + return functionName + ' was deleted...'; +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js new file mode 100644 index 0000000..1417601 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): ibukanov8@yahoo.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 12 Apr 2002 +* SUMMARY: delete arguments[i] should break connection to local reference +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=137181 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 137181; +var summary = 'delete arguments[i] should break connection to local reference'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +function f1(x) +{ + x = 1; + delete arguments[0]; + return x; +} +actual = f1(0); // (bug: Rhino was returning |undefined|) +expect = 1; +addThis(); + + +status = inSection(2); +function f2(x) +{ + x = 1; + delete arguments[0]; + arguments[0] = -1; + return x; +} +actual = f2(0); // (bug: Rhino was returning -1) +expect = 1; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js new file mode 100644 index 0000000..cc3c1eb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js @@ -0,0 +1,131 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 17 February 2003 +* SUMMARY: Testing access to function name from inside function +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=193555 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 193555; +var summary = 'Testing access to function name from inside function'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// test via function statement +status = inSection(1); +function f() {return f.toString();}; +actual = f(); +expect = f.toString(); +addThis(); + +// test via function expression +status = inSection(2); +var x = function g() {return g.toString();}; +actual = x(); +expect = x.toString(); +addThis(); + +// test via eval() outside function +status = inSection(3); +eval ('function a() {return a.toString();}'); +actual = a(); +expect = a.toString(); +addThis(); + +status = inSection(4); +eval ('var y = function b() {return b.toString();}'); +actual = y(); +expect = y.toString(); +addThis(); + +// test via eval() inside function +status = inSection(5); +function c() {return eval('c').toString();}; +actual = c(); +expect = c.toString(); +addThis(); + +status = inSection(6); +var z = function d() {return eval('d').toString();}; +actual = z(); +expect = z.toString(); +addThis(); + +// test via two evals! +status = inSection(7); +eval('var w = function e() {return eval("e").toString();}'); +actual = w(); +expect = w.toString(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js new file mode 100644 index 0000000..5f7093a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js @@ -0,0 +1,116 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributors: jlaprise@delanotech.com,pschwartau@netscape.com +* Date: 2001-07-10 +* +* SUMMARY: Invoking try...catch through Function.call +* See http://bugzilla.mozilla.org/show_bug.cgi?id=49286 +* +* 1) Define a function with a try...catch block in it +* 2) Invoke the function via the call method of Function +* 3) Pass bad syntax to the try...catch block +* 4) We should catch the error! +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 49286; +var summary = 'Invoking try...catch through Function.call'; +var cnErrorCaught = 'Error caught'; +var cnErrorNotCaught = 'Error NOT caught'; +var cnGoodSyntax = '1==2'; +var cnBadSyntax = '1=2'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var obj = new testObject(); + +status = 'Section A of test: direct call of f'; +actual = f.call(obj); +expect = cnErrorCaught; +addThis(); + +status = 'Section B of test: indirect call of f'; +actual = g.call(obj); +expect = cnErrorCaught; +addThis(); + + + +//----------------------------------------- +test(); +//----------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +// An object storing bad syntax as a property - +function testObject() +{ + this.badSyntax = cnBadSyntax; + this.goodSyntax = cnGoodSyntax; +} + + +// A function wrapping a try...catch block +function f() +{ + try + { + eval(this.badSyntax); + } + catch(e) + { + return cnErrorCaught; + } + return cnErrorNotCaught; +} + + +// A function wrapping a call to f - +function g() +{ + return f.call(this); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js new file mode 100644 index 0000000..8a5c2e6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js @@ -0,0 +1,221 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 15 July 2002 +* SUMMARY: Testing functions with double-byte names +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274 +* +* Here is a sample of the problem: +* +* js> function f\u02B1 () {} +* +* js> f\u02B1.toSource(); +* function f¦() {} +* +* js> f\u02B1.toSource().toSource(); +* (new String("function f\xB1() {}")) +* +* +* See how the high-byte information (the 02) has been lost? +* The same thing was happening with the toString() method: +* +* js> f\u02B1.toString(); +* +* function f¦() { +* } +* +* js> f\u02B1.toString().toSource(); +* (new String("\nfunction f\xB1() {\n}\n")) +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 58274; +var summary = 'Testing functions with double-byte names'; +var ERR = 'UNEXPECTED ERROR! \n'; +var ERR_MALFORMED_NAME = ERR + 'Could not find function name in: \n\n'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var sEval; +var sName; + + +sEval = "function f\u02B2() {return 42;}"; +eval(sEval); +sName = getFunctionName(f\u02B2); + +// Test function call - +status = inSection(1); +actual = f\u02B2(); +expect = 42; +addThis(); + +// Test both characters of function name - +status = inSection(2); +actual = sName[0]; +expect = sEval[9]; +addThis(); + +status = inSection(3); +actual = sName[1]; +expect = sEval[10]; +addThis(); + + + +sEval = "function f\u02B2\u0AAA () {return 84;}"; +eval(sEval); +sName = getFunctionName(f\u02B2\u0AAA); + +// Test function call - +status = inSection(4); +actual = f\u02B2\u0AAA(); +expect = 84; +addThis(); + +// Test all three characters of function name - +status = inSection(5); +actual = sName[0]; +expect = sEval[9]; +addThis(); + +status = inSection(6); +actual = sName[1]; +expect = sEval[10]; +addThis(); + +status = inSection(7); +actual = sName[2]; +expect = sEval[11]; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Goal: test that f.toString() contains the proper function name. + * + * Note, however, f.toString() is implementation-independent. For example, + * it may begin with '\nfunction' instead of 'function'. Therefore we use + * a regexp to make sure we extract the name properly. + * + * Here we assume that f has been defined by means of a function statement, + * and not a function expression (where it wouldn't have to have a name). + * + * Rhino uses a Unicode representation for f.toString(); whereas + * SpiderMonkey uses an ASCII representation, putting escape sequences + * for non-ASCII characters. For example, if a function is called f\u02B1, + * then in Rhino the toString() method will present a 2-character Unicode + * string for its name, whereas SpiderMonkey will present a 7-character + * ASCII string for its name: the string literal 'f\u02B1'. + * + * So we force the lexer to condense the string before using it. + * This will give uniform results in Rhino and SpiderMonkey. + */ +function getFunctionName(f) +{ + var s = condenseStr(f.toString()); + var re = /\s*function\s+(\S+)\s*\(/; + var arr = s.match(re); + + if (!(arr && arr[1])) + return ERR_MALFORMED_NAME + s; + return arr[1]; +} + + +/* + * This function is the opposite of functions like escape(), which take + * Unicode characters and return escape sequences for them. Here, we force + * the lexer to turn escape sequences back into single characters. + * + * Note we can't simply do |eval(str)|, since in practice |str| will be an + * identifier somewhere in the program (e.g. a function name); thus |eval(str)| + * would return the object that the identifier represents: not what we want. + * + * So we surround |str| lexicographically with quotes to force the lexer to + * evaluate it as a string. Have to strip out any linefeeds first, however - + */ +function condenseStr(str) +{ + /* + * You won't be able to do the next step if |str| has + * any carriage returns or linefeeds in it. For example: + * + * js> eval("'" + '\nHello' + "'"); + * 1: SyntaxError: unterminated string literal: + * 1: ' + * 1: ^ + * + * So replace them with the empty string - + */ + str = str.replace(/[\r\n]/g, '') + return eval("'" + str + "'"); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js new file mode 100644 index 0000000..fea243e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js @@ -0,0 +1,152 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-06-14 +* +* SUMMARY: Regression test for Bugzilla bug 85880 +* +* Rhino interpreted mode was nulling out the arguments object of a +* function if it happened to call another function inside its body. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=85880 +* +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 85880; +var summary = 'Arguments object of g(){f()} should not be null'; +var cnNonNull = 'Arguments != null'; +var cnNull = 'Arguments == null'; +var cnRecurse = true; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f1(x) +{ +} + + +function f2() +{ + return f2.arguments; +} +status = 'Section A of test'; +actual = (f2() == null); +expect = false; +addThis(); + +status = 'Section B of test'; +actual = (f2(0) == null); +expect = false; +addThis(); + + +function f3() +{ + f1(); + return f3.arguments; +} +status = 'Section C of test'; +actual = (f3() == null); +expect = false; +addThis(); + +status = 'Section D of test'; +actual = (f3(0) == null); +expect = false; +addThis(); + + +function f4() +{ + f1(); + f2(); + f3(); + return f4.arguments; +} +status = 'Section E of test'; +actual = (f4() == null); +expect = false; +addThis(); + +status = 'Section F of test'; +actual = (f4(0) == null); +expect = false; +addThis(); + + +function f5() +{ + if (cnRecurse) + { + cnRecurse = false; + f5(); + } + return f5.arguments; +} +status = 'Section G of test'; +actual = (f5() == null); +expect = false; +addThis(); + +status = 'Section H of test'; +actual = (f5(0) == null); +expect = false; +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isThisNull(actual); + expectedvalues[UBound] = isThisNull(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function isThisNull(bool) +{ + return bool? cnNull : cnNonNull +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js new file mode 100644 index 0000000..de4a3a3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js @@ -0,0 +1,142 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): deneen@alum.bucknell.edu, shaver@mozilla.org +* Date: 08 August 2001 +* +* SUMMARY: When we invoke a function, the arguments object should take +* a back seat to any local identifier named "arguments". +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=94506 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 94506; +var summary = 'Testing functions employing identifiers named "arguments"'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var TYPE_OBJECT = typeof new Object(); +var arguments = 5555; + + +// use a parameter named "arguments" +function F1(arguments) +{ + return arguments; +} + + +// use a local variable named "arguments" +function F2() +{ + var arguments = 55; + return arguments; +} + + +// same thing in a different order. CHANGES THE RESULT! +function F3() +{ + return arguments; + var arguments = 555; +} + + +// use the global variable above named "arguments" +function F4() +{ + return arguments; +} + + + +/* + * In Sections 1 and 2, expect the local identifier, not the arguments object. + * In Sections 3 and 4, expect the arguments object, not the the identifier. + */ + +status = 'Section 1 of test'; +actual = F1(5); +expect = 5; +addThis(); + + +status = 'Section 2 of test'; +actual = F2(); +expect = 55; +addThis(); + + +status = 'Section 3 of test'; +actual = typeof F3(); +expect = TYPE_OBJECT; +addThis(); + + +status = 'Section 4 of test'; +actual = typeof F4(); +expect = TYPE_OBJECT; +addThis(); + + +// Let's try calling F1 without providing a parameter - +status = 'Section 5 of test'; +actual = F1(); +expect = undefined; +addThis(); + + +// Let's try calling F1 with too many parameters - +status = 'Section 6 of test'; +actual = F1(3,33,333); +expect = 3; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js new file mode 100644 index 0000000..c982673 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js @@ -0,0 +1,131 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): georg@bioshop.de, pschwartau@netscape.com +* Date: 10 September 2001 +* +* SUMMARY: Testing with() statement with nested functions +* See http://bugzilla.mozilla.org/show_bug.cgi?id=97921 +* +* Brendan: "The bug is peculiar to functions that have formal parameters, +* but that are called with fewer actual arguments than the declared number +* of formal parameters." +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 97921; +var summary = 'Testing with() statement with nested functions'; +var cnYES = 'Inner value === outer value'; +var cnNO = "Inner value !== outer value!"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var outerValue = ''; +var innerValue = ''; +var useWith = ''; + + +function F(i) +{ + i = 0; + if(useWith) with(1){i;} + i++; + + outerValue = i; // capture value of i in outer function + F1 = function() {innerValue = i;}; // capture value of i in inner function + F1(); +} + + +status = inSection(1); +useWith=false; +F(); // call F without supplying the argument +actual = innerValue === outerValue; +expect = true; +addThis(); + +status = inSection(2); +useWith=true; +F(); // call F without supplying the argument +actual = innerValue === outerValue; +expect = true; +addThis(); + + +function G(i) +{ + i = 0; + with (new Object()) {i=100}; + i++; + + outerValue = i; // capture value of i in outer function + G1 = function() {innerValue = i;}; // capture value of i in inner function + G1(); +} + + +status = inSection(3); +G(); // call G without supplying the argument +actual = innerValue === 101; +expect = true; +addThis(); + +status = inSection(4); +G(); // call G without supplying the argument +actual = innerValue === outerValue; +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = areTheseEqual(actual); + expectedvalues[UBound] = areTheseEqual(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function areTheseEqual(yes) +{ + return yes? cnYES : cnNO +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js new file mode 100644 index 0000000..9c4e8fa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js @@ -0,0 +1,249 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com +* Date: 28 May 2001 +* +* SUMMARY: Functions are scoped statically, not dynamically +* +* See ECMA Section 10.1.4 Scope Chain and Identifier Resolution +* (This section defines the scope chain of an execution context) +* +* See ECMA Section 12.10 The with Statement +* +* See ECMA Section 13 Function Definition +* (This section defines the scope chain of a function object as that +* of the running execution context when the function was declared) +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing that functions are scoped statically, not dynamically'; +var self = this; // capture a reference to the global object +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + +/* + * In this section the expected value is 1, not 2. + * + * Why? f captures its scope chain from when it's declared, and imposes that chain + * when it's executed. In other words, f's scope chain is from when it was compiled. + * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1. + */ +status = 'Section A of test'; +var a = 1; +function f() +{ + return a; +} +var obj = {a:2}; +with (obj) +{ + actual = f(); +} +expect = 1; +addThis(); + + +/* + * In this section the expected value is 2, not 1. That is because here + * f's associated scope chain now includes 'obj' before the global object. + */ +status = 'Section B of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } + actual = f(); +} +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; +expect = 1; +addThis(); + + +/* + * Like Section B , except that we call f outside the with block. + * By the principles explained above, we still expect 2 - + */ +status = 'Section C of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; +expect = 1; +addThis(); + + +/* + * Like Section C, but with one more level of indirection - + */ +status = 'Section D of test'; +var a = 1; +var obj = {a:2, obj:{a:3}}; +with (obj) +{ + with (obj) + { + function f() + { + return a; + } + } +} +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = 3; +expect = 1; +addThis(); + + +/* + * Like Section C, but here we actually delete obj before calling f. + * We still expect 2 - + */ +status = 'Section E of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +delete obj; +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; +expect = 1; +addThis(); + + +/* + * Like Section E. Here we redefine obj and call f under with (obj) - + * We still expect 2 - + */ +status = 'Section F of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +delete obj; +var obj = {a:3}; +with (obj) +{ + actual = f(); +} +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; // NOT 3 !!! +expect = 1; +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section G of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]); +expect = String([false, true]); +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section H of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +actual = String(['f' in obj, 'f' in self]); +expect = String([false, true]); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; + resetTestVars(); +} + + +function resetTestVars() +{ + delete a; + delete obj; + delete f; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js new file mode 100644 index 0000000..8e4626e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js @@ -0,0 +1,224 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com +* Date: 28 May 2001 +* +* SUMMARY: Functions are scoped statically, not dynamically +* +* See ECMA Section 10.1.4 Scope Chain and Identifier Resolution +* (This section defines the scope chain of an execution context) +* +* See ECMA Section 12.10 The with Statement +* +* See ECMA Section 13 Function Definition +* (This section defines the scope chain of a function object as that +* of the running execution context when the function was declared) +* +* Like scope-001.js, but using assignment var f = function expression +* instead of a function declaration: function f() {} etc. +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing that functions are scoped statically, not dynamically'; +var self = this; // capture a reference to the global object +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + + +/* + * In this section the expected value is 1, not 2. + * + * Why? f captures its scope chain from when it's declared, and imposes that chain + * when it's executed. In other words, f's scope chain is from when it was compiled. + * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1. + */ +status = 'Section A of test'; +var a = 1; +var f = function () {return a;}; +var obj = {a:2}; +with (obj) +{ + actual = f(); +} +expect = 1; +addThis(); + + +/* + * In this section the expected value is 2, not 1. That is because here + * f's associated scope chain now includes 'obj' before the global object. + */ +status = 'Section B of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; + actual = f(); +} +expect = 2; +addThis(); + + +/* + * Like Section B , except that we call f outside the with block. + * By the principles explained above, we still expect 2 - + */ +status = 'Section C of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +actual = f(); +expect = 2; +addThis(); + + +/* + * Like Section C, but with one more level of indirection - + */ +status = 'Section D of test'; +var a = 1; +var obj = {a:2, obj:{a:3}}; +with (obj) +{ + with (obj) + { + var f = function () {return a;}; + } +} +actual = f(); +expect = 3; +addThis(); + + +/* + * Like Section C, but here we actually delete obj before calling f. + * We still expect 2 - + */ +status = 'Section E of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +delete obj; +actual = f(); +expect = 2; +addThis(); + + +/* + * Like Section E. Here we redefine obj and call f under with (obj) - + * We still expect 2 - + */ +status = 'Section F of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +delete obj; +var obj = {a:3}; +with (obj) +{ + actual = f(); +} +expect = 2; // NOT 3 !!! +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section G of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]); +expect = String([false, true]); +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section H of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +actual = String(['f' in obj, 'f' in self]); +expect = String([false, true]); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; + resetTestVars(); +} + + +function resetTestVars() +{ + delete a; + delete obj; + delete f; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js new file mode 100644 index 0000000..767ee6e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js @@ -0,0 +1,124 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-15 +* +* SUMMARY: Testing Number.prototype.toFixed(fractionDigits) +* See EMCA 262 Edition 3 Section 15.7.4.5 +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Number.prototype.toFixed(fractionDigits)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 234.2040506; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toFixed(4); +expect = '234.2041'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.5 Number.prototype.toFixed(fractionDigits) + * + * An implementation is permitted to extend the behaviour of toFixed + * for values of fractionDigits less than 0 or greater than 20. In this + * case toFixed would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because fractionDigits < 0'; +actual = catchError('testNum.toFixed(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because fractionDigits > 20 '; +actual = catchError('testNum.toFixed(21)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + +status = 'Section D of test: no error intended!'; +actual = 0.00001.toFixed(2); +expect = '0.00'; +captureThis(); + +status = 'Section E of test: no error intended!'; +actual = 0.000000000000000000001.toFixed(20); +expect = '0.00000000000000000000'; +captureThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js new file mode 100644 index 0000000..9a06f46 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js @@ -0,0 +1,113 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-15 +* +* SUMMARY: Testing Number.prototype.toExponential(fractionDigits) +* See EMCA 262 Edition 3 Section 15.7.4.6 +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Number.prototype.toExponential(fractionDigits)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 77.1234; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toExponential(4); +expect = '7.7123e+1'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.6 Number.prototype.toExponential(fractionDigits) + * + * An implementation is permitted to extend the behaviour of toExponential + * for values of fractionDigits less than 0 or greater than 20. In this + * case toExponential would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because fractionDigits < 0'; +actual = catchError('testNum.toExponential(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because fractionDigits > 20 '; +actual = catchError('testNum.toExponential(21)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js new file mode 100644 index 0000000..c29c0af --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js @@ -0,0 +1,118 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-15 +* +* SUMMARY: Testing Number.prototype.toPrecision(precision) +* See EMCA 262 Edition 3 Section 15.7.4.7 +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Number.prototype.toPrecision(precision)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 5.123456; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toPrecision(4); +expect = '5.123'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.7 Number.prototype.toPrecision(precision) + * + * An implementation is permitted to extend the behaviour of toPrecision + * for values of precision less than 1 or greater than 21. In this + * case toPrecision would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because precision < 1'; +actual = catchError('testNum.toPrecision(0)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because precision < 1'; +actual = catchError('testNum.toPrecision(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section D of test: expect RangeError because precision > 21 '; +actual = catchError('testNum.toPrecision(22)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js new file mode 100644 index 0000000..e99912d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + var n0 = 1e23; + var n1 = 5e22; + var n2 = 1.6e24; + + printStatus ("Number formatting test."); + printBugNumber ("11178"); + + reportCompare ("1e+23", n0.toString(), "1e23 toString()"); + reportCompare ("5e+22", n1.toString(), "5e22 toString()"); + reportCompare ("1.6e+24", n2.toString(), "1.6e24 toString()"); + +} + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js new file mode 100644 index 0000000..1c7ef47 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 September 2002 +* SUMMARY: Test for TypeError on invalid default string value of object +* See ECMA reference at http://bugzilla.mozilla.org/show_bug.cgi?id=167325 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 167325; +var summary = "Test for TypeError on invalid default string value of object"; +var TEST_PASSED = 'TypeError'; +var TEST_FAILED = 'Generated an error, but NOT a TypeError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * This should generate a TypeError. See ECMA reference + * at http://bugzilla.mozilla.org/show_bug.cgi?id=167325 + */ +try +{ + var obj = {toString: function() {return new Object();}} + obj == 'abc'; +} +catch(e) +{ + if (e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js new file mode 100644 index 0000000..6572995 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js @@ -0,0 +1,128 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the internal [[Class]] property of objects +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js". +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the internal [[Class]] property of objects'; +var statprefix = 'Current object is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + + +status = 'the global object'; +actual = getJSClass(this); +expect = 'global'; +addThis(); + +status = 'new Object()'; +actual = getJSClass(new Object()); +expect = 'Object'; +addThis(); + +status = 'new Function()'; +actual = getJSClass(new Function()); +expect = 'Function'; +addThis(); + +status = 'new Array()'; +actual = getJSClass(new Array()); +expect = 'Array'; +addThis(); + +status = 'new String()'; +actual = getJSClass(new String()); +expect = 'String'; +addThis(); + +status = 'new Boolean()'; +actual = getJSClass(new Boolean()); +expect = 'Boolean'; +addThis(); + +status = 'new Number()'; +actual = getJSClass(new Number()); +expect = 'Number'; +addThis(); + +status = 'Math'; +actual = getJSClass(Math); // can't use 'new' with the Math object (EMCA3, 15.8) +expect = 'Math'; +addThis(); + +status = 'new Date()'; +actual = getJSClass(new Date()); +expect = 'Date'; +addThis(); + +status = 'new RegExp()'; +actual = getJSClass(new RegExp()); +expect = 'RegExp'; +addThis(); + +status = 'new Error()'; +actual = getJSClass(new Error()); +expect = 'Error'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js new file mode 100644 index 0000000..bc5a7de --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js @@ -0,0 +1,124 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the [[Class]] property of native constructors. +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property. +* +* Same as class-001.js - but testing the constructors here, not object instances. +* Therefore we expect the [[Class]] property to equal 'Function' in each case. +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the internal [[Class]] property of native constructors'; +var statprefix = 'Current constructor is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + +/* + * We set the expect variable each time only for readability. + * We expect 'Function' every time; see discussion above - + */ +status = 'Object'; +actual = getJSClass(Object); +expect = 'Function'; +addThis(); + +status = 'Function'; +actual = getJSClass(Function); +expect = 'Function'; +addThis(); + +status = 'Array'; +actual = getJSClass(Array); +expect = 'Function'; +addThis(); + +status = 'String'; +actual = getJSClass(String); +expect = 'Function'; +addThis(); + +status = 'Boolean'; +actual = getJSClass(Boolean); +expect = 'Function'; +addThis(); + +status = 'Number'; +actual = getJSClass(Number); +expect = 'Function'; +addThis(); + +status = 'Date'; +actual = getJSClass(Date); +expect = 'Function'; +addThis(); + +status = 'RegExp'; +actual = getJSClass(RegExp); +expect = 'Function'; +addThis(); + +status = 'Error'; +actual = getJSClass(Error); +expect = 'Function'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js new file mode 100644 index 0000000..012a179 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js @@ -0,0 +1,118 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the [[Class]] property of native error types. +* See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property. +* +* Same as class-001.js - but testing only the native error types here. +* See ECMA-262 Edition 3, Section 15.11.6 for a list of these types. +* +* ECMA expects the [[Class]] property to equal 'Error' in each case. +* See ECMA-262 Edition 3, Sections 15.11.1.1 and 15.11.7.2 for this. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56868 +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = 56868; +var summary = 'Testing the internal [[Class]] property of native error types'; +var statprefix = 'Current object is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + +/* + * We set the expect variable each time only for readability. + * We expect 'Error' every time; see discussion above - + */ +status = 'new Error()'; +actual = getJSClass(new Error()); +expect = 'Error'; +addThis(); + +status = 'new EvalError()'; +actual = getJSClass(new EvalError()); +expect = 'Error'; +addThis(); + +status = 'new RangeError()'; +actual = getJSClass(new RangeError()); +expect = 'Error'; +addThis(); + +status = 'new ReferenceError()'; +actual = getJSClass(new ReferenceError()); +expect = 'Error'; +addThis(); + +status = 'new SyntaxError()'; +actual = getJSClass(new SyntaxError()); +expect = 'Error'; +addThis(); + +status = 'new TypeError()'; +actual = getJSClass(new TypeError()); +expect = 'Error'; +addThis(); + +status = 'new URIError()'; +actual = getJSClass(new URIError()); +expect = 'Error'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js new file mode 100644 index 0000000..6c248cb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js @@ -0,0 +1,117 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing [[Class]] property of native error constructors. +* See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property. +* +* See ECMA-262 Edition 3, Section 15.11.6 for the native error types. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56868 +* +* Same as class-003.js - but testing the constructors here, not object instances. +* Therefore we expect the [[Class]] property to equal 'Function' in each case. +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = 56868; +var summary = 'Testing the internal [[Class]] property of native error constructors'; +var statprefix = 'Current constructor is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + +/* + * We set the expect variable each time only for readability. + * We expect 'Function' every time; see discussion above - + */ +status = 'Error'; +actual = getJSClass(Error); +expect = 'Function'; +addThis(); + +status = 'EvalError'; +actual = getJSClass(EvalError); +expect = 'Function'; +addThis(); + +status = 'RangeError'; +actual = getJSClass(RangeError); +expect = 'Function'; +addThis(); + +status = 'ReferenceError'; +actual = getJSClass(ReferenceError); +expect = 'Function'; +addThis(); + +status = 'SyntaxError'; +actual = getJSClass(SyntaxError); +expect = 'Function'; +addThis(); + +status = 'TypeError'; +actual = getJSClass(TypeError); +expect = 'Function'; +addThis(); + +status = 'URIError'; +actual = getJSClass(URIError); +expect = 'Function'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js new file mode 100644 index 0000000..dd238f9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js @@ -0,0 +1,102 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the internal [[Class]] property of user-defined types. +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property. +* +* Same as class-001.js - but testing user-defined types here, not native types. +* Therefore we expect the [[Class]] property to equal 'Object' in each case - +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the internal [[Class]] property of user-defined types'; +var statprefix = 'Current user-defined type is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + + +Calf.prototype= new Cow(); + +/* + * We set the expect variable each time only for readability. + * We expect 'Object' every time; see discussion above - + */ +status = 'new Cow()'; +actual = getJSClass(new Cow()); +expect = 'Object'; +addThis(); + +status = 'new Calf()'; +actual = getJSClass(new Calf()); +expect = 'Object'; +addThis(); + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} + + +function Cow(name) +{ + this.name=name; +} + + +function Calf(name) +{ + this.name=name; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js new file mode 100644 index 0000000..de3f2fc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js @@ -0,0 +1,75 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 09 May 2001 +* +* SUMMARY: Regression test: we shouldn't crash on this code +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72773 +* +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property. +* +* Same as class-001.js - but testing user-defined types here, not native types. +* Therefore we expect the [[Class]] property to equal 'Object' in each case - +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var bug = 72773; +var summary = "Regression test: we shouldn't crash on this code"; +var status = ''; +var actual = ''; +var expect = ''; +var sToEval = ''; + +/* + * This code should produce an error, but not a crash. + * 'TypeError: Function.prototype.toString called on incompatible object' + */ +sToEval += 'function Cow(name){this.name = name;}' +sToEval += 'function Calf(str){this.name = str;}' +sToEval += 'Calf.prototype = Cow;' +sToEval += 'new Calf().toString();' + +status = 'Trying to catch an expected error'; +try +{ + eval(sToEval); +} +catch(e) +{ + actual = getJSClass(e); + expect = 'Error'; +} + + +//---------------------------------------------------------------------------------------------- +test(); +//---------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + reportCompare(expect, actual, status); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js new file mode 100644 index 0000000..a5ff87c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js @@ -0,0 +1,58 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 06 May 2001 +* +* SUMMARY: Regression test: we shouldn't crash on this code +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=79129 +*/ +//------------------------------------------------------------------------------------------------- +var bug = 79129; +var summary = "Regression test: we shouldn't crash on this code"; + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + tryThis(); + exitFunc ('test'); +} + + +function tryThis() +{ + obj={}; + obj.a = obj.b = obj.c = 1; + delete obj.a; + delete obj.b; + delete obj.c; + obj.d = obj.e = 1; + obj.a=1; + obj.b=1; + obj.c=1; + obj.d=1; + obj.e=1; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js new file mode 100644 index 0000000..b92ffd2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js @@ -0,0 +1,81 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Utility functions for testing objects - +* +* Suppose obj is an instance of a native type, e.g. Number. +* Then obj.toString() invokes Number.prototype.toString(). +* We would also like to access Object.prototype.toString(). +* +* The difference is this: suppose obj = new Number(7). +* Invoking Number.prototype.toString() on this just returns 7. +* Object.prototype.toString() on this returns '[object Number]'. +* +* The getJSType() function below will return '[object Number]' for us. +* The getJSClass() function returns 'Number', the [[Class]] property of obj. +* See ECMA-262 Edition 3, 13-Oct-1999, Section 8.6.2 +*/ +//------------------------------------------------------------------------------------------------- +var cnNoObject = 'Unexpected Error!!! Parameter to this function must be an object'; +var cnNoClass = 'Unexpected Error!!! Cannot find Class property'; +var cnObjectToString = Object.prototype.toString; + + +// checks that it's safe to call findType() +function getJSType(obj) +{ + if (isObject(obj)) + return findType(obj); + return cnNoObject; +} + + +// checks that it's safe to call findType() +function getJSClass(obj) +{ + if (isObject(obj)) + return findClass(findType(obj)); + return cnNoObject; +} + + +function findType(obj) +{ + return cnObjectToString.apply(obj); +} + + +// given '[object Number]', return 'Number' +function findClass(sType) +{ + var re = /^\[.*\s+(\w+)\s*\]$/; + var a = sType.match(re); + + if (a && a[1]) + return a[1]; + return cnNoClass; +} + + +function isObject(obj) +{ + return obj instanceof Object; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js new file mode 100644 index 0000000..89b0c05 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js @@ -0,0 +1,147 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 08 May 2003 +* SUMMARY: JS should evaluate RHS before binding LHS implicit variable +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=204919 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 204919; +var summary = 'JS should evaluate RHS before binding LHS implicit variable'; +var TEST_PASSED = 'ReferenceError'; +var TEST_FAILED = 'Generated an error, but NOT a ReferenceError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * global scope - + */ +status = inSection(1); +try +{ + x = x; + actual = TEST_FAILED_BADLY; +} +catch(e) +{ + if (e instanceof ReferenceError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +expect = TEST_PASSED; +addThis(); + + +/* + * function scope - + */ +status = inSection(2); +try +{ + (function() {y = y;})(); + actual = TEST_FAILED_BADLY; +} +catch(e) +{ + if (e instanceof ReferenceError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +expect = TEST_PASSED; +addThis(); + + +/* + * eval scope - + */ +status = inSection(3); +try +{ + eval('z = z'); + actual = TEST_FAILED_BADLY; +} +catch(e) +{ + if (e instanceof ReferenceError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +expect = TEST_PASSED; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js new file mode 100644 index 0000000..7edffd2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js @@ -0,0 +1,115 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: |delete x.y| should return |true| if |x| has no property |y| +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201987 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201987; +var summary = '|delete x.y| should return |true| if |x| has no property |y|'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +var x = {}; +actual = delete x.y; +expect = true; +addThis(); + +status = inSection(2); +actual = delete {}.y; +expect = true; +addThis(); + +status = inSection(3); +actual = delete "".y; +expect = true; +addThis(); + +status = inSection(4); +actual = delete /abc/.y; +expect = true; +addThis(); + +status = inSection(5); +actual = delete (new Date()).y; +expect = true; +addThis(); + +status = inSection(6); +var x = 99; +actual = delete x.y; +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js new file mode 100644 index 0000000..f35c487 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js @@ -0,0 +1,176 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 July 2002 +* SUMMARY: RegExp conformance test +* +* These testcases are derived from the examples in the ECMA-262 Ed.3 spec +* scattered through section 15.10.2. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = '(none)'; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /a|ab/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(2); +pattern = /((a)|(ab))((c)|(bc))/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a', 'a', undefined, 'bc', undefined, 'bc'); +addThis(); + +status = inSection(3); +pattern = /a[a-z]{2,4}/; +string = 'abcdefghi'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcde'); +addThis(); + +status = inSection(4); +pattern = /a[a-z]{2,4}?/; +string = 'abcdefghi'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(5); +pattern = /(aa|aabaac|ba|b|c)*/; +string = 'aabaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaba', 'ba'); +addThis(); + +status = inSection(6); +pattern = /^(a+)\1*,\1+$/; +string = 'aaaaaaaaaa,aaaaaaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa,aaaaaaaaaaaaaaa', 'aaaaa'); +addThis(); + +status = inSection(7); +pattern = /(z)((a+)?(b+)?(c))*/; +string = 'zaacbbbcac'; +actualmatch = string.match(pattern); +expectedmatch = Array('zaacbbbcac', 'z', 'ac', 'a', undefined, 'c'); +addThis(); + +status = inSection(8); +pattern = /(a*)*/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + +status = inSection(9); +pattern = /(a*)b\1+/; +string = 'baaaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', ''); +addThis(); + +status = inSection(10); +pattern = /(?=(a+))/; +string = 'baaabac'; +actualmatch = string.match(pattern); +expectedmatch = Array('', 'aaa'); +addThis(); + +status = inSection(11); +pattern = /(?=(a+))a*b\1/; +string = 'baaabac'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba', 'a'); +addThis(); + +status = inSection(12); +pattern = /(.*?)a(?!(a+)b\2c)\2(.*)/; +string = 'baaabaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('baaabaac', 'ba', undefined, 'abaac'); +addThis(); + +status = inSection(13); +pattern = /(?=(a+))/; +string = 'baaabac'; +actualmatch = string.match(pattern); +expectedmatch = Array('', 'aaa'); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js new file mode 100644 index 0000000..b12a14c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js @@ -0,0 +1,115 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +* SUMMARY: Passing (RegExp object, flag) to RegExp() function. +* This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.3 The RegExp Constructor Called as a Function +* +* 15.10.3.1 RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" +* and flags is undefined, then return R unchanged. Otherwise +* call the RegExp constructor (section 15.10.4.1), passing it the +* pattern and flags arguments and return the object constructed +* by that constructor. +* +* +* The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* The flags parameter will be undefined in the sense of not being +* provided. We check that RegExp(R) returns R - +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing (RegExp object,flag) to RegExp() function'; +var statprefix = 'RegExp(new RegExp('; +var comma = ', '; var singlequote = "'"; var closeparens = '))'; +var cnSUCCESS = 'RegExp() returned the supplied RegExp object'; +var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object'; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj = new RegExp(s, f); + + actual = (obj == RegExp(obj))? cnSUCCESS : cnFAILURE; + expect = cnSUCCESS; + reportCompare (expect, actual, status); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + comma + flag + closeparens); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js new file mode 100644 index 0000000..ed309b0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js @@ -0,0 +1,123 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +* SUMMARY: Passing (RegExp object, flag) to RegExp() function. +* This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.3 The RegExp Constructor Called as a Function +* +* 15.10.3.1 RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" +* and flags is undefined, then return R unchanged. Otherwise +* call the RegExp constructor (section 15.10.4.1), passing it the +* pattern and flags arguments and return the object constructed +* by that constructor. +* +* +* The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* This test is identical to test 15.10.3.1-1.js, except here we do: +* +* RegExp(R, undefined); +* +* instead of: +* +* RegExp(R); +* +* +* We check that RegExp(R, undefined) returns R - +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing (RegExp object,flag) to RegExp() function'; +var statprefix = 'RegExp(new RegExp('; +var comma = ', '; var singlequote = "'"; var closeparens = '))'; +var cnSUCCESS = 'RegExp() returned the supplied RegExp object'; +var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object'; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj = new RegExp(s, f); + + actual = (obj == RegExp(obj, undefined))? cnSUCCESS : cnFAILURE ; + expect = cnSUCCESS; + reportCompare (expect, actual, status); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + comma + flag + closeparens); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js new file mode 100644 index 0000000..c122abb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js @@ -0,0 +1,111 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp object obj1 will not include a flag. The flags +* parameter for obj2 will be undefined in the sense of not being provided. +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + status =getStatus(s); + obj1 = new RegExp(s); + obj2 = new RegExp(obj1); + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp) +{ + return (statprefix + quote(regexp) + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js new file mode 100644 index 0000000..e8613a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js @@ -0,0 +1,117 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp object obj1 will not include a flag. This test is +* identical to test 15.10.4.1-1.js, except that here we use this syntax: +* +* obj2 = new RegExp(obj1, undefined); +* +* instead of: +* +* obj2 = new RegExp(obj1); +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + status =getStatus(s); + obj1 = new RegExp(s); + obj2 = new RegExp(obj1, undefined); // see introduction to bug + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp) +{ + return (statprefix + quote(regexp) + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js new file mode 100644 index 0000000..03c4498 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js @@ -0,0 +1,124 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp obj1 will include a flag. The flags +* parameter for obj2 will be undefined in the sense of not being provided. +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statmiddle = ' and flag '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj1 = new RegExp(s, f); + obj2 = new RegExp(obj1); + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statmiddle + flag + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js new file mode 100644 index 0000000..e767a69 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js @@ -0,0 +1,130 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp object obj1 will include a flag. This test is +* identical to test 15.10.4.1-3.js, except that here we use this syntax: +* +* obj2 = new RegExp(obj1, undefined); +* +* instead of: +* +* obj2 = new RegExp(obj1); +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statmiddle = ' and flag '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj1 = new RegExp(s, f); + obj2 = new RegExp(obj1, undefined); // see introduction to bug + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statmiddle + flag + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js new file mode 100644 index 0000000..5868e77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js @@ -0,0 +1,113 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the second scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is NOT undefined +* +* This should throw an exception ... we test for this. +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Negative test: Passing (RegExp object, flag) to RegExp() constructor'; +var statprefix = 'Passing RegExp object on pattern '; +var statsuffix = '; passing flag '; +var cnFAILURE = 'Expected an exception to be thrown, but none was -'; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj1 = {}; var obj2 = {}; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + printStatus(getStatus(s, f)); + obj1 = new RegExp(s, f); + obj2 = new RegExp(obj1, f); // this should cause an exception + + // WE SHOULD NEVER REACH THIS POINT - + reportFailure(cnFAILURE); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statsuffix + flag); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js new file mode 100644 index 0000000..365e32d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js @@ -0,0 +1,119 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 23 October 2001 +* +* SUMMARY: Testing regexps with the global flag set. +* NOT every substring fitting the given pattern will be matched. +* The parent string is CONSUMED as successive matches are found. +* +* From the ECMA-262 Final spec: +* +* 15.10.6.2 RegExp.prototype.exec(string) +* Performs a regular expression match of string against the regular +* expression and returns an Array object containing the results of +* the match, or null if the string did not match. +* +* The string ToString(string) is searched for an occurrence of the +* regular expression pattern as follows: +* +* 1. Let S be the value of ToString(string). +* 2. Let length be the length of S. +* 3. Let lastIndex be the value of the lastIndex property. +* 4. Let i be the value of ToInteger(lastIndex). +* 5. If the global property is false, let i = 0. +* 6. If i < 0 or i > length then set lastIndex to 0 and return null. +* 7. Call [[Match]], giving it the arguments S and i. +* If [[Match]] returned failure, go to step 8; +* otherwise let r be its State result and go to step 10. +* 8. Let i = i+1. +* 9. Go to step 6. +* 10. Let e be r's endIndex value. +* 11. If the global property is true, set lastIndex to e. +* +* etc. +* +* +* So when the global flag is set, |lastIndex| is incremented every time +* there is a match; not from i to i+1, but from i to "endIndex" e: +* +* e = (index of last input character matched so far by the pattern) + 1 +* +* Thus in the example below, the first endIndex e occurs after the +* first match 'a b'. The next match will begin AFTER this, and so +* will NOT be 'b c', but rather 'c d'. Similarly, 'd e' won't be matched. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = '(none)'; +var summary = 'Testing regexps with the global flag set'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a b c d e'; +pattern = /\w\s\w/g; +actualmatch = string.match(pattern); +expectedmatch = ['a b','c d']; // see above explanation - +addThis(); + + +status = inSection(2); +string = '12345678'; +pattern = /\d\d\d/g; +actualmatch = string.match(pattern); +expectedmatch = ['123','456']; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js new file mode 100644 index 0000000..cce4c2c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js @@ -0,0 +1,362 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 Feb 2002 +* SUMMARY: Testing re.exec(str) when re.lastIndex is < 0 or > str.length +* +* Case 1: If re has the global flag set, then re(str) should be null +* Case 2: If re doesn't have this set, then re(str) should be unaffected +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76717 +* +* +* From the ECMA-262 Final spec: +* +* 15.10.6.2 RegExp.prototype.exec(string) +* Performs a regular expression match of string against the regular +* expression and returns an Array object containing the results of +* the match, or null if the string did not match. +* +* The string ToString(string) is searched for an occurrence of the +* regular expression pattern as follows: +* +* 1. Let S be the value of ToString(string). +* 2. Let length be the length of S. +* 3. Let lastIndex be the value of the lastIndex property. +* 4. Let i be the value of ToInteger(lastIndex). +* 5. If the global property is false, let i = 0. +* 6. If i < 0 or i > length then set lastIndex to 0 and return null. +* 7. Call [[Match]], giving it the arguments S and i. +* If [[Match]] returned failure, go to step 8; +* otherwise let r be its State result and go to step 10. +* 8. Let i = i+1. +* 9. Go to step 6. +* 10. Let e be r's endIndex value. +* 11. If the global property is true, set lastIndex to e. +* +* etc. +* +* +* So: +* +* A. If the global flag is not set, |lastIndex| is set to 0 +* before the match is attempted; thus the match is unaffected. +* +* B. If the global flag IS set and re.lastIndex is >= 0 and <= str.length, +* |lastIndex| is incremented every time there is a match; not from +* i to i+1, but from i to "endIndex" e: +* +* e = (index of last input character matched so far by the pattern) + 1 +* +* The match is then attempted from this position in the string (Step 7). +* +* C. When the global flag IS set and re.lastIndex is < 0 or > str.length, +* |lastIndex| is set to 0 and the match returns null. +* +* +* Note the |lastIndex| property is writeable, and may be set arbitrarily +* by the programmer - and we will do that below. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 76717; +var summary = 'Testing re.exec(str) when re.lastIndex is < 0 or > str.length'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/****************************************************************************** + * + * Case 1 : when the global flag is set - + * + *****************************************************************************/ +pattern = /abc/gi; +string = 'AbcaBcabC'; + + status = inSection(1); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); + addThis(); + + status = inSection(2); + actualmatch = pattern.exec(string); + expectedmatch = Array('aBc'); + addThis(); + + status = inSection(3); + actualmatch = pattern.exec(string); + expectedmatch = Array('abC'); + addThis(); + + /* + * At this point |lastIndex| is > string.length, so the match should be null - + */ + status = inSection(4); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + /* + * Now let's set |lastIndex| to -1, so the match should again be null - + */ + status = inSection(5); + pattern.lastIndex = -1; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + /* + * Now try some edge-case values. Thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex| + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + */ + status = inSection(6); + pattern.lastIndex = Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(7); + pattern.lastIndex = -Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(8); + pattern.lastIndex = Math.pow(2,32) + 1; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(9); + pattern.lastIndex = -(Math.pow(2,32) + 1); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(10); + pattern.lastIndex = Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(11); + pattern.lastIndex = -Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(12); + pattern.lastIndex = Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(13); + pattern.lastIndex = -Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(14); + pattern.lastIndex = Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(15); + pattern.lastIndex = -Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + + +/****************************************************************************** + * + * Case 2: repeat all the above cases WITHOUT the global flag set. + * According to EMCA. |lastIndex| should get set to 0 before the match. + * + * Therefore re.exec(str) should be unaffected; thus our expected values + * below are now DIFFERENT when |lastIndex| is < 0 or > str.length + * + *****************************************************************************/ + +pattern = /abc/i; +string = 'AbcaBcabC'; + + status = inSection(16); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); + addThis(); + + status = inSection(17); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); // NOT Array('aBc') as before - + addThis(); + + status = inSection(18); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); // NOT Array('abC') as before - + addThis(); + + /* + * At this point above, |lastIndex| WAS > string.length, but not here - + */ + status = inSection(19); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + /* + * Now let's set |lastIndex| to -1 + */ + status = inSection(20); + pattern.lastIndex = -1; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + /* + * Now try some edge-case values. Thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex| + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + */ + status = inSection(21); + pattern.lastIndex = Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(22); + pattern.lastIndex = -Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(23); + pattern.lastIndex = Math.pow(2,32) + 1; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(24); + pattern.lastIndex = -(Math.pow(2,32) + 1); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(25); + pattern.lastIndex = Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(26); + pattern.lastIndex = -Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(27); + pattern.lastIndex = Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before -; + addThis(); + + status = inSection(28); + pattern.lastIndex = -Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(29); + pattern.lastIndex = Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(30); + pattern.lastIndex = -Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js new file mode 100644 index 0000000..34b3e34 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js @@ -0,0 +1,131 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 July 2002 +* SUMMARY: Testing octal sequences in regexps +* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 141078; +var summary = 'Testing octal sequences in regexps'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /\240/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* + * In the following sections, we test the octal escape sequence '\052'. + * This is character code 42, representing the asterisk character '*'. + * The Unicode escape for it would be '\u002A', the hex escape '\x2A'. + */ +status = inSection(2); +pattern = /ab\052c/; +string = 'ab*c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab*c'); +addThis(); + +status = inSection(3); +pattern = /ab\052*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(4); +pattern = /ab(\052)+c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab****c', '*'); +addThis(); + +status = inSection(5); +pattern = /ab((\052)+)c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab****c', '****', '*'); +addThis(); + +status = inSection(6); +pattern = /(?:\052)c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('*c'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js new file mode 100644 index 0000000..6d75e48 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js @@ -0,0 +1,213 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 July 2002 +* SUMMARY: Testing regexps containing octal escape sequences +* This is an elaboration of mozilla/js/tests/ecma_2/RegExp/octal-003.js +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078 +* for a reference on octal escape sequences in regexps. +* +* NOTE: +* We will use the identities '\011' === '\u0009' === '\x09' === '\t' +* +* The first is an octal escape sequence (\(0-3)OO; O an octal digit). +* See ECMA-262 Edition 2, Section 7.7.4 "String Literals". These were +* dropped in Edition 3 but we support them for backward compatibility. +* +* The second is a Unicode escape sequence (\uHHHH; H a hex digit). +* Since octal 11 = hex 9, the two escapes define the same character. +* +* The third is a hex escape sequence (\xHH; H a hex digit). +* Since hex 09 = hex 0009, this defines the same character. +* +* The fourth is the familiar escape sequence for a horizontal tab, +* defined in the ECMA spec as having Unicode value \u0009. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 141078; +var summary = 'Testing regexps containing octal escape sequences'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Test a string containing the null character '\0' followed by the string '11' + * + * 'a' + String.fromCharCode(0) + '11'; + * + * Note we can't simply write 'a\011', because '\011' would be interpreted + * as the octal escape sequence for the tab character (see above). + * + * We should get no match from the regexp /.\011/, because it should be + * looking for the octal escape sequence \011, i.e. the tab character - + * + */ +status = inSection(1); +pattern = /.\011/; +string = 'a' + String.fromCharCode(0) + '11'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + + +/* + * Try same thing with 'xx' in place of '11'. + * + * Should get a match now, because the octal escape sequence in the regexp + * has been reduced from \011 to \0, and '\0' is present in the string - + */ +status = inSection(2); +pattern = /.\0xx/; +string = 'a' + String.fromCharCode(0) + 'xx'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same thing; don't use |String.fromCharCode(0)| this time. + * There is no ambiguity in '\0xx': it is the null character + * followed by two x's, no other interpretation is possible. + */ +status = inSection(3); +pattern = /.\0xx/; +string = 'a\0xx'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * This one should produce a match. The two-character string + * 'a' + '\011' is duplicated in the pattern and test string: + */ +status = inSection(4); +pattern = /.\011/; +string = 'a\011'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now, for the second character of the string, + * use the Unicode escape '\u0009' instead of the octal escape '\011' + */ +status = inSection(5); +pattern = /.\011/; +string = 'a\u0009'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now for the second character of the string, + * use the hex escape '\x09' instead of the octal escape '\011' + */ +status = inSection(6); +pattern = /.\011/; +string = 'a\x09'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now for the second character of the string, + * use the escape '\t' instead of the octal escape '\011' + */ +status = inSection(7); +pattern = /.\011/; +string = 'a\t'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Return to the string from Section 1. + * + * Unlike Section 1, use the RegExp() function to create the + * regexp pattern: null character followed by the string '11'. + * + * Since this is exactly what the string is, we should get a match - + */ +status = inSection(8); +string = 'a' + String.fromCharCode(0) + '11'; +pattern = RegExp(string); +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js new file mode 100644 index 0000000..fd544c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js @@ -0,0 +1,3225 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 2002-07-07 +* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. +* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. +* +* This test was created by running various patterns and strings through the +* Perl 5 RegExp engine. We saved the results below to test the JS engine. +* +* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented +* out such sections altogether, or modified them to fit what we expect from JS. +* +* EXAMPLES: +* +* - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437. +* By contrast, in Perl, unmatched captures hold the empty string. +* We have modified such sections accordingly. Example: + + pattern = /^([^a-z])|(\^)$/; + string = '.'; + actualmatch = string.match(pattern); + //expectedmatch = Array('.', '.', ''); <<<--- Perl + expectedmatch = Array('.', '.', undefined); <<<--- JS + addThis(); + + +* - In JS, you can't refer to a capture before it's encountered & completed +* +* - Perl supports ] & ^] inside a [], ECMA does not +* +* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. +* +* - ECMA doesn't support (?imsx or (?-imsx +* +* - ECMA doesn't support (?(condition) +* +* - Perl has \Z has end-of-line, ECMA doesn't +* +* - In ECMA, ^ matches only the empty string before the first character +* +* - In ECMA, $ matches only the empty string at end of input (unless multiline) +* +* - ECMA spec says that each atom in a range must be a single character +* +* - ECMA doesn't support \A +* +* - ECMA doesn't have rules for [: +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 85721; +var summary = 'Testing regular expression edge cases'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +var cnLBOUND = 1; +var cnUBOUND = 1000; + + +status = inSection(1); +pattern = /abc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(2); +pattern = /abc/; +string = 'xabcy'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(3); +pattern = /abc/; +string = 'ababc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(4); +pattern = /ab*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(5); +pattern = /ab*bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(6); +pattern = /ab*bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(7); +pattern = /ab*bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(8); +pattern = /.{1}/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(9); +pattern = /.{3,4}/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbb'); +addThis(); + +status = inSection(10); +pattern = /ab{0,}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(11); +pattern = /ab+bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(12); +pattern = /ab+bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(13); +pattern = /ab{1,}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(14); +pattern = /ab{1,3}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(15); +pattern = /ab{3,4}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(16); +pattern = /ab?bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(17); +pattern = /ab?bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(18); +pattern = /ab{0,1}bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(19); +pattern = /ab?c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(20); +pattern = /ab{0,1}c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(21); +pattern = /^abc$/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(22); +pattern = /^abc/; +string = 'abcc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(23); +pattern = /abc$/; +string = 'aabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(24); +pattern = /^/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(25); +pattern = /$/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(26); +pattern = /a.c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(27); +pattern = /a.c/; +string = 'axc'; +actualmatch = string.match(pattern); +expectedmatch = Array('axc'); +addThis(); + +status = inSection(28); +pattern = /a.*c/; +string = 'axyzc'; +actualmatch = string.match(pattern); +expectedmatch = Array('axyzc'); +addThis(); + +status = inSection(29); +pattern = /a[bc]d/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abd'); +addThis(); + +status = inSection(30); +pattern = /a[b-d]e/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace'); +addThis(); + +status = inSection(31); +pattern = /a[b-d]/; +string = 'aac'; +actualmatch = string.match(pattern); +expectedmatch = Array('ac'); +addThis(); + +status = inSection(32); +pattern = /a[-b]/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-'); +addThis(); + +status = inSection(33); +pattern = /a[b-]/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-'); +addThis(); + +status = inSection(34); +pattern = /a]/; +string = 'a]'; +actualmatch = string.match(pattern); +expectedmatch = Array('a]'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +pattern = /a[]]b/; +status = inSection(35); +string = 'a]b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a]b'); +addThis(); +*/ + +status = inSection(36); +pattern = /a[^bc]d/; +string = 'aed'; +actualmatch = string.match(pattern); +expectedmatch = Array('aed'); +addThis(); + +status = inSection(37); +pattern = /a[^-b]c/; +string = 'adc'; +actualmatch = string.match(pattern); +expectedmatch = Array('adc'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(38); +pattern = /a[^]b]c/; +string = 'adc'; +actualmatch = string.match(pattern); +expectedmatch = Array('adc'); +addThis(); +*/ + +status = inSection(39); +pattern = /\ba\b/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(40); +pattern = /\ba\b/; +string = '-a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(41); +pattern = /\ba\b/; +string = '-a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(42); +pattern = /\By\b/; +string = 'xy'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(43); +pattern = /\by\B/; +string = 'yz'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(44); +pattern = /\By\B/; +string = 'xyz'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(45); +pattern = /\w/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(46); +pattern = /\W/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(47); +pattern = /a\Sb/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-b'); +addThis(); + +status = inSection(48); +pattern = /\d/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = Array('1'); +addThis(); + +status = inSection(49); +pattern = /\D/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(50); +pattern = /[\w]/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(51); +pattern = /[\W]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(52); +pattern = /a[\S]b/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-b'); +addThis(); + +status = inSection(53); +pattern = /[\d]/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = Array('1'); +addThis(); + +status = inSection(54); +pattern = /[\D]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(55); +pattern = /ab|cd/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(56); +pattern = /ab|cd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(57); +pattern = /()ef/; +string = 'def'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', ''); +addThis(); + +status = inSection(58); +pattern = /a\(b/; +string = 'a(b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a(b'); +addThis(); + +status = inSection(59); +pattern = /a\(*b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(60); +pattern = /a\(*b/; +string = 'a((b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a((b'); +addThis(); + +status = inSection(61); +pattern = /a\\b/; +string = 'a\\b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\\b'); +addThis(); + +status = inSection(62); +pattern = /((a))/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a'); +addThis(); + +status = inSection(63); +pattern = /(a)b(c)/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a', 'c'); +addThis(); + +status = inSection(64); +pattern = /a+b+c/; +string = 'aabbabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(65); +pattern = /a{1,}b{1,}c/; +string = 'aabbabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(66); +pattern = /a.+?c/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(67); +pattern = /(a+|b)*/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(68); +pattern = /(a+|b){0,}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(69); +pattern = /(a+|b)+/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(70); +pattern = /(a+|b){1,}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(71); +pattern = /(a+|b)?/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(72); +pattern = /(a+|b){0,1}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(73); +pattern = /[^ab]*/; +string = 'cde'; +actualmatch = string.match(pattern); +expectedmatch = Array('cde'); +addThis(); + +status = inSection(74); +pattern = /([abc])*d/; +string = 'abbbcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbcd', 'c'); +addThis(); + +status = inSection(75); +pattern = /([abc])*bcd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'a'); +addThis(); + +status = inSection(76); +pattern = /a|b|c|d|e/; +string = 'e'; +actualmatch = string.match(pattern); +expectedmatch = Array('e'); +addThis(); + +status = inSection(77); +pattern = /(a|b|c|d|e)f/; +string = 'ef'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', 'e'); +addThis(); + +status = inSection(78); +pattern = /abcd*efg/; +string = 'abcdefg'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcdefg'); +addThis(); + +status = inSection(79); +pattern = /ab*/; +string = 'xabyabbbz'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(80); +pattern = /ab*/; +string = 'xayabbbz'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(81); +pattern = /(ab|cd)e/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('cde', 'cd'); +addThis(); + +status = inSection(82); +pattern = /[abhgefdc]ij/; +string = 'hij'; +actualmatch = string.match(pattern); +expectedmatch = Array('hij'); +addThis(); + +status = inSection(83); +pattern = /(abc|)ef/; +string = 'abcdef'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', ''); +addThis(); + +status = inSection(84); +pattern = /(a|b)c*d/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('bcd', 'b'); +addThis(); + +status = inSection(85); +pattern = /(ab|ab*)bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a'); +addThis(); + +status = inSection(86); +pattern = /a([bc]*)c*/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'bc'); +addThis(); + +status = inSection(87); +pattern = /a([bc]*)(c*d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc', 'd'); +addThis(); + +status = inSection(88); +pattern = /a([bc]+)(c*d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc', 'd'); +addThis(); + +status = inSection(89); +pattern = /a([bc]*)(c+d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'b', 'cd'); +addThis(); + +status = inSection(90); +pattern = /a[bcd]*dcdcde/; +string = 'adcdcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('adcdcde'); +addThis(); + +status = inSection(91); +pattern = /(ab|a)b*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'ab'); +addThis(); + +status = inSection(92); +pattern = /((a)(b)c)(d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd'); +addThis(); + +status = inSection(93); +pattern = /[a-zA-Z_][a-zA-Z0-9_]*/; +string = 'alpha'; +actualmatch = string.match(pattern); +expectedmatch = Array('alpha'); +addThis(); + +status = inSection(94); +pattern = /^a(bc+|b[eh])g|.h$/; +string = 'abh'; +actualmatch = string.match(pattern); +expectedmatch = Array('bh', undefined); +addThis(); + +status = inSection(95); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'effgz'; +actualmatch = string.match(pattern); +expectedmatch = Array('effgz', 'effgz', undefined); +addThis(); + +status = inSection(96); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'ij'; +actualmatch = string.match(pattern); +expectedmatch = Array('ij', 'ij', 'j'); +addThis(); + +status = inSection(97); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'reffgz'; +actualmatch = string.match(pattern); +expectedmatch = Array('effgz', 'effgz', undefined); +addThis(); + +status = inSection(98); +pattern = /((((((((((a))))))))))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(99); +pattern = /((((((((((a))))))))))\10/; +string = 'aa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(100); +pattern = /((((((((((a))))))))))/; +string = 'a!'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(101); +pattern = /(((((((((a)))))))))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(102); +pattern = /(.*)c(.*)/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcde', 'ab', 'de'); +addThis(); + +status = inSection(103); +pattern = /abcd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd'); +addThis(); + +status = inSection(104); +pattern = /a(bc)d/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc'); +addThis(); + +status = inSection(105); +pattern = /a[-]?c/; +string = 'ac'; +actualmatch = string.match(pattern); +expectedmatch = Array('ac'); +addThis(); + +status = inSection(106); +pattern = /(abc)\1/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabc', 'abc'); +addThis(); + +status = inSection(107); +pattern = /([a-c]*)\1/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabc', 'abc'); +addThis(); + +status = inSection(108); +pattern = /(a)|\1/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(109); +pattern = /(([a-c])b*?\2)*/; +string = 'ababbbcbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ababb', 'bb', 'b'); +addThis(); + +status = inSection(110); +pattern = /(([a-c])b*?\2){3}/; +string = 'ababbbcbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ababbbcbc', 'cbc', 'c'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(111); +pattern = /((\3|b)\2(a)x)+/; +string = 'aaaxabaxbaaxbbax'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbax', 'bbax', 'b', 'a'); +addThis(); + +status = inSection(112); +pattern = /((\3|b)\2(a)){2,}/; +string = 'bbaababbabaaaaabbaaaabba'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a'); +addThis(); +*/ + +status = inSection(113); +pattern = /abc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(114); +pattern = /abc/i; +string = 'XABCY'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(115); +pattern = /abc/i; +string = 'ABABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(116); +pattern = /ab*c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(117); +pattern = /ab*bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(118); +pattern = /ab*bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(119); +pattern = /ab*?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(120); +pattern = /ab{0,}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(121); +pattern = /ab+?bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(122); +pattern = /ab+bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(123); +pattern = /ab{1,}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(124); +pattern = /ab{1,3}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(125); +pattern = /ab{3,4}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(126); +pattern = /ab??bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(127); +pattern = /ab??bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(128); +pattern = /ab{0,1}?bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(129); +pattern = /ab??c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(130); +pattern = /ab{0,1}?c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(131); +pattern = /^abc$/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(132); +pattern = /^abc/i; +string = 'ABCC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(133); +pattern = /abc$/i; +string = 'AABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(134); +pattern = /^/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(135); +pattern = /$/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(136); +pattern = /a.c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(137); +pattern = /a.c/i; +string = 'AXC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AXC'); +addThis(); + +status = inSection(138); +pattern = /a.*?c/i; +string = 'AXYZC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AXYZC'); +addThis(); + +status = inSection(139); +pattern = /a[bc]d/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABD'); +addThis(); + +status = inSection(140); +pattern = /a[b-d]e/i; +string = 'ACE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ACE'); +addThis(); + +status = inSection(141); +pattern = /a[b-d]/i; +string = 'AAC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AC'); +addThis(); + +status = inSection(142); +pattern = /a[-b]/i; +string = 'A-'; +actualmatch = string.match(pattern); +expectedmatch = Array('A-'); +addThis(); + +status = inSection(143); +pattern = /a[b-]/i; +string = 'A-'; +actualmatch = string.match(pattern); +expectedmatch = Array('A-'); +addThis(); + +status = inSection(144); +pattern = /a]/i; +string = 'A]'; +actualmatch = string.match(pattern); +expectedmatch = Array('A]'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(145); +pattern = /a[]]b/i; +string = 'A]B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A]B'); +addThis(); +*/ + +status = inSection(146); +pattern = /a[^bc]d/i; +string = 'AED'; +actualmatch = string.match(pattern); +expectedmatch = Array('AED'); +addThis(); + +status = inSection(147); +pattern = /a[^-b]c/i; +string = 'ADC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADC'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(148); +pattern = /a[^]b]c/i; +string = 'ADC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADC'); +addThis(); +*/ + +status = inSection(149); +pattern = /ab|cd/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(150); +pattern = /ab|cd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(151); +pattern = /()ef/i; +string = 'DEF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', ''); +addThis(); + +status = inSection(152); +pattern = /a\(b/i; +string = 'A(B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A(B'); +addThis(); + +status = inSection(153); +pattern = /a\(*b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(154); +pattern = /a\(*b/i; +string = 'A((B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A((B'); +addThis(); + +status = inSection(155); +pattern = /a\\b/i; +string = 'A\\B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A\\B'); +addThis(); + +status = inSection(156); +pattern = /((a))/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A'); +addThis(); + +status = inSection(157); +pattern = /(a)b(c)/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'A', 'C'); +addThis(); + +status = inSection(158); +pattern = /a+b+c/i; +string = 'AABBABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(159); +pattern = /a{1,}b{1,}c/i; +string = 'AABBABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(160); +pattern = /a.+?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(161); +pattern = /a.*?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(162); +pattern = /a.{0,5}?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(163); +pattern = /(a+|b)*/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(164); +pattern = /(a+|b){0,}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(165); +pattern = /(a+|b)+/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(166); +pattern = /(a+|b){1,}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(167); +pattern = /(a+|b)?/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(168); +pattern = /(a+|b){0,1}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(169); +pattern = /(a+|b){0,1}?/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + +status = inSection(170); +pattern = /[^ab]*/i; +string = 'CDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('CDE'); +addThis(); + +status = inSection(171); +pattern = /([abc])*d/i; +string = 'ABBBCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBCD', 'C'); +addThis(); + +status = inSection(172); +pattern = /([abc])*bcd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'A'); +addThis(); + +status = inSection(173); +pattern = /a|b|c|d|e/i; +string = 'E'; +actualmatch = string.match(pattern); +expectedmatch = Array('E'); +addThis(); + +status = inSection(174); +pattern = /(a|b|c|d|e)f/i; +string = 'EF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', 'E'); +addThis(); + +status = inSection(175); +pattern = /abcd*efg/i; +string = 'ABCDEFG'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCDEFG'); +addThis(); + +status = inSection(176); +pattern = /ab*/i; +string = 'XABYABBBZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(177); +pattern = /ab*/i; +string = 'XAYABBBZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('A'); +addThis(); + +status = inSection(178); +pattern = /(ab|cd)e/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('CDE', 'CD'); +addThis(); + +status = inSection(179); +pattern = /[abhgefdc]ij/i; +string = 'HIJ'; +actualmatch = string.match(pattern); +expectedmatch = Array('HIJ'); +addThis(); + +status = inSection(180); +pattern = /(abc|)ef/i; +string = 'ABCDEF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', ''); +addThis(); + +status = inSection(181); +pattern = /(a|b)c*d/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('BCD', 'B'); +addThis(); + +status = inSection(182); +pattern = /(ab|ab*)bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'A'); +addThis(); + +status = inSection(183); +pattern = /a([bc]*)c*/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'BC'); +addThis(); + +status = inSection(184); +pattern = /a([bc]*)(c*d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC', 'D'); +addThis(); + +status = inSection(185); +pattern = /a([bc]+)(c*d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC', 'D'); +addThis(); + +status = inSection(186); +pattern = /a([bc]*)(c+d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'B', 'CD'); +addThis(); + +status = inSection(187); +pattern = /a[bcd]*dcdcde/i; +string = 'ADCDCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADCDCDE'); +addThis(); + +status = inSection(188); +pattern = /(ab|a)b*c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'AB'); +addThis(); + +status = inSection(189); +pattern = /((a)(b)c)(d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D'); +addThis(); + +status = inSection(190); +pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i; +string = 'ALPHA'; +actualmatch = string.match(pattern); +expectedmatch = Array('ALPHA'); +addThis(); + +status = inSection(191); +pattern = /^a(bc+|b[eh])g|.h$/i; +string = 'ABH'; +actualmatch = string.match(pattern); +expectedmatch = Array('BH', undefined); +addThis(); + +status = inSection(192); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'EFFGZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); +addThis(); + +status = inSection(193); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'IJ'; +actualmatch = string.match(pattern); +expectedmatch = Array('IJ', 'IJ', 'J'); +addThis(); + +status = inSection(194); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'REFFGZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); +addThis(); + +status = inSection(195); +pattern = /((((((((((a))))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(196); +pattern = /((((((((((a))))))))))\10/i; +string = 'AA'; +actualmatch = string.match(pattern); +expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(197); +pattern = /((((((((((a))))))))))/i; +string = 'A!'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(198); +pattern = /(((((((((a)))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(199); +pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(200); +pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i; +string = 'C'; +actualmatch = string.match(pattern); +expectedmatch = Array('C', 'C'); +addThis(); + +status = inSection(201); +pattern = /(.*)c(.*)/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCDE', 'AB', 'DE'); +addThis(); + +status = inSection(202); +pattern = /abcd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD'); +addThis(); + +status = inSection(203); +pattern = /a(bc)d/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC'); +addThis(); + +status = inSection(204); +pattern = /a[-]?c/i; +string = 'AC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AC'); +addThis(); + +status = inSection(205); +pattern = /(abc)\1/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCABC', 'ABC'); +addThis(); + +status = inSection(206); +pattern = /([a-c]*)\1/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCABC', 'ABC'); +addThis(); + +status = inSection(207); +pattern = /a(?!b)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(208); +pattern = /a(?=d)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(209); +pattern = /a(?=c|d)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(210); +pattern = /a(?:b|c|d)(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(211); +pattern = /a(?:b|c|d)*(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(212); +pattern = /a(?:b|c|d)+?(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(213); +pattern = /a(?:b|c|d)+?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acd', 'd'); +addThis(); + +status = inSection(214); +pattern = /a(?:b|c|d)+(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(215); +pattern = /a(?:b|c|d){2}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdb', 'b'); +addThis(); + +status = inSection(216); +pattern = /a(?:b|c|d){4,5}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(217); +pattern = /a(?:b|c|d){4,5}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcd', 'd'); +addThis(); + +// MODIFIED - ECMA has different rules for paren contents +status = inSection(218); +pattern = /((foo)|(bar))*/; +string = 'foobar'; +actualmatch = string.match(pattern); +//expectedmatch = Array('foobar', 'bar', 'foo', 'bar'); +expectedmatch = Array('foobar', 'bar', undefined, 'bar'); +addThis(); + +status = inSection(219); +pattern = /a(?:b|c|d){6,7}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(220); +pattern = /a(?:b|c|d){6,7}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(221); +pattern = /a(?:b|c|d){5,6}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(222); +pattern = /a(?:b|c|d){5,6}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(223); +pattern = /a(?:b|c|d){5,7}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(224); +pattern = /a(?:b|c|d){5,7}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(225); +pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'c', 'e'); +addThis(); + +status = inSection(226); +pattern = /^(.+)?B/; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'A'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(227); +pattern = /^([^a-z])|(\^)$/; +string = '.'; +actualmatch = string.match(pattern); +//expectedmatch = Array('.', '.', ''); +expectedmatch = Array('.', '.', undefined); +addThis(); + +status = inSection(228); +pattern = /^[<>]&/; +string = '<&OUT'; +actualmatch = string.match(pattern); +expectedmatch = Array('<&'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(229); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa', 'aaaa'); +addThis(); + +status = inSection(230); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa', 'aaaa'); +addThis(); +*/ + +status = inSection(231); +pattern = /((a{4})+)/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa'); +addThis(); + +status = inSection(232); +pattern = /(((aa){2})+)/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); +addThis(); + +status = inSection(233); +pattern = /(((a{2}){2})+)/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); +addThis(); + +status = inSection(234); +pattern = /(?:(f)(o)(o)|(b)(a)(r))*/; +string = 'foobar'; +actualmatch = string.match(pattern); +//expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r'); +expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r'); +addThis(); + +/* ECMA supports (?: (?= and (?! but doesn't support (?< etc. +status = inSection(235); +pattern = /(?<=a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(236); +pattern = /(?<!c)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(237); +pattern = /(?<!c)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(238); +pattern = /(?<!c)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); +*/ + +status = inSection(239); +pattern = /(?:..)*a/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba'); +addThis(); + +status = inSection(240); +pattern = /(?:..)*?a/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* + * MODIFIED - ECMA has different rules for paren contents. Note + * this regexp has two non-capturing parens, and one capturing + * + * The issue: shouldn't the match be ['ab', undefined]? Because the + * '\1' matches the undefined value of the second iteration of the '*' + * (in which the 'b' part of the '|' matches). But Perl wants ['ab','b']. + * + * Answer: waldemar@netscape.com: + * + * The correct answer is ['ab', undefined]. Perl doesn't match + * ECMAScript here, and I'd say that Perl is wrong in this case. + */ +status = inSection(241); +pattern = /^(?:b|a(?=(.)))*\1/; +string = 'abc'; +actualmatch = string.match(pattern); +//expectedmatch = Array('ab', 'b'); +expectedmatch = Array('ab', undefined); +addThis(); + +status = inSection(242); +pattern = /^(){3,5}/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('', ''); +addThis(); + +status = inSection(243); +pattern = /^(a+)*ax/; +string = 'aax'; +actualmatch = string.match(pattern); +expectedmatch = Array('aax', 'a'); +addThis(); + +status = inSection(244); +pattern = /^((a|b)+)*ax/; +string = 'aax'; +actualmatch = string.match(pattern); +expectedmatch = Array('aax', 'a', 'a'); +addThis(); + +status = inSection(245); +pattern = /^((a|bc)+)*ax/; +string = 'aax'; +actualmatch = string.match(pattern); +expectedmatch = Array('aax', 'a', 'a'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(246); +pattern = /(a|x)*ab/; +string = 'cab'; +actualmatch = string.match(pattern); +//expectedmatch = Array('ab', ''); +expectedmatch = Array('ab', undefined); +addThis(); + +status = inSection(247); +pattern = /(a)*ab/; +string = 'cab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', undefined); +addThis(); + +/* ECMA doesn't support (?imsx or (?-imsx +status = inSection(248); +pattern = /(?:(?i)a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(249); +pattern = /((?i)a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(250); +pattern = /(?:(?i)a)b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab'); +addThis(); + +status = inSection(251); +pattern = /((?i)a)b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab', 'A'); +addThis(); + +status = inSection(252); +pattern = /(?i:a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(253); +pattern = /((?i:a))b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(254); +pattern = /(?i:a)b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab'); +addThis(); + +status = inSection(255); +pattern = /((?i:a))b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab', 'A'); +addThis(); + +status = inSection(256); +pattern = /(?:(?-i)a)b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(257); +pattern = /((?-i)a)b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(258); +pattern = /(?:(?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(259); +pattern = /((?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(260); +pattern = /(?:(?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(261); +pattern = /((?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(262); +pattern = /(?-i:a)b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(263); +pattern = /((?-i:a))b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(264); +pattern = /(?-i:a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(265); +pattern = /((?-i:a))b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(266); +pattern = /(?-i:a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(267); +pattern = /((?-i:a))b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(268); +pattern = /((?s-i:a.))b/i; +string = 'a\nB'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\nB', 'a\n'); +addThis(); +*/ + +status = inSection(269); +pattern = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/; +string = 'cabbbb'; +actualmatch = string.match(pattern); +expectedmatch = Array('cabbbb'); +addThis(); + +status = inSection(270); +pattern = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/; +string = 'caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'; +actualmatch = string.match(pattern); +expectedmatch = Array('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +addThis(); + +status = inSection(271); +pattern = /(ab)\d\1/i; +string = 'Ab4ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab4ab', 'Ab'); +addThis(); + +status = inSection(272); +pattern = /(ab)\d\1/i; +string = 'ab4Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab4Ab', 'ab'); +addThis(); + +status = inSection(273); +pattern = /foo\w*\d{4}baz/; +string = 'foobar1234baz'; +actualmatch = string.match(pattern); +expectedmatch = Array('foobar1234baz'); +addThis(); + +status = inSection(274); +pattern = /x(~~)*(?:(?:F)?)?/; +string = 'x~~'; +actualmatch = string.match(pattern); +expectedmatch = Array('x~~', '~~'); +addThis(); + +/* Perl supports (?# but JS doesn't +status = inSection(275); +pattern = /^a(?#xxx){3}c/; +string = 'aaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaac'); +addThis(); +*/ + +/* ECMA doesn't support (?< etc +status = inSection(276); +pattern = /(?<![cd])[ab]/; +string = 'dbaacb'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(277); +pattern = /(?<!(c|d))[ab]/; +string = 'dbaacb'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(278); +pattern = /(?<!cd)[ab]/; +string = 'cdaccb'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(279); +pattern = /((?s)^a(.))((?m)^b$)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\nb', 'a\n', '\n', 'b'); +addThis(); + +status = inSection(280); +pattern = /((?m)^b$)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); + +status = inSection(281); +pattern = /(?m)^b/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(282); +pattern = /(?m)^(b)/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); + +status = inSection(283); +pattern = /((?m)^b)/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); + +status = inSection(284); +pattern = /\n((?m)^b)/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\nb', 'b'); +addThis(); + +status = inSection(285); +pattern = /((?s).)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\nc', '\n'); +addThis(); + +status = inSection(286); +pattern = /((?s).)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\nc', '\n'); +addThis(); + +status = inSection(287); +pattern = /((?s)b.)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b\nc', 'b\n'); +addThis(); + +status = inSection(288); +pattern = /((?s)b.)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b\nc', 'b\n'); +addThis(); + +status = inSection(289); +pattern = /((?m)^b)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); +*/ + +/* ECMA doesn't support (?(condition) +status = inSection(290); +pattern = /(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(291); +pattern = /(x)?(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(292); +pattern = /()?(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(293); +pattern = /()?(?(1)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(294); +pattern = /^(\()?blah(?(1)(\)))$/; +string = '(blah)'; +actualmatch = string.match(pattern); +expectedmatch = Array('(blah)', '(', ')'); +addThis(); + +status = inSection(295); +pattern = /^(\()?blah(?(1)(\)))$/; +string = 'blah'; +actualmatch = string.match(pattern); +expectedmatch = Array('blah'); +addThis(); + +status = inSection(296); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = '(blah)'; +actualmatch = string.match(pattern); +expectedmatch = Array('(blah)', '(', ')'); +addThis(); + +status = inSection(297); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = 'blah'; +actualmatch = string.match(pattern); +expectedmatch = Array('blah'); +addThis(); + +status = inSection(298); +pattern = /(?(?!a)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(299); +pattern = /(?(?=a)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(300); +pattern = /(?=(a+?))(\1ab)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aab', 'a', 'aab'); +addThis(); + +status = inSection(301); +pattern = /(\w+:)+/; +string = 'one:'; +actualmatch = string.match(pattern); +expectedmatch = Array('one:', 'one:'); +addThis(); + +/* ECMA doesn't support (?< etc +status = inSection(302); +pattern = /$(?<=^(a))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('', 'a'); +addThis(); +*/ + +status = inSection(303); +pattern = /(?=(a+?))(\1ab)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aab', 'a', 'aab'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(304); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd'; +actualmatch = string.match(pattern); +//expectedmatch = Array('abcd', '', 'abcd'); +expectedmatch = Array('abcd', undefined, 'abcd'); +addThis(); + +status = inSection(305); +pattern = /([\w:]+::)?(\w+)$/; +string = 'xy:z:::abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd'); +addThis(); + +status = inSection(306); +pattern = /^[^bcd]*(c+)/; +string = 'aexycd'; +actualmatch = string.match(pattern); +expectedmatch = Array('aexyc', 'c'); +addThis(); + +status = inSection(307); +pattern = /(a*)b+/; +string = 'caab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aab', 'aa'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(308); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd'; +actualmatch = string.match(pattern); +//expectedmatch = Array('abcd', '', 'abcd'); +expectedmatch = Array('abcd', undefined, 'abcd'); +addThis(); + +status = inSection(309); +pattern = /([\w:]+::)?(\w+)$/; +string = 'xy:z:::abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd'); +addThis(); + +status = inSection(310); +pattern = /^[^bcd]*(c+)/; +string = 'aexycd'; +actualmatch = string.match(pattern); +expectedmatch = Array('aexyc', 'c'); +addThis(); + +/* ECMA doesn't support (?> +status = inSection(311); +pattern = /(?>a+)b/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab'); +addThis(); +*/ + +status = inSection(312); +pattern = /([[:]+)/; +string = 'a:[b]:'; +actualmatch = string.match(pattern); +expectedmatch = Array(':[', ':['); +addThis(); + +status = inSection(313); +pattern = /([[=]+)/; +string = 'a=[b]='; +actualmatch = string.match(pattern); +expectedmatch = Array('=[', '=['); +addThis(); + +status = inSection(314); +pattern = /([[.]+)/; +string = 'a.[b].'; +actualmatch = string.match(pattern); +expectedmatch = Array('.[', '.['); +addThis(); + +/* ECMA doesn't have rules for [: +status = inSection(315); +pattern = /[a[:]b[:c]/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); +*/ + +/* ECMA doesn't support (?> +status = inSection(316); +pattern = /((?>a+)b)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab', 'aaab'); +addThis(); + +status = inSection(317); +pattern = /(?>(a+))b/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab', 'aaa'); +addThis(); + +status = inSection(318); +pattern = /((?>[^()]+)|\([^()]*\))+/; +string = '((abc(ade)ufh()()x'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc(ade)ufh()()x', 'x'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(319); +pattern = /\Z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(320); +pattern = /\z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(321); +pattern = /$/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(322); +pattern = /\Z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(323); +pattern = /\z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(324); +pattern = /$/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(325); +pattern = /\Z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(326); +pattern = /\z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(327); +pattern = /$/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(328); +pattern = /\Z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(329); +pattern = /\z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(330); +pattern = /$/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(331); +pattern = /\Z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(332); +pattern = /\z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(333); +pattern = /$/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(334); +pattern = /\Z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(335); +pattern = /\z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(336); +pattern = /$/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(337); +pattern = /a\Z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(338); +pattern = /a$/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(339); +pattern = /a\Z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(340); +pattern = /a\z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(341); +pattern = /a$/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(342); +pattern = /a$/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(343); +pattern = /a\Z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(344); +pattern = /a$/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(345); +pattern = /a\Z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(346); +pattern = /a\z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(347); +pattern = /a$/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(348); +pattern = /aa\Z/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(349); +pattern = /aa$/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(350); +pattern = /aa\Z/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(351); +pattern = /aa\z/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(352); +pattern = /aa$/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(353); +pattern = /aa$/m; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(354); +pattern = /aa\Z/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(355); +pattern = /aa$/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(356); +pattern = /aa\Z/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(357); +pattern = /aa\z/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(358); +pattern = /aa$/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(359); +pattern = /ab\Z/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(360); +pattern = /ab$/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(361); +pattern = /ab\Z/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(362); +pattern = /ab\z/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(363); +pattern = /ab$/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(364); +pattern = /ab$/m; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(365); +pattern = /ab\Z/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(366); +pattern = /ab$/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(367); +pattern = /ab\Z/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(368); +pattern = /ab\z/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(369); +pattern = /ab$/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(370); +pattern = /abb\Z/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(371); +pattern = /abb$/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(372); +pattern = /abb\Z/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(373); +pattern = /abb\z/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(374); +pattern = /abb$/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(375); +pattern = /abb$/m; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(376); +pattern = /abb\Z/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(377); +pattern = /abb$/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(378); +pattern = /abb\Z/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(379); +pattern = /abb\z/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(380); +pattern = /abb$/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(381); +pattern = /(^|x)(c)/; +string = 'ca'; +actualmatch = string.match(pattern); +expectedmatch = Array('c', '', 'c'); +addThis(); + +status = inSection(382); +pattern = /foo.bart/; +string = 'foo.bart'; +actualmatch = string.match(pattern); +expectedmatch = Array('foo.bart'); +addThis(); + +status = inSection(383); +pattern = /^d[x][x][x]/m; +string = 'abcd\ndxxx'; +actualmatch = string.match(pattern); +expectedmatch = Array('dxxx'); +addThis(); + +status = inSection(384); +pattern = /tt+$/; +string = 'xxxtt'; +actualmatch = string.match(pattern); +expectedmatch = Array('tt'); +addThis(); + +/* ECMA spec says that each atom in a range must be a single character +status = inSection(385); +pattern = /([a-\d]+)/; +string = 'za-9z'; +actualmatch = string.match(pattern); +expectedmatch = Array('9', '9'); +addThis(); + +status = inSection(386); +pattern = /([\d-z]+)/; +string = 'a0-za'; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); +*/ + +/* ECMA doesn't support [: +status = inSection(387); +pattern = /([a-[:digit:]]+)/; +string = 'za-9z'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-9', 'a-9'); +addThis(); + +status = inSection(388); +pattern = /([[:digit:]-z]+)/; +string = '=0-z='; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); + +status = inSection(389); +pattern = /([[:digit:]-[:alpha:]]+)/; +string = '=0-z='; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); +*/ + +status = inSection(390); +pattern = /(\d+\.\d+)/; +string = '3.1415926'; +actualmatch = string.match(pattern); +expectedmatch = Array('3.1415926', '3.1415926'); +addThis(); + +status = inSection(391); +pattern = /\.c(pp|xx|c)?$/i; +string = 'IO.c'; +actualmatch = string.match(pattern); +expectedmatch = Array('.c', undefined); +addThis(); + +status = inSection(392); +pattern = /(\.c(pp|xx|c)?$)/i; +string = 'IO.c'; +actualmatch = string.match(pattern); +expectedmatch = Array('.c', '.c', undefined); +addThis(); + +status = inSection(393); +pattern = /(^|a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(394); +pattern = /^([ab]*?)(b)?(c)$/; +string = 'abac'; +actualmatch = string.match(pattern); +expectedmatch = Array('abac', 'aba', undefined, 'c'); +addThis(); + +status = inSection(395); +pattern = /^(?:.,){2}c/i; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c'); +addThis(); + +status = inSection(396); +pattern = /^(.,){2}c/i; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c', 'b,'); +addThis(); + +status = inSection(397); +pattern = /^(?:[^,]*,){2}c/; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c'); +addThis(); + +status = inSection(398); +pattern = /^([^,]*,){2}c/; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c', 'b,'); +addThis(); + +status = inSection(399); +pattern = /^([^,]*,){3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(400); +pattern = /^([^,]*,){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(401); +pattern = /^([^,]*,){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(402); +pattern = /^([^,]{1,3},){3}d/i; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(403); +pattern = /^([^,]{1,3},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(404); +pattern = /^([^,]{1,3},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(405); +pattern = /^([^,]{1,},){3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(406); +pattern = /^([^,]{1,},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(407); +pattern = /^([^,]{1,},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(408); +pattern = /^([^,]{0,3},){3}d/i; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(409); +pattern = /^([^,]{0,3},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(410); +pattern = /^([^,]{0,3},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +/* ECMA doesn't support \A +status = inSection(411); +pattern = /(?!\A)x/m; +string = 'a\nxb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\n'); +addThis(); +*/ + +status = inSection(412); +pattern = /^(a(b)?)+$/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba', 'a', undefined); +addThis(); + +status = inSection(413); +pattern = /^(aa(bb)?)+$/; +string = 'aabbaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aabbaa', 'aa', undefined); +addThis(); + +status = inSection(414); +pattern = /^.{9}abc.*\n/m; +string = '123\nabcabcabcabc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabcabcabc\n'); +addThis(); + +status = inSection(415); +pattern = /^(a)?a$/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +status = inSection(416); +pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/; +string = 'aaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(417); +pattern = /^(a\1?){4}$/; +string = 'aaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaa', 'aaa'); +addThis(); +*/ + +status = inSection(418); +pattern = /^(0+)?(?:x(1))?/; +string = 'x1'; +actualmatch = string.match(pattern); +expectedmatch = Array('x1', undefined, '1'); +addThis(); + +status = inSection(419); +pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/; +string = '012cxx0190'; +actualmatch = string.match(pattern); +expectedmatch = Array('012cxx0190', '012c', undefined, '0190'); +addThis(); + +status = inSection(420); +pattern = /^(b+?|a){1,2}c/; +string = 'bbbac'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbac', 'a'); +addThis(); + +status = inSection(421); +pattern = /^(b+?|a){1,2}c/; +string = 'bbbbac'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbbac', 'a'); +addThis(); + +status = inSection(422); +pattern = /((?:aaaa|bbbb)cccc)?/; +string = 'aaaacccc'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaacccc', 'aaaacccc'); +addThis(); + +status = inSection(423); +pattern = /((?:aaaa|bbbb)cccc)?/; +string = 'bbbbcccc'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbbcccc', 'bbbbcccc'); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + if(omitCurrentSection()) + return; + + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function omitCurrentSection() +{ + try + { + // current section number is in global status variable + var n = status.match(/(\d+)/)[1]; + return ((n < cnLBOUND) || (n > cnUBOUND)); + } + catch(e) + { + return false; + } +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js new file mode 100644 index 0000000..44cfbb5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js @@ -0,0 +1,1837 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 2002-07-07 +* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. +* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. +* +* This test was created by running various patterns and strings through the +* Perl 5 RegExp engine. We saved the results below to test the JS engine. +* +* Each of the examples below is a negative test; that is, each produces a +* null match in Perl. Thus we set |expectedmatch| = |null| in each section. +* +* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented +* out such sections altogether, or modified them to fit what we expect from JS. +* +* EXAMPLES: +* +* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. +* +* - ECMA doesn't support (?(condition) +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 85721; +var summary = 'Testing regular expression edge cases'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +var cnLBOUND = 0; +var cnUBOUND = 1000; + + +status = inSection(1); +pattern = /abc/; +string = 'xbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(2); +pattern = /abc/; +string = 'axc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(3); +pattern = /abc/; +string = 'abx'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(4); +pattern = /ab+bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(5); +pattern = /ab+bc/; +string = 'abq'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(6); +pattern = /ab{1,}bc/; +string = 'abq'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(7); +pattern = /ab{4,5}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(8); +pattern = /ab?bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(9); +pattern = /^abc$/; +string = 'abcc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(10); +pattern = /^abc$/; +string = 'aabc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(11); +pattern = /abc$/; +string = 'aabcd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(12); +pattern = /a.*c/; +string = 'axyzd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(13); +pattern = /a[bc]d/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(14); +pattern = /a[b-d]e/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(15); +pattern = /a[^bc]d/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(16); +pattern = /a[^-b]c/; +string = 'a-c'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(17); +pattern = /a[^]b]c/; +string = 'a]c'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(18); +pattern = /\by\b/; +string = 'xy'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(19); +pattern = /\by\b/; +string = 'yz'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(20); +pattern = /\by\b/; +string = 'xyz'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(21); +pattern = /\Ba\B/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(22); +pattern = /\Ba\B/; +string = '-a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(23); +pattern = /\Ba\B/; +string = '-a-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(24); +pattern = /\w/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(25); +pattern = /\W/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(26); +pattern = /a\sb/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(27); +pattern = /\d/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(28); +pattern = /\D/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(29); +pattern = /[\w]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(30); +pattern = /[\W]/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(31); +pattern = /a[\s]b/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(32); +pattern = /[\d]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(33); +pattern = /[\D]/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(34); +pattern = /$b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(35); +pattern = /^(ab|cd)e/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(36); +pattern = /a[bcd]+dcdcde/; +string = 'adcdcde'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(37); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'effg'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(38); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'bcdd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(39); +pattern = /[k]/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +// MODIFIED - ECMA has different rules for paren contents. +status = inSection(40); +pattern = /(a)|\1/; +string = 'x'; +actualmatch = string.match(pattern); +//expectedmatch = null; +expectedmatch = Array("", undefined); +addThis(); + +// MODIFIED - ECMA has different rules for paren contents. +status = inSection(41); +pattern = /((\3|b)\2(a)x)+/; +string = 'aaxabxbaxbbx'; +actualmatch = string.match(pattern); +//expectedmatch = null; +expectedmatch = Array("ax", "ax", "", "a"); +addThis(); + +status = inSection(42); +pattern = /abc/i; +string = 'XBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(43); +pattern = /abc/i; +string = 'AXC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(44); +pattern = /abc/i; +string = 'ABX'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(45); +pattern = /ab+bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(46); +pattern = /ab+bc/i; +string = 'ABQ'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(47); +pattern = /ab{1,}bc/i; +string = 'ABQ'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(48); +pattern = /ab{4,5}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(49); +pattern = /ab??bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(50); +pattern = /^abc$/i; +string = 'ABCC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(51); +pattern = /^abc$/i; +string = 'AABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(52); +pattern = /a.*c/i; +string = 'AXYZD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(53); +pattern = /a[bc]d/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(54); +pattern = /a[b-d]e/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(55); +pattern = /a[^bc]d/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(56); +pattern = /a[^-b]c/i; +string = 'A-C'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(57); +pattern = /a[^]b]c/i; +string = 'A]C'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(58); +pattern = /$b/i; +string = 'B'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(59); +pattern = /^(ab|cd)e/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(60); +pattern = /a[bcd]+dcdcde/i; +string = 'ADCDCDE'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(61); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'EFFG'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(62); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'BCDD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(63); +pattern = /[k]/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(64); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(65); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(66); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(67); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?< +status = inSection(68); +pattern = /(?<=a)b/; +string = 'cb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(69); +pattern = /(?<=a)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(70); +pattern = /(?<!c)b/; +string = 'cb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?(condition) +status = inSection(71); +pattern = /(?:(?i)a)b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(72); +pattern = /((?i)a)b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(73); +pattern = /(?i:a)b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(74); +pattern = /((?i:a))b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(75); +pattern = /(?:(?-i)a)b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(76); +pattern = /((?-i)a)b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(77); +pattern = /(?:(?-i)a)b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(78); +pattern = /((?-i)a)b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(79); +pattern = /(?-i:a)b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(80); +pattern = /((?-i:a))b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(81); +pattern = /(?-i:a)b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(82); +pattern = /((?-i:a))b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(83); +pattern = /((?-i:a.))b/i; +string = 'a\nB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(84); +pattern = /((?s-i:a.))b/i; +string = 'B\nB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?< +status = inSection(85); +pattern = /(?<![cd])b/; +string = 'dbcb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(86); +pattern = /(?<!(c|d))b/; +string = 'dbcb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +status = inSection(87); +pattern = /^(?:a?b?)*$/; +string = 'a--'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(88); +pattern = /^b/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(89); +pattern = /()^b/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(90); +pattern = /(?(1)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(91); +pattern = /(x)?(?(1)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(92); +pattern = /()(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(93); +pattern = /^(\()?blah(?(1)(\)))$/; +string = 'blah)'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(94); +pattern = /^(\()?blah(?(1)(\)))$/; +string = '(blah'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(95); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = 'blah)'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(96); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = '(blah'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(97); +pattern = /(?(?{0})a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(98); +pattern = /(?(?{1})b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(99); +pattern = /(?(?!a)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(100); +pattern = /(?(?=a)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +status = inSection(101); +pattern = /^(?=(a+?))\1ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(102); +pattern = /^(?=(a+?))\1ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(103); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd:'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(104); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd:'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(105); +pattern = /(>a+)ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(106); +pattern = /a\Z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(107); +pattern = /a\z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(108); +pattern = /a$/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(109); +pattern = /a\z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(110); +pattern = /a\z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(111); +pattern = /a\z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(112); +pattern = /aa\Z/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(113); +pattern = /aa\z/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(114); +pattern = /aa$/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(115); +pattern = /aa\z/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(116); +pattern = /aa\z/m; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(117); +pattern = /aa\z/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(118); +pattern = /aa\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(119); +pattern = /aa\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(120); +pattern = /aa$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(121); +pattern = /aa\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(122); +pattern = /aa\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(123); +pattern = /aa$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(124); +pattern = /aa\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(125); +pattern = /aa\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(126); +pattern = /aa$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(127); +pattern = /aa\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(128); +pattern = /aa\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(129); +pattern = /aa$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(130); +pattern = /aa\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(131); +pattern = /aa\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(132); +pattern = /aa$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(133); +pattern = /aa\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(134); +pattern = /aa\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(135); +pattern = /aa$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(136); +pattern = /aa\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(137); +pattern = /aa\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(138); +pattern = /aa$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(139); +pattern = /aa\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(140); +pattern = /aa\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(141); +pattern = /aa$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(142); +pattern = /aa\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(143); +pattern = /aa\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(144); +pattern = /aa$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(145); +pattern = /aa\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(146); +pattern = /aa\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(147); +pattern = /aa$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(148); +pattern = /aa\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(149); +pattern = /aa\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(150); +pattern = /aa$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(151); +pattern = /aa\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(152); +pattern = /aa\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(153); +pattern = /aa$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(154); +pattern = /ab\Z/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(155); +pattern = /ab\z/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(156); +pattern = /ab$/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(157); +pattern = /ab\z/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(158); +pattern = /ab\z/m; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(159); +pattern = /ab\z/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(160); +pattern = /ab\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(161); +pattern = /ab\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(162); +pattern = /ab$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(163); +pattern = /ab\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(164); +pattern = /ab\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(165); +pattern = /ab$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(166); +pattern = /ab\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(167); +pattern = /ab\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(168); +pattern = /ab$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(169); +pattern = /ab\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(170); +pattern = /ab\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(171); +pattern = /ab$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(172); +pattern = /ab\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(173); +pattern = /ab\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(174); +pattern = /ab$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(175); +pattern = /ab\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(176); +pattern = /ab\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(177); +pattern = /ab$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(178); +pattern = /ab\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(179); +pattern = /ab\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(180); +pattern = /ab$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(181); +pattern = /ab\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(182); +pattern = /ab\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(183); +pattern = /ab$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(184); +pattern = /ab\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(185); +pattern = /ab\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(186); +pattern = /ab$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(187); +pattern = /ab\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(188); +pattern = /ab\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(189); +pattern = /ab$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(190); +pattern = /ab\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(191); +pattern = /ab\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(192); +pattern = /ab$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(193); +pattern = /ab\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(194); +pattern = /ab\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(195); +pattern = /ab$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(196); +pattern = /abb\Z/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(197); +pattern = /abb\z/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(198); +pattern = /abb$/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(199); +pattern = /abb\z/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(200); +pattern = /abb\z/m; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(201); +pattern = /abb\z/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(202); +pattern = /abb\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(203); +pattern = /abb\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(204); +pattern = /abb$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(205); +pattern = /abb\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(206); +pattern = /abb\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(207); +pattern = /abb$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(208); +pattern = /abb\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(209); +pattern = /abb\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(210); +pattern = /abb$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(211); +pattern = /abb\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(212); +pattern = /abb\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(213); +pattern = /abb$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(214); +pattern = /abb\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(215); +pattern = /abb\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(216); +pattern = /abb$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(217); +pattern = /abb\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(218); +pattern = /abb\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(219); +pattern = /abb$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(220); +pattern = /abb\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(221); +pattern = /abb\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(222); +pattern = /abb$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(223); +pattern = /abb\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(224); +pattern = /abb\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(225); +pattern = /abb$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(226); +pattern = /abb\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(227); +pattern = /abb\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(228); +pattern = /abb$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(229); +pattern = /abb\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(230); +pattern = /abb\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(231); +pattern = /abb$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(232); +pattern = /abb\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(233); +pattern = /abb\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(234); +pattern = /abb$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(235); +pattern = /abb\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(236); +pattern = /abb\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(237); +pattern = /abb$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(238); +pattern = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/; +string = 'x'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(239); +pattern = /\GX.*X/; +string = 'aaaXbX'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(240); +pattern = /\.c(pp|xx|c)?$/i; +string = 'Changes'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(241); +pattern = /^([a-z]:)/; +string = 'C:/'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(242); +pattern = /(\w)?(abc)\1b/; +string = 'abcab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(243); +pattern = /^(a)?(?(1)a|b)+$/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + if(omitCurrentSection()) + return; + + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function omitCurrentSection() +{ + try + { + // current section number is in global status variable + var n = status.match(/(\d+)/)[1]; + return ((n < cnLBOUND) || (n > cnUBOUND)); + } + catch(e) + { + return false; + } +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js new file mode 100644 index 0000000..8380499 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js @@ -0,0 +1,286 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 17 September 2001 +* +* SUMMARY: Regression test for Bugzilla bug 100199 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=100199 +* +* The empty character class [] is a valid RegExp construct: the condition +* that a given character belong to a set containing no characters. As such, +* it can never be met and is always FALSE. Similarly, [^] is a condition +* that matches any given character and is always TRUE. +* +* Neither one of these conditions should cause syntax errors in a RegExp. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 100199; +var summary = '[], [^] are valid RegExp conditions. Should not cause errors -'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /[]/; + string = 'abc'; + status = inSection(1); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ''; + status = inSection(2); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(3); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '/'; + status = inSection(4); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(5); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']'; + status = inSection(6); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[]'; + status = inSection(7); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[ ]'; + status = inSection(8); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']['; + status = inSection(9); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /a[]/; + string = 'abc'; + status = inSection(10); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ''; + status = inSection(11); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = 'a['; + status = inSection(12); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = 'a[]'; + status = inSection(13); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(14); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']'; + status = inSection(15); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[]'; + status = inSection(16); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[ ]'; + status = inSection(17); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']['; + status = inSection(18); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /[^]/; + string = 'abc'; + status = inSection(19); + actualmatch = string.match(pattern); + expectedmatch = Array('a'); + addThis(); + + string = ''; + status = inSection(20); + actualmatch = string.match(pattern); + expectedmatch = null; //there are no characters to test against the condition + addThis(); + + string = '\/'; + status = inSection(21); + actualmatch = string.match(pattern); + expectedmatch = Array('/'); + addThis(); + + string = '\['; + status = inSection(22); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = '['; + status = inSection(23); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = ']'; + status = inSection(24); + actualmatch = string.match(pattern); + expectedmatch = Array(']'); + addThis(); + + string = '[]'; + status = inSection(25); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = '[ ]'; + status = inSection(26); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = ']['; + status = inSection(27); + actualmatch = string.match(pattern); + expectedmatch = Array(']'); + addThis(); + + +pattern = /a[^]/; + string = 'abc'; + status = inSection(28); + actualmatch = string.match(pattern); + expectedmatch = Array('ab'); + addThis(); + + string = ''; + status = inSection(29); + actualmatch = string.match(pattern); + expectedmatch = null; //there are no characters to test against the condition + addThis(); + + string = 'a['; + status = inSection(30); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a]'; + status = inSection(31); + actualmatch = string.match(pattern); + expectedmatch = Array('a]'); + addThis(); + + string = 'a[]'; + status = inSection(32); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a[ ]'; + status = inSection(33); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a]['; + status = inSection(34); + actualmatch = string.match(pattern); + expectedmatch = Array('a]'); + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js new file mode 100644 index 0000000..8cfc662 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js @@ -0,0 +1,155 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): bedney@technicalpursuit.com, pschwartau@netscape.com +* Date: 04 October 2001 +* +* SUMMARY: Arose from Bugzilla bug 103087: +* "The RegExp MarkupSPE in demo crashes Mozilla" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=103087 +* The SpiderMonkey shell crashed on some of these regexps. +* +* The reported crash was on i=24 below ('MarkupSPE' regexp) +* I crashed on that, and also on i=43 ('XML_SPE' regexp) +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 103087; +var summary = "Testing that we don't crash on any of these regexps -"; +var re = ''; +var lm = ''; +var lc = ''; +var rc = ''; + + +// the regexps are built in pieces - +var NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]"; +var NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]"; +var Name = "(" + NameStrt + ")(" + NameChar + ")*"; +var TextSE = "[^<]+"; +var UntilHyphen = "[^-]*-"; +var Until2Hyphens = UntilHyphen + "([^-]" + UntilHyphen + ")*-"; +var CommentCE = Until2Hyphens + ">?"; +var UntilRSBs = "[^]]*]([^]]+])*]+"; +var CDATA_CE = UntilRSBs + "([^]>]" + UntilRSBs + ")*>"; +var S = "[ \\n\\t\\r]+"; +var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'"; +var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*"; +var MarkupDeclCE = "([^]\"'><]+|" + QuoteSE + ")*>"; +var S1 = "[\\n\\r\\t ]"; +var UntilQMs = "[^?]*\\?+"; +var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>"; +var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S; +var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*](" + S + ")?)?>?"; +var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?"; +var PI_CE = Name + "(" + PI_Tail + ")?"; +var EndTagCE = Name + "(" + S + ")?>?"; +var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'"; +var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?"; +var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)"; +var XML_SPE = TextSE + "|" + MarkupSPE; +var CommentRE = "<!--" + Until2Hyphens + ">"; +var CommentSPE = "<!--(" + CommentCE + ")?"; +var PI_RE = "<\\?" + Name + "(" + PI_Tail + ")"; +var Erroneous_PI_SE = "<\\?[^?]*(\\?[^>]+)*\\?>"; +var PI_SPE = "<\\?(" + PI_CE + ")?"; +var CDATA_RE = "<!\\[CDATA\\[" + CDATA_CE; +var CDATA_SPE = "<!\\[CDATA\\[(" + CDATA_CE + ")?"; +var ElemTagSE = "<(" + NameStrt + ")([^<>\"']+|" + AttValSE + ")*>"; +var ElemTagRE = "<" + Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>"; +var ElemTagSPE = "<" + ElemTagCE; +var EndTagRE = "</" + Name + "(" + S + ")?>"; +var EndTagSPE = "</(" + EndTagCE + ")?"; +var DocTypeSPE = "<!DOCTYPE(" + DocTypeCE + ")?"; +var PERef_APE = "%(" + Name + ";?)?"; +var HexPart = "x([0-9a-fA-F]+;?)?"; +var NumPart = "#([0-9]+;?|" + HexPart + ")?"; +var CGRef_APE = "&(" + Name + ";?|" + NumPart + ")?"; +var Text_PE = CGRef_APE + "|[^&]+"; +var EntityValue_PE = CGRef_APE + "|" + PERef_APE + "|[^%&]+"; + + +var rePatterns = new Array(AttValSE, CDATA_CE, CDATA_RE, CDATA_SPE, CGRef_APE, CommentCE, CommentRE, CommentSPE, DT_IdentSE, DT_ItemSE, DeclCE, DocTypeCE, DocTypeSPE, ElemTagCE, ElemTagRE, ElemTagSE, ElemTagSPE, EndTagCE, EndTagRE, EndTagSPE, EntityValue_PE, Erroneous_PI_SE, HexPart, MarkupDeclCE, MarkupSPE, Name, NameChar, NameStrt, NumPart, PERef_APE, PI_CE, PI_RE, PI_SPE, PI_Tail, QuoteSE, S, S1, TextSE, Text_PE, Until2Hyphens, UntilHyphen, UntilQMs, UntilRSBs, XML_SPE); + + +// here's a big string to test the regexps on - +var str = ''; +str += '<html xmlns="http://www.w3.org/1999/xhtml"' + '\n'; +str += ' xmlns:xlink="http://www.w3.org/XML/XLink/0.9">' + '\n'; +str += ' <head><title>Three Namespaces</title></head>' + '\n'; +str += ' <body>' + '\n'; +str += ' <h1 align="center">An Ellipse and a Rectangle</h1>' + '\n'; +str += ' <svg xmlns="http://www.w3.org/Graphics/SVG/SVG-19991203.dtd" ' + '\n'; +str += ' width="12cm" height="10cm">' + '\n'; +str += ' <ellipse rx="110" ry="130" />' + '\n'; +str += ' <rect x="4cm" y="1cm" width="3cm" height="6cm" />' + '\n'; +str += ' </svg>' + '\n'; +str += ' <p xlink:type="simple" xlink:href="ellipses.html">' + '\n'; +str += ' More about ellipses' + '\n'; +str += ' </p>' + '\n'; +str += ' <p xlink:type="simple" xlink:href="rectangles.html">' + '\n'; +str += ' More about rectangles' + '\n'; +str += ' </p>' + '\n'; +str += ' <hr/>' + '\n'; +str += ' <p>Last Modified February 13, 2000</p> ' + '\n'; +str += ' </body>' + '\n'; +str += '</html>'; + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<rePatterns.length; i++) + { + status = inSection(i); + re = new RegExp(rePatterns[i]); + + // Test that we don't crash on any of these - + re.exec(str); + getResults(); + + // Just for the heck of it, test the current leftContext + re.exec(lc); + getResults(); + + // Test the current rightContext + re.exec(rc); + getResults(); + } + + exitFunc ('test'); +} + + +function getResults() +{ + lm = RegExp.lastMatch; + lc = RegExp.leftContext; + rc = RegExp.rightContext; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js new file mode 100644 index 0000000..9f0cdb5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js @@ -0,0 +1,136 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): mozilla@pdavis.cx, pschwartau@netscape.com +* Date: 22 October 2001 +* +* SUMMARY: Regression test for Bugzilla bug 105972: +* "/^.*?$/ will not match anything" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=105972 +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 105972; +var summary = 'Regression test for Bugzilla bug 105972'; +var cnEmptyString = ''; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * The bug: this match was coming up null in Rhino and SpiderMonkey. + * It should match the whole string. The reason: + * + * The * operator is greedy, but *? is non-greedy: it will stop + * at the simplest match it can find. But the pattern here asks us + * to match till the end of the string. So the simplest match must + * go all the way out to the end, and *? has no choice but to do it. + */ +status = inSection(1); +pattern = /^.*?$/; +string = 'Hello World'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Leave off the '$' condition - here we expect the empty string. + * Unlike the above pattern, we don't have to match till the end of + * the string, so the non-greedy operator *? doesn't try to... + */ +status = inSection(2); +pattern = /^.*?/; +string = 'Hello World'; +actualmatch = string.match(pattern); +expectedmatch = Array(cnEmptyString); +addThis(); + + +/* + * Try '$' combined with an 'or' operator. + * + * The operator *? will consume the string from left to right, + * attempting to satisfy the condition (:|$). When it hits ':', + * the match will stop because the operator *? is non-greedy. + * + * The submatch $1 = (:|$) will contain the ':' + */ +status = inSection(3); +pattern = /^.*?(:|$)/; +string = 'Hello: World'; +actualmatch = string.match(pattern); +expectedmatch = Array('Hello:', ':'); +addThis(); + + +/* + * Again, '$' combined with an 'or' operator. + * + * The operator * will consume the string from left to right, + * attempting to satisfy the condition (:|$). When it hits ':', + * the match will not stop since * is greedy. The match will + * continue until it hits $, the end-of-string boundary. + * + * The submatch $1 = (:|$) will contain the empty string + * conceived to exist at the end-of-string boundary. + */ +status = inSection(4); +pattern = /^.*(:|$)/; +string = 'Hello: World'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, cnEmptyString); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js new file mode 100644 index 0000000..4bb2866 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js @@ -0,0 +1,86 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): 1010mozilla@Ostermiller.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 Jan 2002 +* SUMMARY: Shouldn't crash on regexps with many nested parentheses +* See http://bugzilla.mozilla.org/show_bug.cgi?id=119909 +* +*/ +//----------------------------------------------------------------------------- +var bug = 119909; +var summary = "Shouldn't crash on regexps with many nested parentheses"; +var NO_BACKREFS = false; +var DO_BACKREFS = true; + + +//-------------------------------------------------- +test(); +//-------------------------------------------------- + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + // Changed the parameter from 500 to 200 for WebKit, because PCRE reports an error for more parentheses. + testThis(200, NO_BACKREFS, 'hello', 'goodbye'); + testThis(200, DO_BACKREFS, 'hello', 'goodbye'); + + exitFunc('test'); +} + + +/* + * Creates a regexp pattern like (((((((((hello))))))))) + * and tests str.search(), str.match(), str.replace() + */ +function testThis(numParens, doBackRefs, strOriginal, strReplace) +{ + var openParen = doBackRefs? '(' : '(?:'; + var closeParen = ')'; + var pattern = ''; + + for (var i=0; i<numParens; i++) {pattern += openParen;} + pattern += strOriginal; + for (i=0; i<numParens; i++) {pattern += closeParen;} + var re = new RegExp(pattern); + + var res = strOriginal.search(re); + res = strOriginal.match(re); + res = strOriginal.replace(re, strReplace); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js new file mode 100644 index 0000000..ed2afc3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js @@ -0,0 +1,103 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 12 Feb 2002 +* SUMMARY: Don't crash on invalid regexp literals / \\/ / +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=122076 +* The function checkURL() below sometimes caused a compile-time error: +* +* SyntaxError: unterminated parenthetical (: +* +* However, sometimes it would cause a crash instead. The presence of +* other functions below is merely fodder to help provoke the crash. +* The constant |STRESS| is number of times we'll try to crash on this. +* +*/ +//----------------------------------------------------------------------------- +var bug = 122076; +var summary = "Don't crash on invalid regexp literals / \\/ /"; +var STRESS = 10; +var sEval = ''; + +printBugNumber(bug); +printStatus(summary); + + +sEval += 'function checkDate()' +sEval += '{' +sEval += 'return (this.value.search(/^[012]?\d\/[0123]?\d\/[0]\d$/) != -1);' +sEval += '}' + +sEval += 'function checkDNSName()' +sEval += '{' +sEval += ' return (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) != -1);' +sEval += '}' + +sEval += 'function checkEmail()' +sEval += '{' +sEval += ' return (this.value.search(/^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$/) != -1);' +sEval += '}' + +sEval += 'function checkHostOrIP()' +sEval += '{' +sEval += ' if (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) == -1)' +sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);' +sEval += ' else' +sEval += ' return true;' +sEval += '}' + +sEval += 'function checkIPAddress()' +sEval += '{' +sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);' +sEval += '}' + +sEval += 'function checkURL()' +sEval += '{' +sEval += ' return (this.value.search(/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,4}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\/\*\$+@&#;`~=%!]*)(\.\w{2,})?)*\/?)$/) != -1);' +sEval += '}' + + +for (var i=0; i<STRESS; i++) +{ + try + { + eval(sEval); + } + catch(e) + { + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js new file mode 100644 index 0000000..77194fe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js @@ -0,0 +1,107 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): waldemar, rogerl, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 04 Feb 2002 +* SUMMARY: regexp backreferences must hold |undefined| if not used +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437 (SpiderMonkey) +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123439 (Rhino) +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 123437; +var summary = 'regexp backreferences must hold |undefined| if not used'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /(a)?a/; +string = 'a'; +status = inSection(1); +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +pattern = /a|(b)/; +string = 'a'; +status = inSection(2); +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +pattern = /(a)?(a)/; +string = 'a'; +status = inSection(3); +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined, 'a'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js new file mode 100644 index 0000000..10a235f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js @@ -0,0 +1,117 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): franky@pacificconnections.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 August 2002 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=165353 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 165353; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^([a-z]+)*[a-z]$/; + status = inSection(1); + string = 'a'; + actualmatch = string.match(pattern); + expectedmatch = Array('a', undefined); + addThis(); + + status = inSection(2); + string = 'ab'; + actualmatch = string.match(pattern); + expectedmatch = Array('ab', 'a'); + addThis(); + + status = inSection(3); + string = 'abc'; + actualmatch = string.match(pattern); + expectedmatch = Array('abc', 'ab'); + addThis(); + + +string = 'www.netscape.com'; + status = inSection(4); + pattern = /^(([a-z]+)*[a-z]\.)+[a-z]{2,}$/; + actualmatch = string.match(pattern); + expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap'); + addThis(); + + // add one more capturing parens to the previous regexp - + status = inSection(5); + pattern = /^(([a-z]+)*([a-z])\.)+[a-z]{2,}$/; + actualmatch = string.match(pattern); + expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap', 'e'); + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js new file mode 100644 index 0000000..0069bfd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js @@ -0,0 +1,100 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): martin.honnen@t-online.de, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 August 2002 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169497 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 169497; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var sBody = ''; +var sHTML = ''; +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + +sBody += '<body onXXX="alert(event.type);">\n'; +sBody += '<p>Kibology for all<\/p>\n'; +sBody += '<p>All for Kibology<\/p>\n'; +sBody += '<\/body>'; + +sHTML += '<html>\n'; +sHTML += sBody; +sHTML += '\n<\/html>'; + +status = inSection(1); +string = sHTML; +pattern = /<body.*>((.*\n?)*?)<\/body>/i; +actualmatch = string.match(pattern); +expectedmatch = Array(sBody, '\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n', '<p>All for Kibology</p>\n'); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js new file mode 100644 index 0000000..c29d11e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js @@ -0,0 +1,90 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 20 Sep 2002 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169534 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 169534; +var summary = 'RegExp conformance test'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +var re = /(\|)([\w\x81-\xff ]*)(\|)([\/a-z][\w:\/\.]*\.[a-z]{3,4})(\|)/ig; +var str = "To sign up click |here|https://www.xxxx.org/subscribe.htm|"; +actual = str.replace(re, '<a href="$4">$2</a>'); +expect = 'To sign up click <a href="https://www.xxxx.org/subscribe.htm">here</a>'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js new file mode 100644 index 0000000..bffcda8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js @@ -0,0 +1,137 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): ji_bo@yahoo.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 06 January 2003 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=187133 +* +* The tests here employ the regular expression construct: +* +* (?!pattern) +* +* This is a "zero-width lookahead negative assertion". +* From the Perl documentation: +* +* For example, /foo(?!bar)/ matches any occurrence +* of 'foo' that isn't followed by 'bar'. +* +* It is "zero-width" means that it does not consume any characters and that +* the parens are non-capturing. A non-null match array in the example above +* will have only have length 1, not 2. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 187133; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /(\.(?!com|org)|\/)/; + status = inSection(1); + string = 'ah.info'; + actualmatch = string.match(pattern); + expectedmatch = ['.', '.']; + addThis(); + + status = inSection(2); + string = 'ah/info'; + actualmatch = string.match(pattern); + expectedmatch = ['/', '/']; + addThis(); + + status = inSection(3); + string = 'ah.com'; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /(?!a|b)|c/; + status = inSection(4); + string = ''; + actualmatch = string.match(pattern); + expectedmatch = ['']; + addThis(); + + status = inSection(5); + string = 'bc'; + actualmatch = string.match(pattern); + expectedmatch = ['']; + addThis(); + + status = inSection(6); + string = 'd'; + actualmatch = string.match(pattern); + expectedmatch = ['']; + addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js new file mode 100644 index 0000000..6fae0e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js @@ -0,0 +1,282 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): scole@planetweb.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 January 2003 +* SUMMARY: Invalid use of regexp quantifiers should generate SyntaxErrors +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=188206 +* and http://bugzilla.mozilla.org/show_bug.cgi?id=85721#c48 etc. +* and http://bugzilla.mozilla.org/show_bug.cgi?id=190685 +* and http://bugzilla.mozilla.org/show_bug.cgi?id=197451 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 188206; +var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors'; +var TEST_PASSED = 'SyntaxError'; +var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var CHECK_PASSED = 'Should not generate an error'; +var CHECK_FAILED = 'Generated an error!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * All the following are invalid uses of regexp quantifiers and + * should generate SyntaxErrors. That's what we're testing for. + * + * To allow the test to compile and run, we have to hide the errors + * inside eval strings, and check they are caught at run-time - + * + */ +status = inSection(1); +testThis(' /a**/ '); + +status = inSection(2); +testThis(' /a***/ '); + +status = inSection(3); +testThis(' /a++/ '); + +status = inSection(4); +testThis(' /a+++/ '); + +/* + * The ? quantifier, unlike * or +, may appear twice in succession. + * Thus we need at least three in a row to provoke a SyntaxError - + */ + +status = inSection(5); +testThis(' /a???/ '); + +status = inSection(6); +testThis(' /a????/ '); + + +/* + * Now do some weird things on the left side of the regexps - + */ +status = inSection(7); +testThis(' /*a/ '); + +status = inSection(8); +testThis(' /**a/ '); + +status = inSection(9); +testThis(' /+a/ '); + +status = inSection(10); +testThis(' /++a/ '); + +status = inSection(11); +testThis(' /?a/ '); + +status = inSection(12); +testThis(' /??a/ '); + + +/* + * Misusing the {DecmalDigits} quantifier - according to ECMA, + * but not according to Perl. + * + * ECMA-262 Edition 3 prohibits the use of unescaped braces in + * regexp patterns, unless they form part of a quantifier. + * + * Hovever, Perl does not prohibit this. If not used as part + * of a quantifer, Perl treats braces literally. + * + * We decided to follow Perl on this for backward compatibility. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=190685. + * + * Therefore NONE of the following ECMA violations should generate + * a SyntaxError. Note we use checkThis() instead of testThis(). + */ +status = inSection(13); +checkThis(' /a*{/ '); + +status = inSection(14); +checkThis(' /a{}/ '); + +status = inSection(15); +checkThis(' /{a/ '); + +status = inSection(16); +checkThis(' /}a/ '); + +status = inSection(17); +checkThis(' /x{abc}/ '); + +status = inSection(18); +checkThis(' /{{0}/ '); + +status = inSection(19); +checkThis(' /{{1}/ '); + +status = inSection(20); +checkThis(' /x{{0}/ '); + +status = inSection(21); +checkThis(' /x{{1}/ '); + +status = inSection(22); +checkThis(' /x{{0}}/ '); + +status = inSection(23); +checkThis(' /x{{1}}/ '); + +status = inSection(24); +checkThis(' /x{{0}}/ '); + +status = inSection(25); +checkThis(' /x{{1}}/ '); + +status = inSection(26); +checkThis(' /x{{0}}/ '); + +status = inSection(27); +checkThis(' /x{{1}}/ '); + + +/* + * Misusing the {DecmalDigits} quantifier - according to BOTH ECMA and Perl. + * + * Just as with the * and + quantifiers above, can't have two {DecmalDigits} + * quantifiers in succession - it's a SyntaxError. + */ +status = inSection(28); +testThis(' /x{1}{1}/ '); + +status = inSection(29); +testThis(' /x{1,}{1}/ '); + +status = inSection(30); +testThis(' /x{1,2}{1}/ '); + +status = inSection(31); +testThis(' /x{1}{1,}/ '); + +status = inSection(32); +testThis(' /x{1,}{1,}/ '); + +status = inSection(33); +testThis(' /x{1,2}{1,}/ '); + +status = inSection(34); +testThis(' /x{1}{1,2}/ '); + +status = inSection(35); +testThis(' /x{1,}{1,2}/ '); + +status = inSection(36); +testThis(' /x{1,2}{1,2}/ '); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Invalid syntax should generate a SyntaxError + */ +function testThis(sInvalidSyntax) +{ + expect = TEST_PASSED; + actual = TEST_FAILED_BADLY; + + try + { + eval(sInvalidSyntax); + } + catch(e) + { + if (e instanceof SyntaxError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; + } + + statusitems[UBound] = status; + expectedvalues[UBound] = expect; + actualvalues[UBound] = actual; + UBound++; +} + + +/* + * Allowed syntax shouldn't generate any errors + */ +function checkThis(sAllowedSyntax) +{ + expect = CHECK_PASSED; + actual = CHECK_PASSED; + + try + { + eval(sAllowedSyntax); + } + catch(e) + { + actual = CHECK_FAILED; + } + + statusitems[UBound] = status; + expectedvalues[UBound] = expect; + actualvalues[UBound] = actual; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js new file mode 100644 index 0000000..a3d8b39 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js @@ -0,0 +1,193 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): flying@dom.natm.ru, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 January 2003 +* SUMMARY: Testing regular expressions of form /(x|y){n,}/ +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=191479 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 191479; +var summary = 'Testing regular expressions of form /(x|y){n,}/'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = '12 3 45'; +pattern = /(\d|\d\s){2,}/; +actualmatch = string.match(pattern); +expectedmatch = Array('12', '2'); +addThis(); + +status = inSection(2); +string = '12 3 45'; +pattern = /(\d|\d\s){4,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +status = inSection(3); +string = '12 3 45'; +pattern = /(\d|\d\s)+/; +actualmatch = string.match(pattern); +expectedmatch = Array('12', '2'); +addThis(); + +status = inSection(4); +string = '12 3 45'; +pattern = /(\d\s?){4,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +/* + * Let's reverse the operands in Sections 1-3 above - + */ +status = inSection(5); +string = '12 3 45'; +pattern = /(\d\s|\d){2,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +status = inSection(6); +string = '12 3 45'; +pattern = /(\d\s|\d){4,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +status = inSection(7); +string = '12 3 45'; +pattern = /(\d\s|\d)+/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + + +/* + * Let's take all 7 sections above and make each quantifer non-greedy. + * + * This is done by appending ? to it. It doesn't change the meaning of + * the quantifier, but makes it non-greedy, which affects the results - + */ +status = inSection(8); +string = '12 3 45'; +pattern = /(\d|\d\s){2,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12', '2'); +addThis(); + +status = inSection(9); +string = '12 3 45'; +pattern = /(\d|\d\s){4,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 3 4', '4'); +addThis(); + +status = inSection(10); +string = '12 3 45'; +pattern = /(\d|\d\s)+?/; +actualmatch = string.match(pattern); +expectedmatch = Array('1', '1'); +addThis(); + +status = inSection(11); +string = '12 3 45'; +pattern = /(\d\s?){4,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 3 4', '4'); +addThis(); + +status = inSection(12); +string = '12 3 45'; +pattern = /(\d\s|\d){2,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 ', '2 '); +addThis(); + +status = inSection(13); +string = '12 3 45'; +pattern = /(\d\s|\d){4,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 3 4', '4'); +addThis(); + +status = inSection(14); +string = '12 3 45'; +pattern = /(\d\s|\d)+?/; +actualmatch = string.match(pattern); +expectedmatch = Array('1', '1'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js new file mode 100644 index 0000000..14722c3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js @@ -0,0 +1,96 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): drbrain-bugzilla@segment7.net, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 April 2003 +* SUMMARY: Testing regexp with many backreferences +* See http://bugzilla.mozilla.org/show_bug.cgi?id=202564 +* +* Note that in Section 1 below, we expect the 1st and 4th backreferences +* to hold |undefined| instead of the empty strings one gets in Perl and IE6. +* This is because per ECMA, regexp backreferences must hold |undefined| +* if not used. See http://bugzilla.mozilla.org/show_bug.cgi?id=123437. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 202564; +var summary = 'Testing regexp with many backreferences'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'Seattle, WA to Buckley, WA'; +pattern = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, undefined, "Seattle", "WA", undefined, "Buckley", "WA"); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js new file mode 100644 index 0000000..ba4c1e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js @@ -0,0 +1,1101 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 12 June 2003 +* SUMMARY: Testing complicated str.replace() +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=209067 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 209067; +var summary = 'Testing complicated str.replace()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function formatHTML(h) +{ + // a replace function used in the succeeding lines - + function S(s) + { + return s.replace(/</g,'<').replace(/>/g,'>'); + } + + h+='\n'; + h=h.replace(/&([^\s]+;)/g,'<&$1>'); + h=h.replace(new RegExp('<!-'+'-[\\s\\S]*-'+'->','g'), S); + h=h.replace(/"[^"]*"/g,S); + h=h.replace(/'[^']*'/g,S); + + + h=h.replace(/<([^>]*)>/g, + function(s,p) + { + if(s.match(/!doctype/i)) + return'<span class=doctype><' + p + '></span>'; + + p=p.replace(/\\'/g,'\\'').replace(/\\"/g,'\\"').replace(/^\s/,''); + p=p.replace(/(\s)([^<]+)$/g, + function(s,p1,p2) + { + p2=p2.replace(/(=)(\s*[^"'][^\s]*)(\s|$)/g,'$1<span class=attribute-value>$2</span>$3'); + p2=p2.replace(/("[^"]*")/g,'<span class=attribute-value>$1</span>'); + p2=p2.replace(/('[^']*')/g,'<span class=attribute-value>$1</span>'); + return p1 + '<span class=attribute-name>'+p2+'</span>'; + } + ) + + return'<<span class=' + (s.match(/<\s*\//)?'end-tag':'start-tag') + '>' + p + '</span>>'; + } + ) + + + h=h.replace(/<(&[^\s]+;)>/g,'<span class=entity>$1</span>'); + h=h.replace(/(<!--[\s\S]*-->)/g,'<span class=comment>$1</span>'); + + + numer=1; + h=h.replace(/(.*\n)/g, + function(s,p) + { + return (numer++) +'. ' + p; + } + ) + + + return'<span class=text>' + h + '</span>'; +} + + + +/* + * sanity check + */ +status = inSection(1); +actual = formatHTML('abc'); +expect = '<span class=text>1. abc\n</span>'; +addThis(); + + +/* + * The real test: can we run this without crashing? + * We are not validating the result, just running it. + */ +status = inSection(2); +var HUGE_TEST_STRING = hugeString(); +formatHTML(HUGE_TEST_STRING); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function hugeString() +{ +var s = ''; + +s += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; +s += '<html lang="en">'; +s += '<head>'; +s += ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'; +s += ' <meta http-equiv="refresh" content="1800">'; +s += ' <title>CNN.com</title>'; +s += ' <link rel="Start" href="/">'; +s += ' <link rel="Search" href="/search/">'; +s += ' <link rel="stylesheet" href="http://i.cnn.net/cnn/.element/ssi/css/1.0/main.css" type="text/css">'; +s += ' <script language="JavaScript1.2" src="http://i.cnn.net/cnn/.element/ssi/js/1.0/main.js" type="text/javascript"></script>'; +s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsWrapper.js"></script>'; +s += '<style type="text/css">'; +s += '<!--'; +s += '.aoltextad { text-align: justify; font-size: 12px; color: black; font-family: Georgia, sans-serif }'; +s += '-->'; +s += '</style>'; +s += '<script language="JavaScript1.1" type="text/javascript" src="http://ar.atwola.com/file/adsPopup2.js"></script>'; +s += '<script language="JavaScript">'; +s += 'document.adoffset = 0;'; +s += 'document.adPopupDomain = "www.cnn.com";'; +s += 'document.adPopupFile = "/cnn_adspaces/adsPopup2.html";'; +s += 'document.adPopupInterval = "P24";'; +s += 'document.adPopunderInterval = "P24";'; +s += 'adSetOther("&TVAR="+escape("class=us.low"));'; +s += '</script>'; +s += ''; +s += ' '; +s += '</head>'; +s += '<body class="cnnMainPage">'; +s += ''; +s += ''; +s += ''; +s += '<a name="top_of_page"></a>'; +s += '<a href="#ContentArea"><img src="http://i.cnn.net/cnn/images/1.gif" alt="Click here to skip to main content." width="10" height="1" border="0" align="right"></a>'; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0" style="speak: none">'; +s += ' <col width="229">'; +s += ' <col width="73">'; +s += ' <col width="468">'; +s += ' <tr>'; +s += ' <td colspan="3"><!--'; +s += '[[!~~ netscape hat ~~]][[table border="0" cellpadding="0" cellspacing="0" width="100%"]][[tr]][[td]][[script Language="Javascript" SRC="http://toolbar.aol.com/dashboard.twhat?dom=cnn" type="text/javascript"]][[/script]][[/td]][[/tr]][[/table]]'; +s += ''; +s += '[[div]][[img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" border="0"]][[/div]]'; +s += '-->'; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr valign="bottom">'; +s += ' <td width="229" style="speak: normal"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/logo/cnn.gif" alt="CNN.com" width="229" height="52" border="0"></td>'; +s += ' <td width="73"></td>'; +s += ' <td width="468" align="right">'; +s += ' <!-- home/bottom.468x60 -->'; +s += '<script language="JavaScript1.1">'; +s += '<!--'; +s += 'adSetTarget("_top");'; +s += 'htmlAdWH( (new Array(93103287,93103287,93103300,93103300))[document.adoffset||0] , 468, 60);'; +s += '//-->'; +s += '</script>'; +s += '<noscript><a href="http://ar.atwola.com/link/93103287/aol" target="_top"><img src="http://ar.atwola.com/image/93103287/aol" alt="Click Here" width="468" height="60" border="0"></a></noscript> '; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr><td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr>'; +s += ' <td colspan="3">'; +s += '</td>'; +s += ' </tr>'; +s += ' <tr><td colspan="3" bgcolor="#CC0000"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3"></td></tr>'; +s += ' <tr>'; +s += ' <td colspan="3">'; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <form action="http://search.cnn.com/cnn/search" method="get" onsubmit="return CNN_validateSearchForm(this);">'; +s += '<input type="hidden" name="source" value="cnn">'; +s += '<input type="hidden" name="invocationType" value="search/top">'; +s += ' <tr><td colspan="4"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" border="0"></td></tr>'; +s += ' <tr><td colspan="4" bgcolor="#003366"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3" border="0"></td></tr>'; +s += ' <tr>'; +s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.search.gif" alt="SEARCH" width="110" height="27" border="0"></td>'; +s += ' <td colspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.top.bevel.gif" alt="" width="653" height="3" border="0"></td>'; +s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.right.bevel.gif" alt="" width="7" height="27" border="0"></td>'; +s += ' </tr>'; +s += ' <tr bgcolor="#B6D8E0">'; +s += ' <td><table border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td> </td>'; +s += ' <td nowrap><span class="cnnFormTextB" style="color:#369">The Web</span></td>'; +s += ' <td><input type="radio" name="sites" value="google" checked></td>'; +s += ' <td> </td>'; +s += ' <td><span class="cnnFormTextB" style="color:#369;">CNN.com</span></td>'; +s += ' <td><input type="radio" name="sites" value="cnn"></td>'; +s += ' <td> </td>'; +s += ' <td><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="35" maxlength="40" style="width: 280px"></td>'; +s += ' <td> <input type="Submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>'; +s += ' </tr>'; +s += ' </table></td>'; +s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.google.gif" alt="enhanced by Google" width="137" height="24" border="0"></td>'; +s += ' </tr>'; +s += ' <tr><td colspan="4"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.bottom.bevel.gif" alt="" width="770" height="3" border="0"></td></tr>'; +s += ' </form>'; +s += '</table>'; +s += ' </td>'; +s += ' </tr>'; +s += ''; +s += ''; +s += '</table>'; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <col width="126" align="left" valign="top">'; +s += ' <col width="10">'; +s += ' <col width="280">'; +s += ' <col width="10">'; +s += ' <col width="344">'; +s += ' <tr valign="top">'; +s += ' <td rowspan="5" width="126" style="speak: none"><table id="cnnNavBar" width="126" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" summary="CNN.com Navigation">'; +s += ' <col width="8" align="left" valign="top">'; +s += ' <col width="118" align="left" valign="top">'; +s += ' <tr bgcolor="#CCCCCC" class="cnnNavHiliteRow"><td width="8" class="swath"> </td>'; +s += ' <td class="cnnNavHilite" onClick="CNN_goTo("/")"><div class="cnnNavText"><a href="/">Home Page</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WORLD/")"><div class="cnnNavText"><a href="/WORLD/">World</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/US/")"><div class="cnnNavText"><a href="/US/">U.S.</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WEATHER/")"><div class="cnnNavText"><a href="/WEATHER/">Weather</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/money/")"><div class="cnnNavText"><a href="/money/">Business</a> <a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_money.gif" alt="at CNN/Money" width="51" height="5" border="0"></a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/cnnsi/")"><div class="cnnNavText"><a href="/si/">Sports</a> <a href="/si/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_si.gif" alt="at SI.com" width="50" height="5" border="0"></a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/ALLPOLITICS/")"><div class="cnnNavText"><a href="/ALLPOLITICS/">Politics</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/LAW/")"><div class="cnnNavText"><a href="/LAW/">Law</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/")"><div class="cnnNavText"><a href="/TECH/">Technology</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/space/")"><div class="cnnNavText"><a href="/TECH/space/">Science & Space</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/HEALTH/")"><div class="cnnNavText"><a href="/HEALTH/">Health</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SHOWBIZ/")"><div class="cnnNavText"><a href="/SHOWBIZ/">Entertainment</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TRAVEL/")"><div class="cnnNavText"><a href="/TRAVEL/">Travel</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/EDUCATION/")"><div class="cnnNavText"><a href="/EDUCATION/">Education</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SPECIALS/")"><div class="cnnNavText"><a href="/SPECIALS/">Special Reports</a></div></td></tr>'; +s += ' <tr bgcolor="#FFFFFF"><td class="cnnNavAd" colspan="2" align="center"><!-- home/left.120x90 -->'; +s += '<script language="JavaScript1.1">'; +s += '<!--'; +s += 'adSetTarget("_top");'; +s += 'htmlAdWH( (new Array(93166917,93166917,93170132,93170132))[document.adoffset||0] , 120, 90);'; +s += '//-->'; +s += '</script><noscript><a href="http://ar.atwola.com/link/93166917/aol" target="_top"><img src="http://ar.atwola.com/image/93166917/aol" alt="Click here for our advertiser" width="120" height="90" border="0"></a></noscript></td></tr>'; +s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">'; +s += ' <td colspan="2" class="cnnNavGroup"><div class="cnnNavText">SERVICES</div></td></tr>'; +s += ' <tr class="cnnNavOtherRow"><td class="swath"> </td>'; +s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/video/")"><div class="cnnNavText"><a href="/video/">Video</a></div></td></tr>'; +s += ' <tr class="cnnNavOtherRow"><td class="swath"> </td>'; +s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/EMAIL/")"><div class="cnnNavText"><a href="/EMAIL/">E-Mail Services</a></div></td></tr>'; +s += ' <tr class="cnnNavOtherRow"><td class="swath"> </td>'; +s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/mobile/CNNtoGO/")"><div class="cnnNavText"><a href="/mobile/CNNtoGO/">CNN To Go</a></div></td></tr>'; +s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">'; +s += ' <td colspan="2" class="cnnNavGroup" style="background-color: #445B60"><div class="cnnNavText" style="color: #fff">SEARCH</div></td></tr>'; +s += ' <tr bgcolor="#CCCCCC"><td colspan="2" class="cnnNavSearch" style="background-color:#B6D8E0">'; +s += ''; +s += '<form action="http://search.cnn.com/cnn/search" method="get" name="nav_bottom_search" onSubmit="return CNN_validateSearchForm(this)" style="margin: 0px;">'; +s += ' <input type="hidden" name="sites" value="cnn">'; +s += ' <input type="hidden" name="source" value="cnn">'; +s += ' <input type="hidden" name="invocationType" value="side/bottom">'; +s += '<table width="100%" border="0" cellpadding="0" cellspacing="4">'; +s += ' <tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td align="left"><span class="cnnFormTextB" style="color: #369">Web</span></td>'; +s += ' <td><input type="radio" name="sites" value="google" checked></td>'; +s += ' <td align="right"><span class="cnnFormTextB" style="color: #369">CNN.com</span></td>'; +s += ' <td><input type="radio" name="sites" value="cnn"></td>'; +s += ' </tr>'; +s += ' </table></td></tr>'; +s += ' <tr><td colspan="2"><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="7" maxlength="40" style="width: 100%"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td><input type="submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>'; +s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/nav.search.gif" alt="enhanced by Google" width="54" height="27"></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += ''; +s += ''; +s += '</td></form></tr>'; +s += '</table>'; +s += ''; +s += ' </td>'; +s += ' <td rowspan="5" width="10"><a name="ContentArea"></a><img id="accessibilityPixel" src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="7" border="0"></td>'; +s += ' <td colspan="3" valign="middle">'; +s += ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'; +s += ' <tr>'; +s += ' <td valign="top" nowrap><div class="cnnFinePrint" style="color: #333;padding:6px;padding-left:0px;">Updated: 05:53 p.m. EDT (2153 GMT) June 12, 2003</div></td>'; +s += ' <td align="right" nowrap class="cnnt1link"><a href="http://edition.cnn.com/">Visit International Edition</a> </td>'; +s += ' </tr><!--include virtual="/.element/ssi/sect/MAIN/1.0/banner.html"-->'; +s += ' </table>'; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr valign="top">'; +s += ' <td rowspan="2" width="280" bgcolor="#EAEFF4">'; +s += ''; +s += '<!-- T1 -->'; +s += ' '; +s += ' <a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html"><img src="http://i.cnn.net/cnn/2003/SHOWBIZ/Movies/06/12/obit.peck/top.peck.obit.jpg" alt="Oscar-winner Peck dies" width="280" height="210" border="0" hspace="0" vspace="0"></a>'; +s += ''; +s += ' <div class="cnnMainT1">'; +s += ' <h2 style="font-size:20px;"><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html">Oscar-winner Peck dies</a></h2>'; +s += '<p>'; +s += 'Actor Gregory Peck, who won an Oscar for his portrayal of upstanding lawyer Atticus Finch in 1962s "To Kill a Mockingbird," has died at age 87. Peck was best known for roles of dignified statesmen and people who followed a strong code of ethics. But he also could play against type. All told, Peck was nominated for five Academy Awards.'; +s += '</p>'; +s += ' <p>'; +s += ' <b><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html" class="cnnt1link">FULL STORY</a></b>'; +s += ' </p>'; +s += ''; +s += ''; +s += ''; +s += '• <span class="cnnBodyText" style="font-weight:bold;color:#333;">Video: </span><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/showbiz/2003/06/12/peck.obit.affl.","300k");">A leading mans leading man</a><br>'; +s += ''; +s += ''; +s += ''; +s += ' '; +s += '• <span class="cnnBodyText" style="font-weight:bold;color:#333">Interactive: </span> <a href="javascript:CNN_openPopup("/interactive/entertainment/0306/peck.obit/frameset.exclude.html","620x430","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=620,height=430")">Gregory Peck through the years</a><br>'; +s += ''; +s += ' '; +s += '• <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/12/peck.filmography/index.html" target="new">Gregory Peck filmography</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>'; +s += ''; +s += ' '; +s += '• <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/04/heroes.villains.ap/index.html" target="new">Pecks Finch chararcter AFIs top hero</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>'; +s += ' </div>'; +s += ''; +s += '<!-- /T1 -->'; +s += ' </td>'; +s += ' '; +s += ' <td rowspan="2" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td width="344">'; +s += ''; +s += ''; +s += ''; +s += ''; +s += '<!-- T2 -->'; +s += ''; +s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>'; +s += '<table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="285" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE TOP STORIES</b></span></td>'; +s += ' <td width="59" class="cnnTabbedBoxTab" align="right" bgcolor="#336699"><a href="/userpicks"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/userpicks.gif" alt=" Hot Stories " width="59" height="11" border="0"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += '<div style="padding:6px;padding-left:0px;">'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/WORLD/meast/06/12/mideast/index.html">7 dead in new Gaza strike</a>'; +s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/world/2003/06/11/cb.bush.roadmap.ap.","300k");">Video</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/WORLD/meast/06/12/sprj.irq.main/index.html">U.S. helicopter, jet down in Iraqi raid</a>'; +s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/iraq/2003/06/11/bw.iraq.oil.cnn.","300k");">Video</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/SHOWBIZ/TV/06/12/obit.brinkley/index.html">Television icon David Brinkley dead at 82</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/LAW/06/12/peterson.case/index.html">Peterson search warrants will be made public in July</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/WORLD/asiapcf/east/06/12/okinawa.rape/index.html">U.S. Marine held in new Okinawa rape case</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat discovered for shuttle launches</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/SHOWBIZ/TV/06/12/television.sopranos.reut/index.html">"Soprano" Gandolfini shares his wealth with castmates</a><br></div>'; +s += '<!--[[div class="cnnMainNewT2"]]• [[b]][[span style="color:#C00;"]]CNN[[/span]]Radio:[[/b]] [[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]]Bush on Medicare[[/a]] [[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/live.video.gif" alt="" width="61" height="14" vspace="0" hspace="2" align="absmiddle" border="0"]][[/a]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle"]][[br]][[/div]]--></div>'; +s += ''; +s += '<!-- /T2 -->'; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ''; +s += '<!--include virtual="/.element/ssi/misc/1.0/war.zone.smmap.txt"-->'; +s += '<!-- =========== CNN Radio/Video Box =========== -->'; +s += '<!-- top line --> '; +s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>'; +s += '<!-- /top line -->'; +s += ' <table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += '<!-- left-side line --> '; +s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="30" hspace="0" vspace="0" border="0"></td>'; +s += '<!-- /left-side line --> '; +s += '<!-- CNNRadio cell -->'; +s += ' <td width="114"><div class="cnn6pxPad">'; +s += ' <span class="cnnBigPrint" style="color:#C00;font-weight:bold;">CNN</span><span class="cnnBigPrint" style="color:#000;font-weight:bold;">RADIO</span>'; +s += '<div class="cnnMainNewT2"><a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")">Listen to latest updates</a><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle">'; +s += '<div><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="5" hspace="0" vspace="0"></div>'; +s += '<!--'; +s += '[[span class="cnnFinePrint"]]sponsored by:[[/span]][[br]][[center]]'; +s += '[[!~~#include virtual="/cnn_adspaces/home/war_in_iraq/sponsor.88x31.ad"~~]]'; +s += ' [[/center]]'; +s += '-->'; +s += ' </div></td>'; +s += '<!-- /CNNRadio cell --> '; +s += '<!-- center line --> '; +s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>'; +s += '<!-- /center line --> '; +s += '<!-- video cell --> '; +s += ' <td width="227"><div class="cnn6pxPad">'; +s += '<!-- video box --> '; +s += '<table width="215" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td width="144"><span class="cnnBigPrint" style="font-weight:bold;">VIDEO</span></td>'; +s += ' <td width="6"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="6" height="1" hspace="0" vspace="0"></td>'; +s += ' <td width="65"><a href="/video/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/more.video.blue.gif" alt="MORE VIDEO" width="62" height="11" hspace="0" vspace="0" border="0"></a></td></tr>'; +s += ' <tr>'; +s += ' <td width="215" colspan="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" hspace="0" vspace="0"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td><div class="cnnBodyText">'; +s += ' Soldier broke dozens of hearts over e-mail<br>'; +s += ' <img src="http://i.a.cnn.net/cnn/images/icons/premium.gif" align="middle" alt="premium content" width="9" height="11" hspace="0" vspace="1" border="0"> <a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");" class="cnnVideoLink">PLAY VIDEO</a></div>'; +s += ' </td>'; +s += '<td width="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="3" height="1" hspace="0" vspace="0"></td> '; +s += ' <td width="65" align="right">'; +s += ' <a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");"><img src="http://i.cnn.net/cnn/video/offbeat/2003/06/12/ms.casanova.col.vs.kndu.jpg" alt="" width="65" height="49" border="0" vspace="2" hspace="0"></a>'; +s += ' </td></tr>'; +s += '</table>'; +s += ' <!-- /video box --> '; +s += ' </div></td>'; +s += '<!-- /video cell --> '; +s += '<!-- right-side line --> '; +s += '<td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>'; +s += '<!-- /right-side line --> '; +s += ' </tr>'; +s += ' </table>'; +s += ''; +s += '<!-- bottom line -->'; +s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>'; +s += '<!-- /bottom line -->'; +s += '<!-- =========== /CNN Radio/Video Box =========== -->'; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += '<div><img src="http://i.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>'; +s += '<table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="260" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>ON THE SCENE</b></span></td>'; +s += ' <td width="84" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/law.gif" alt="more reports" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<table width="344" border="0" cellpadding="5" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td style="padding-left:0px;"> <b>Jeffrey Toobin:</b> "It takes guts" for Peterson defense to subpoena judge over wiretap issue.'; +s += '<a href="/2003/LAW/06/12/otsc.toobin/index.html">Full Story</a></td>'; +s += ''; +s += '<td width="65" align="right" style="padding-left:6px;"><a href="/2003/LAW/06/12/otsc.toobin/index.html"><img src="http://i.cnn.net/cnn/2003/LAW/06/12/otsc.toobin/tz.toobin.jpg" alt="image" width="65" height="49" border="0" hspace="0" vspace="0"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr valign="bottom">'; +s += ' <td>'; +s += '<table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="267" nowrap style="color: #c00; padding-left: 6px"><span class="cnnBigPrint" style="vertical-align: top"><b>BUSINESS</b></span>'; +s += ' <a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/at_cnnmoney.gif" alt=" at CNN/Money " width="100" height="15" border="0"></a></td>'; +s += ' <td width="77" align="right"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.news.blue.gif" alt=" Business News " width="77" height="11" border="0"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<table width="344" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" style="border: solid 1px #ddd">'; +s += ' <tr valign="top">'; +s += ' <td>'; +s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">'; +s += ' <tr>'; +s += ' <td colspan="3"><span class="cnnMenuText"><b>STOCK/FUND QUOTES: </b></span></td>'; +s += ' </tr><form action="http://qs.money.cnn.com/tq/stockquote" method="get" style="margin: 0px;">'; +s += ' <tr>'; +s += ' <td><span class="cnnFinePrint">enter symbol</span></td>'; +s += ' <td><input type="text" name="symbols" size="7" maxlength="40" class="cnnMenuText" title="Enter stock/fund symbol or name to get a quote"></td>'; +s += ' <td><input type="submit" value="GET" class="cnnNavButton"></td>'; +s += ' </tr></form>'; +s += ' </table>'; +s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">'; +s += ' <tr valign="top">'; +s += ' <td><span class="cnnFinePrint">sponsored by:</span></td>'; +s += ' <td align="right"><!--<a href="/money/news/specials/rebuild_iraq/"><img src="http://i.a.cnn.net/cnn/2003/images/04/17/money.box.gif" ALT="" width="150" height="31" HSPACE="0" VSPACE="0" border="0" align="left"></a>--><a href="http://ar.atwola.com/link/93103306/aol"><img src="http://ar.atwola.com/image/93103306/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' </td>'; +s += ' <td class="cnnMainMarketBox"> <table width="100%" border="0" cellpadding="4" cellspacing="0" summary="Market data from CNNmoney">'; +s += ' <tr class="noBottomBorder">'; +s += ' <td colspan="5"><span class="cnnMainMarketCell"><span class="cnnMenuText"><b><a href="/money/markets/">MARKETS:</a></b></span> <!-- 16:30:15 -->'; +s += ''; +s += '4:30pm ET, 6/12</span></td>'; +s += ' </tr>'; +s += ' <tr class="noTopBorder">'; +s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/dow.html" title="Dow Jones Industrial Average">DJIA</a></span></td>'; +s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+13.30</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">9196.50</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.14%</span></td>'; +s += ''; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/nasdaq.html" title="NASDAQ">NAS</a></span></td>'; +s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 7.60</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">1653.62</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.46%</span></td>'; +s += ''; +s += ' </tr>'; +s += ' <tr class="noBottomBorder">'; +s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/sandp.html" title="S&P 500">S&P</a></span></td>'; +s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 1.03</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">998.51</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.10%</span></td>'; +s += ''; +s += ' </tr>'; +s += ' </table>'; +s += '</td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '</td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="4"></td>'; +s += ' </tr>'; +s += ' <tr align="center" valign="bottom">'; +s += ' <td width="280" bgcolor="#EEEEEE"><a href="/linkto/ftn.nytimes1.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.280x32.ny.times.gif" width="255" height="32" alt="" border="0"></a></td>'; +s += '<td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td width="344" bgcolor="#EEEEEE"><a href="/linkto/ftn.bn3.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.345x32.breaking.news.gif" width="340" height="32" alt="" border="0"></a></td>'; +s += ' </tr>'; +s += ''; +s += '</table>'; +s += ''; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ''; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <col width="10">'; +s += ' <col width="483" align="left" valign="top">'; +s += ' <col width="10">'; +s += ' <col width="267" align="left" valign="top">'; +s += ' <tr valign="top">'; +s += ' <td rowspan="2"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td valign="top">'; +s += ' <table border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td width="238">'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="132" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE REAL TV</b></span></td>'; +s += ' <td width="106" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/SHOWBIZ"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.news.gif" alt="More Entertainment" border="0" width="102" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>'; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td><div class="cnn6pxTpad">'; +s += ' '; +s += ' <a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html">Go ahead, follow me</a><br>'; +s += 'New reality series and the movie debut of "Idol" finalists'; +s += ' </div></td>'; +s += ' <td width="71" align="right"><a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html"><img src="http://i.a.cnn.net/cnn/2003/SHOWBIZ/06/11/eye.ent.voyeurs/tz.movies.gif" alt="Go ahead, follow me" width="65" height="49" border="0" vspace="6"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>'; +s += '<!--include virtual="/.element/ssi/video/section_teases/topvideos_include.txt"-->'; +s += ' </td>'; +s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>'; +s += ' <td width="238">'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="157" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>GIFT IDEAS</b></span></td>'; +s += ' <td width="81" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/money"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/business.gif" alt="Business News" border="0" width="77" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>'; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td><div class="cnn6pxTpad">'; +s += ''; +s += ''; +s += '<span class="cnnBodyText" style="font-weight:bold;">CNN/Money: </span> <a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes">Fathers Day</a><br>'; +s += 'Smaller is better --from digital cameras to iPod'; +s += ' </div></td>'; +s += ' <td width="71" align="right"><a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes"><img src="http://i.a.cnn.net/cnn/images/programming.boxes/tz.money.dads.day.watch.jpg" alt="Fathers Day" width="65" height="49" border="0" vspace="6"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="10" vspace="0" hspace="0"></div> '; +s += '<table width="483" border="0" cellspacing="0" cellpadding="0">'; +s += ' <tr valign="top">'; +s += ' <td rowspan="9"><br></td>'; +s += ' <td width="238"><a href="/US/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/us.gif" alt="U.S. News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/US/South/06/11/miami.rapist/index.html">Miami police link 4 rapes to serial rapist</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/LAW/06/12/mistaken.identity.ap/index.html">Woman mistaken for fugitive jailed</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/US/Northeast/06/12/woman.impaled.ap/index.html">Pregnant woman impaled on mic stand</a><br>'; +s += ' </div></td>'; +s += ' <td rowspan="7" width="7"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>'; +s += ' <td width="238"><a href="/WORLD/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/world.gif" alt="World News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/WORLD/europe/06/12/nato.bases/index.html">NATO reshapes for new era</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/WORLD/africa/06/12/congo.democratic/index.html">U.N. reviews Bunia peace force</a><br>'; +s += ''; +s += ''; +s += ''; +s += '• <span class="cnnBodyText" style="font-weight:bold;color:#900;">TIME.com: </span><a href="/time/magazine/article/0,9171,1101030616-457361,00.html?CNN=yes" target="new">Saddams curtain trail</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/TECH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/technology.gif" alt="Sci-Tech News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/ptech/06/11/bus2.ptech.dvd.maker/index.html">Another reason to throw out your VCR</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/ptech/06/12/korea.samsung.reut/index.html">Flat screen TV prices dropping</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/SHOWBIZ/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.gif" alt="Entertainment News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/SHOWBIZ/TV/06/12/cnn.obrien/index.html">CNN hires Soledad OBrien for "AM"</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/SHOWBIZ/TV/06/11/batchelor.troubles.ap/index.html">Dating show star let go by law firm</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/ALLPOLITICS/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/politics.gif" alt="Politics News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/ALLPOLITICS/06/11/schwarzenegger.ap/index.html">Schwarzenegger on California politics</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/ALLPOLITICS/06/12/tax.credit.ap/index.html">House approves extension on child tax credit</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/law.gif" alt="Law News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/LAW/06/12/plaintiff.advances.ap/index.html">Court bars cash advances to plaintiffs</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/LAW/06/11/jackson.lawsuit.ap/index.html">Lawsuit against Jackson settled</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/HEALTH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/health.gif" alt="Health News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/HEALTH/06/12/monkeypox.ap/index.html">Monkeypox spreading person-to-person?</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/HEALTH/06/12/quick.xray.ap/index.html">A full body X-ray in 13 seconds</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/TECH/space/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/space.gif" alt="Space News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/science/06/12/hydrogen.ozone.ap/index.html">Hydrogen fuel may disturb ozone layer</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat found for shuttle launches</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/TRAVEL/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/travel.gif" alt="Travel News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/TRAVEL/DESTINATIONS/06/12/walk.across.america.ap/index.html">Walking America from coast to coast</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/TRAVEL/06/11/bi.airlines.executives.reut/index.html">Airline execs not seeing sunny skies yet</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/EDUCATION/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/education.gif" alt="Education News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/EDUCATION/06/12/arabs.prom.ap/index.html">Arab students seek prom balance</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/EDUCATION/06/11/school.fundraising.ap/index.html">Public schools turn to upscale fundraising</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/si/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/sports.gif" alt="Sports News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += '• <a href="/cnnsi/golfonline/2003/us_open/news/2003/06/12/open_thursday_ap">Woods eyes third U.S. Open title</a><br>'; +s += '• <a href="/cnnsi/basketball/news/2003/06/12/jordan_ruling_ap">Judge denies Jordan's former lover $5M payoff</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.gif" alt="Business News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += '• <a href="/money/2003/06/12/pf/saving/duppies/index.htm">Here come the "Duppies"</a><br>'; +s += '• <a href="/money/2003/06/12/technology/oracle/index.htm">Oracle beats estimates</a><br>'; +s += ' </div></td>'; +s += ' </tr>'; +s += '</table>'; +s += ' </td>'; +s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" width="10" hspace="0" vspace="0" alt=""></td>'; +s += ' <td valign="top">'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>'; +s += ' '; +s += '<table width="267" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="173" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>WATCH CNN TV</b></span></div></td>'; +s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>'; +s += ' <td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/CNN/Programs/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += '<table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td><a href="/CNN/Programs/american.morning/"><img src="http://i.cnn.net/cnn/CNN/Programs/includes/showbox/images/2003/05/tz.hemmer.jpg" alt="American Morning, 7 a.m. ET" width="65" height="49" border="0" align="right"></a><a href="/CNN/Programs/american.morning/"><b>American Morning (7 a.m. ET):</b></a> Tomorrow, singer Carnie Wilson talks about her new book, "Im Still Hungry."'; +s += ' </td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<!--'; +s += '[[table width="267" border="0" cellpadding="0" cellspacing="0"]]'; +s += '[[tr]][[td width="173" bgcolor="#003366"]][[div class="cnnBlueBoxHeader"]][[span class="cnnBigPrint"]][[b]]WATCH CNN TV[[/b]][[/span]][[/div]][[/td]][[td width="25" class="cnnBlueBoxHeader" align="right"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""]][[/td]][[td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"]][[a href="/CNN/Programs/"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"]][[/a]][[/td]][[/tr]][[/table]][[table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0"]][[tr valign="top"]][[td]]'; +s += '[[img src="http://i.cnn.net/cnn/2003/images/05/31/tz.bw.jpg" alt="" width="65" height="49" border="0" align="right"]]'; +s += ' '; +s += '[[b]] CNN Presents: The Hunt for Eric Robert Rudolph (8 p.m. ET)[[/b]][[br]]Latest on his capture.'; +s += ' [[/td]]'; +s += ' [[/tr]]'; +s += ' [[/table]]'; +s += '-->'; +s += ''; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div> '; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>'; +s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="184" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>ANALYSIS</b></span></div></td>'; +s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>'; +s += ' <td width="58" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/US"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/us.gif" alt="U.S. News" border="0" width="54" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td>'; +s += '<a href="/2003/US/06/12/nyt.safire/index.html"><img src="http://i.a.cnn.net/cnn/2003/US/06/12/nyt.safire/tz.stewart.jpg" alt="Fight It, Martha" width="65" height="49" border="0" align="right"></a>'; +s += ''; +s += ''; +s += '<span class="cnnBodyText" style="font-weight:bold;color:#000;">NYTimes: </span> <a href="/2003/US/06/12/nyt.safire/index.html">Fight It, Martha</a><br>'; +s += 'William Safire: I hope Martha Stewart beats this bum rap'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>'; +s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="164" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>OFFBEAT</b></span></div></td>'; +s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>'; +s += ' <td width="78" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/offbeat"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/offbeat.gif" alt="more offbeat" width="74" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <table width="267" bgcolor="#DDDDDD" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td>'; +s += '<a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html"><img src="http://i.a.cnn.net/cnn/2003/HEALTH/06/12/offbeat.china.sperm.ap/tz.china.sperm.jpg" alt="Waiting list" width="65" height="49" border="0" align="right"></a>'; +s += ' '; +s += ' <a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html">Waiting list</a><br>'; +s += 'Chinas "smart sperm" bank needs donors'; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ''; +s += ' <table width="267" bgcolor="#999999" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td>'; +s += ' <table width="100%" border="0" cellpadding="4" cellspacing="1">'; +s += ' <tr>'; +s += ' <td bgcolor="#EEEEEE" class="cnnMainWeatherBox"><a name="weatherBox"></a>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += '<table width="257" border="0" cellpadding="1" cellspacing="0">'; +s += '<form method="get" action="http://weather.cnn.com/weather/search" style="margin: 0px">'; +s += '<input type="hidden" name="mode" value="hplwp">'; +s += ' <tr>'; +s += ' <td bgcolor="#FFFFFF"><table width="255" bgcolor="#EAEFF4" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr>'; +s += ' <td colspan="2" class="cnnWEATHERrow"> <span class="cnnBigPrint">WEATHER</span></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td colspan="2" class="cnnBodyText">Get your hometown weather on the home page! <b>Enter city name or U.S. Zip Code:</b></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td><input class="cnnFormText" type="text" size="12" name="wsearch" value="" style="width:100px;"></td>'; +s += ' <td><input class="cnnNavButton" type="submit" value="PERSONALIZE"></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td class="cnnBodyText" colspan="2">Or <a href="javascript:CNN_openPopup("http://weather.cnn.com/weather/select.popup/content2.jsp?mode=hplwp", "weather", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=260,height=250")"><b>select location from a list</b></a></td>'; +s += ' </tr>'; +s += ' </table></td>'; +s += ' </tr>'; +s += '</form>'; +s += '</table>'; +s += ''; +s += ''; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td bgcolor="#EEEEEE">'; +s += ' <table width="100%" border="0" cellpadding="0" cellspacing="2">'; +s += ' <tr>'; +s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/quickvote.gif" alt="Quick Vote" width="107" height="24" border="0"></td>'; +s += ' <td width="88" align="right"><!-- ad home/quickvote/sponsor.88x31 -->'; +s += '<!-- ad commented while aol investigates 3/31/03 5:40 a.m. lk -->'; +s += '<a href="http://ar.atwola.com/link/93101912/aol"><img src="http://ar.atwola.com/image/93101912/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a>'; +s += '</td>'; +s += ' </tr>'; +s += ' </table>'; +s += '<table width="100%" cellspacing="0" cellpadding="1" border="0"><form target="popuppoll" method="post" action="http://polls.cnn.com/poll">'; +s += '<INPUT TYPE=HIDDEN NAME="poll_id" VALUE="3966">'; +s += '<tr><td colspan="2" align="left"><span class="cnnBodyText">Should an international peacekeeping force be sent to the Mideast?<br></span></td></tr>'; +s += '<tr valign="top">'; +s += '<td><span class="cnnBodyText">Yes</span>'; +s += '</td><td align="right"><input value="1" type="radio" name="question_1"></td></tr>'; +s += '<tr valign="top">'; +s += '<td><span class="cnnBodyText">No</span>'; +s += '</td><td align="right"><input value="2" type="radio" name="question_1"></td></tr>'; +s += '<!-- /end Question 1 -->'; +s += '<tr>'; +s += '<td colspan="2">'; +s += '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><span class="cnnInterfaceLink"><nobr><a href="javascript:CNN_openPopup("/POLLSERVER/results/3966.html","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")">VIEW RESULTS</a></nobr></span></td>'; +s += '<td align="right"><input class="cnnFormButton" onclick="CNN_openPopup("","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")" value="VOTE" type="SUBMIT"></td></tr></table></td></tr>'; +s += '</form></table>'; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <!-- /right --></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td colspan="3" valign="bottom"> <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="483" height="1"> </td>'; +s += ' </tr>'; +s += '</table>'; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0" summary="Links to stories from CNN partners">'; +s += ' <col width="10">'; +s += ' <col width="250" align="left" valign="top">'; +s += ' <col width="5">'; +s += ' <col width="250" align="left" valign="top">'; +s += ' <col width="5">'; +s += ' <col width="250" align="left" valign="top">'; +s += ' <tr><td colspan="6"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td rowspan="6" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td colspan="3"><span class="cnnMenuText" style="font-size: 12px"><b style="color: #c00">From our Partners</b></span>'; +s += ' <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_external.gif" alt=" External site icon " width="20" height="13" border="0" align="middle"></td>'; +s += ' <td colspan="2"></td>'; +s += ' </tr>'; +s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr><td colspan="5" bgcolor="#CCCCCC"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr>'; +s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td class="cnnMainSections" width="250">'; +s += '<a href="/time/" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_time.gif" alt="Time: " width="70" height="17" border="0"></a><br><div style="margin-top: 4px"> • <a target="new" href="/time/magazine/article/0,9171,1101030616-457387,00.html?CNN=yes">Where the Jobs Are</a><br> • <a target="new" href="/time/magazine/article/0,9171,1101030616-457373,00.html?CNN=yes">Of Dogs and Men</a><br> • <a target="new" href="/time/photoessays/gunmen/?CNN=yes">Photo Essay: Fighting the Peace</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td> <a target="new" href="/linkto/time.main.html">Subscribe to TIME</a> </td></tr></table> </td>'; +s += ' <td width="5"><br></td>'; +s += ' <td class="cnnMainSections" width="250">'; +s += '<a href="/cnnsi/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_si.gif" alt="CNNsi.com: " width="138" height="17" border="0"></a><br><div style="margin-top: 4px">'; +s += '• Marty Burns: <a target="new" href="/cnnsi/inside_game/marty_burns/news/2003/06/11/burns_game4/">Nets pull out all stops</a><br>'; +s += '• Michael Farber: <a target="new" href="/cnnsi/inside_game/michael_farber/news/2003/06/11/farber_wrapup/">Sens look good for "04</a><br>'; +s += '• Tim Layden: <a target="new" href="/cnnsi/inside_game/tim_layden/news/2003/06/11/layden_neuheisel/">NFL or bust for Neuheisel</a><br>'; +s += '</div>'; +s += '<table border="0"><tr><td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr><tr bgcolor="#dddddd"><td> <a href="http://subs.timeinc.net/CampaignHandler/si_cnnsi?source_id=19">Subscribe to Sports Illustrated</a> </td></tr></table>'; +s += ' </td>'; +s += ' <td width="5"><br></td>'; +s += ' <td class="cnnMainSections" width="250">'; +s += '<a href="/linkto/nyt/main.banner.html" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partners_nyt.gif" alt="New York Times: " width="105" height="17" border="0"></a><br><div style="margin-top: 4px"> • <a target="new" href="/linkto/nyt/story/1.0612.html">U.S. Widens Checks at Foreign Ports</a><br> • <a target="new" href="/linkto/nyt/story/2.0612.html">Rumsfeld: Iran Developing Nuclear Arms</a><br> • <a target="new" href="/linkto/nyt/story/3.0612.html">Vandalism, "Improvements" Mar Great Wall</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td> <a target="new" href="/linkto/nyt.main.html">Get 50% OFF the NY Times</a> </td></tr></table> </td>'; +s += ' </tr>'; +s += ''; +s += '</table>'; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></div>'; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="10"></td>'; +s += ' <td width="760">'; +s += '<!-- floor -->'; +s += ''; +s += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#999999"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr></table>'; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>'; +s += ''; +s += '<table width="100%" bgcolor="#DEDEDE" border="0" cellpadding="3" cellspacing="0">'; +s += ' <tr> '; +s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="5" height="5"></td>'; +s += ' <td><a href="http://edition.cnn.com/" class="cnnFormTextB" onClick="clickEdLink()" style="color:#000;">International Edition</a></td>'; +s += '<form>'; +s += ' <td><select title="CNN.com is available in different languages" class="cnnMenuText" name="languages" size="1" style="font-weight: bold; vertical-align: middle" onChange="if (this.options[selectedIndex].value != "") location.href=this.options[selectedIndex].value">'; +s += ' <option value="" disabled selected>Languages</option>'; +s += ' <option value="" disabled>---------</option>'; +s += ' <option value="/cnnes/">Spanish</option>'; +s += ' <option value="http://cnn.de/">German</option>'; +s += ' <option value="http://cnnitalia.it/">Italian</option>'; +s += ' <option value="http://www.joins.com/cnn/">Korean</option>'; +s += ' <option value="http://arabic.cnn.com/">Arabic</option>'; +s += ' <option value="http://www.CNN.co.jp/">Japanese</option>'; +s += ' </select></td>'; +s += '</form>'; +s += ' <td><a href="/CNN/Programs/" class="cnnFormTextB" style="color:#000;">CNN TV</a></td>'; +s += ' <td><a href="/CNNI/" class="cnnFormTextB" style="color:#000;">CNN International</a></td>'; +s += ' <td><a href="/HLN/" class="cnnFormTextB" style="color:#000;">Headline News</a></td>'; +s += ' <td><a href="/TRANSCRIPTS/" class="cnnFormTextB" style="color:#000;">Transcripts</a></td>'; +s += ' <td><a href="/services/preferences/" title="Customize your CNN.com experience" class="cnnFormTextB" style="color:#000;">Preferences</a></td>'; +s += ' <td><a href="/INDEX/about.us/" class="cnnFormTextB" style="color:#000;">About CNN.com</a></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>'; +s += ''; +s += '<table width="100%" bgcolor="#EFEFEF" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top"> '; +s += ' <td style="padding-left:10px"><div class="cnnSectCopyright">'; +s += '<b>© 2003 Cable News Network LP, LLLP.</b><br>'; +s += 'An AOL Time Warner Company. All Rights Reserved.<br>'; +s += '<a href="/interactive_legal.html">Terms</a> under which this service is provided to you.<br>'; +s += 'Read our <a href="/privacy.html">privacy guidelines</a>. <a href="/feedback/">Contact us</a>.'; +s += ' </div></td>'; +s += ' <td align="right"><table border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr> '; +s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>'; +s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13"></td>'; +s += ' <td><div class="cnnSectExtSites">All external sites will open in a new browser.<br>'; +s += ' CNN.com does not endorse external sites.</div></td>'; +s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>'; +s += ' <td rowspan="2"><!-- home/powered_by/sponsor.88x31 -->'; +s += '<script language="JavaScript1.1">'; +s += '<!--'; +s += 'adSetTarget("_top");'; +s += 'htmlAdWH( (new Array(93103308,93103308,93103308,93103308))[document.adoffset||0] , 88, 31);'; +s += '//-->'; +s += '</script><noscript><a href="http://ar.atwola.com/link/93103308/aol" target="_top"><img src="http://ar.atwola.com/image/93103308/aol" alt="Click here for our advertiser" width="88" height="31" border="0"></a></noscript>'; +s += '</td>'; +s += ' </tr>'; +s += ' <tr valign="top"> '; +s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_premium.gif" alt=" Premium content icon " width="9" height="11"></td>'; +s += ' <td><span class="cnnSectExtSites">Denotes premium content.</span></td>'; +s += ' </tr>'; +s += ' </table></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<!-- /floor --></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += ''; +s += ''; +s += '<!-- popunder ad generic/popunder_launch.720x300 -->'; +s += '<script language="JavaScript1.1" type="text/javascript">'; +s += '<!--'; +s += 'if (document.adPopupFile) {'; +s += ' if (document.adPopupInterval == null) {'; +s += ' document.adPopupInterval = "0";'; +s += ' }'; +s += ' if (document.adPopunderInterval == null) {'; +s += ' document.adPopunderInterval = document.adPopupInterval;'; +s += ' }'; +s += ' if (document.adPopupDomain != null) {'; +s += ' adSetPopDm(document.adPopupDomain);'; +s += ' }'; +s += ' adSetPopupWH("93162673", "720", "300", document.adPopupFile, document.adPopunderInterval, 20, 50, -1);'; +s += '}'; +s += '// -->'; +s += '</script>'; +s += ' '; +s += '<!-- home/bottom.eyeblaster -->'; +s += '<script language="JavaScript1.1" type="text/javascript">'; +s += '<!--'; +s += 'var MacPPC = (navigator.platform == "MacPPC") ? true : false;'; +s += 'if (!MacPPC) {'; +s += 'adSetType("J");'; +s += 'htmlAdWH( (new Array(93137910,93137910,93137910,93137910))[document.adoffset||0], 101, 1);'; +s += 'adSetType("");'; +s += '}'; +s += '// -->'; +s += '</script>'; +s += ''; +s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsEnd.js"></script>'; +s += ''; +s += '<img src="/cookie.crumb" alt="" width="1" height="1">'; +s += '<!--include virtual="/virtual/2002/main/survey.html"-->'; +s += '</body>'; +s += '</html>'; + +return s; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js new file mode 100644 index 0000000..e1bb76c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js @@ -0,0 +1,169 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): sagdjb@softwareag.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 June 2003 +* SUMMARY: Testing regexp submatches with quantifiers +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=209919 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 209919; +var summary = 'Testing regexp submatches with quantifiers'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Waldemar: "ECMA-262 15.10.2.5, third algorithm, step 2.1 states that + * once the minimum repeat count (which is 0 for *, 1 for +, etc.) has + * been satisfied, an atom being repeated must not match the empty string." + * + * In this example, the minimum repeat count is 0, so the last thing the + * capturing parens is permitted to contain is the 'a'. It may NOT go on + * to capture the '' at the $ position of 'a', even though '' satifies + * the condition b* + * + */ +status = inSection(1); +string = 'a'; +pattern = /(a|b*)*/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'a'); +addThis(); + + +/* + * In this example, the minimum repeat count is 5, so the capturing parens + * captures the 'a', then goes on to capture the '' at the $ position of 'a' + * 4 times before it has to stop. Therefore the last thing it contains is ''. + */ +status = inSection(2); +string = 'a'; +pattern = /(a|b*){5,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, ''); +addThis(); + + +/* + * Reduction of the above examples to contain only the condition b* + * inside the capturing parens. This can be even harder to grasp! + * + * The global match is the '' at the ^ position of 'a', but the parens + * is NOT permitted to capture it since the minimum repeat count is 0! + */ +status = inSection(3); +string = 'a'; +pattern = /(b*)*/; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + + +/* + * Here we have used the + quantifier (repeat count 1) outside the parens. + * Therefore the parens must capture at least once before stopping, so it + * does capture the '' this time - + */ +status = inSection(4); +string = 'a'; +pattern = /(b*)+/; +actualmatch = string.match(pattern); +expectedmatch = Array('', ''); +addThis(); + + +/* + * More complex examples - + */ +pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/; + + status = inSection(5); + string = '100.00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '00', undefined); + addThis(); + + status = inSection(6); + string = '100,00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '100', ',00'); + addThis(); + + status = inSection(7); + string = '1.000,00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '000', ',00'); + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js new file mode 100644 index 0000000..cc86d73 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js @@ -0,0 +1,112 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): okin7@yahoo.fr, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 August 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=216591 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 216591; +var summary = 'Regexp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a {result.data.DATA} b'; +pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; +actualmatch = string.match(pattern); +expectedmatch = Array('{result.data.DATA}', 'result.data.', 'data.', 'DATA'); +addThis(); + +/* + * Add a global flag to the regexp. In Perl 5, this gives the same results as above. Compare: + * + * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; print("$&, $1, $2, $3");' + * {result.data.DATA}, result.data., data., DATA + * + * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; print("$&, $1, $2, $3");' + * {result.data.DATA}, result.data., data., DATA + * + * + * But in JavaScript, there will no longer be any sub-captures: + */ +status = inSection(2); +string = 'a {result.data.DATA} b'; +pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; +actualmatch = string.match(pattern); +expectedmatch = Array('{result.data.DATA}'); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js new file mode 100644 index 0000000..e6a767e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js @@ -0,0 +1,99 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 September 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 220367; +var summary = 'Regexp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a'; +pattern = /(a)|(b)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'a', undefined); +addThis(); + +status = inSection(2); +string = 'b'; +pattern = /(a)|(b)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, undefined, 'b'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js new file mode 100644 index 0000000..62eec23 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js @@ -0,0 +1,107 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 September 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 220367; +var summary = 'Regexp conformance test'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var re = /(a)|(b)/; + +re.test('a'); + status = inSection(1); + actual = RegExp.$1; + expect = 'a'; + addThis(); + + status = inSection(2); + actual = RegExp.$2; + expect = ''; + addThis(); + +re.test('b'); + status = inSection(3); + actual = RegExp.$1; + expect = ''; + addThis(); + + status = inSection(4); + actual = RegExp.$2; + expect = 'b'; + addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js new file mode 100644 index 0000000..41c17f6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printBugNumber (24712); + + var re = /([\S]+([ \t]+[\S]+)*)[ \t]*=[ \t]*[\S]+/; + var result = re.exec("Course_Creator = Test"); + + if (!result) + reportFailure ("exec() returned null."); + + exitFunc ("test"); + +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js new file mode 100644 index 0000000..599f613 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printBugNumber (28686); + + var str = 'foo "bar" baz'; + reportCompare ('foo \\"bar\\" baz', str.replace(/([\'\"])/g, "\\$1"), + "str.replace failed."); + + exitFunc ("test"); + +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js new file mode 100644 index 0000000..b68e42a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js @@ -0,0 +1,75 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 31316: +* "Rhino: Regexp matches return garbage" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=31316 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 31316; +var summary = 'Regression test for Bugzilla bug 31316'; +var cnEmptyString = ''; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/; +string = '<p>Some<br />test</p>'; +actualmatch = string.match(pattern); +expectedmatch = Array('<p>', undefined, 'p'); +addThis(); + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js new file mode 100644 index 0000000..de9834a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js @@ -0,0 +1,129 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 28 December 2000 +* +* SUMMARY: Testing regular expressions containing the ? character. +* Arose from Bugzilla bug 57572: "RegExp with ? matches incorrectly" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=57572 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 57572; +var summary = 'Testing regular expressions containing "?"'; +var cnEmptyString = ''; var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /(\S+)?(.*)/; +string = 'Test this'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this' +addThis(); + +status = inSection(2); +pattern = /(\S+)? ?(.*)/; //single space between the ? characters +string= 'Test this'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this' +addThis(); + +status = inSection(3); +pattern = /(\S+)?(.*)/; +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase' +addThis(); + +status = inSection(4); +pattern = /(\S+)? ?(.*)/; //single space between the ? characters +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase' +addThis(); + + +// let's add an extra back-reference this time - three instead of two - +status = inSection(5); +pattern = /(\S+)?( ?)(.*)/; //single space before second ? character +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words'); +addThis(); + +status = inSection(6); +pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character +string = 'AAABBB'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B'); +addThis(); + +status = inSection(7); +pattern = /(\S+)?(!?)(.*)/; +string = 'WOW !!! !!!'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!'); +addThis(); + +status = inSection(8); +pattern = /(.+)?(!?)(!+)/; +string = 'WOW !!! !!!'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'WOW !!! !!', cnEmptyString, '!'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js new file mode 100644 index 0000000..1917ed4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js @@ -0,0 +1,128 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +* SUMMARY: This test arose from Bugzilla bug 57631: +* "RegExp with invalid pattern or invalid flag causes segfault" +* +* Either error should throw an exception of type SyntaxError, +* and we check to see that it does... +*/ +//------------------------------------------------------------------------------------------------- +var bug = '57631'; +var summary = 'Testing new RegExp(pattern,flag) with illegal pattern or flag'; +var statprefix = 'Testing for error creating illegal RegExp object on pattern '; +var statsuffix = 'and flag '; +var cnSUCCESS = 'SyntaxError'; +var cnFAILURE = 'not a SyntaxError'; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var legalpatterns = new Array(); var illegalpatterns = new Array(); +var legalflags = new Array(); var illegalflags = new Array(); + + +// valid regular expressions to try - +legalpatterns[0] = ''; +legalpatterns[1] = 'abc'; +legalpatterns[2] = '(.*)(3-1)\s\w'; +legalpatterns[3] = '(.*)(...)\\s\\w'; +legalpatterns[4] = '[^A-Za-z0-9_]'; +legalpatterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// invalid regular expressions to try - +illegalpatterns[0] = '()'; +illegalpatterns[1] = '(a'; +illegalpatterns[2] = '( ]'; +illegalpatterns[3] = '\d{s}'; + +// valid flags to try - +legalflags[0] = 'i'; +legalflags[1] = 'g'; +legalflags[2] = 'm'; +legalflags[3] = undefined; + +// invalid flags to try - +illegalflags[0] = 'a'; +illegalflags[1] = 123; +illegalflags[2] = new RegExp(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + testIllegalRegExps(legalpatterns, illegalflags); + testIllegalRegExps(illegalpatterns, legalflags); + testIllegalRegExps(illegalpatterns, illegalflags); + + exitFunc ('test'); +} + + +// This function will only be called where all the patterns are illegal, or all the flags +function testIllegalRegExps(patterns, flags) +{ + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + + try + { + // This should cause an exception if either s or f is illegal - + eval('obj = new RegExp(s, f);'); + } + catch(e) + { + // We expect to get a SyntaxError - test for this: + actual = (e instanceof SyntaxError)? cnSUCCESS : cnFAILURE; + expect = cnSUCCESS; + reportCompare(expect, actual, status); + } + } + } +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statsuffix + quote(flag)); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js new file mode 100644 index 0000000..e399050 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js @@ -0,0 +1,190 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 06 February 2001 +* +* SUMMARY: Arose from Bugzilla bug 67773: +* "Regular subexpressions followed by + failing to run to completion" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=67773 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 67773; +var summary = 'Testing regular subexpressions followed by ? or +\n'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character + status = inSection(1); + string = 'AAABBB AAABBB '; //single space at middle and at end - + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(2); + string = 'AAABBB BBB'; //single space in the middle + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB'); + addThis(); + + status = inSection(3); + string = 'AAABBB AAABBB'; //single space in the middle + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /^(A+B)+$/; + status = inSection(4); + string = 'AABAAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAB'); + addThis(); + + status = inSection(5); + string = 'ABAABAAAAAAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAAAAAB'); + addThis(); + + status = inSection(6); + string = 'ABAABAABAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AB'); + addThis(); + + status = inSection(7); + string = 'ABAABAABABB'; + actualmatch = string.match(pattern); + expectedmatch = null; // because string doesn't match at end + addThis(); + + +pattern = /^(A+1)+$/; + status = inSection(8); + string = 'AA1AA1'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AA1'); + addThis(); + + +pattern = /^(\w+\-)+$/; + status = inSection(9); + string = ''; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(10); + string = 'bla-'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, string); + addThis(); + + status = inSection(11); + string = 'bla-bla'; // hyphen missing at end - + actualmatch = string.match(pattern); + expectedmatch = null; //because string doesn't match at end + addThis(); + + status = inSection(12); + string = 'bla-bla-'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'bla-'); + addThis(); + + +pattern = /^(\S+)+(A+)$/; + status = inSection(13); + string = 'asdldflkjAAA'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkjAA', 'A'); + addThis(); + + status = inSection(14); + string = 'asdldflkj AAA'; // space in middle + actualmatch = string.match(pattern); + expectedmatch = null; //because of the space + addThis(); + + +pattern = /^(\S+)+(\d+)$/; + status = inSection(15); + string = 'asdldflkj122211'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkj12221', '1'); + addThis(); + + status = inSection(16); + string = 'asdldflkj1111111aaa1'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkj1111111aaa', '1'); + addThis(); + + +/* + * This one comes from Stephen Ostermiller. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 + */ +pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/; + status = inSection(17); + string = 'some.host.tld'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '.tld', '.'); + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js new file mode 100644 index 0000000..5965313 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js @@ -0,0 +1,100 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-17 +* +* SUMMARY: Regression test for Bugzilla bug 72964: +* "String method for pattern matching failed for Chinese Simplified (GB2312)" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72964 +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 72964; +var summary = 'Testing regular expressions containing non-Latin1 characters'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /[\S]+/; + // 4 low Unicode chars = Latin1; whole string should match + status = inSection(1); + string = '\u00BF\u00CD\u00BB\u00A7'; + actualmatch = string.match(pattern); + expectedmatch = Array(string); + addThis(); + + // Now put a space in the middle; first half of string should match + status = inSection(2); + string = '\u00BF\u00CD \u00BB\u00A7'; + actualmatch = string.match(pattern); + expectedmatch = Array('\u00BF\u00CD'); + addThis(); + + + // 4 high Unicode chars = non-Latin1; whole string should match + status = inSection(3); + string = '\u4e00\uac00\u4e03\u4e00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string); + addThis(); + + // Now put a space in the middle; first half of string should match + status = inSection(4); + string = '\u4e00\uac00 \u4e03\u4e00'; + actualmatch = string.match(pattern); + expectedmatch = Array('\u4e00\uac00'); + addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js new file mode 100644 index 0000000..59b95b9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js @@ -0,0 +1,93 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 76683 on Rhino: +* "RegExp regression (NullPointerException)" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76683 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 76683; +var summary = 'Regression test for Bugzilla bug 76683'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Rhino (2001-04-19) crashed on the 3rd regular expression below. + * It didn't matter what the string was. No problem in SpiderMonkey - + */ +string = 'abc'; + status = inSection(1); + pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(2); + pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + // This was the one causing a Rhino crash - + status = inSection(3); + pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js new file mode 100644 index 0000000..08947ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js @@ -0,0 +1,102 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 06 February 2001 +* +* SUMMARY: Arose from Bugzilla bug 78156: +* "m flag of regular expression does not work with $" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=78156 +* +* The m flag means a regular expression should search strings +* across multiple lines, i.e. across '\n', '\r'. +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 78156; +var summary = 'Testing regular expressions with ^, $, and the m flag -'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + +/* + * All patterns have an m flag; all strings are multiline. + * Looking for digit characters at beginning/end of lines. + */ + +string = 'aaa\n789\r\nccc\r\n345'; + status = inSection(1); + pattern = /^\d/gm; + actualmatch = string.match(pattern); + expectedmatch = ['7','3']; + addThis(); + + status = inSection(2); + pattern = /\d$/gm; + actualmatch = string.match(pattern); + expectedmatch = ['9','5']; + addThis(); + +string = 'aaa\n789\r\nccc\r\nddd'; + status = inSection(3); + pattern = /^\d/gm; + actualmatch = string.match(pattern); + expectedmatch = ['7']; + addThis(); + + status = inSection(4); + pattern = /\d$/gm; + actualmatch = string.match(pattern); + expectedmatch = ['9']; + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js new file mode 100644 index 0000000..41f5bc0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js @@ -0,0 +1,271 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 Feb 2002 +* SUMMARY: Performance: Regexp performance degraded from 4.7 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=85721 +* +* Adjust this testcase if necessary. The FAST constant defines +* an upper bound in milliseconds for any execution to take. +* +*/ +//----------------------------------------------------------------------------- +var bug = 85721; +var summary = 'Performance: execution of regular expression'; +var FAST = 100; // execution should be 100 ms or less to pass the test +var MSG_FAST = 'Execution took less than ' + FAST + ' ms'; +var MSG_SLOW = 'Execution took '; +var MSG_MS = ' ms'; +var str = ''; +var re = ''; +var status = ''; +var actual = ''; +var expect= ''; + +printBugNumber (bug); +printStatus (summary); + + +function elapsedTime(startTime) +{ + return new Date() - startTime; +} + + +function isThisFast(ms) +{ + if (ms <= FAST) + return MSG_FAST; + return MSG_SLOW + ms + MSG_MS; +} + + + +/* + * The first regexp. We'll test for performance (Section 1) and accuracy (Section 2). + */ +str='<sql:connection id="conn1"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>'; +re = /<sql:connection id="([^\r\n]*?)">\s*<sql:url>\s*([^\r\n]*?)\s*<\/sql:url>\s*<sql:driver>\s*([^\r\n]*?)\s*<\/sql:driver>\s*(\s*<sql:userId>\s*([^\r\n]*?)\s*<\/sql:userId>\s*)?\s*(\s*<sql:password>\s*([^\r\n]*?)\s*<\/sql:password>\s*)?\s*<\/sql:connection>/; +expect = Array("<sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>","conn1","www.m.com","drive.class","<sql:userId>foo</sql:userId> ","foo","<sql:password>goo</sql:password> ","goo"); + +/* + * Check performance - + */ +status = inSection(1); +var start = new Date(); +var result = re.exec(str); +actual = elapsedTime(start); +reportCompare(isThisFast(FAST), isThisFast(actual), status); + +/* + * Check accuracy - + */ +status = inSection(2); +testRegExp([status], [re], [str], [result], [expect]); + + + +/* + * The second regexp (HUGE!). We'll test for performance (Section 3) and accuracy (Section 4). + * It comes from the O'Reilly book "Mastering Regular Expressions" by Jeffrey Friedl, Appendix B + */ + +//# Some things for avoiding backslashitis later on. +$esc = '\\\\'; +$Period = '\.'; +$space = '\040'; $tab = '\t'; +$OpenBR = '\\['; $CloseBR = '\\]'; +$OpenParen = '\\('; $CloseParen = '\\)'; +$NonASCII = '\x80-\xff'; $ctrl = '\000-\037'; +$CRlist = '\n\015'; //# note: this should really be only \015. +// Items 19, 20, 21 +$qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..." +$dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...] +$quoted_pair = $esc + '[^' + $NonASCII + ']'; // # an escaped character + +//############################################################################## +//# Items 22 and 23, comment. +//# Impossible to do properly with a regex, I make do by allowing at most one level of nesting. +$ctext = '[^' + $esc + $NonASCII + $CRlist + '()]'; + +//# $Cnested matches one non-nested comment. +//# It is unrolled, with normal of $ctext, special of $quoted_pair. +$Cnested = + $OpenParen + // # ( + $ctext + '*' + // # normal* + '(?:' + $quoted_pair + $ctext + '*)*' + // # (special normal*)* + $CloseParen; // # ) + + +//# $comment allows one level of nested parentheses +//# It is unrolled, with normal of $ctext, special of ($quoted_pair|$Cnested) +$comment = + $OpenParen + // # ( + $ctext + '*' + // # normal* + '(?:' + // # ( + '(?:' + $quoted_pair + '|' + $Cnested + ')' + // # special + $ctext + '*' + // # normal* + ')*' + // # )* + $CloseParen; // # ) + + +//############################################################################## +//# $X is optional whitespace/comments. +$X = + '[' + $space + $tab + ']*' + // # Nab whitespace. + '(?:' + $comment + '[' + $space + $tab + ']*)*'; // # If comment found, allow more spaces. + + +//# Item 10: atom +$atom_char = '[^(' + $space + '<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $ctrl + $NonASCII + ']'; +$atom = + $atom_char + '+' + // # some number of atom characters... + '(?!' + $atom_char + ')'; // # ..not followed by something that could be part of an atom + +// # Item 11: doublequoted string, unrolled. +$quoted_str = + '\"' + // # " + $qtext + '*' + // # normal + '(?:' + $quoted_pair + $qtext + '*)*' + // # ( special normal* )* + '\"'; // # " + +//# Item 7: word is an atom or quoted string +$word = + '(?:' + + $atom + // # Atom + '|' + // # or + $quoted_str + // # Quoted string + ')' + +//# Item 12: domain-ref is just an atom +$domain_ref = $atom; + +//# Item 13: domain-literal is like a quoted string, but [...] instead of "..." +$domain_lit = + $OpenBR + // # [ + '(?:' + $dtext + '|' + $quoted_pair + ')*' + // # stuff + $CloseBR; // # ] + +// # Item 9: sub-domain is a domain-ref or domain-literal +$sub_domain = + '(?:' + + $domain_ref + + '|' + + $domain_lit + + ')' + + $X; // # optional trailing comments + +// # Item 6: domain is a list of subdomains separated by dots. +$domain = + $sub_domain + + '(?:' + + $Period + $X + $sub_domain + + ')*'; + +//# Item 8: a route. A bunch of "@ $domain" separated by commas, followed by a colon. +$route = + '\@' + $X + $domain + + '(?:,' + $X + '\@' + $X + $domain + ')*' + // # additional domains + ':' + + $X; // # optional trailing comments + +//# Item 6: local-part is a bunch of $word separated by periods +$local_part = + $word + $X + '(?:' + + $Period + $X + $word + $X + // # additional words + ')*'; + +// # Item 2: addr-spec is local@domain +$addr_spec = + $local_part + '\@' + $X + $domain; + +//# Item 4: route-addr is <route? addr-spec> +$route_addr = + '<' + $X + // # < + '(?:' + $route + ')?' + // # optional route + $addr_spec + // # address spec + '>'; // # > + +//# Item 3: phrase........ +$phrase_ctrl = '\000-\010\012-\037'; // # like ctrl, but without tab + +//# Like atom-char, but without listing space, and uses phrase_ctrl. +//# Since the class is negated, this matches the same as atom-char plus space and tab +$phrase_char = + '[^()<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $NonASCII + $phrase_ctrl + ']'; + +// # We've worked it so that $word, $comment, and $quoted_str to not consume trailing $X +// # because we take care of it manually. +$phrase = + $word + // # leading word + $phrase_char + '*' + // # "normal" atoms and/or spaces + '(?:' + + '(?:' + $comment + '|' + $quoted_str + ')' + // # "special" comment or quoted string + $phrase_char + '*' + // # more "normal" + ')*'; + +// ## Item #1: mailbox is an addr_spec or a phrase/route_addr +$mailbox = + $X + // # optional leading comment + '(?:' + + $phrase + $route_addr + // # name and address + '|' + // # or + $addr_spec + // # address + ')'; + + +//########################################################################### + + +re = new RegExp($mailbox, "g"); +str = 'Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'; +expect = Array('Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'); + +/* + * Check performance - + */ +status = inSection(3); +var start = new Date(); +var result = re.exec(str); +actual = elapsedTime(start); +reportCompare(isThisFast(FAST), isThisFast(actual), status); + +/* + * Check accuracy - + */ +status = inSection(4); +testRegExp([status], [re], [str], [result], [expect]); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js new file mode 100644 index 0000000..7fde4ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js @@ -0,0 +1,124 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 22 June 2001 +* +* SUMMARY: Regression test for Bugzilla bug 87231: +* "Regular expression /(A)?(A.*)/ picks 'A' twice" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=87231 +* Key case: +* +* pattern = /^(A)?(A.*)$/; +* string = 'A'; +* expectedmatch = Array('A', '', 'A'); +* +* +* We expect the 1st subexpression (A)? NOT to consume the single 'A'. +* Recall that "?" means "match 0 or 1 times". Here, it should NOT do +* greedy matching: it should match 0 times instead of 1. This allows +* the 2nd subexpression to make the only match it can: the single 'A'. +* Such "altruism" is the only way there can be a successful global match... +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 87231; +var cnEmptyString = ''; +var summary = 'Testing regular expression /(A)?(A.*)/'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^(A)?(A.*)$/; + status = inSection(1); + string = 'AAA'; + actualmatch = string.match(pattern); + expectedmatch = Array('AAA', 'A', 'AA'); + addThis(); + + status = inSection(2); + string = 'AA'; + actualmatch = string.match(pattern); + expectedmatch = Array('AA', 'A', 'A'); + addThis(); + + status = inSection(3); + string = 'A'; + actualmatch = string.match(pattern); + expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above + addThis(); + + +pattern = /(A)?(A.*)/; +var strL = 'zxcasd;fl\\\ ^'; +var strR = 'aaAAaaaf;lrlrzs'; + + status = inSection(4); + string = strL + 'AAA' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR); + addThis(); + + status = inSection(5); + string = strL + 'AA' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('AA' + strR, 'A', 'A' + strR); + addThis(); + + status = inSection(6); + string = strL + 'A' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js new file mode 100644 index 0000000..e812ebf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js @@ -0,0 +1,77 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): jrgm@netscape.com, pschwartau@netscape.com +* Date: 04 September 2001 +* +* SUMMARY: Regression test for Bugzilla bug 98306 +* "JS parser crashes in ParseAtom for script using Regexp()" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=98306 +*/ +//----------------------------------------------------------------------------- +var bug = 98306; +var summary = "Testing that we don't crash on this code -"; +var cnUBOUND = 10; +var re; +var s; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + s = '"Hello".match(/[/]/)'; + tryThis(s); + + s = 're = /[/'; + tryThis(s); + + s = 're = /[/]/'; + tryThis(s); + + s = 're = /[//]/'; + tryThis(s); + + exitFunc ('test'); +} + + +// Try to provoke a crash - +function tryThis(sCode) +{ + // sometimes more than one attempt is necessary - + for (var i=0; i<cnUBOUND; i++) + { + try + { + eval(sCode); + } + catch(e) + { + // do nothing; keep going - + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js new file mode 100644 index 0000000..8dec83c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js @@ -0,0 +1,230 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 07 February 2001 +* +* Functionality common to RegExp testing - +*/ +//------------------------------------------------------------------------------------------------- +var MSG_PATTERN = '\nregexp = '; +var MSG_STRING = '\nstring = '; +var MSG_EXPECT = '\nExpect: '; +var MSG_ACTUAL = '\nActual: '; +var ERR_LENGTH = '\nERROR !!! match arrays have different lengths:'; +var ERR_MATCH = '\nERROR !!! regexp failed to give expected match array:'; +var ERR_NO_MATCH = '\nERROR !!! regexp FAILED to match anything !!!'; +var ERR_UNEXP_MATCH = '\nERROR !!! regexp MATCHED when we expected it to fail !!!'; +var CHAR_LBRACKET = '['; +var CHAR_RBRACKET = ']'; +var CHAR_QT_DBL = '"'; +var CHAR_QT = "'"; +var CHAR_NL = '\n'; +var CHAR_COMMA = ','; +var CHAR_SPACE = ' '; +var TYPE_STRING = typeof 'abc'; + + + +function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches) +{ + var status = ''; + var pattern = new RegExp(); + var string = ''; + var actualmatch = new Array(); + var expectedmatch = new Array(); + var state = ''; + var lActual = -1; + var lExpect = -1; + + + for (var i=0; i != patterns.length; i++) + { + status = statuses[i]; + pattern = patterns[i]; + string = strings[i]; + actualmatch=actualmatches[i]; + expectedmatch=expectedmatches[i]; + state = getState(status, pattern, string); + + + if(actualmatch) + { + if(expectedmatch) + { + // expectedmatch and actualmatch are arrays - + lExpect = expectedmatch.length; + lActual = actualmatch.length; + + if (lActual != lExpect) + { + reportFailure( + state + ERR_LENGTH + + MSG_EXPECT + formatArray(expectedmatch) + + MSG_ACTUAL + formatArray(actualmatch) + + CHAR_NL + ); + continue; + } + + // OK, the arrays have same length - + if (formatArray(expectedmatch) != formatArray(actualmatch)) + { + reportFailure( + state + ERR_MATCH + + MSG_EXPECT + formatArray(expectedmatch) + + MSG_ACTUAL + formatArray(actualmatch) + + CHAR_NL + ); + } + + } + else //expectedmatch is null - that is, we did not expect a match - + { + reportFailure( + state + ERR_UNEXP_MATCH + + MSG_EXPECT + expectedmatch + + MSG_ACTUAL + formatArray(actualmatch) + + CHAR_NL + ); + } + + } + else // actualmatch is null + { + if (expectedmatch) + { + reportFailure( + state + ERR_NO_MATCH + + MSG_EXPECT + formatArray(expectedmatch) + + MSG_ACTUAL + actualmatch + + CHAR_NL + ); + } + else // we did not expect a match + { + // Being ultra-cautious. Presumably expectedmatch===actualmatch===null + reportCompare (expectedmatch, actualmatch, state); + } + } + } +} + + +function getState(status, pattern, string) +{ + /* + * Escape \n's, etc. to make them LITERAL in the presentation string. + * We don't have to worry about this in |pattern|; such escaping is + * done automatically by pattern.toString(), invoked implicitly below. + * + * One would like to simply do: string = string.replace(/(\s)/g, '\$1'). + * However, the backreference $1 is not a literal string value, + * so this method doesn't work. + * + * Also tried string = string.replace(/(\s)/g, escape('$1')); + * but this just inserts the escape of the literal '$1', i.e. '%241'. + */ + string = string.replace(/\n/g, '\\n'); + string = string.replace(/\r/g, '\\r'); + string = string.replace(/\t/g, '\\t'); + string = string.replace(/\v/g, '\\v'); + string = string.replace(/\f/g, '\\f'); + + return (status + MSG_PATTERN + pattern + MSG_STRING + singleQuote(string)); +} + + +/* + * If available, arr.toSource() gives more detail than arr.toString() + * + * var arr = Array(1,2,'3'); + * + * arr.toSource() + * [1, 2, "3"] + * + * arr.toString() + * 1,2,3 + * + * But toSource() doesn't exist in Rhino, so use our own imitation, below - + * + */ +function formatArray(arr) +{ + try + { + return arr.toSource(); + } + catch(e) + { + return toSource(arr); + } +} + + +/* + * Imitate SpiderMonkey's arr.toSource() method: + * + * a) Double-quote each array element that is of string type + * b) Represent |undefined| and |null| by empty strings + * c) Delimit elements by a comma + single space + * d) Do not add delimiter at the end UNLESS the last element is |undefined| + * e) Add square brackets to the beginning and end of the string + */ +function toSource(arr) +{ + var delim = CHAR_COMMA + CHAR_SPACE; + var elt = ''; + var ret = ''; + var len = arr.length; + + for (i=0; i<len; i++) + { + elt = arr[i]; + + switch(true) + { + case (typeof elt === TYPE_STRING) : + ret += doubleQuote(elt); + break; + + case (elt === undefined || elt === null) : + break; // add nothing but the delimiter, below - + + default: + ret += elt.toString(); + } + + if ((i < len-1) || (elt === undefined)) + ret += delim; + } + + return CHAR_LBRACKET + ret + CHAR_RBRACKET; +} + + +function doubleQuote(text) +{ + return CHAR_QT_DBL + text + CHAR_QT_DBL; +} + + +function singleQuote(text) +{ + return CHAR_QT + text + CHAR_QT; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js new file mode 100644 index 0000000..ca4653a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js @@ -0,0 +1,212 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 30 Jan 2002 +* Revised: 10 Apr 2002 +* Revised: 14 July 2002 +* +* SUMMARY: JS should error on |for(i in undefined)|, |for(i in null)| +* See http://bugzilla.mozilla.org/show_bug.cgi?id=121744 +* +* ECMA-262 3rd Edition Final spec says such statements should error. See: +* +* Section 12.6.4 The for-in Statement +* Section 9.9 ToObject +* +* +* BUT: SpiderMonkey has decided NOT to follow this; it's a bug in the spec. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131348 +* +* UPDATE: Rhino has also decided not to follow the spec on this. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=136893 +* + + |--------------------------------------------------------------------| + | | + | So for now, adding an early return for this test so it won't run. | + | | + |--------------------------------------------------------------------| + +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 121744; +var summary = 'JS should error on |for(i in undefined)|, |for(i in null)|'; +var TEST_PASSED = 'TypeError'; +var TEST_FAILED = 'Generated an error, but NOT a TypeError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +/* + * AS OF 14 JULY 2002, DON'T RUN THIS TEST IN EITHER RHINO OR SPIDERMONKEY - + */ +quit(); + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * OK, this should generate a TypeError + */ +try +{ + for (var i in undefined) + { + print(i); + } +} +catch(e) +{ + if (e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(2); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * OK, this should generate a TypeError + */ +try +{ + for (var i in null) + { + print(i); + } +} +catch(e) +{ + if (e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(3); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * Variable names that cannot be looked up generate ReferenceErrors; however, + * property names like obj.ZZZ that cannot be looked up are set to |undefined| + * + * Therefore, this should indirectly test | for (var i in undefined) | + */ +try +{ + for (var i in this.ZZZ) + { + print(i); + } +} +catch(e) +{ + if(e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(4); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * The result of an unsuccessful regexp match is the null value + * Therefore, this should indirectly test | for (var i in null) | + */ +try +{ + for (var i in 'bbb'.match(/aaa/)) + { + print(i); + } +} +catch(e) +{ + if(e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js new file mode 100644 index 0000000..7315373 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js @@ -0,0 +1,179 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 Apr 2002 +* Revised: 14 July 2002 +* +* SUMMARY: JS should NOT error on |for(i in undefined)|, |for(i in null)| +* +* ECMA-262 3rd Edition Final spec says such statements SHOULD error. See: +* +* Section 12.6.4 The for-in Statement +* Section 9.9 ToObject +* +* +* But SpiderMonkey has decided NOT to follow this; it's a bug in the spec. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131348 +* +* Update: Rhino has also decided not to follow the spec on this +* See http://bugzilla.mozilla.org/show_bug.cgi?id=136893 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 131348; +var summary = 'JS should not error on |for(i in undefined)|, |for(i in null)|'; +var TEST_PASSED = 'No error'; +var TEST_FAILED = 'An error was generated!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_PASSED; +try +{ + for (var i in undefined) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(2); +expect = TEST_PASSED; +actual = TEST_PASSED; +try +{ + for (var i in null) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(3); +expect = TEST_PASSED; +actual = TEST_PASSED; +/* + * Variable names that cannot be looked up generate ReferenceErrors; however, + * property names like obj.ZZZ that cannot be looked up are set to |undefined| + * + * Therefore, this should indirectly test | for (var i in undefined) | + */ +try +{ + for (var i in this.ZZZ) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(4); +expect = TEST_PASSED; +actual = TEST_PASSED; +/* + * The result of an unsuccessful regexp match is the null value + * Therefore, this should indirectly test | for (var i in null) | + */ +try +{ + for (var i in 'bbb'.match(/aaa/)) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js new file mode 100644 index 0000000..ad6bd77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js @@ -0,0 +1,106 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor3@apochta.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 15 July 2002 +* SUMMARY: Testing for SyntaxError on usage of '\' in identifiers +* See http://bugzilla.mozilla.org/show_bug.cgi?id=157509 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 157509; +var summary = "Testing for SyntaxError on usage of '\\' in identifiers"; +var TEST_PASSED = 'SyntaxError'; +var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * OK, this should generate a SyntaxError + */ +try +{ + eval('var a\\1 = 0;'); +} +catch(e) +{ + if (e instanceof SyntaxError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js new file mode 100644 index 0000000..830a6c6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js @@ -0,0 +1,134 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 February 2003 +* SUMMARY: Testing eval statements containing conditional function expressions +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=194364 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 194364; +var summary = 'Testing eval statements with conditional function expressions'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = eval('1; function() {}'); +expect = 1; +addThis(); + +status = inSection(2); +actual = eval('2; function f() {}'); +expect = 2; +addThis(); + +status = inSection(3); +actual = eval('3; if (true) function() {}'); +expect = 3; +addThis(); + +status = inSection(4); +actual = eval('4; if (true) function f() {}'); +expect = 4; +addThis(); + +status = inSection(5); +actual = eval('5; if (false) function() {}'); +expect = 5; +addThis(); + +status = inSection(6); +actual = eval('6; if (false) function f() {}'); +expect = 6; +addThis(); + +status = inSection(7); +actual = eval('7; switch(true) { case true: function() {} }'); +expect = 7; +addThis(); + +status = inSection(8); +actual = eval('8; switch(true) { case true: function f() {} }'); +expect = 8; +addThis(); + +status = inSection(9); +actual = eval('9; switch(false) { case false: function() {} }'); +expect = 9; +addThis(); + +status = inSection(10); +actual = eval('10; switch(false) { case false: function f() {} }'); +expect = 10; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js new file mode 100644 index 0000000..d592264 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js @@ -0,0 +1,118 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 74474 +*"switch() misbehaves with duplicated labels" +* +* See ECMA3 Section 12.11, "The switch Statement" +* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474 +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 74474; +var summary = 'Testing switch statements with duplicate labels'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + + +status = 'Section A of test: the string literal "1" as a duplicate label'; +actual = ''; +switch ('1') +{ + case '1': + actual += 'a'; + case '1': + actual += 'b'; +} +expect = 'ab'; +addThis(); + + +status = 'Section B of test: the numeric literal 1 as a duplicate label'; +actual = ''; +switch (1) +{ + case 1: + actual += 'a'; + case 1: + actual += 'b'; +} +expect = 'ab'; +addThis(); + + +status = 'Section C of test: the numeric literal 1 as a duplicate label, via a function parameter'; +tryThis(1); +function tryThis(x) +{ + actual = ''; + + switch (x) + { + case x: + actual += 'a'; + case x: + actual += 'b'; + } +} +expect = 'ab'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js new file mode 100644 index 0000000..52f8787 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js @@ -0,0 +1,9076 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 09 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 74474 +* "switch() misbehaves with duplicated labels" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474 +* See ECMA3 Section 12.11, "The switch Statement" +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 74474; +var summary = 'Test of switch statement that overflows the stack-allocated bitmap'; +var status = '(No duplicated labels)'; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var x = 3; + + +switch (x) +{ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 185: + case 186: + case 187: + case 188: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 216: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: + case 223: + case 224: + case 225: + case 226: + case 227: + case 228: + case 229: + case 230: + case 231: + case 232: + case 233: + case 234: + case 235: + case 236: + case 237: + case 238: + case 239: + case 240: + case 241: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 248: + case 249: + case 250: + case 251: + case 252: + case 253: + case 254: + case 255: + case 256: + case 257: + case 258: + case 259: + case 260: + case 261: + case 262: + case 263: + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 290: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 307: + case 308: + case 309: + case 310: + case 311: + case 312: + case 313: + case 314: + case 315: + case 316: + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + case 331: + case 332: + case 333: + case 334: + case 335: + case 336: + case 337: + case 338: + case 339: + case 340: + case 341: + case 342: + case 343: + case 344: + case 345: + case 346: + case 347: + case 348: + case 349: + case 350: + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 372: + case 373: + case 374: + case 375: + case 376: + case 377: + case 378: + case 379: + case 380: + case 381: + case 382: + case 383: + case 384: + case 385: + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + case 394: + case 395: + case 396: + case 397: + case 398: + case 399: + case 400: + case 401: + case 402: + case 403: + case 404: + case 405: + case 406: + case 407: + case 408: + case 409: + case 410: + case 411: + case 412: + case 413: + case 414: + case 415: + case 416: + case 417: + case 418: + case 419: + case 420: + case 421: + case 422: + case 423: + case 424: + case 425: + case 426: + case 427: + case 428: + case 429: + case 430: + case 431: + case 432: + case 433: + case 434: + case 435: + case 436: + case 437: + case 438: + case 439: + case 440: + case 441: + case 442: + case 443: + case 444: + case 445: + case 446: + case 447: + case 448: + case 449: + case 450: + case 451: + case 452: + case 453: + case 454: + case 455: + case 456: + case 457: + case 458: + case 459: + case 460: + case 461: + case 462: + case 463: + case 464: + case 465: + case 466: + case 467: + case 468: + case 469: + case 470: + case 471: + case 472: + case 473: + case 474: + case 475: + case 476: + case 477: + case 478: + case 479: + case 480: + case 481: + case 482: + case 483: + case 484: + case 485: + case 486: + case 487: + case 488: + case 489: + case 490: + case 491: + case 492: + case 493: + case 494: + case 495: + case 496: + case 497: + case 498: + case 499: + case 500: + case 501: + case 502: + case 503: + case 504: + case 505: + case 506: + case 507: + case 508: + case 509: + case 510: + case 511: + case 512: + case 513: + case 514: + case 515: + case 516: + case 517: + case 518: + case 519: + case 520: + case 521: + case 522: + case 523: + case 524: + case 525: + case 526: + case 527: + case 528: + case 529: + case 530: + case 531: + case 532: + case 533: + case 534: + case 535: + case 536: + case 537: + case 538: + case 539: + case 540: + case 541: + case 542: + case 543: + case 544: + case 545: + case 546: + case 547: + case 548: + case 549: + case 550: + case 551: + case 552: + case 553: + case 554: + case 555: + case 556: + case 557: + case 558: + case 559: + case 560: + case 561: + case 562: + case 563: + case 564: + case 565: + case 566: + case 567: + case 568: + case 569: + case 570: + case 571: + case 572: + case 573: + case 574: + case 575: + case 576: + case 577: + case 578: + case 579: + case 580: + case 581: + case 582: + case 583: + case 584: + case 585: + case 586: + case 587: + case 588: + case 589: + case 590: + case 591: + case 592: + case 593: + case 594: + case 595: + case 596: + case 597: + case 598: + case 599: + case 600: + case 601: + case 602: + case 603: + case 604: + case 605: + case 606: + case 607: + case 608: + case 609: + case 610: + case 611: + case 612: + case 613: + case 614: + case 615: + case 616: + case 617: + case 618: + case 619: + case 620: + case 621: + case 622: + case 623: + case 624: + case 625: + case 626: + case 627: + case 628: + case 629: + case 630: + case 631: + case 632: + case 633: + case 634: + case 635: + case 636: + case 637: + case 638: + case 639: + case 640: + case 641: + case 642: + case 643: + case 644: + case 645: + case 646: + case 647: + case 648: + case 649: + case 650: + case 651: + case 652: + case 653: + case 654: + case 655: + case 656: + case 657: + case 658: + case 659: + case 660: + case 661: + case 662: + case 663: + case 664: + case 665: + case 666: + case 667: + case 668: + case 669: + case 670: + case 671: + case 672: + case 673: + case 674: + case 675: + case 676: + case 677: + case 678: + case 679: + case 680: + case 681: + case 682: + case 683: + case 684: + case 685: + case 686: + case 687: + case 688: + case 689: + case 690: + case 691: + case 692: + case 693: + case 694: + case 695: + case 696: + case 697: + case 698: + case 699: + case 700: + case 701: + case 702: + case 703: + case 704: + case 705: + case 706: + case 707: + case 708: + case 709: + case 710: + case 711: + case 712: + case 713: + case 714: + case 715: + case 716: + case 717: + case 718: + case 719: + case 720: + case 721: + case 722: + case 723: + case 724: + case 725: + case 726: + case 727: + case 728: + case 729: + case 730: + case 731: + case 732: + case 733: + case 734: + case 735: + case 736: + case 737: + case 738: + case 739: + case 740: + case 741: + case 742: + case 743: + case 744: + case 745: + case 746: + case 747: + case 748: + case 749: + case 750: + case 751: + case 752: + case 753: + case 754: + case 755: + case 756: + case 757: + case 758: + case 759: + case 760: + case 761: + case 762: + case 763: + case 764: + case 765: + case 766: + case 767: + case 768: + case 769: + case 770: + case 771: + case 772: + case 773: + case 774: + case 775: + case 776: + case 777: + case 778: + case 779: + case 780: + case 781: + case 782: + case 783: + case 784: + case 785: + case 786: + case 787: + case 788: + case 789: + case 790: + case 791: + case 792: + case 793: + case 794: + case 795: + case 796: + case 797: + case 798: + case 799: + case 800: + case 801: + case 802: + case 803: + case 804: + case 805: + case 806: + case 807: + case 808: + case 809: + case 810: + case 811: + case 812: + case 813: + case 814: + case 815: + case 816: + case 817: + case 818: + case 819: + case 820: + case 821: + case 822: + case 823: + case 824: + case 825: + case 826: + case 827: + case 828: + case 829: + case 830: + case 831: + case 832: + case 833: + case 834: + case 835: + case 836: + case 837: + case 838: + case 839: + case 840: + case 841: + case 842: + case 843: + case 844: + case 845: + case 846: + case 847: + case 848: + case 849: + case 850: + case 851: + case 852: + case 853: + case 854: + case 855: + case 856: + case 857: + case 858: + case 859: + case 860: + case 861: + case 862: + case 863: + case 864: + case 865: + case 866: + case 867: + case 868: + case 869: + case 870: + case 871: + case 872: + case 873: + case 874: + case 875: + case 876: + case 877: + case 878: + case 879: + case 880: + case 881: + case 882: + case 883: + case 884: + case 885: + case 886: + case 887: + case 888: + case 889: + case 890: + case 891: + case 892: + case 893: + case 894: + case 895: + case 896: + case 897: + case 898: + case 899: + case 900: + case 901: + case 902: + case 903: + case 904: + case 905: + case 906: + case 907: + case 908: + case 909: + case 910: + case 911: + case 912: + case 913: + case 914: + case 915: + case 916: + case 917: + case 918: + case 919: + case 920: + case 921: + case 922: + case 923: + case 924: + case 925: + case 926: + case 927: + case 928: + case 929: + case 930: + case 931: + case 932: + case 933: + case 934: + case 935: + case 936: + case 937: + case 938: + case 939: + case 940: + case 941: + case 942: + case 943: + case 944: + case 945: + case 946: + case 947: + case 948: + case 949: + case 950: + case 951: + case 952: + case 953: + case 954: + case 955: + case 956: + case 957: + case 958: + case 959: + case 960: + case 961: + case 962: + case 963: + case 964: + case 965: + case 966: + case 967: + case 968: + case 969: + case 970: + case 971: + case 972: + case 973: + case 974: + case 975: + case 976: + case 977: + case 978: + case 979: + case 980: + case 981: + case 982: + case 983: + case 984: + case 985: + case 986: + case 987: + case 988: + case 989: + case 990: + case 991: + case 992: + case 993: + case 994: + case 995: + case 996: + case 997: + case 998: + case 999: + case 1000: + case 1001: + case 1002: + case 1003: + case 1004: + case 1005: + case 1006: + case 1007: + case 1008: + case 1009: + case 1010: + case 1011: + case 1012: + case 1013: + case 1014: + case 1015: + case 1016: + case 1017: + case 1018: + case 1019: + case 1020: + case 1021: + case 1022: + case 1023: + case 1024: + case 1025: + case 1026: + case 1027: + case 1028: + case 1029: + case 1030: + case 1031: + case 1032: + case 1033: + case 1034: + case 1035: + case 1036: + case 1037: + case 1038: + case 1039: + case 1040: + case 1041: + case 1042: + case 1043: + case 1044: + case 1045: + case 1046: + case 1047: + case 1048: + case 1049: + case 1050: + case 1051: + case 1052: + case 1053: + case 1054: + case 1055: + case 1056: + case 1057: + case 1058: + case 1059: + case 1060: + case 1061: + case 1062: + case 1063: + case 1064: + case 1065: + case 1066: + case 1067: + case 1068: + case 1069: + case 1070: + case 1071: + case 1072: + case 1073: + case 1074: + case 1075: + case 1076: + case 1077: + case 1078: + case 1079: + case 1080: + case 1081: + case 1082: + case 1083: + case 1084: + case 1085: + case 1086: + case 1087: + case 1088: + case 1089: + case 1090: + case 1091: + case 1092: + case 1093: + case 1094: + case 1095: + case 1096: + case 1097: + case 1098: + case 1099: + case 1100: + case 1101: + case 1102: + case 1103: + case 1104: + case 1105: + case 1106: + case 1107: + case 1108: + case 1109: + case 1110: + case 1111: + case 1112: + case 1113: + case 1114: + case 1115: + case 1116: + case 1117: + case 1118: + case 1119: + case 1120: + case 1121: + case 1122: + case 1123: + case 1124: + case 1125: + case 1126: + case 1127: + case 1128: + case 1129: + case 1130: + case 1131: + case 1132: + case 1133: + case 1134: + case 1135: + case 1136: + case 1137: + case 1138: + case 1139: + case 1140: + case 1141: + case 1142: + case 1143: + case 1144: + case 1145: + case 1146: + case 1147: + case 1148: + case 1149: + case 1150: + case 1151: + case 1152: + case 1153: + case 1154: + case 1155: + case 1156: + case 1157: + case 1158: + case 1159: + case 1160: + case 1161: + case 1162: + case 1163: + case 1164: + case 1165: + case 1166: + case 1167: + case 1168: + case 1169: + case 1170: + case 1171: + case 1172: + case 1173: + case 1174: + case 1175: + case 1176: + case 1177: + case 1178: + case 1179: + case 1180: + case 1181: + case 1182: + case 1183: + case 1184: + case 1185: + case 1186: + case 1187: + case 1188: + case 1189: + case 1190: + case 1191: + case 1192: + case 1193: + case 1194: + case 1195: + case 1196: + case 1197: + case 1198: + case 1199: + case 1200: + case 1201: + case 1202: + case 1203: + case 1204: + case 1205: + case 1206: + case 1207: + case 1208: + case 1209: + case 1210: + case 1211: + case 1212: + case 1213: + case 1214: + case 1215: + case 1216: + case 1217: + case 1218: + case 1219: + case 1220: + case 1221: + case 1222: + case 1223: + case 1224: + case 1225: + case 1226: + case 1227: + case 1228: + case 1229: + case 1230: + case 1231: + case 1232: + case 1233: + case 1234: + case 1235: + case 1236: + case 1237: + case 1238: + case 1239: + case 1240: + case 1241: + case 1242: + case 1243: + case 1244: + case 1245: + case 1246: + case 1247: + case 1248: + case 1249: + case 1250: + case 1251: + case 1252: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 1259: + case 1260: + case 1261: + case 1262: + case 1263: + case 1264: + case 1265: + case 1266: + case 1267: + case 1268: + case 1269: + case 1270: + case 1271: + case 1272: + case 1273: + case 1274: + case 1275: + case 1276: + case 1277: + case 1278: + case 1279: + case 1280: + case 1281: + case 1282: + case 1283: + case 1284: + case 1285: + case 1286: + case 1287: + case 1288: + case 1289: + case 1290: + case 1291: + case 1292: + case 1293: + case 1294: + case 1295: + case 1296: + case 1297: + case 1298: + case 1299: + case 1300: + case 1301: + case 1302: + case 1303: + case 1304: + case 1305: + case 1306: + case 1307: + case 1308: + case 1309: + case 1310: + case 1311: + case 1312: + case 1313: + case 1314: + case 1315: + case 1316: + case 1317: + case 1318: + case 1319: + case 1320: + case 1321: + case 1322: + case 1323: + case 1324: + case 1325: + case 1326: + case 1327: + case 1328: + case 1329: + case 1330: + case 1331: + case 1332: + case 1333: + case 1334: + case 1335: + case 1336: + case 1337: + case 1338: + case 1339: + case 1340: + case 1341: + case 1342: + case 1343: + case 1344: + case 1345: + case 1346: + case 1347: + case 1348: + case 1349: + case 1350: + case 1351: + case 1352: + case 1353: + case 1354: + case 1355: + case 1356: + case 1357: + case 1358: + case 1359: + case 1360: + case 1361: + case 1362: + case 1363: + case 1364: + case 1365: + case 1366: + case 1367: + case 1368: + case 1369: + case 1370: + case 1371: + case 1372: + case 1373: + case 1374: + case 1375: + case 1376: + case 1377: + case 1378: + case 1379: + case 1380: + case 1381: + case 1382: + case 1383: + case 1384: + case 1385: + case 1386: + case 1387: + case 1388: + case 1389: + case 1390: + case 1391: + case 1392: + case 1393: + case 1394: + case 1395: + case 1396: + case 1397: + case 1398: + case 1399: + case 1400: + case 1401: + case 1402: + case 1403: + case 1404: + case 1405: + case 1406: + case 1407: + case 1408: + case 1409: + case 1410: + case 1411: + case 1412: + case 1413: + case 1414: + case 1415: + case 1416: + case 1417: + case 1418: + case 1419: + case 1420: + case 1421: + case 1422: + case 1423: + case 1424: + case 1425: + case 1426: + case 1427: + case 1428: + case 1429: + case 1430: + case 1431: + case 1432: + case 1433: + case 1434: + case 1435: + case 1436: + case 1437: + case 1438: + case 1439: + case 1440: + case 1441: + case 1442: + case 1443: + case 1444: + case 1445: + case 1446: + case 1447: + case 1448: + case 1449: + case 1450: + case 1451: + case 1452: + case 1453: + case 1454: + case 1455: + case 1456: + case 1457: + case 1458: + case 1459: + case 1460: + case 1461: + case 1462: + case 1463: + case 1464: + case 1465: + case 1466: + case 1467: + case 1468: + case 1469: + case 1470: + case 1471: + case 1472: + case 1473: + case 1474: + case 1475: + case 1476: + case 1477: + case 1478: + case 1479: + case 1480: + case 1481: + case 1482: + case 1483: + case 1484: + case 1485: + case 1486: + case 1487: + case 1488: + case 1489: + case 1490: + case 1491: + case 1492: + case 1493: + case 1494: + case 1495: + case 1496: + case 1497: + case 1498: + case 1499: + case 1500: + case 1501: + case 1502: + case 1503: + case 1504: + case 1505: + case 1506: + case 1507: + case 1508: + case 1509: + case 1510: + case 1511: + case 1512: + case 1513: + case 1514: + case 1515: + case 1516: + case 1517: + case 1518: + case 1519: + case 1520: + case 1521: + case 1522: + case 1523: + case 1524: + case 1525: + case 1526: + case 1527: + case 1528: + case 1529: + case 1530: + case 1531: + case 1532: + case 1533: + case 1534: + case 1535: + case 1536: + case 1537: + case 1538: + case 1539: + case 1540: + case 1541: + case 1542: + case 1543: + case 1544: + case 1545: + case 1546: + case 1547: + case 1548: + case 1549: + case 1550: + case 1551: + case 1552: + case 1553: + case 1554: + case 1555: + case 1556: + case 1557: + case 1558: + case 1559: + case 1560: + case 1561: + case 1562: + case 1563: + case 1564: + case 1565: + case 1566: + case 1567: + case 1568: + case 1569: + case 1570: + case 1571: + case 1572: + case 1573: + case 1574: + case 1575: + case 1576: + case 1577: + case 1578: + case 1579: + case 1580: + case 1581: + case 1582: + case 1583: + case 1584: + case 1585: + case 1586: + case 1587: + case 1588: + case 1589: + case 1590: + case 1591: + case 1592: + case 1593: + case 1594: + case 1595: + case 1596: + case 1597: + case 1598: + case 1599: + case 1600: + case 1601: + case 1602: + case 1603: + case 1604: + case 1605: + case 1606: + case 1607: + case 1608: + case 1609: + case 1610: + case 1611: + case 1612: + case 1613: + case 1614: + case 1615: + case 1616: + case 1617: + case 1618: + case 1619: + case 1620: + case 1621: + case 1622: + case 1623: + case 1624: + case 1625: + case 1626: + case 1627: + case 1628: + case 1629: + case 1630: + case 1631: + case 1632: + case 1633: + case 1634: + case 1635: + case 1636: + case 1637: + case 1638: + case 1639: + case 1640: + case 1641: + case 1642: + case 1643: + case 1644: + case 1645: + case 1646: + case 1647: + case 1648: + case 1649: + case 1650: + case 1651: + case 1652: + case 1653: + case 1654: + case 1655: + case 1656: + case 1657: + case 1658: + case 1659: + case 1660: + case 1661: + case 1662: + case 1663: + case 1664: + case 1665: + case 1666: + case 1667: + case 1668: + case 1669: + case 1670: + case 1671: + case 1672: + case 1673: + case 1674: + case 1675: + case 1676: + case 1677: + case 1678: + case 1679: + case 1680: + case 1681: + case 1682: + case 1683: + case 1684: + case 1685: + case 1686: + case 1687: + case 1688: + case 1689: + case 1690: + case 1691: + case 1692: + case 1693: + case 1694: + case 1695: + case 1696: + case 1697: + case 1698: + case 1699: + case 1700: + case 1701: + case 1702: + case 1703: + case 1704: + case 1705: + case 1706: + case 1707: + case 1708: + case 1709: + case 1710: + case 1711: + case 1712: + case 1713: + case 1714: + case 1715: + case 1716: + case 1717: + case 1718: + case 1719: + case 1720: + case 1721: + case 1722: + case 1723: + case 1724: + case 1725: + case 1726: + case 1727: + case 1728: + case 1729: + case 1730: + case 1731: + case 1732: + case 1733: + case 1734: + case 1735: + case 1736: + case 1737: + case 1738: + case 1739: + case 1740: + case 1741: + case 1742: + case 1743: + case 1744: + case 1745: + case 1746: + case 1747: + case 1748: + case 1749: + case 1750: + case 1751: + case 1752: + case 1753: + case 1754: + case 1755: + case 1756: + case 1757: + case 1758: + case 1759: + case 1760: + case 1761: + case 1762: + case 1763: + case 1764: + case 1765: + case 1766: + case 1767: + case 1768: + case 1769: + case 1770: + case 1771: + case 1772: + case 1773: + case 1774: + case 1775: + case 1776: + case 1777: + case 1778: + case 1779: + case 1780: + case 1781: + case 1782: + case 1783: + case 1784: + case 1785: + case 1786: + case 1787: + case 1788: + case 1789: + case 1790: + case 1791: + case 1792: + case 1793: + case 1794: + case 1795: + case 1796: + case 1797: + case 1798: + case 1799: + case 1800: + case 1801: + case 1802: + case 1803: + case 1804: + case 1805: + case 1806: + case 1807: + case 1808: + case 1809: + case 1810: + case 1811: + case 1812: + case 1813: + case 1814: + case 1815: + case 1816: + case 1817: + case 1818: + case 1819: + case 1820: + case 1821: + case 1822: + case 1823: + case 1824: + case 1825: + case 1826: + case 1827: + case 1828: + case 1829: + case 1830: + case 1831: + case 1832: + case 1833: + case 1834: + case 1835: + case 1836: + case 1837: + case 1838: + case 1839: + case 1840: + case 1841: + case 1842: + case 1843: + case 1844: + case 1845: + case 1846: + case 1847: + case 1848: + case 1849: + case 1850: + case 1851: + case 1852: + case 1853: + case 1854: + case 1855: + case 1856: + case 1857: + case 1858: + case 1859: + case 1860: + case 1861: + case 1862: + case 1863: + case 1864: + case 1865: + case 1866: + case 1867: + case 1868: + case 1869: + case 1870: + case 1871: + case 1872: + case 1873: + case 1874: + case 1875: + case 1876: + case 1877: + case 1878: + case 1879: + case 1880: + case 1881: + case 1882: + case 1883: + case 1884: + case 1885: + case 1886: + case 1887: + case 1888: + case 1889: + case 1890: + case 1891: + case 1892: + case 1893: + case 1894: + case 1895: + case 1896: + case 1897: + case 1898: + case 1899: + case 1900: + case 1901: + case 1902: + case 1903: + case 1904: + case 1905: + case 1906: + case 1907: + case 1908: + case 1909: + case 1910: + case 1911: + case 1912: + case 1913: + case 1914: + case 1915: + case 1916: + case 1917: + case 1918: + case 1919: + case 1920: + case 1921: + case 1922: + case 1923: + case 1924: + case 1925: + case 1926: + case 1927: + case 1928: + case 1929: + case 1930: + case 1931: + case 1932: + case 1933: + case 1934: + case 1935: + case 1936: + case 1937: + case 1938: + case 1939: + case 1940: + case 1941: + case 1942: + case 1943: + case 1944: + case 1945: + case 1946: + case 1947: + case 1948: + case 1949: + case 1950: + case 1951: + case 1952: + case 1953: + case 1954: + case 1955: + case 1956: + case 1957: + case 1958: + case 1959: + case 1960: + case 1961: + case 1962: + case 1963: + case 1964: + case 1965: + case 1966: + case 1967: + case 1968: + case 1969: + case 1970: + case 1971: + case 1972: + case 1973: + case 1974: + case 1975: + case 1976: + case 1977: + case 1978: + case 1979: + case 1980: + case 1981: + case 1982: + case 1983: + case 1984: + case 1985: + case 1986: + case 1987: + case 1988: + case 1989: + case 1990: + case 1991: + case 1992: + case 1993: + case 1994: + case 1995: + case 1996: + case 1997: + case 1998: + case 1999: + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + case 2010: + case 2011: + case 2012: + case 2013: + case 2014: + case 2015: + case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: + case 2036: + case 2037: + case 2038: + case 2039: + case 2040: + case 2041: + case 2042: + case 2043: + case 2044: + case 2045: + case 2046: + case 2047: + case 2048: + case 2049: + case 2050: + case 2051: + case 2052: + case 2053: + case 2054: + case 2055: + case 2056: + case 2057: + case 2058: + case 2059: + case 2060: + case 2061: + case 2062: + case 2063: + case 2064: + case 2065: + case 2066: + case 2067: + case 2068: + case 2069: + case 2070: + case 2071: + case 2072: + case 2073: + case 2074: + case 2075: + case 2076: + case 2077: + case 2078: + case 2079: + case 2080: + case 2081: + case 2082: + case 2083: + case 2084: + case 2085: + case 2086: + case 2087: + case 2088: + case 2089: + case 2090: + case 2091: + case 2092: + case 2093: + case 2094: + case 2095: + case 2096: + case 2097: + case 2098: + case 2099: + case 2100: + case 2101: + case 2102: + case 2103: + case 2104: + case 2105: + case 2106: + case 2107: + case 2108: + case 2109: + case 2110: + case 2111: + case 2112: + case 2113: + case 2114: + case 2115: + case 2116: + case 2117: + case 2118: + case 2119: + case 2120: + case 2121: + case 2122: + case 2123: + case 2124: + case 2125: + case 2126: + case 2127: + case 2128: + case 2129: + case 2130: + case 2131: + case 2132: + case 2133: + case 2134: + case 2135: + case 2136: + case 2137: + case 2138: + case 2139: + case 2140: + case 2141: + case 2142: + case 2143: + case 2144: + case 2145: + case 2146: + case 2147: + case 2148: + case 2149: + case 2150: + case 2151: + case 2152: + case 2153: + case 2154: + case 2155: + case 2156: + case 2157: + case 2158: + case 2159: + case 2160: + case 2161: + case 2162: + case 2163: + case 2164: + case 2165: + case 2166: + case 2167: + case 2168: + case 2169: + case 2170: + case 2171: + case 2172: + case 2173: + case 2174: + case 2175: + case 2176: + case 2177: + case 2178: + case 2179: + case 2180: + case 2181: + case 2182: + case 2183: + case 2184: + case 2185: + case 2186: + case 2187: + case 2188: + case 2189: + case 2190: + case 2191: + case 2192: + case 2193: + case 2194: + case 2195: + case 2196: + case 2197: + case 2198: + case 2199: + case 2200: + case 2201: + case 2202: + case 2203: + case 2204: + case 2205: + case 2206: + case 2207: + case 2208: + case 2209: + case 2210: + case 2211: + case 2212: + case 2213: + case 2214: + case 2215: + case 2216: + case 2217: + case 2218: + case 2219: + case 2220: + case 2221: + case 2222: + case 2223: + case 2224: + case 2225: + case 2226: + case 2227: + case 2228: + case 2229: + case 2230: + case 2231: + case 2232: + case 2233: + case 2234: + case 2235: + case 2236: + case 2237: + case 2238: + case 2239: + case 2240: + case 2241: + case 2242: + case 2243: + case 2244: + case 2245: + case 2246: + case 2247: + case 2248: + case 2249: + case 2250: + case 2251: + case 2252: + case 2253: + case 2254: + case 2255: + case 2256: + case 2257: + case 2258: + case 2259: + case 2260: + case 2261: + case 2262: + case 2263: + case 2264: + case 2265: + case 2266: + case 2267: + case 2268: + case 2269: + case 2270: + case 2271: + case 2272: + case 2273: + case 2274: + case 2275: + case 2276: + case 2277: + case 2278: + case 2279: + case 2280: + case 2281: + case 2282: + case 2283: + case 2284: + case 2285: + case 2286: + case 2287: + case 2288: + case 2289: + case 2290: + case 2291: + case 2292: + case 2293: + case 2294: + case 2295: + case 2296: + case 2297: + case 2298: + case 2299: + case 2300: + case 2301: + case 2302: + case 2303: + case 2304: + case 2305: + case 2306: + case 2307: + case 2308: + case 2309: + case 2310: + case 2311: + case 2312: + case 2313: + case 2314: + case 2315: + case 2316: + case 2317: + case 2318: + case 2319: + case 2320: + case 2321: + case 2322: + case 2323: + case 2324: + case 2325: + case 2326: + case 2327: + case 2328: + case 2329: + case 2330: + case 2331: + case 2332: + case 2333: + case 2334: + case 2335: + case 2336: + case 2337: + case 2338: + case 2339: + case 2340: + case 2341: + case 2342: + case 2343: + case 2344: + case 2345: + case 2346: + case 2347: + case 2348: + case 2349: + case 2350: + case 2351: + case 2352: + case 2353: + case 2354: + case 2355: + case 2356: + case 2357: + case 2358: + case 2359: + case 2360: + case 2361: + case 2362: + case 2363: + case 2364: + case 2365: + case 2366: + case 2367: + case 2368: + case 2369: + case 2370: + case 2371: + case 2372: + case 2373: + case 2374: + case 2375: + case 2376: + case 2377: + case 2378: + case 2379: + case 2380: + case 2381: + case 2382: + case 2383: + case 2384: + case 2385: + case 2386: + case 2387: + case 2388: + case 2389: + case 2390: + case 2391: + case 2392: + case 2393: + case 2394: + case 2395: + case 2396: + case 2397: + case 2398: + case 2399: + case 2400: + case 2401: + case 2402: + case 2403: + case 2404: + case 2405: + case 2406: + case 2407: + case 2408: + case 2409: + case 2410: + case 2411: + case 2412: + case 2413: + case 2414: + case 2415: + case 2416: + case 2417: + case 2418: + case 2419: + case 2420: + case 2421: + case 2422: + case 2423: + case 2424: + case 2425: + case 2426: + case 2427: + case 2428: + case 2429: + case 2430: + case 2431: + case 2432: + case 2433: + case 2434: + case 2435: + case 2436: + case 2437: + case 2438: + case 2439: + case 2440: + case 2441: + case 2442: + case 2443: + case 2444: + case 2445: + case 2446: + case 2447: + case 2448: + case 2449: + case 2450: + case 2451: + case 2452: + case 2453: + case 2454: + case 2455: + case 2456: + case 2457: + case 2458: + case 2459: + case 2460: + case 2461: + case 2462: + case 2463: + case 2464: + case 2465: + case 2466: + case 2467: + case 2468: + case 2469: + case 2470: + case 2471: + case 2472: + case 2473: + case 2474: + case 2475: + case 2476: + case 2477: + case 2478: + case 2479: + case 2480: + case 2481: + case 2482: + case 2483: + case 2484: + case 2485: + case 2486: + case 2487: + case 2488: + case 2489: + case 2490: + case 2491: + case 2492: + case 2493: + case 2494: + case 2495: + case 2496: + case 2497: + case 2498: + case 2499: + case 2500: + case 2501: + case 2502: + case 2503: + case 2504: + case 2505: + case 2506: + case 2507: + case 2508: + case 2509: + case 2510: + case 2511: + case 2512: + case 2513: + case 2514: + case 2515: + case 2516: + case 2517: + case 2518: + case 2519: + case 2520: + case 2521: + case 2522: + case 2523: + case 2524: + case 2525: + case 2526: + case 2527: + case 2528: + case 2529: + case 2530: + case 2531: + case 2532: + case 2533: + case 2534: + case 2535: + case 2536: + case 2537: + case 2538: + case 2539: + case 2540: + case 2541: + case 2542: + case 2543: + case 2544: + case 2545: + case 2546: + case 2547: + case 2548: + case 2549: + case 2550: + case 2551: + case 2552: + case 2553: + case 2554: + case 2555: + case 2556: + case 2557: + case 2558: + case 2559: + case 2560: + case 2561: + case 2562: + case 2563: + case 2564: + case 2565: + case 2566: + case 2567: + case 2568: + case 2569: + case 2570: + case 2571: + case 2572: + case 2573: + case 2574: + case 2575: + case 2576: + case 2577: + case 2578: + case 2579: + case 2580: + case 2581: + case 2582: + case 2583: + case 2584: + case 2585: + case 2586: + case 2587: + case 2588: + case 2589: + case 2590: + case 2591: + case 2592: + case 2593: + case 2594: + case 2595: + case 2596: + case 2597: + case 2598: + case 2599: + case 2600: + case 2601: + case 2602: + case 2603: + case 2604: + case 2605: + case 2606: + case 2607: + case 2608: + case 2609: + case 2610: + case 2611: + case 2612: + case 2613: + case 2614: + case 2615: + case 2616: + case 2617: + case 2618: + case 2619: + case 2620: + case 2621: + case 2622: + case 2623: + case 2624: + case 2625: + case 2626: + case 2627: + case 2628: + case 2629: + case 2630: + case 2631: + case 2632: + case 2633: + case 2634: + case 2635: + case 2636: + case 2637: + case 2638: + case 2639: + case 2640: + case 2641: + case 2642: + case 2643: + case 2644: + case 2645: + case 2646: + case 2647: + case 2648: + case 2649: + case 2650: + case 2651: + case 2652: + case 2653: + case 2654: + case 2655: + case 2656: + case 2657: + case 2658: + case 2659: + case 2660: + case 2661: + case 2662: + case 2663: + case 2664: + case 2665: + case 2666: + case 2667: + case 2668: + case 2669: + case 2670: + case 2671: + case 2672: + case 2673: + case 2674: + case 2675: + case 2676: + case 2677: + case 2678: + case 2679: + case 2680: + case 2681: + case 2682: + case 2683: + case 2684: + case 2685: + case 2686: + case 2687: + case 2688: + case 2689: + case 2690: + case 2691: + case 2692: + case 2693: + case 2694: + case 2695: + case 2696: + case 2697: + case 2698: + case 2699: + case 2700: + case 2701: + case 2702: + case 2703: + case 2704: + case 2705: + case 2706: + case 2707: + case 2708: + case 2709: + case 2710: + case 2711: + case 2712: + case 2713: + case 2714: + case 2715: + case 2716: + case 2717: + case 2718: + case 2719: + case 2720: + case 2721: + case 2722: + case 2723: + case 2724: + case 2725: + case 2726: + case 2727: + case 2728: + case 2729: + case 2730: + case 2731: + case 2732: + case 2733: + case 2734: + case 2735: + case 2736: + case 2737: + case 2738: + case 2739: + case 2740: + case 2741: + case 2742: + case 2743: + case 2744: + case 2745: + case 2746: + case 2747: + case 2748: + case 2749: + case 2750: + case 2751: + case 2752: + case 2753: + case 2754: + case 2755: + case 2756: + case 2757: + case 2758: + case 2759: + case 2760: + case 2761: + case 2762: + case 2763: + case 2764: + case 2765: + case 2766: + case 2767: + case 2768: + case 2769: + case 2770: + case 2771: + case 2772: + case 2773: + case 2774: + case 2775: + case 2776: + case 2777: + case 2778: + case 2779: + case 2780: + case 2781: + case 2782: + case 2783: + case 2784: + case 2785: + case 2786: + case 2787: + case 2788: + case 2789: + case 2790: + case 2791: + case 2792: + case 2793: + case 2794: + case 2795: + case 2796: + case 2797: + case 2798: + case 2799: + case 2800: + case 2801: + case 2802: + case 2803: + case 2804: + case 2805: + case 2806: + case 2807: + case 2808: + case 2809: + case 2810: + case 2811: + case 2812: + case 2813: + case 2814: + case 2815: + case 2816: + case 2817: + case 2818: + case 2819: + case 2820: + case 2821: + case 2822: + case 2823: + case 2824: + case 2825: + case 2826: + case 2827: + case 2828: + case 2829: + case 2830: + case 2831: + case 2832: + case 2833: + case 2834: + case 2835: + case 2836: + case 2837: + case 2838: + case 2839: + case 2840: + case 2841: + case 2842: + case 2843: + case 2844: + case 2845: + case 2846: + case 2847: + case 2848: + case 2849: + case 2850: + case 2851: + case 2852: + case 2853: + case 2854: + case 2855: + case 2856: + case 2857: + case 2858: + case 2859: + case 2860: + case 2861: + case 2862: + case 2863: + case 2864: + case 2865: + case 2866: + case 2867: + case 2868: + case 2869: + case 2870: + case 2871: + case 2872: + case 2873: + case 2874: + case 2875: + case 2876: + case 2877: + case 2878: + case 2879: + case 2880: + case 2881: + case 2882: + case 2883: + case 2884: + case 2885: + case 2886: + case 2887: + case 2888: + case 2889: + case 2890: + case 2891: + case 2892: + case 2893: + case 2894: + case 2895: + case 2896: + case 2897: + case 2898: + case 2899: + case 2900: + case 2901: + case 2902: + case 2903: + case 2904: + case 2905: + case 2906: + case 2907: + case 2908: + case 2909: + case 2910: + case 2911: + case 2912: + case 2913: + case 2914: + case 2915: + case 2916: + case 2917: + case 2918: + case 2919: + case 2920: + case 2921: + case 2922: + case 2923: + case 2924: + case 2925: + case 2926: + case 2927: + case 2928: + case 2929: + case 2930: + case 2931: + case 2932: + case 2933: + case 2934: + case 2935: + case 2936: + case 2937: + case 2938: + case 2939: + case 2940: + case 2941: + case 2942: + case 2943: + case 2944: + case 2945: + case 2946: + case 2947: + case 2948: + case 2949: + case 2950: + case 2951: + case 2952: + case 2953: + case 2954: + case 2955: + case 2956: + case 2957: + case 2958: + case 2959: + case 2960: + case 2961: + case 2962: + case 2963: + case 2964: + case 2965: + case 2966: + case 2967: + case 2968: + case 2969: + case 2970: + case 2971: + case 2972: + case 2973: + case 2974: + case 2975: + case 2976: + case 2977: + case 2978: + case 2979: + case 2980: + case 2981: + case 2982: + case 2983: + case 2984: + case 2985: + case 2986: + case 2987: + case 2988: + case 2989: + case 2990: + case 2991: + case 2992: + case 2993: + case 2994: + case 2995: + case 2996: + case 2997: + case 2998: + case 2999: + case 3000: + case 3001: + case 3002: + case 3003: + case 3004: + case 3005: + case 3006: + case 3007: + case 3008: + case 3009: + case 3010: + case 3011: + case 3012: + case 3013: + case 3014: + case 3015: + case 3016: + case 3017: + case 3018: + case 3019: + case 3020: + case 3021: + case 3022: + case 3023: + case 3024: + case 3025: + case 3026: + case 3027: + case 3028: + case 3029: + case 3030: + case 3031: + case 3032: + case 3033: + case 3034: + case 3035: + case 3036: + case 3037: + case 3038: + case 3039: + case 3040: + case 3041: + case 3042: + case 3043: + case 3044: + case 3045: + case 3046: + case 3047: + case 3048: + case 3049: + case 3050: + case 3051: + case 3052: + case 3053: + case 3054: + case 3055: + case 3056: + case 3057: + case 3058: + case 3059: + case 3060: + case 3061: + case 3062: + case 3063: + case 3064: + case 3065: + case 3066: + case 3067: + case 3068: + case 3069: + case 3070: + case 3071: + case 3072: + case 3073: + case 3074: + case 3075: + case 3076: + case 3077: + case 3078: + case 3079: + case 3080: + case 3081: + case 3082: + case 3083: + case 3084: + case 3085: + case 3086: + case 3087: + case 3088: + case 3089: + case 3090: + case 3091: + case 3092: + case 3093: + case 3094: + case 3095: + case 3096: + case 3097: + case 3098: + case 3099: + case 3100: + case 3101: + case 3102: + case 3103: + case 3104: + case 3105: + case 3106: + case 3107: + case 3108: + case 3109: + case 3110: + case 3111: + case 3112: + case 3113: + case 3114: + case 3115: + case 3116: + case 3117: + case 3118: + case 3119: + case 3120: + case 3121: + case 3122: + case 3123: + case 3124: + case 3125: + case 3126: + case 3127: + case 3128: + case 3129: + case 3130: + case 3131: + case 3132: + case 3133: + case 3134: + case 3135: + case 3136: + case 3137: + case 3138: + case 3139: + case 3140: + case 3141: + case 3142: + case 3143: + case 3144: + case 3145: + case 3146: + case 3147: + case 3148: + case 3149: + case 3150: + case 3151: + case 3152: + case 3153: + case 3154: + case 3155: + case 3156: + case 3157: + case 3158: + case 3159: + case 3160: + case 3161: + case 3162: + case 3163: + case 3164: + case 3165: + case 3166: + case 3167: + case 3168: + case 3169: + case 3170: + case 3171: + case 3172: + case 3173: + case 3174: + case 3175: + case 3176: + case 3177: + case 3178: + case 3179: + case 3180: + case 3181: + case 3182: + case 3183: + case 3184: + case 3185: + case 3186: + case 3187: + case 3188: + case 3189: + case 3190: + case 3191: + case 3192: + case 3193: + case 3194: + case 3195: + case 3196: + case 3197: + case 3198: + case 3199: + case 3200: + case 3201: + case 3202: + case 3203: + case 3204: + case 3205: + case 3206: + case 3207: + case 3208: + case 3209: + case 3210: + case 3211: + case 3212: + case 3213: + case 3214: + case 3215: + case 3216: + case 3217: + case 3218: + case 3219: + case 3220: + case 3221: + case 3222: + case 3223: + case 3224: + case 3225: + case 3226: + case 3227: + case 3228: + case 3229: + case 3230: + case 3231: + case 3232: + case 3233: + case 3234: + case 3235: + case 3236: + case 3237: + case 3238: + case 3239: + case 3240: + case 3241: + case 3242: + case 3243: + case 3244: + case 3245: + case 3246: + case 3247: + case 3248: + case 3249: + case 3250: + case 3251: + case 3252: + case 3253: + case 3254: + case 3255: + case 3256: + case 3257: + case 3258: + case 3259: + case 3260: + case 3261: + case 3262: + case 3263: + case 3264: + case 3265: + case 3266: + case 3267: + case 3268: + case 3269: + case 3270: + case 3271: + case 3272: + case 3273: + case 3274: + case 3275: + case 3276: + case 3277: + case 3278: + case 3279: + case 3280: + case 3281: + case 3282: + case 3283: + case 3284: + case 3285: + case 3286: + case 3287: + case 3288: + case 3289: + case 3290: + case 3291: + case 3292: + case 3293: + case 3294: + case 3295: + case 3296: + case 3297: + case 3298: + case 3299: + case 3300: + case 3301: + case 3302: + case 3303: + case 3304: + case 3305: + case 3306: + case 3307: + case 3308: + case 3309: + case 3310: + case 3311: + case 3312: + case 3313: + case 3314: + case 3315: + case 3316: + case 3317: + case 3318: + case 3319: + case 3320: + case 3321: + case 3322: + case 3323: + case 3324: + case 3325: + case 3326: + case 3327: + case 3328: + case 3329: + case 3330: + case 3331: + case 3332: + case 3333: + case 3334: + case 3335: + case 3336: + case 3337: + case 3338: + case 3339: + case 3340: + case 3341: + case 3342: + case 3343: + case 3344: + case 3345: + case 3346: + case 3347: + case 3348: + case 3349: + case 3350: + case 3351: + case 3352: + case 3353: + case 3354: + case 3355: + case 3356: + case 3357: + case 3358: + case 3359: + case 3360: + case 3361: + case 3362: + case 3363: + case 3364: + case 3365: + case 3366: + case 3367: + case 3368: + case 3369: + case 3370: + case 3371: + case 3372: + case 3373: + case 3374: + case 3375: + case 3376: + case 3377: + case 3378: + case 3379: + case 3380: + case 3381: + case 3382: + case 3383: + case 3384: + case 3385: + case 3386: + case 3387: + case 3388: + case 3389: + case 3390: + case 3391: + case 3392: + case 3393: + case 3394: + case 3395: + case 3396: + case 3397: + case 3398: + case 3399: + case 3400: + case 3401: + case 3402: + case 3403: + case 3404: + case 3405: + case 3406: + case 3407: + case 3408: + case 3409: + case 3410: + case 3411: + case 3412: + case 3413: + case 3414: + case 3415: + case 3416: + case 3417: + case 3418: + case 3419: + case 3420: + case 3421: + case 3422: + case 3423: + case 3424: + case 3425: + case 3426: + case 3427: + case 3428: + case 3429: + case 3430: + case 3431: + case 3432: + case 3433: + case 3434: + case 3435: + case 3436: + case 3437: + case 3438: + case 3439: + case 3440: + case 3441: + case 3442: + case 3443: + case 3444: + case 3445: + case 3446: + case 3447: + case 3448: + case 3449: + case 3450: + case 3451: + case 3452: + case 3453: + case 3454: + case 3455: + case 3456: + case 3457: + case 3458: + case 3459: + case 3460: + case 3461: + case 3462: + case 3463: + case 3464: + case 3465: + case 3466: + case 3467: + case 3468: + case 3469: + case 3470: + case 3471: + case 3472: + case 3473: + case 3474: + case 3475: + case 3476: + case 3477: + case 3478: + case 3479: + case 3480: + case 3481: + case 3482: + case 3483: + case 3484: + case 3485: + case 3486: + case 3487: + case 3488: + case 3489: + case 3490: + case 3491: + case 3492: + case 3493: + case 3494: + case 3495: + case 3496: + case 3497: + case 3498: + case 3499: + case 3500: + case 3501: + case 3502: + case 3503: + case 3504: + case 3505: + case 3506: + case 3507: + case 3508: + case 3509: + case 3510: + case 3511: + case 3512: + case 3513: + case 3514: + case 3515: + case 3516: + case 3517: + case 3518: + case 3519: + case 3520: + case 3521: + case 3522: + case 3523: + case 3524: + case 3525: + case 3526: + case 3527: + case 3528: + case 3529: + case 3530: + case 3531: + case 3532: + case 3533: + case 3534: + case 3535: + case 3536: + case 3537: + case 3538: + case 3539: + case 3540: + case 3541: + case 3542: + case 3543: + case 3544: + case 3545: + case 3546: + case 3547: + case 3548: + case 3549: + case 3550: + case 3551: + case 3552: + case 3553: + case 3554: + case 3555: + case 3556: + case 3557: + case 3558: + case 3559: + case 3560: + case 3561: + case 3562: + case 3563: + case 3564: + case 3565: + case 3566: + case 3567: + case 3568: + case 3569: + case 3570: + case 3571: + case 3572: + case 3573: + case 3574: + case 3575: + case 3576: + case 3577: + case 3578: + case 3579: + case 3580: + case 3581: + case 3582: + case 3583: + case 3584: + case 3585: + case 3586: + case 3587: + case 3588: + case 3589: + case 3590: + case 3591: + case 3592: + case 3593: + case 3594: + case 3595: + case 3596: + case 3597: + case 3598: + case 3599: + case 3600: + case 3601: + case 3602: + case 3603: + case 3604: + case 3605: + case 3606: + case 3607: + case 3608: + case 3609: + case 3610: + case 3611: + case 3612: + case 3613: + case 3614: + case 3615: + case 3616: + case 3617: + case 3618: + case 3619: + case 3620: + case 3621: + case 3622: + case 3623: + case 3624: + case 3625: + case 3626: + case 3627: + case 3628: + case 3629: + case 3630: + case 3631: + case 3632: + case 3633: + case 3634: + case 3635: + case 3636: + case 3637: + case 3638: + case 3639: + case 3640: + case 3641: + case 3642: + case 3643: + case 3644: + case 3645: + case 3646: + case 3647: + case 3648: + case 3649: + case 3650: + case 3651: + case 3652: + case 3653: + case 3654: + case 3655: + case 3656: + case 3657: + case 3658: + case 3659: + case 3660: + case 3661: + case 3662: + case 3663: + case 3664: + case 3665: + case 3666: + case 3667: + case 3668: + case 3669: + case 3670: + case 3671: + case 3672: + case 3673: + case 3674: + case 3675: + case 3676: + case 3677: + case 3678: + case 3679: + case 3680: + case 3681: + case 3682: + case 3683: + case 3684: + case 3685: + case 3686: + case 3687: + case 3688: + case 3689: + case 3690: + case 3691: + case 3692: + case 3693: + case 3694: + case 3695: + case 3696: + case 3697: + case 3698: + case 3699: + case 3700: + case 3701: + case 3702: + case 3703: + case 3704: + case 3705: + case 3706: + case 3707: + case 3708: + case 3709: + case 3710: + case 3711: + case 3712: + case 3713: + case 3714: + case 3715: + case 3716: + case 3717: + case 3718: + case 3719: + case 3720: + case 3721: + case 3722: + case 3723: + case 3724: + case 3725: + case 3726: + case 3727: + case 3728: + case 3729: + case 3730: + case 3731: + case 3732: + case 3733: + case 3734: + case 3735: + case 3736: + case 3737: + case 3738: + case 3739: + case 3740: + case 3741: + case 3742: + case 3743: + case 3744: + case 3745: + case 3746: + case 3747: + case 3748: + case 3749: + case 3750: + case 3751: + case 3752: + case 3753: + case 3754: + case 3755: + case 3756: + case 3757: + case 3758: + case 3759: + case 3760: + case 3761: + case 3762: + case 3763: + case 3764: + case 3765: + case 3766: + case 3767: + case 3768: + case 3769: + case 3770: + case 3771: + case 3772: + case 3773: + case 3774: + case 3775: + case 3776: + case 3777: + case 3778: + case 3779: + case 3780: + case 3781: + case 3782: + case 3783: + case 3784: + case 3785: + case 3786: + case 3787: + case 3788: + case 3789: + case 3790: + case 3791: + case 3792: + case 3793: + case 3794: + case 3795: + case 3796: + case 3797: + case 3798: + case 3799: + case 3800: + case 3801: + case 3802: + case 3803: + case 3804: + case 3805: + case 3806: + case 3807: + case 3808: + case 3809: + case 3810: + case 3811: + case 3812: + case 3813: + case 3814: + case 3815: + case 3816: + case 3817: + case 3818: + case 3819: + case 3820: + case 3821: + case 3822: + case 3823: + case 3824: + case 3825: + case 3826: + case 3827: + case 3828: + case 3829: + case 3830: + case 3831: + case 3832: + case 3833: + case 3834: + case 3835: + case 3836: + case 3837: + case 3838: + case 3839: + case 3840: + case 3841: + case 3842: + case 3843: + case 3844: + case 3845: + case 3846: + case 3847: + case 3848: + case 3849: + case 3850: + case 3851: + case 3852: + case 3853: + case 3854: + case 3855: + case 3856: + case 3857: + case 3858: + case 3859: + case 3860: + case 3861: + case 3862: + case 3863: + case 3864: + case 3865: + case 3866: + case 3867: + case 3868: + case 3869: + case 3870: + case 3871: + case 3872: + case 3873: + case 3874: + case 3875: + case 3876: + case 3877: + case 3878: + case 3879: + case 3880: + case 3881: + case 3882: + case 3883: + case 3884: + case 3885: + case 3886: + case 3887: + case 3888: + case 3889: + case 3890: + case 3891: + case 3892: + case 3893: + case 3894: + case 3895: + case 3896: + case 3897: + case 3898: + case 3899: + case 3900: + case 3901: + case 3902: + case 3903: + case 3904: + case 3905: + case 3906: + case 3907: + case 3908: + case 3909: + case 3910: + case 3911: + case 3912: + case 3913: + case 3914: + case 3915: + case 3916: + case 3917: + case 3918: + case 3919: + case 3920: + case 3921: + case 3922: + case 3923: + case 3924: + case 3925: + case 3926: + case 3927: + case 3928: + case 3929: + case 3930: + case 3931: + case 3932: + case 3933: + case 3934: + case 3935: + case 3936: + case 3937: + case 3938: + case 3939: + case 3940: + case 3941: + case 3942: + case 3943: + case 3944: + case 3945: + case 3946: + case 3947: + case 3948: + case 3949: + case 3950: + case 3951: + case 3952: + case 3953: + case 3954: + case 3955: + case 3956: + case 3957: + case 3958: + case 3959: + case 3960: + case 3961: + case 3962: + case 3963: + case 3964: + case 3965: + case 3966: + case 3967: + case 3968: + case 3969: + case 3970: + case 3971: + case 3972: + case 3973: + case 3974: + case 3975: + case 3976: + case 3977: + case 3978: + case 3979: + case 3980: + case 3981: + case 3982: + case 3983: + case 3984: + case 3985: + case 3986: + case 3987: + case 3988: + case 3989: + case 3990: + case 3991: + case 3992: + case 3993: + case 3994: + case 3995: + case 3996: + case 3997: + case 3998: + case 3999: + case 4000: + case 4001: + case 4002: + case 4003: + case 4004: + case 4005: + case 4006: + case 4007: + case 4008: + case 4009: + case 4010: + case 4011: + case 4012: + case 4013: + case 4014: + case 4015: + case 4016: + case 4017: + case 4018: + case 4019: + case 4020: + case 4021: + case 4022: + case 4023: + case 4024: + case 4025: + case 4026: + case 4027: + case 4028: + case 4029: + case 4030: + case 4031: + case 4032: + case 4033: + case 4034: + case 4035: + case 4036: + case 4037: + case 4038: + case 4039: + case 4040: + case 4041: + case 4042: + case 4043: + case 4044: + case 4045: + case 4046: + case 4047: + case 4048: + case 4049: + case 4050: + case 4051: + case 4052: + case 4053: + case 4054: + case 4055: + case 4056: + case 4057: + case 4058: + case 4059: + case 4060: + case 4061: + case 4062: + case 4063: + case 4064: + case 4065: + case 4066: + case 4067: + case 4068: + case 4069: + case 4070: + case 4071: + case 4072: + case 4073: + case 4074: + case 4075: + case 4076: + case 4077: + case 4078: + case 4079: + case 4080: + case 4081: + case 4082: + case 4083: + case 4084: + case 4085: + case 4086: + case 4087: + case 4088: + case 4089: + case 4090: + case 4091: + case 4092: + case 4093: + case 4094: + case 4095: + case 4096: + case 4097: + case 4098: + case 4099: + case 4100: + case 4101: + case 4102: + case 4103: + case 4104: + case 4105: + case 4106: + case 4107: + case 4108: + case 4109: + case 4110: + case 4111: + case 4112: + case 4113: + case 4114: + case 4115: + case 4116: + case 4117: + case 4118: + case 4119: + case 4120: + case 4121: + case 4122: + case 4123: + case 4124: + case 4125: + case 4126: + case 4127: + case 4128: + case 4129: + case 4130: + case 4131: + case 4132: + case 4133: + case 4134: + case 4135: + case 4136: + case 4137: + case 4138: + case 4139: + case 4140: + case 4141: + case 4142: + case 4143: + case 4144: + case 4145: + case 4146: + case 4147: + case 4148: + case 4149: + case 4150: + case 4151: + case 4152: + case 4153: + case 4154: + case 4155: + case 4156: + case 4157: + case 4158: + case 4159: + case 4160: + case 4161: + case 4162: + case 4163: + case 4164: + case 4165: + case 4166: + case 4167: + case 4168: + case 4169: + case 4170: + case 4171: + case 4172: + case 4173: + case 4174: + case 4175: + case 4176: + case 4177: + case 4178: + case 4179: + case 4180: + case 4181: + case 4182: + case 4183: + case 4184: + case 4185: + case 4186: + case 4187: + case 4188: + case 4189: + case 4190: + case 4191: + case 4192: + case 4193: + case 4194: + case 4195: + case 4196: + case 4197: + case 4198: + case 4199: + case 4200: + case 4201: + case 4202: + case 4203: + case 4204: + case 4205: + case 4206: + case 4207: + case 4208: + case 4209: + case 4210: + case 4211: + case 4212: + case 4213: + case 4214: + case 4215: + case 4216: + case 4217: + case 4218: + case 4219: + case 4220: + case 4221: + case 4222: + case 4223: + case 4224: + case 4225: + case 4226: + case 4227: + case 4228: + case 4229: + case 4230: + case 4231: + case 4232: + case 4233: + case 4234: + case 4235: + case 4236: + case 4237: + case 4238: + case 4239: + case 4240: + case 4241: + case 4242: + case 4243: + case 4244: + case 4245: + case 4246: + case 4247: + case 4248: + case 4249: + case 4250: + case 4251: + case 4252: + case 4253: + case 4254: + case 4255: + case 4256: + case 4257: + case 4258: + case 4259: + case 4260: + case 4261: + case 4262: + case 4263: + case 4264: + case 4265: + case 4266: + case 4267: + case 4268: + case 4269: + case 4270: + case 4271: + case 4272: + case 4273: + case 4274: + case 4275: + case 4276: + case 4277: + case 4278: + case 4279: + case 4280: + case 4281: + case 4282: + case 4283: + case 4284: + case 4285: + case 4286: + case 4287: + case 4288: + case 4289: + case 4290: + case 4291: + case 4292: + case 4293: + case 4294: + case 4295: + case 4296: + case 4297: + case 4298: + case 4299: + case 4300: + case 4301: + case 4302: + case 4303: + case 4304: + case 4305: + case 4306: + case 4307: + case 4308: + case 4309: + case 4310: + case 4311: + case 4312: + case 4313: + case 4314: + case 4315: + case 4316: + case 4317: + case 4318: + case 4319: + case 4320: + case 4321: + case 4322: + case 4323: + case 4324: + case 4325: + case 4326: + case 4327: + case 4328: + case 4329: + case 4330: + case 4331: + case 4332: + case 4333: + case 4334: + case 4335: + case 4336: + case 4337: + case 4338: + case 4339: + case 4340: + case 4341: + case 4342: + case 4343: + case 4344: + case 4345: + case 4346: + case 4347: + case 4348: + case 4349: + case 4350: + case 4351: + case 4352: + case 4353: + case 4354: + case 4355: + case 4356: + case 4357: + case 4358: + case 4359: + case 4360: + case 4361: + case 4362: + case 4363: + case 4364: + case 4365: + case 4366: + case 4367: + case 4368: + case 4369: + case 4370: + case 4371: + case 4372: + case 4373: + case 4374: + case 4375: + case 4376: + case 4377: + case 4378: + case 4379: + case 4380: + case 4381: + case 4382: + case 4383: + case 4384: + case 4385: + case 4386: + case 4387: + case 4388: + case 4389: + case 4390: + case 4391: + case 4392: + case 4393: + case 4394: + case 4395: + case 4396: + case 4397: + case 4398: + case 4399: + case 4400: + case 4401: + case 4402: + case 4403: + case 4404: + case 4405: + case 4406: + case 4407: + case 4408: + case 4409: + case 4410: + case 4411: + case 4412: + case 4413: + case 4414: + case 4415: + case 4416: + case 4417: + case 4418: + case 4419: + case 4420: + case 4421: + case 4422: + case 4423: + case 4424: + case 4425: + case 4426: + case 4427: + case 4428: + case 4429: + case 4430: + case 4431: + case 4432: + case 4433: + case 4434: + case 4435: + case 4436: + case 4437: + case 4438: + case 4439: + case 4440: + case 4441: + case 4442: + case 4443: + case 4444: + case 4445: + case 4446: + case 4447: + case 4448: + case 4449: + case 4450: + case 4451: + case 4452: + case 4453: + case 4454: + case 4455: + case 4456: + case 4457: + case 4458: + case 4459: + case 4460: + case 4461: + case 4462: + case 4463: + case 4464: + case 4465: + case 4466: + case 4467: + case 4468: + case 4469: + case 4470: + case 4471: + case 4472: + case 4473: + case 4474: + case 4475: + case 4476: + case 4477: + case 4478: + case 4479: + case 4480: + case 4481: + case 4482: + case 4483: + case 4484: + case 4485: + case 4486: + case 4487: + case 4488: + case 4489: + case 4490: + case 4491: + case 4492: + case 4493: + case 4494: + case 4495: + case 4496: + case 4497: + case 4498: + case 4499: + case 4500: + case 4501: + case 4502: + case 4503: + case 4504: + case 4505: + case 4506: + case 4507: + case 4508: + case 4509: + case 4510: + case 4511: + case 4512: + case 4513: + case 4514: + case 4515: + case 4516: + case 4517: + case 4518: + case 4519: + case 4520: + case 4521: + case 4522: + case 4523: + case 4524: + case 4525: + case 4526: + case 4527: + case 4528: + case 4529: + case 4530: + case 4531: + case 4532: + case 4533: + case 4534: + case 4535: + case 4536: + case 4537: + case 4538: + case 4539: + case 4540: + case 4541: + case 4542: + case 4543: + case 4544: + case 4545: + case 4546: + case 4547: + case 4548: + case 4549: + case 4550: + case 4551: + case 4552: + case 4553: + case 4554: + case 4555: + case 4556: + case 4557: + case 4558: + case 4559: + case 4560: + case 4561: + case 4562: + case 4563: + case 4564: + case 4565: + case 4566: + case 4567: + case 4568: + case 4569: + case 4570: + case 4571: + case 4572: + case 4573: + case 4574: + case 4575: + case 4576: + case 4577: + case 4578: + case 4579: + case 4580: + case 4581: + case 4582: + case 4583: + case 4584: + case 4585: + case 4586: + case 4587: + case 4588: + case 4589: + case 4590: + case 4591: + case 4592: + case 4593: + case 4594: + case 4595: + case 4596: + case 4597: + case 4598: + case 4599: + case 4600: + case 4601: + case 4602: + case 4603: + case 4604: + case 4605: + case 4606: + case 4607: + case 4608: + case 4609: + case 4610: + case 4611: + case 4612: + case 4613: + case 4614: + case 4615: + case 4616: + case 4617: + case 4618: + case 4619: + case 4620: + case 4621: + case 4622: + case 4623: + case 4624: + case 4625: + case 4626: + case 4627: + case 4628: + case 4629: + case 4630: + case 4631: + case 4632: + case 4633: + case 4634: + case 4635: + case 4636: + case 4637: + case 4638: + case 4639: + case 4640: + case 4641: + case 4642: + case 4643: + case 4644: + case 4645: + case 4646: + case 4647: + case 4648: + case 4649: + case 4650: + case 4651: + case 4652: + case 4653: + case 4654: + case 4655: + case 4656: + case 4657: + case 4658: + case 4659: + case 4660: + case 4661: + case 4662: + case 4663: + case 4664: + case 4665: + case 4666: + case 4667: + case 4668: + case 4669: + case 4670: + case 4671: + case 4672: + case 4673: + case 4674: + case 4675: + case 4676: + case 4677: + case 4678: + case 4679: + case 4680: + case 4681: + case 4682: + case 4683: + case 4684: + case 4685: + case 4686: + case 4687: + case 4688: + case 4689: + case 4690: + case 4691: + case 4692: + case 4693: + case 4694: + case 4695: + case 4696: + case 4697: + case 4698: + case 4699: + case 4700: + case 4701: + case 4702: + case 4703: + case 4704: + case 4705: + case 4706: + case 4707: + case 4708: + case 4709: + case 4710: + case 4711: + case 4712: + case 4713: + case 4714: + case 4715: + case 4716: + case 4717: + case 4718: + case 4719: + case 4720: + case 4721: + case 4722: + case 4723: + case 4724: + case 4725: + case 4726: + case 4727: + case 4728: + case 4729: + case 4730: + case 4731: + case 4732: + case 4733: + case 4734: + case 4735: + case 4736: + case 4737: + case 4738: + case 4739: + case 4740: + case 4741: + case 4742: + case 4743: + case 4744: + case 4745: + case 4746: + case 4747: + case 4748: + case 4749: + case 4750: + case 4751: + case 4752: + case 4753: + case 4754: + case 4755: + case 4756: + case 4757: + case 4758: + case 4759: + case 4760: + case 4761: + case 4762: + case 4763: + case 4764: + case 4765: + case 4766: + case 4767: + case 4768: + case 4769: + case 4770: + case 4771: + case 4772: + case 4773: + case 4774: + case 4775: + case 4776: + case 4777: + case 4778: + case 4779: + case 4780: + case 4781: + case 4782: + case 4783: + case 4784: + case 4785: + case 4786: + case 4787: + case 4788: + case 4789: + case 4790: + case 4791: + case 4792: + case 4793: + case 4794: + case 4795: + case 4796: + case 4797: + case 4798: + case 4799: + case 4800: + case 4801: + case 4802: + case 4803: + case 4804: + case 4805: + case 4806: + case 4807: + case 4808: + case 4809: + case 4810: + case 4811: + case 4812: + case 4813: + case 4814: + case 4815: + case 4816: + case 4817: + case 4818: + case 4819: + case 4820: + case 4821: + case 4822: + case 4823: + case 4824: + case 4825: + case 4826: + case 4827: + case 4828: + case 4829: + case 4830: + case 4831: + case 4832: + case 4833: + case 4834: + case 4835: + case 4836: + case 4837: + case 4838: + case 4839: + case 4840: + case 4841: + case 4842: + case 4843: + case 4844: + case 4845: + case 4846: + case 4847: + case 4848: + case 4849: + case 4850: + case 4851: + case 4852: + case 4853: + case 4854: + case 4855: + case 4856: + case 4857: + case 4858: + case 4859: + case 4860: + case 4861: + case 4862: + case 4863: + case 4864: + case 4865: + case 4866: + case 4867: + case 4868: + case 4869: + case 4870: + case 4871: + case 4872: + case 4873: + case 4874: + case 4875: + case 4876: + case 4877: + case 4878: + case 4879: + case 4880: + case 4881: + case 4882: + case 4883: + case 4884: + case 4885: + case 4886: + case 4887: + case 4888: + case 4889: + case 4890: + case 4891: + case 4892: + case 4893: + case 4894: + case 4895: + case 4896: + case 4897: + case 4898: + case 4899: + case 4900: + case 4901: + case 4902: + case 4903: + case 4904: + case 4905: + case 4906: + case 4907: + case 4908: + case 4909: + case 4910: + case 4911: + case 4912: + case 4913: + case 4914: + case 4915: + case 4916: + case 4917: + case 4918: + case 4919: + case 4920: + case 4921: + case 4922: + case 4923: + case 4924: + case 4925: + case 4926: + case 4927: + case 4928: + case 4929: + case 4930: + case 4931: + case 4932: + case 4933: + case 4934: + case 4935: + case 4936: + case 4937: + case 4938: + case 4939: + case 4940: + case 4941: + case 4942: + case 4943: + case 4944: + case 4945: + case 4946: + case 4947: + case 4948: + case 4949: + case 4950: + case 4951: + case 4952: + case 4953: + case 4954: + case 4955: + case 4956: + case 4957: + case 4958: + case 4959: + case 4960: + case 4961: + case 4962: + case 4963: + case 4964: + case 4965: + case 4966: + case 4967: + case 4968: + case 4969: + case 4970: + case 4971: + case 4972: + case 4973: + case 4974: + case 4975: + case 4976: + case 4977: + case 4978: + case 4979: + case 4980: + case 4981: + case 4982: + case 4983: + case 4984: + case 4985: + case 4986: + case 4987: + case 4988: + case 4989: + case 4990: + case 4991: + case 4992: + case 4993: + case 4994: + case 4995: + case 4996: + case 4997: + case 4998: + case 4999: + case 5000: + case 5001: + case 5002: + case 5003: + case 5004: + case 5005: + case 5006: + case 5007: + case 5008: + case 5009: + case 5010: + case 5011: + case 5012: + case 5013: + case 5014: + case 5015: + case 5016: + case 5017: + case 5018: + case 5019: + case 5020: + case 5021: + case 5022: + case 5023: + case 5024: + case 5025: + case 5026: + case 5027: + case 5028: + case 5029: + case 5030: + case 5031: + case 5032: + case 5033: + case 5034: + case 5035: + case 5036: + case 5037: + case 5038: + case 5039: + case 5040: + case 5041: + case 5042: + case 5043: + case 5044: + case 5045: + case 5046: + case 5047: + case 5048: + case 5049: + case 5050: + case 5051: + case 5052: + case 5053: + case 5054: + case 5055: + case 5056: + case 5057: + case 5058: + case 5059: + case 5060: + case 5061: + case 5062: + case 5063: + case 5064: + case 5065: + case 5066: + case 5067: + case 5068: + case 5069: + case 5070: + case 5071: + case 5072: + case 5073: + case 5074: + case 5075: + case 5076: + case 5077: + case 5078: + case 5079: + case 5080: + case 5081: + case 5082: + case 5083: + case 5084: + case 5085: + case 5086: + case 5087: + case 5088: + case 5089: + case 5090: + case 5091: + case 5092: + case 5093: + case 5094: + case 5095: + case 5096: + case 5097: + case 5098: + case 5099: + case 5100: + case 5101: + case 5102: + case 5103: + case 5104: + case 5105: + case 5106: + case 5107: + case 5108: + case 5109: + case 5110: + case 5111: + case 5112: + case 5113: + case 5114: + case 5115: + case 5116: + case 5117: + case 5118: + case 5119: + case 5120: + case 5121: + case 5122: + case 5123: + case 5124: + case 5125: + case 5126: + case 5127: + case 5128: + case 5129: + case 5130: + case 5131: + case 5132: + case 5133: + case 5134: + case 5135: + case 5136: + case 5137: + case 5138: + case 5139: + case 5140: + case 5141: + case 5142: + case 5143: + case 5144: + case 5145: + case 5146: + case 5147: + case 5148: + case 5149: + case 5150: + case 5151: + case 5152: + case 5153: + case 5154: + case 5155: + case 5156: + case 5157: + case 5158: + case 5159: + case 5160: + case 5161: + case 5162: + case 5163: + case 5164: + case 5165: + case 5166: + case 5167: + case 5168: + case 5169: + case 5170: + case 5171: + case 5172: + case 5173: + case 5174: + case 5175: + case 5176: + case 5177: + case 5178: + case 5179: + case 5180: + case 5181: + case 5182: + case 5183: + case 5184: + case 5185: + case 5186: + case 5187: + case 5188: + case 5189: + case 5190: + case 5191: + case 5192: + case 5193: + case 5194: + case 5195: + case 5196: + case 5197: + case 5198: + case 5199: + case 5200: + case 5201: + case 5202: + case 5203: + case 5204: + case 5205: + case 5206: + case 5207: + case 5208: + case 5209: + case 5210: + case 5211: + case 5212: + case 5213: + case 5214: + case 5215: + case 5216: + case 5217: + case 5218: + case 5219: + case 5220: + case 5221: + case 5222: + case 5223: + case 5224: + case 5225: + case 5226: + case 5227: + case 5228: + case 5229: + case 5230: + case 5231: + case 5232: + case 5233: + case 5234: + case 5235: + case 5236: + case 5237: + case 5238: + case 5239: + case 5240: + case 5241: + case 5242: + case 5243: + case 5244: + case 5245: + case 5246: + case 5247: + case 5248: + case 5249: + case 5250: + case 5251: + case 5252: + case 5253: + case 5254: + case 5255: + case 5256: + case 5257: + case 5258: + case 5259: + case 5260: + case 5261: + case 5262: + case 5263: + case 5264: + case 5265: + case 5266: + case 5267: + case 5268: + case 5269: + case 5270: + case 5271: + case 5272: + case 5273: + case 5274: + case 5275: + case 5276: + case 5277: + case 5278: + case 5279: + case 5280: + case 5281: + case 5282: + case 5283: + case 5284: + case 5285: + case 5286: + case 5287: + case 5288: + case 5289: + case 5290: + case 5291: + case 5292: + case 5293: + case 5294: + case 5295: + case 5296: + case 5297: + case 5298: + case 5299: + case 5300: + case 5301: + case 5302: + case 5303: + case 5304: + case 5305: + case 5306: + case 5307: + case 5308: + case 5309: + case 5310: + case 5311: + case 5312: + case 5313: + case 5314: + case 5315: + case 5316: + case 5317: + case 5318: + case 5319: + case 5320: + case 5321: + case 5322: + case 5323: + case 5324: + case 5325: + case 5326: + case 5327: + case 5328: + case 5329: + case 5330: + case 5331: + case 5332: + case 5333: + case 5334: + case 5335: + case 5336: + case 5337: + case 5338: + case 5339: + case 5340: + case 5341: + case 5342: + case 5343: + case 5344: + case 5345: + case 5346: + case 5347: + case 5348: + case 5349: + case 5350: + case 5351: + case 5352: + case 5353: + case 5354: + case 5355: + case 5356: + case 5357: + case 5358: + case 5359: + case 5360: + case 5361: + case 5362: + case 5363: + case 5364: + case 5365: + case 5366: + case 5367: + case 5368: + case 5369: + case 5370: + case 5371: + case 5372: + case 5373: + case 5374: + case 5375: + case 5376: + case 5377: + case 5378: + case 5379: + case 5380: + case 5381: + case 5382: + case 5383: + case 5384: + case 5385: + case 5386: + case 5387: + case 5388: + case 5389: + case 5390: + case 5391: + case 5392: + case 5393: + case 5394: + case 5395: + case 5396: + case 5397: + case 5398: + case 5399: + case 5400: + case 5401: + case 5402: + case 5403: + case 5404: + case 5405: + case 5406: + case 5407: + case 5408: + case 5409: + case 5410: + case 5411: + case 5412: + case 5413: + case 5414: + case 5415: + case 5416: + case 5417: + case 5418: + case 5419: + case 5420: + case 5421: + case 5422: + case 5423: + case 5424: + case 5425: + case 5426: + case 5427: + case 5428: + case 5429: + case 5430: + case 5431: + case 5432: + case 5433: + case 5434: + case 5435: + case 5436: + case 5437: + case 5438: + case 5439: + case 5440: + case 5441: + case 5442: + case 5443: + case 5444: + case 5445: + case 5446: + case 5447: + case 5448: + case 5449: + case 5450: + case 5451: + case 5452: + case 5453: + case 5454: + case 5455: + case 5456: + case 5457: + case 5458: + case 5459: + case 5460: + case 5461: + case 5462: + case 5463: + case 5464: + case 5465: + case 5466: + case 5467: + case 5468: + case 5469: + case 5470: + case 5471: + case 5472: + case 5473: + case 5474: + case 5475: + case 5476: + case 5477: + case 5478: + case 5479: + case 5480: + case 5481: + case 5482: + case 5483: + case 5484: + case 5485: + case 5486: + case 5487: + case 5488: + case 5489: + case 5490: + case 5491: + case 5492: + case 5493: + case 5494: + case 5495: + case 5496: + case 5497: + case 5498: + case 5499: + case 5500: + case 5501: + case 5502: + case 5503: + case 5504: + case 5505: + case 5506: + case 5507: + case 5508: + case 5509: + case 5510: + case 5511: + case 5512: + case 5513: + case 5514: + case 5515: + case 5516: + case 5517: + case 5518: + case 5519: + case 5520: + case 5521: + case 5522: + case 5523: + case 5524: + case 5525: + case 5526: + case 5527: + case 5528: + case 5529: + case 5530: + case 5531: + case 5532: + case 5533: + case 5534: + case 5535: + case 5536: + case 5537: + case 5538: + case 5539: + case 5540: + case 5541: + case 5542: + case 5543: + case 5544: + case 5545: + case 5546: + case 5547: + case 5548: + case 5549: + case 5550: + case 5551: + case 5552: + case 5553: + case 5554: + case 5555: + case 5556: + case 5557: + case 5558: + case 5559: + case 5560: + case 5561: + case 5562: + case 5563: + case 5564: + case 5565: + case 5566: + case 5567: + case 5568: + case 5569: + case 5570: + case 5571: + case 5572: + case 5573: + case 5574: + case 5575: + case 5576: + case 5577: + case 5578: + case 5579: + case 5580: + case 5581: + case 5582: + case 5583: + case 5584: + case 5585: + case 5586: + case 5587: + case 5588: + case 5589: + case 5590: + case 5591: + case 5592: + case 5593: + case 5594: + case 5595: + case 5596: + case 5597: + case 5598: + case 5599: + case 5600: + case 5601: + case 5602: + case 5603: + case 5604: + case 5605: + case 5606: + case 5607: + case 5608: + case 5609: + case 5610: + case 5611: + case 5612: + case 5613: + case 5614: + case 5615: + case 5616: + case 5617: + case 5618: + case 5619: + case 5620: + case 5621: + case 5622: + case 5623: + case 5624: + case 5625: + case 5626: + case 5627: + case 5628: + case 5629: + case 5630: + case 5631: + case 5632: + case 5633: + case 5634: + case 5635: + case 5636: + case 5637: + case 5638: + case 5639: + case 5640: + case 5641: + case 5642: + case 5643: + case 5644: + case 5645: + case 5646: + case 5647: + case 5648: + case 5649: + case 5650: + case 5651: + case 5652: + case 5653: + case 5654: + case 5655: + case 5656: + case 5657: + case 5658: + case 5659: + case 5660: + case 5661: + case 5662: + case 5663: + case 5664: + case 5665: + case 5666: + case 5667: + case 5668: + case 5669: + case 5670: + case 5671: + case 5672: + case 5673: + case 5674: + case 5675: + case 5676: + case 5677: + case 5678: + case 5679: + case 5680: + case 5681: + case 5682: + case 5683: + case 5684: + case 5685: + case 5686: + case 5687: + case 5688: + case 5689: + case 5690: + case 5691: + case 5692: + case 5693: + case 5694: + case 5695: + case 5696: + case 5697: + case 5698: + case 5699: + case 5700: + case 5701: + case 5702: + case 5703: + case 5704: + case 5705: + case 5706: + case 5707: + case 5708: + case 5709: + case 5710: + case 5711: + case 5712: + case 5713: + case 5714: + case 5715: + case 5716: + case 5717: + case 5718: + case 5719: + case 5720: + case 5721: + case 5722: + case 5723: + case 5724: + case 5725: + case 5726: + case 5727: + case 5728: + case 5729: + case 5730: + case 5731: + case 5732: + case 5733: + case 5734: + case 5735: + case 5736: + case 5737: + case 5738: + case 5739: + case 5740: + case 5741: + case 5742: + case 5743: + case 5744: + case 5745: + case 5746: + case 5747: + case 5748: + case 5749: + case 5750: + case 5751: + case 5752: + case 5753: + case 5754: + case 5755: + case 5756: + case 5757: + case 5758: + case 5759: + case 5760: + case 5761: + case 5762: + case 5763: + case 5764: + case 5765: + case 5766: + case 5767: + case 5768: + case 5769: + case 5770: + case 5771: + case 5772: + case 5773: + case 5774: + case 5775: + case 5776: + case 5777: + case 5778: + case 5779: + case 5780: + case 5781: + case 5782: + case 5783: + case 5784: + case 5785: + case 5786: + case 5787: + case 5788: + case 5789: + case 5790: + case 5791: + case 5792: + case 5793: + case 5794: + case 5795: + case 5796: + case 5797: + case 5798: + case 5799: + case 5800: + case 5801: + case 5802: + case 5803: + case 5804: + case 5805: + case 5806: + case 5807: + case 5808: + case 5809: + case 5810: + case 5811: + case 5812: + case 5813: + case 5814: + case 5815: + case 5816: + case 5817: + case 5818: + case 5819: + case 5820: + case 5821: + case 5822: + case 5823: + case 5824: + case 5825: + case 5826: + case 5827: + case 5828: + case 5829: + case 5830: + case 5831: + case 5832: + case 5833: + case 5834: + case 5835: + case 5836: + case 5837: + case 5838: + case 5839: + case 5840: + case 5841: + case 5842: + case 5843: + case 5844: + case 5845: + case 5846: + case 5847: + case 5848: + case 5849: + case 5850: + case 5851: + case 5852: + case 5853: + case 5854: + case 5855: + case 5856: + case 5857: + case 5858: + case 5859: + case 5860: + case 5861: + case 5862: + case 5863: + case 5864: + case 5865: + case 5866: + case 5867: + case 5868: + case 5869: + case 5870: + case 5871: + case 5872: + case 5873: + case 5874: + case 5875: + case 5876: + case 5877: + case 5878: + case 5879: + case 5880: + case 5881: + case 5882: + case 5883: + case 5884: + case 5885: + case 5886: + case 5887: + case 5888: + case 5889: + case 5890: + case 5891: + case 5892: + case 5893: + case 5894: + case 5895: + case 5896: + case 5897: + case 5898: + case 5899: + case 5900: + case 5901: + case 5902: + case 5903: + case 5904: + case 5905: + case 5906: + case 5907: + case 5908: + case 5909: + case 5910: + case 5911: + case 5912: + case 5913: + case 5914: + case 5915: + case 5916: + case 5917: + case 5918: + case 5919: + case 5920: + case 5921: + case 5922: + case 5923: + case 5924: + case 5925: + case 5926: + case 5927: + case 5928: + case 5929: + case 5930: + case 5931: + case 5932: + case 5933: + case 5934: + case 5935: + case 5936: + case 5937: + case 5938: + case 5939: + case 5940: + case 5941: + case 5942: + case 5943: + case 5944: + case 5945: + case 5946: + case 5947: + case 5948: + case 5949: + case 5950: + case 5951: + case 5952: + case 5953: + case 5954: + case 5955: + case 5956: + case 5957: + case 5958: + case 5959: + case 5960: + case 5961: + case 5962: + case 5963: + case 5964: + case 5965: + case 5966: + case 5967: + case 5968: + case 5969: + case 5970: + case 5971: + case 5972: + case 5973: + case 5974: + case 5975: + case 5976: + case 5977: + case 5978: + case 5979: + case 5980: + case 5981: + case 5982: + case 5983: + case 5984: + case 5985: + case 5986: + case 5987: + case 5988: + case 5989: + case 5990: + case 5991: + case 5992: + case 5993: + case 5994: + case 5995: + case 5996: + case 5997: + case 5998: + case 5999: + case 6000: + case 6001: + case 6002: + case 6003: + case 6004: + case 6005: + case 6006: + case 6007: + case 6008: + case 6009: + case 6010: + case 6011: + case 6012: + case 6013: + case 6014: + case 6015: + case 6016: + case 6017: + case 6018: + case 6019: + case 6020: + case 6021: + case 6022: + case 6023: + case 6024: + case 6025: + case 6026: + case 6027: + case 6028: + case 6029: + case 6030: + case 6031: + case 6032: + case 6033: + case 6034: + case 6035: + case 6036: + case 6037: + case 6038: + case 6039: + case 6040: + case 6041: + case 6042: + case 6043: + case 6044: + case 6045: + case 6046: + case 6047: + case 6048: + case 6049: + case 6050: + case 6051: + case 6052: + case 6053: + case 6054: + case 6055: + case 6056: + case 6057: + case 6058: + case 6059: + case 6060: + case 6061: + case 6062: + case 6063: + case 6064: + case 6065: + case 6066: + case 6067: + case 6068: + case 6069: + case 6070: + case 6071: + case 6072: + case 6073: + case 6074: + case 6075: + case 6076: + case 6077: + case 6078: + case 6079: + case 6080: + case 6081: + case 6082: + case 6083: + case 6084: + case 6085: + case 6086: + case 6087: + case 6088: + case 6089: + case 6090: + case 6091: + case 6092: + case 6093: + case 6094: + case 6095: + case 6096: + case 6097: + case 6098: + case 6099: + case 6100: + case 6101: + case 6102: + case 6103: + case 6104: + case 6105: + case 6106: + case 6107: + case 6108: + case 6109: + case 6110: + case 6111: + case 6112: + case 6113: + case 6114: + case 6115: + case 6116: + case 6117: + case 6118: + case 6119: + case 6120: + case 6121: + case 6122: + case 6123: + case 6124: + case 6125: + case 6126: + case 6127: + case 6128: + case 6129: + case 6130: + case 6131: + case 6132: + case 6133: + case 6134: + case 6135: + case 6136: + case 6137: + case 6138: + case 6139: + case 6140: + case 6141: + case 6142: + case 6143: + case 6144: + case 6145: + case 6146: + case 6147: + case 6148: + case 6149: + case 6150: + case 6151: + case 6152: + case 6153: + case 6154: + case 6155: + case 6156: + case 6157: + case 6158: + case 6159: + case 6160: + case 6161: + case 6162: + case 6163: + case 6164: + case 6165: + case 6166: + case 6167: + case 6168: + case 6169: + case 6170: + case 6171: + case 6172: + case 6173: + case 6174: + case 6175: + case 6176: + case 6177: + case 6178: + case 6179: + case 6180: + case 6181: + case 6182: + case 6183: + case 6184: + case 6185: + case 6186: + case 6187: + case 6188: + case 6189: + case 6190: + case 6191: + case 6192: + case 6193: + case 6194: + case 6195: + case 6196: + case 6197: + case 6198: + case 6199: + case 6200: + case 6201: + case 6202: + case 6203: + case 6204: + case 6205: + case 6206: + case 6207: + case 6208: + case 6209: + case 6210: + case 6211: + case 6212: + case 6213: + case 6214: + case 6215: + case 6216: + case 6217: + case 6218: + case 6219: + case 6220: + case 6221: + case 6222: + case 6223: + case 6224: + case 6225: + case 6226: + case 6227: + case 6228: + case 6229: + case 6230: + case 6231: + case 6232: + case 6233: + case 6234: + case 6235: + case 6236: + case 6237: + case 6238: + case 6239: + case 6240: + case 6241: + case 6242: + case 6243: + case 6244: + case 6245: + case 6246: + case 6247: + case 6248: + case 6249: + case 6250: + case 6251: + case 6252: + case 6253: + case 6254: + case 6255: + case 6256: + case 6257: + case 6258: + case 6259: + case 6260: + case 6261: + case 6262: + case 6263: + case 6264: + case 6265: + case 6266: + case 6267: + case 6268: + case 6269: + case 6270: + case 6271: + case 6272: + case 6273: + case 6274: + case 6275: + case 6276: + case 6277: + case 6278: + case 6279: + case 6280: + case 6281: + case 6282: + case 6283: + case 6284: + case 6285: + case 6286: + case 6287: + case 6288: + case 6289: + case 6290: + case 6291: + case 6292: + case 6293: + case 6294: + case 6295: + case 6296: + case 6297: + case 6298: + case 6299: + case 6300: + case 6301: + case 6302: + case 6303: + case 6304: + case 6305: + case 6306: + case 6307: + case 6308: + case 6309: + case 6310: + case 6311: + case 6312: + case 6313: + case 6314: + case 6315: + case 6316: + case 6317: + case 6318: + case 6319: + case 6320: + case 6321: + case 6322: + case 6323: + case 6324: + case 6325: + case 6326: + case 6327: + case 6328: + case 6329: + case 6330: + case 6331: + case 6332: + case 6333: + case 6334: + case 6335: + case 6336: + case 6337: + case 6338: + case 6339: + case 6340: + case 6341: + case 6342: + case 6343: + case 6344: + case 6345: + case 6346: + case 6347: + case 6348: + case 6349: + case 6350: + case 6351: + case 6352: + case 6353: + case 6354: + case 6355: + case 6356: + case 6357: + case 6358: + case 6359: + case 6360: + case 6361: + case 6362: + case 6363: + case 6364: + case 6365: + case 6366: + case 6367: + case 6368: + case 6369: + case 6370: + case 6371: + case 6372: + case 6373: + case 6374: + case 6375: + case 6376: + case 6377: + case 6378: + case 6379: + case 6380: + case 6381: + case 6382: + case 6383: + case 6384: + case 6385: + case 6386: + case 6387: + case 6388: + case 6389: + case 6390: + case 6391: + case 6392: + case 6393: + case 6394: + case 6395: + case 6396: + case 6397: + case 6398: + case 6399: + case 6400: + case 6401: + case 6402: + case 6403: + case 6404: + case 6405: + case 6406: + case 6407: + case 6408: + case 6409: + case 6410: + case 6411: + case 6412: + case 6413: + case 6414: + case 6415: + case 6416: + case 6417: + case 6418: + case 6419: + case 6420: + case 6421: + case 6422: + case 6423: + case 6424: + case 6425: + case 6426: + case 6427: + case 6428: + case 6429: + case 6430: + case 6431: + case 6432: + case 6433: + case 6434: + case 6435: + case 6436: + case 6437: + case 6438: + case 6439: + case 6440: + case 6441: + case 6442: + case 6443: + case 6444: + case 6445: + case 6446: + case 6447: + case 6448: + case 6449: + case 6450: + case 6451: + case 6452: + case 6453: + case 6454: + case 6455: + case 6456: + case 6457: + case 6458: + case 6459: + case 6460: + case 6461: + case 6462: + case 6463: + case 6464: + case 6465: + case 6466: + case 6467: + case 6468: + case 6469: + case 6470: + case 6471: + case 6472: + case 6473: + case 6474: + case 6475: + case 6476: + case 6477: + case 6478: + case 6479: + case 6480: + case 6481: + case 6482: + case 6483: + case 6484: + case 6485: + case 6486: + case 6487: + case 6488: + case 6489: + case 6490: + case 6491: + case 6492: + case 6493: + case 6494: + case 6495: + case 6496: + case 6497: + case 6498: + case 6499: + case 6500: + case 6501: + case 6502: + case 6503: + case 6504: + case 6505: + case 6506: + case 6507: + case 6508: + case 6509: + case 6510: + case 6511: + case 6512: + case 6513: + case 6514: + case 6515: + case 6516: + case 6517: + case 6518: + case 6519: + case 6520: + case 6521: + case 6522: + case 6523: + case 6524: + case 6525: + case 6526: + case 6527: + case 6528: + case 6529: + case 6530: + case 6531: + case 6532: + case 6533: + case 6534: + case 6535: + case 6536: + case 6537: + case 6538: + case 6539: + case 6540: + case 6541: + case 6542: + case 6543: + case 6544: + case 6545: + case 6546: + case 6547: + case 6548: + case 6549: + case 6550: + case 6551: + case 6552: + case 6553: + case 6554: + case 6555: + case 6556: + case 6557: + case 6558: + case 6559: + case 6560: + case 6561: + case 6562: + case 6563: + case 6564: + case 6565: + case 6566: + case 6567: + case 6568: + case 6569: + case 6570: + case 6571: + case 6572: + case 6573: + case 6574: + case 6575: + case 6576: + case 6577: + case 6578: + case 6579: + case 6580: + case 6581: + case 6582: + case 6583: + case 6584: + case 6585: + case 6586: + case 6587: + case 6588: + case 6589: + case 6590: + case 6591: + case 6592: + case 6593: + case 6594: + case 6595: + case 6596: + case 6597: + case 6598: + case 6599: + case 6600: + case 6601: + case 6602: + case 6603: + case 6604: + case 6605: + case 6606: + case 6607: + case 6608: + case 6609: + case 6610: + case 6611: + case 6612: + case 6613: + case 6614: + case 6615: + case 6616: + case 6617: + case 6618: + case 6619: + case 6620: + case 6621: + case 6622: + case 6623: + case 6624: + case 6625: + case 6626: + case 6627: + case 6628: + case 6629: + case 6630: + case 6631: + case 6632: + case 6633: + case 6634: + case 6635: + case 6636: + case 6637: + case 6638: + case 6639: + case 6640: + case 6641: + case 6642: + case 6643: + case 6644: + case 6645: + case 6646: + case 6647: + case 6648: + case 6649: + case 6650: + case 6651: + case 6652: + case 6653: + case 6654: + case 6655: + case 6656: + case 6657: + case 6658: + case 6659: + case 6660: + case 6661: + case 6662: + case 6663: + case 6664: + case 6665: + case 6666: + case 6667: + case 6668: + case 6669: + case 6670: + case 6671: + case 6672: + case 6673: + case 6674: + case 6675: + case 6676: + case 6677: + case 6678: + case 6679: + case 6680: + case 6681: + case 6682: + case 6683: + case 6684: + case 6685: + case 6686: + case 6687: + case 6688: + case 6689: + case 6690: + case 6691: + case 6692: + case 6693: + case 6694: + case 6695: + case 6696: + case 6697: + case 6698: + case 6699: + case 6700: + case 6701: + case 6702: + case 6703: + case 6704: + case 6705: + case 6706: + case 6707: + case 6708: + case 6709: + case 6710: + case 6711: + case 6712: + case 6713: + case 6714: + case 6715: + case 6716: + case 6717: + case 6718: + case 6719: + case 6720: + case 6721: + case 6722: + case 6723: + case 6724: + case 6725: + case 6726: + case 6727: + case 6728: + case 6729: + case 6730: + case 6731: + case 6732: + case 6733: + case 6734: + case 6735: + case 6736: + case 6737: + case 6738: + case 6739: + case 6740: + case 6741: + case 6742: + case 6743: + case 6744: + case 6745: + case 6746: + case 6747: + case 6748: + case 6749: + case 6750: + case 6751: + case 6752: + case 6753: + case 6754: + case 6755: + case 6756: + case 6757: + case 6758: + case 6759: + case 6760: + case 6761: + case 6762: + case 6763: + case 6764: + case 6765: + case 6766: + case 6767: + case 6768: + case 6769: + case 6770: + case 6771: + case 6772: + case 6773: + case 6774: + case 6775: + case 6776: + case 6777: + case 6778: + case 6779: + case 6780: + case 6781: + case 6782: + case 6783: + case 6784: + case 6785: + case 6786: + case 6787: + case 6788: + case 6789: + case 6790: + case 6791: + case 6792: + case 6793: + case 6794: + case 6795: + case 6796: + case 6797: + case 6798: + case 6799: + case 6800: + case 6801: + case 6802: + case 6803: + case 6804: + case 6805: + case 6806: + case 6807: + case 6808: + case 6809: + case 6810: + case 6811: + case 6812: + case 6813: + case 6814: + case 6815: + case 6816: + case 6817: + case 6818: + case 6819: + case 6820: + case 6821: + case 6822: + case 6823: + case 6824: + case 6825: + case 6826: + case 6827: + case 6828: + case 6829: + case 6830: + case 6831: + case 6832: + case 6833: + case 6834: + case 6835: + case 6836: + case 6837: + case 6838: + case 6839: + case 6840: + case 6841: + case 6842: + case 6843: + case 6844: + case 6845: + case 6846: + case 6847: + case 6848: + case 6849: + case 6850: + case 6851: + case 6852: + case 6853: + case 6854: + case 6855: + case 6856: + case 6857: + case 6858: + case 6859: + case 6860: + case 6861: + case 6862: + case 6863: + case 6864: + case 6865: + case 6866: + case 6867: + case 6868: + case 6869: + case 6870: + case 6871: + case 6872: + case 6873: + case 6874: + case 6875: + case 6876: + case 6877: + case 6878: + case 6879: + case 6880: + case 6881: + case 6882: + case 6883: + case 6884: + case 6885: + case 6886: + case 6887: + case 6888: + case 6889: + case 6890: + case 6891: + case 6892: + case 6893: + case 6894: + case 6895: + case 6896: + case 6897: + case 6898: + case 6899: + case 6900: + case 6901: + case 6902: + case 6903: + case 6904: + case 6905: + case 6906: + case 6907: + case 6908: + case 6909: + case 6910: + case 6911: + case 6912: + case 6913: + case 6914: + case 6915: + case 6916: + case 6917: + case 6918: + case 6919: + case 6920: + case 6921: + case 6922: + case 6923: + case 6924: + case 6925: + case 6926: + case 6927: + case 6928: + case 6929: + case 6930: + case 6931: + case 6932: + case 6933: + case 6934: + case 6935: + case 6936: + case 6937: + case 6938: + case 6939: + case 6940: + case 6941: + case 6942: + case 6943: + case 6944: + case 6945: + case 6946: + case 6947: + case 6948: + case 6949: + case 6950: + case 6951: + case 6952: + case 6953: + case 6954: + case 6955: + case 6956: + case 6957: + case 6958: + case 6959: + case 6960: + case 6961: + case 6962: + case 6963: + case 6964: + case 6965: + case 6966: + case 6967: + case 6968: + case 6969: + case 6970: + case 6971: + case 6972: + case 6973: + case 6974: + case 6975: + case 6976: + case 6977: + case 6978: + case 6979: + case 6980: + case 6981: + case 6982: + case 6983: + case 6984: + case 6985: + case 6986: + case 6987: + case 6988: + case 6989: + case 6990: + case 6991: + case 6992: + case 6993: + case 6994: + case 6995: + case 6996: + case 6997: + case 6998: + case 6999: + case 7000: + case 7001: + case 7002: + case 7003: + case 7004: + case 7005: + case 7006: + case 7007: + case 7008: + case 7009: + case 7010: + case 7011: + case 7012: + case 7013: + case 7014: + case 7015: + case 7016: + case 7017: + case 7018: + case 7019: + case 7020: + case 7021: + case 7022: + case 7023: + case 7024: + case 7025: + case 7026: + case 7027: + case 7028: + case 7029: + case 7030: + case 7031: + case 7032: + case 7033: + case 7034: + case 7035: + case 7036: + case 7037: + case 7038: + case 7039: + case 7040: + case 7041: + case 7042: + case 7043: + case 7044: + case 7045: + case 7046: + case 7047: + case 7048: + case 7049: + case 7050: + case 7051: + case 7052: + case 7053: + case 7054: + case 7055: + case 7056: + case 7057: + case 7058: + case 7059: + case 7060: + case 7061: + case 7062: + case 7063: + case 7064: + case 7065: + case 7066: + case 7067: + case 7068: + case 7069: + case 7070: + case 7071: + case 7072: + case 7073: + case 7074: + case 7075: + case 7076: + case 7077: + case 7078: + case 7079: + case 7080: + case 7081: + case 7082: + case 7083: + case 7084: + case 7085: + case 7086: + case 7087: + case 7088: + case 7089: + case 7090: + case 7091: + case 7092: + case 7093: + case 7094: + case 7095: + case 7096: + case 7097: + case 7098: + case 7099: + case 7100: + case 7101: + case 7102: + case 7103: + case 7104: + case 7105: + case 7106: + case 7107: + case 7108: + case 7109: + case 7110: + case 7111: + case 7112: + case 7113: + case 7114: + case 7115: + case 7116: + case 7117: + case 7118: + case 7119: + case 7120: + case 7121: + case 7122: + case 7123: + case 7124: + case 7125: + case 7126: + case 7127: + case 7128: + case 7129: + case 7130: + case 7131: + case 7132: + case 7133: + case 7134: + case 7135: + case 7136: + case 7137: + case 7138: + case 7139: + case 7140: + case 7141: + case 7142: + case 7143: + case 7144: + case 7145: + case 7146: + case 7147: + case 7148: + case 7149: + case 7150: + case 7151: + case 7152: + case 7153: + case 7154: + case 7155: + case 7156: + case 7157: + case 7158: + case 7159: + case 7160: + case 7161: + case 7162: + case 7163: + case 7164: + case 7165: + case 7166: + case 7167: + case 7168: + case 7169: + case 7170: + case 7171: + case 7172: + case 7173: + case 7174: + case 7175: + case 7176: + case 7177: + case 7178: + case 7179: + case 7180: + case 7181: + case 7182: + case 7183: + case 7184: + case 7185: + case 7186: + case 7187: + case 7188: + case 7189: + case 7190: + case 7191: + case 7192: + case 7193: + case 7194: + case 7195: + case 7196: + case 7197: + case 7198: + case 7199: + case 7200: + case 7201: + case 7202: + case 7203: + case 7204: + case 7205: + case 7206: + case 7207: + case 7208: + case 7209: + case 7210: + case 7211: + case 7212: + case 7213: + case 7214: + case 7215: + case 7216: + case 7217: + case 7218: + case 7219: + case 7220: + case 7221: + case 7222: + case 7223: + case 7224: + case 7225: + case 7226: + case 7227: + case 7228: + case 7229: + case 7230: + case 7231: + case 7232: + case 7233: + case 7234: + case 7235: + case 7236: + case 7237: + case 7238: + case 7239: + case 7240: + case 7241: + case 7242: + case 7243: + case 7244: + case 7245: + case 7246: + case 7247: + case 7248: + case 7249: + case 7250: + case 7251: + case 7252: + case 7253: + case 7254: + case 7255: + case 7256: + case 7257: + case 7258: + case 7259: + case 7260: + case 7261: + case 7262: + case 7263: + case 7264: + case 7265: + case 7266: + case 7267: + case 7268: + case 7269: + case 7270: + case 7271: + case 7272: + case 7273: + case 7274: + case 7275: + case 7276: + case 7277: + case 7278: + case 7279: + case 7280: + case 7281: + case 7282: + case 7283: + case 7284: + case 7285: + case 7286: + case 7287: + case 7288: + case 7289: + case 7290: + case 7291: + case 7292: + case 7293: + case 7294: + case 7295: + case 7296: + case 7297: + case 7298: + case 7299: + case 7300: + case 7301: + case 7302: + case 7303: + case 7304: + case 7305: + case 7306: + case 7307: + case 7308: + case 7309: + case 7310: + case 7311: + case 7312: + case 7313: + case 7314: + case 7315: + case 7316: + case 7317: + case 7318: + case 7319: + case 7320: + case 7321: + case 7322: + case 7323: + case 7324: + case 7325: + case 7326: + case 7327: + case 7328: + case 7329: + case 7330: + case 7331: + case 7332: + case 7333: + case 7334: + case 7335: + case 7336: + case 7337: + case 7338: + case 7339: + case 7340: + case 7341: + case 7342: + case 7343: + case 7344: + case 7345: + case 7346: + case 7347: + case 7348: + case 7349: + case 7350: + case 7351: + case 7352: + case 7353: + case 7354: + case 7355: + case 7356: + case 7357: + case 7358: + case 7359: + case 7360: + case 7361: + case 7362: + case 7363: + case 7364: + case 7365: + case 7366: + case 7367: + case 7368: + case 7369: + case 7370: + case 7371: + case 7372: + case 7373: + case 7374: + case 7375: + case 7376: + case 7377: + case 7378: + case 7379: + case 7380: + case 7381: + case 7382: + case 7383: + case 7384: + case 7385: + case 7386: + case 7387: + case 7388: + case 7389: + case 7390: + case 7391: + case 7392: + case 7393: + case 7394: + case 7395: + case 7396: + case 7397: + case 7398: + case 7399: + case 7400: + case 7401: + case 7402: + case 7403: + case 7404: + case 7405: + case 7406: + case 7407: + case 7408: + case 7409: + case 7410: + case 7411: + case 7412: + case 7413: + case 7414: + case 7415: + case 7416: + case 7417: + case 7418: + case 7419: + case 7420: + case 7421: + case 7422: + case 7423: + case 7424: + case 7425: + case 7426: + case 7427: + case 7428: + case 7429: + case 7430: + case 7431: + case 7432: + case 7433: + case 7434: + case 7435: + case 7436: + case 7437: + case 7438: + case 7439: + case 7440: + case 7441: + case 7442: + case 7443: + case 7444: + case 7445: + case 7446: + case 7447: + case 7448: + case 7449: + case 7450: + case 7451: + case 7452: + case 7453: + case 7454: + case 7455: + case 7456: + case 7457: + case 7458: + case 7459: + case 7460: + case 7461: + case 7462: + case 7463: + case 7464: + case 7465: + case 7466: + case 7467: + case 7468: + case 7469: + case 7470: + case 7471: + case 7472: + case 7473: + case 7474: + case 7475: + case 7476: + case 7477: + case 7478: + case 7479: + case 7480: + case 7481: + case 7482: + case 7483: + case 7484: + case 7485: + case 7486: + case 7487: + case 7488: + case 7489: + case 7490: + case 7491: + case 7492: + case 7493: + case 7494: + case 7495: + case 7496: + case 7497: + case 7498: + case 7499: + case 7500: + case 7501: + case 7502: + case 7503: + case 7504: + case 7505: + case 7506: + case 7507: + case 7508: + case 7509: + case 7510: + case 7511: + case 7512: + case 7513: + case 7514: + case 7515: + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7525: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7535: + case 7536: + case 7537: + case 7538: + case 7539: + case 7540: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7550: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7565: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7580: + case 7581: + case 7582: + case 7583: + case 7584: + case 7585: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7595: + case 7596: + case 7597: + case 7598: + case 7599: + case 7600: + case 7601: + case 7602: + case 7603: + case 7604: + case 7605: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7620: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + case 7635: + case 7636: + case 7637: + case 7638: + case 7639: + case 7640: + case 7641: + case 7642: + case 7643: + case 7644: + case 7645: + case 7646: + case 7647: + case 7648: + case 7649: + case 7650: + case 7651: + case 7652: + case 7653: + case 7654: + case 7655: + case 7656: + case 7657: + case 7658: + case 7659: + case 7660: + case 7661: + case 7662: + case 7663: + case 7664: + case 7665: + case 7666: + case 7667: + case 7668: + case 7669: + case 7670: + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7680: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7690: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + case 7705: + case 7706: + case 7707: + case 7708: + case 7709: + case 7710: + case 7711: + case 7712: + case 7713: + case 7714: + case 7715: + case 7716: + case 7717: + case 7718: + case 7719: + case 7720: + case 7721: + case 7722: + case 7723: + case 7724: + case 7725: + case 7726: + case 7727: + case 7728: + case 7729: + case 7730: + case 7731: + case 7732: + case 7733: + case 7734: + case 7735: + case 7736: + case 7737: + case 7738: + case 7739: + case 7740: + case 7741: + case 7742: + case 7743: + case 7744: + case 7745: + case 7746: + case 7747: + case 7748: + case 7749: + case 7750: + case 7751: + case 7752: + case 7753: + case 7754: + case 7755: + case 7756: + case 7757: + case 7758: + case 7759: + case 7760: + case 7761: + case 7762: + case 7763: + case 7764: + case 7765: + case 7766: + case 7767: + case 7768: + case 7769: + case 7770: + case 7771: + case 7772: + case 7773: + case 7774: + case 7775: + case 7776: + case 7777: + case 7778: + case 7779: + case 7780: + case 7781: + case 7782: + case 7783: + case 7784: + case 7785: + case 7786: + case 7787: + case 7788: + case 7789: + case 7790: + case 7791: + case 7792: + case 7793: + case 7794: + case 7795: + case 7796: + case 7797: + case 7798: + case 7799: + case 7800: + case 7801: + case 7802: + case 7803: + case 7804: + case 7805: + case 7806: + case 7807: + case 7808: + case 7809: + case 7810: + case 7811: + case 7812: + case 7813: + case 7814: + case 7815: + case 7816: + case 7817: + case 7818: + case 7819: + case 7820: + case 7821: + case 7822: + case 7823: + case 7824: + case 7825: + case 7826: + case 7827: + case 7828: + case 7829: + case 7830: + case 7831: + case 7832: + case 7833: + case 7834: + case 7835: + case 7836: + case 7837: + case 7838: + case 7839: + case 7840: + case 7841: + case 7842: + case 7843: + case 7844: + case 7845: + case 7846: + case 7847: + case 7848: + case 7849: + case 7850: + case 7851: + case 7852: + case 7853: + case 7854: + case 7855: + case 7856: + case 7857: + case 7858: + case 7859: + case 7860: + case 7861: + case 7862: + case 7863: + case 7864: + case 7865: + case 7866: + case 7867: + case 7868: + case 7869: + case 7870: + case 7871: + case 7872: + case 7873: + case 7874: + case 7875: + case 7876: + case 7877: + case 7878: + case 7879: + case 7880: + case 7881: + case 7882: + case 7883: + case 7884: + case 7885: + case 7886: + case 7887: + case 7888: + case 7889: + case 7890: + case 7891: + case 7892: + case 7893: + case 7894: + case 7895: + case 7896: + case 7897: + case 7898: + case 7899: + case 7900: + case 7901: + case 7902: + case 7903: + case 7904: + case 7905: + case 7906: + case 7907: + case 7908: + case 7909: + case 7910: + case 7911: + case 7912: + case 7913: + case 7914: + case 7915: + case 7916: + case 7917: + case 7918: + case 7919: + case 7920: + case 7921: + case 7922: + case 7923: + case 7924: + case 7925: + case 7926: + case 7927: + case 7928: + case 7929: + case 7930: + case 7931: + case 7932: + case 7933: + case 7934: + case 7935: + case 7936: + case 7937: + case 7938: + case 7939: + case 7940: + case 7941: + case 7942: + case 7943: + case 7944: + case 7945: + case 7946: + case 7947: + case 7948: + case 7949: + case 7950: + case 7951: + case 7952: + case 7953: + case 7954: + case 7955: + case 7956: + case 7957: + case 7958: + case 7959: + case 7960: + case 7961: + case 7962: + case 7963: + case 7964: + case 7965: + case 7966: + case 7967: + case 7968: + case 7969: + case 7970: + case 7971: + case 7972: + case 7973: + case 7974: + case 7975: + case 7976: + case 7977: + case 7978: + case 7979: + case 7980: + case 7981: + case 7982: + case 7983: + case 7984: + case 7985: + case 7986: + case 7987: + case 7988: + case 7989: + case 7990: + case 7991: + case 7992: + case 7993: + case 7994: + case 7995: + case 7996: + case 7997: + case 7998: + case 7999: + case 8000: + case 8001: + case 8002: + case 8003: + case 8004: + case 8005: + case 8006: + case 8007: + case 8008: + case 8009: + case 8010: + case 8011: + case 8012: + case 8013: + case 8014: + case 8015: + case 8016: + case 8017: + case 8018: + case 8019: + case 8020: + case 8021: + case 8022: + case 8023: + case 8024: + case 8025: + case 8026: + case 8027: + case 8028: + case 8029: + case 8030: + case 8031: + case 8032: + case 8033: + case 8034: + case 8035: + case 8036: + case 8037: + case 8038: + case 8039: + case 8040: + case 8041: + case 8042: + case 8043: + case 8044: + case 8045: + case 8046: + case 8047: + case 8048: + case 8049: + case 8050: + case 8051: + case 8052: + case 8053: + case 8054: + case 8055: + case 8056: + case 8057: + case 8058: + case 8059: + case 8060: + case 8061: + case 8062: + case 8063: + case 8064: + case 8065: + case 8066: + case 8067: + case 8068: + case 8069: + case 8070: + case 8071: + case 8072: + case 8073: + case 8074: + case 8075: + case 8076: + case 8077: + case 8078: + case 8079: + case 8080: + case 8081: + case 8082: + case 8083: + case 8084: + case 8085: + case 8086: + case 8087: + case 8088: + case 8089: + case 8090: + case 8091: + case 8092: + case 8093: + case 8094: + case 8095: + case 8096: + case 8097: + case 8098: + case 8099: + case 8100: + case 8101: + case 8102: + case 8103: + case 8104: + case 8105: + case 8106: + case 8107: + case 8108: + case 8109: + case 8110: + case 8111: + case 8112: + case 8113: + case 8114: + case 8115: + case 8116: + case 8117: + case 8118: + case 8119: + case 8120: + case 8121: + case 8122: + case 8123: + case 8124: + case 8125: + case 8126: + case 8127: + case 8128: + case 8129: + case 8130: + case 8131: + case 8132: + case 8133: + case 8134: + case 8135: + case 8136: + case 8137: + case 8138: + case 8139: + case 8140: + case 8141: + case 8142: + case 8143: + case 8144: + case 8145: + case 8146: + case 8147: + case 8148: + case 8149: + case 8150: + case 8151: + case 8152: + case 8153: + case 8154: + case 8155: + case 8156: + case 8157: + case 8158: + case 8159: + case 8160: + case 8161: + case 8162: + case 8163: + case 8164: + case 8165: + case 8166: + case 8167: + case 8168: + case 8169: + case 8170: + case 8171: + case 8172: + case 8173: + case 8174: + case 8175: + case 8176: + case 8177: + case 8178: + case 8179: + case 8180: + case 8181: + case 8182: + case 8183: + case 8184: + case 8185: + case 8186: + case 8187: + case 8188: + case 8189: + case 8190: + case 8191: + case 8192: + case 8193: + case 8194: + case 8195: + case 8196: + case 8197: + case 8198: + case 8199: + case 8200: + case 8201: + case 8202: + case 8203: + case 8204: + case 8205: + case 8206: + case 8207: + case 8208: + case 8209: + case 8210: + case 8211: + case 8212: + case 8213: + case 8214: + case 8215: + case 8216: + case 8217: + case 8218: + case 8219: + case 8220: + case 8221: + case 8222: + case 8223: + case 8224: + case 8225: + case 8226: + case 8227: + case 8228: + case 8229: + case 8230: + case 8231: + case 8232: + case 8233: + case 8234: + case 8235: + case 8236: + case 8237: + case 8238: + case 8239: + case 8240: + case 8241: + case 8242: + case 8243: + case 8244: + case 8245: + case 8246: + case 8247: + case 8248: + case 8249: + case 8250: + case 8251: + case 8252: + case 8253: + case 8254: + case 8255: + case 8256: + case 8257: + case 8258: + case 8259: + case 8260: + case 8261: + case 8262: + case 8263: + case 8264: + case 8265: + case 8266: + case 8267: + case 8268: + case 8269: + case 8270: + case 8271: + case 8272: + case 8273: + case 8274: + case 8275: + case 8276: + case 8277: + case 8278: + case 8279: + case 8280: + case 8281: + case 8282: + case 8283: + case 8284: + case 8285: + case 8286: + case 8287: + case 8288: + case 8289: + case 8290: + case 8291: + case 8292: + case 8293: + case 8294: + case 8295: + case 8296: + case 8297: + case 8298: + case 8299: + case 8300: + case 8301: + case 8302: + case 8303: + case 8304: + case 8305: + case 8306: + case 8307: + case 8308: + case 8309: + case 8310: + case 8311: + case 8312: + case 8313: + case 8314: + case 8315: + case 8316: + case 8317: + case 8318: + case 8319: + case 8320: + case 8321: + case 8322: + case 8323: + case 8324: + case 8325: + case 8326: + case 8327: + case 8328: + case 8329: + case 8330: + case 8331: + case 8332: + case 8333: + case 8334: + case 8335: + case 8336: + case 8337: + case 8338: + case 8339: + case 8340: + case 8341: + case 8342: + case 8343: + case 8344: + case 8345: + case 8346: + case 8347: + case 8348: + case 8349: + case 8350: + case 8351: + case 8352: + case 8353: + case 8354: + case 8355: + case 8356: + case 8357: + case 8358: + case 8359: + case 8360: + case 8361: + case 8362: + case 8363: + case 8364: + case 8365: + case 8366: + case 8367: + case 8368: + case 8369: + case 8370: + case 8371: + case 8372: + case 8373: + case 8374: + case 8375: + case 8376: + case 8377: + case 8378: + case 8379: + case 8380: + case 8381: + case 8382: + case 8383: + case 8384: + case 8385: + case 8386: + case 8387: + case 8388: + case 8389: + case 8390: + case 8391: + case 8392: + case 8393: + case 8394: + case 8395: + case 8396: + case 8397: + case 8398: + case 8399: + case 8400: + case 8401: + case 8402: + case 8403: + case 8404: + case 8405: + case 8406: + case 8407: + case 8408: + case 8409: + case 8410: + case 8411: + case 8412: + case 8413: + case 8414: + case 8415: + case 8416: + case 8417: + case 8418: + case 8419: + case 8420: + case 8421: + case 8422: + case 8423: + case 8424: + case 8425: + case 8426: + case 8427: + case 8428: + case 8429: + case 8430: + case 8431: + case 8432: + case 8433: + case 8434: + case 8435: + case 8436: + case 8437: + case 8438: + case 8439: + case 8440: + case 8441: + case 8442: + case 8443: + case 8444: + case 8445: + case 8446: + case 8447: + case 8448: + case 8449: + case 8450: + case 8451: + case 8452: + case 8453: + case 8454: + case 8455: + case 8456: + case 8457: + case 8458: + case 8459: + case 8460: + case 8461: + case 8462: + case 8463: + case 8464: + case 8465: + case 8466: + case 8467: + case 8468: + case 8469: + case 8470: + case 8471: + case 8472: + case 8473: + case 8474: + case 8475: + case 8476: + case 8477: + case 8478: + case 8479: + case 8480: + case 8481: + case 8482: + case 8483: + case 8484: + case 8485: + case 8486: + case 8487: + case 8488: + case 8489: + case 8490: + case 8491: + case 8492: + case 8493: + case 8494: + case 8495: + case 8496: + case 8497: + case 8498: + case 8499: + case 8500: + case 8501: + case 8502: + case 8503: + case 8504: + case 8505: + case 8506: + case 8507: + case 8508: + case 8509: + case 8510: + case 8511: + case 8512: + case 8513: + case 8514: + case 8515: + case 8516: + case 8517: + case 8518: + case 8519: + case 8520: + case 8521: + case 8522: + case 8523: + case 8524: + case 8525: + case 8526: + case 8527: + case 8528: + case 8529: + case 8530: + case 8531: + case 8532: + case 8533: + case 8534: + case 8535: + case 8536: + case 8537: + case 8538: + case 8539: + case 8540: + case 8541: + case 8542: + case 8543: + case 8544: + case 8545: + case 8546: + case 8547: + case 8548: + case 8549: + case 8550: + case 8551: + case 8552: + case 8553: + case 8554: + case 8555: + case 8556: + case 8557: + case 8558: + case 8559: + case 8560: + case 8561: + case 8562: + case 8563: + case 8564: + case 8565: + case 8566: + case 8567: + case 8568: + case 8569: + case 8570: + case 8571: + case 8572: + case 8573: + case 8574: + case 8575: + case 8576: + case 8577: + case 8578: + case 8579: + case 8580: + case 8581: + case 8582: + case 8583: + case 8584: + case 8585: + case 8586: + case 8587: + case 8588: + case 8589: + case 8590: + case 8591: + case 8592: + case 8593: + case 8594: + case 8595: + case 8596: + case 8597: + case 8598: + case 8599: + case 8600: + case 8601: + case 8602: + case 8603: + case 8604: + case 8605: + case 8606: + case 8607: + case 8608: + case 8609: + case 8610: + case 8611: + case 8612: + case 8613: + case 8614: + case 8615: + case 8616: + case 8617: + case 8618: + case 8619: + case 8620: + case 8621: + case 8622: + case 8623: + case 8624: + case 8625: + case 8626: + case 8627: + case 8628: + case 8629: + case 8630: + case 8631: + case 8632: + case 8633: + case 8634: + case 8635: + case 8636: + case 8637: + case 8638: + case 8639: + case 8640: + case 8641: + case 8642: + case 8643: + case 8644: + case 8645: + case 8646: + case 8647: + case 8648: + case 8649: + case 8650: + case 8651: + case 8652: + case 8653: + case 8654: + case 8655: + case 8656: + case 8657: + case 8658: + case 8659: + case 8660: + case 8661: + case 8662: + case 8663: + case 8664: + case 8665: + case 8666: + case 8667: + case 8668: + case 8669: + case 8670: + case 8671: + case 8672: + case 8673: + case 8674: + case 8675: + case 8676: + case 8677: + case 8678: + case 8679: + case 8680: + case 8681: + case 8682: + case 8683: + case 8684: + case 8685: + case 8686: + case 8687: + case 8688: + case 8689: + case 8690: + case 8691: + case 8692: + case 8693: + case 8694: + case 8695: + case 8696: + case 8697: + case 8698: + case 8699: + case 8700: + case 8701: + case 8702: + case 8703: + case 8704: + case 8705: + case 8706: + case 8707: + case 8708: + case 8709: + case 8710: + case 8711: + case 8712: + case 8713: + case 8714: + case 8715: + case 8716: + case 8717: + case 8718: + case 8719: + case 8720: + case 8721: + case 8722: + case 8723: + case 8724: + case 8725: + case 8726: + case 8727: + case 8728: + case 8729: + case 8730: + case 8731: + case 8732: + case 8733: + case 8734: + case 8735: + case 8736: + case 8737: + case 8738: + case 8739: + case 8740: + case 8741: + case 8742: + case 8743: + case 8744: + case 8745: + case 8746: + case 8747: + case 8748: + case 8749: + case 8750: + case 8751: + case 8752: + case 8753: + case 8754: + case 8755: + case 8756: + case 8757: + case 8758: + case 8759: + case 8760: + case 8761: + case 8762: + case 8763: + case 8764: + case 8765: + case 8766: + case 8767: + case 8768: + case 8769: + case 8770: + case 8771: + case 8772: + case 8773: + case 8774: + case 8775: + case 8776: + case 8777: + case 8778: + case 8779: + case 8780: + case 8781: + case 8782: + case 8783: + case 8784: + case 8785: + case 8786: + case 8787: + case 8788: + case 8789: + case 8790: + case 8791: + case 8792: + case 8793: + case 8794: + case 8795: + case 8796: + case 8797: + case 8798: + case 8799: + case 8800: + case 8801: + case 8802: + case 8803: + case 8804: + case 8805: + case 8806: + case 8807: + case 8808: + case 8809: + case 8810: + case 8811: + case 8812: + case 8813: + case 8814: + case 8815: + case 8816: + case 8817: + case 8818: + case 8819: + case 8820: + case 8821: + case 8822: + case 8823: + case 8824: + case 8825: + case 8826: + case 8827: + case 8828: + case 8829: + case 8830: + case 8831: + case 8832: + case 8833: + case 8834: + case 8835: + case 8836: + case 8837: + case 8838: + case 8839: + case 8840: + case 8841: + case 8842: + case 8843: + case 8844: + case 8845: + case 8846: + case 8847: + case 8848: + case 8849: + case 8850: + case 8851: + case 8852: + case 8853: + case 8854: + case 8855: + case 8856: + case 8857: + case 8858: + case 8859: + case 8860: + case 8861: + case 8862: + case 8863: + case 8864: + case 8865: + case 8866: + case 8867: + case 8868: + case 8869: + case 8870: + case 8871: + case 8872: + case 8873: + case 8874: + case 8875: + case 8876: + case 8877: + case 8878: + case 8879: + case 8880: + case 8881: + case 8882: + case 8883: + case 8884: + case 8885: + case 8886: + case 8887: + case 8888: + case 8889: + case 8890: + case 8891: + case 8892: + case 8893: + case 8894: + case 8895: + case 8896: + case 8897: + case 8898: + case 8899: + case 8900: + case 8901: + case 8902: + case 8903: + case 8904: + case 8905: + case 8906: + case 8907: + case 8908: + case 8909: + case 8910: + case 8911: + case 8912: + case 8913: + case 8914: + case 8915: + case 8916: + case 8917: + case 8918: + case 8919: + case 8920: + case 8921: + case 8922: + case 8923: + case 8924: + case 8925: + case 8926: + case 8927: + case 8928: + case 8929: + case 8930: + case 8931: + case 8932: + case 8933: + case 8934: + case 8935: + case 8936: + case 8937: + case 8938: + case 8939: + case 8940: + case 8941: + case 8942: + case 8943: + case 8944: + case 8945: + case 8946: + case 8947: + case 8948: + case 8949: + case 8950: + case 8951: + case 8952: + case 8953: + case 8954: + case 8955: + case 8956: + case 8957: + case 8958: + case 8959: + case 8960: + case 8961: + case 8962: + case 8963: + case 8964: + case 8965: + case 8966: + case 8967: + case 8968: + case 8969: + case 8970: + case 8971: + case 8972: + case 8973: + case 8974: + case 8975: + case 8976: + case 8977: + case 8978: + case 8979: + case 8980: + case 8981: + case 8982: + case 8983: + case 8984: + case 8985: + case 8986: + case 8987: + case 8988: + case 8989: + case 8990: + case 8991: + case 8992: + case 8993: + case 8994: + case 8995: + case 8996: + case 8997: + case 8998: + case 8999: + actual += 'a'; +} +expect = 'a'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js new file mode 100644 index 0000000..681fb3f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js @@ -0,0 +1,9078 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 09 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 74474 +* "switch() misbehaves with duplicated labels" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474 +* See ECMA3 Section 12.11, "The switch Statement" +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 74474; +var summary = 'Test of switch statement that overflows the stack-allocated bitmap'; +var status = '(One duplicated label [8998])'; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var x = 3; + + +switch (x) +{ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 185: + case 186: + case 187: + case 188: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 216: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: + case 223: + case 224: + case 225: + case 226: + case 227: + case 228: + case 229: + case 230: + case 231: + case 232: + case 233: + case 234: + case 235: + case 236: + case 237: + case 238: + case 239: + case 240: + case 241: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 248: + case 249: + case 250: + case 251: + case 252: + case 253: + case 254: + case 255: + case 256: + case 257: + case 258: + case 259: + case 260: + case 261: + case 262: + case 263: + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 290: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 307: + case 308: + case 309: + case 310: + case 311: + case 312: + case 313: + case 314: + case 315: + case 316: + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + case 331: + case 332: + case 333: + case 334: + case 335: + case 336: + case 337: + case 338: + case 339: + case 340: + case 341: + case 342: + case 343: + case 344: + case 345: + case 346: + case 347: + case 348: + case 349: + case 350: + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 372: + case 373: + case 374: + case 375: + case 376: + case 377: + case 378: + case 379: + case 380: + case 381: + case 382: + case 383: + case 384: + case 385: + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + case 394: + case 395: + case 396: + case 397: + case 398: + case 399: + case 400: + case 401: + case 402: + case 403: + case 404: + case 405: + case 406: + case 407: + case 408: + case 409: + case 410: + case 411: + case 412: + case 413: + case 414: + case 415: + case 416: + case 417: + case 418: + case 419: + case 420: + case 421: + case 422: + case 423: + case 424: + case 425: + case 426: + case 427: + case 428: + case 429: + case 430: + case 431: + case 432: + case 433: + case 434: + case 435: + case 436: + case 437: + case 438: + case 439: + case 440: + case 441: + case 442: + case 443: + case 444: + case 445: + case 446: + case 447: + case 448: + case 449: + case 450: + case 451: + case 452: + case 453: + case 454: + case 455: + case 456: + case 457: + case 458: + case 459: + case 460: + case 461: + case 462: + case 463: + case 464: + case 465: + case 466: + case 467: + case 468: + case 469: + case 470: + case 471: + case 472: + case 473: + case 474: + case 475: + case 476: + case 477: + case 478: + case 479: + case 480: + case 481: + case 482: + case 483: + case 484: + case 485: + case 486: + case 487: + case 488: + case 489: + case 490: + case 491: + case 492: + case 493: + case 494: + case 495: + case 496: + case 497: + case 498: + case 499: + case 500: + case 501: + case 502: + case 503: + case 504: + case 505: + case 506: + case 507: + case 508: + case 509: + case 510: + case 511: + case 512: + case 513: + case 514: + case 515: + case 516: + case 517: + case 518: + case 519: + case 520: + case 521: + case 522: + case 523: + case 524: + case 525: + case 526: + case 527: + case 528: + case 529: + case 530: + case 531: + case 532: + case 533: + case 534: + case 535: + case 536: + case 537: + case 538: + case 539: + case 540: + case 541: + case 542: + case 543: + case 544: + case 545: + case 546: + case 547: + case 548: + case 549: + case 550: + case 551: + case 552: + case 553: + case 554: + case 555: + case 556: + case 557: + case 558: + case 559: + case 560: + case 561: + case 562: + case 563: + case 564: + case 565: + case 566: + case 567: + case 568: + case 569: + case 570: + case 571: + case 572: + case 573: + case 574: + case 575: + case 576: + case 577: + case 578: + case 579: + case 580: + case 581: + case 582: + case 583: + case 584: + case 585: + case 586: + case 587: + case 588: + case 589: + case 590: + case 591: + case 592: + case 593: + case 594: + case 595: + case 596: + case 597: + case 598: + case 599: + case 600: + case 601: + case 602: + case 603: + case 604: + case 605: + case 606: + case 607: + case 608: + case 609: + case 610: + case 611: + case 612: + case 613: + case 614: + case 615: + case 616: + case 617: + case 618: + case 619: + case 620: + case 621: + case 622: + case 623: + case 624: + case 625: + case 626: + case 627: + case 628: + case 629: + case 630: + case 631: + case 632: + case 633: + case 634: + case 635: + case 636: + case 637: + case 638: + case 639: + case 640: + case 641: + case 642: + case 643: + case 644: + case 645: + case 646: + case 647: + case 648: + case 649: + case 650: + case 651: + case 652: + case 653: + case 654: + case 655: + case 656: + case 657: + case 658: + case 659: + case 660: + case 661: + case 662: + case 663: + case 664: + case 665: + case 666: + case 667: + case 668: + case 669: + case 670: + case 671: + case 672: + case 673: + case 674: + case 675: + case 676: + case 677: + case 678: + case 679: + case 680: + case 681: + case 682: + case 683: + case 684: + case 685: + case 686: + case 687: + case 688: + case 689: + case 690: + case 691: + case 692: + case 693: + case 694: + case 695: + case 696: + case 697: + case 698: + case 699: + case 700: + case 701: + case 702: + case 703: + case 704: + case 705: + case 706: + case 707: + case 708: + case 709: + case 710: + case 711: + case 712: + case 713: + case 714: + case 715: + case 716: + case 717: + case 718: + case 719: + case 720: + case 721: + case 722: + case 723: + case 724: + case 725: + case 726: + case 727: + case 728: + case 729: + case 730: + case 731: + case 732: + case 733: + case 734: + case 735: + case 736: + case 737: + case 738: + case 739: + case 740: + case 741: + case 742: + case 743: + case 744: + case 745: + case 746: + case 747: + case 748: + case 749: + case 750: + case 751: + case 752: + case 753: + case 754: + case 755: + case 756: + case 757: + case 758: + case 759: + case 760: + case 761: + case 762: + case 763: + case 764: + case 765: + case 766: + case 767: + case 768: + case 769: + case 770: + case 771: + case 772: + case 773: + case 774: + case 775: + case 776: + case 777: + case 778: + case 779: + case 780: + case 781: + case 782: + case 783: + case 784: + case 785: + case 786: + case 787: + case 788: + case 789: + case 790: + case 791: + case 792: + case 793: + case 794: + case 795: + case 796: + case 797: + case 798: + case 799: + case 800: + case 801: + case 802: + case 803: + case 804: + case 805: + case 806: + case 807: + case 808: + case 809: + case 810: + case 811: + case 812: + case 813: + case 814: + case 815: + case 816: + case 817: + case 818: + case 819: + case 820: + case 821: + case 822: + case 823: + case 824: + case 825: + case 826: + case 827: + case 828: + case 829: + case 830: + case 831: + case 832: + case 833: + case 834: + case 835: + case 836: + case 837: + case 838: + case 839: + case 840: + case 841: + case 842: + case 843: + case 844: + case 845: + case 846: + case 847: + case 848: + case 849: + case 850: + case 851: + case 852: + case 853: + case 854: + case 855: + case 856: + case 857: + case 858: + case 859: + case 860: + case 861: + case 862: + case 863: + case 864: + case 865: + case 866: + case 867: + case 868: + case 869: + case 870: + case 871: + case 872: + case 873: + case 874: + case 875: + case 876: + case 877: + case 878: + case 879: + case 880: + case 881: + case 882: + case 883: + case 884: + case 885: + case 886: + case 887: + case 888: + case 889: + case 890: + case 891: + case 892: + case 893: + case 894: + case 895: + case 896: + case 897: + case 898: + case 899: + case 900: + case 901: + case 902: + case 903: + case 904: + case 905: + case 906: + case 907: + case 908: + case 909: + case 910: + case 911: + case 912: + case 913: + case 914: + case 915: + case 916: + case 917: + case 918: + case 919: + case 920: + case 921: + case 922: + case 923: + case 924: + case 925: + case 926: + case 927: + case 928: + case 929: + case 930: + case 931: + case 932: + case 933: + case 934: + case 935: + case 936: + case 937: + case 938: + case 939: + case 940: + case 941: + case 942: + case 943: + case 944: + case 945: + case 946: + case 947: + case 948: + case 949: + case 950: + case 951: + case 952: + case 953: + case 954: + case 955: + case 956: + case 957: + case 958: + case 959: + case 960: + case 961: + case 962: + case 963: + case 964: + case 965: + case 966: + case 967: + case 968: + case 969: + case 970: + case 971: + case 972: + case 973: + case 974: + case 975: + case 976: + case 977: + case 978: + case 979: + case 980: + case 981: + case 982: + case 983: + case 984: + case 985: + case 986: + case 987: + case 988: + case 989: + case 990: + case 991: + case 992: + case 993: + case 994: + case 995: + case 996: + case 997: + case 998: + case 999: + case 1000: + case 1001: + case 1002: + case 1003: + case 1004: + case 1005: + case 1006: + case 1007: + case 1008: + case 1009: + case 1010: + case 1011: + case 1012: + case 1013: + case 1014: + case 1015: + case 1016: + case 1017: + case 1018: + case 1019: + case 1020: + case 1021: + case 1022: + case 1023: + case 1024: + case 1025: + case 1026: + case 1027: + case 1028: + case 1029: + case 1030: + case 1031: + case 1032: + case 1033: + case 1034: + case 1035: + case 1036: + case 1037: + case 1038: + case 1039: + case 1040: + case 1041: + case 1042: + case 1043: + case 1044: + case 1045: + case 1046: + case 1047: + case 1048: + case 1049: + case 1050: + case 1051: + case 1052: + case 1053: + case 1054: + case 1055: + case 1056: + case 1057: + case 1058: + case 1059: + case 1060: + case 1061: + case 1062: + case 1063: + case 1064: + case 1065: + case 1066: + case 1067: + case 1068: + case 1069: + case 1070: + case 1071: + case 1072: + case 1073: + case 1074: + case 1075: + case 1076: + case 1077: + case 1078: + case 1079: + case 1080: + case 1081: + case 1082: + case 1083: + case 1084: + case 1085: + case 1086: + case 1087: + case 1088: + case 1089: + case 1090: + case 1091: + case 1092: + case 1093: + case 1094: + case 1095: + case 1096: + case 1097: + case 1098: + case 1099: + case 1100: + case 1101: + case 1102: + case 1103: + case 1104: + case 1105: + case 1106: + case 1107: + case 1108: + case 1109: + case 1110: + case 1111: + case 1112: + case 1113: + case 1114: + case 1115: + case 1116: + case 1117: + case 1118: + case 1119: + case 1120: + case 1121: + case 1122: + case 1123: + case 1124: + case 1125: + case 1126: + case 1127: + case 1128: + case 1129: + case 1130: + case 1131: + case 1132: + case 1133: + case 1134: + case 1135: + case 1136: + case 1137: + case 1138: + case 1139: + case 1140: + case 1141: + case 1142: + case 1143: + case 1144: + case 1145: + case 1146: + case 1147: + case 1148: + case 1149: + case 1150: + case 1151: + case 1152: + case 1153: + case 1154: + case 1155: + case 1156: + case 1157: + case 1158: + case 1159: + case 1160: + case 1161: + case 1162: + case 1163: + case 1164: + case 1165: + case 1166: + case 1167: + case 1168: + case 1169: + case 1170: + case 1171: + case 1172: + case 1173: + case 1174: + case 1175: + case 1176: + case 1177: + case 1178: + case 1179: + case 1180: + case 1181: + case 1182: + case 1183: + case 1184: + case 1185: + case 1186: + case 1187: + case 1188: + case 1189: + case 1190: + case 1191: + case 1192: + case 1193: + case 1194: + case 1195: + case 1196: + case 1197: + case 1198: + case 1199: + case 1200: + case 1201: + case 1202: + case 1203: + case 1204: + case 1205: + case 1206: + case 1207: + case 1208: + case 1209: + case 1210: + case 1211: + case 1212: + case 1213: + case 1214: + case 1215: + case 1216: + case 1217: + case 1218: + case 1219: + case 1220: + case 1221: + case 1222: + case 1223: + case 1224: + case 1225: + case 1226: + case 1227: + case 1228: + case 1229: + case 1230: + case 1231: + case 1232: + case 1233: + case 1234: + case 1235: + case 1236: + case 1237: + case 1238: + case 1239: + case 1240: + case 1241: + case 1242: + case 1243: + case 1244: + case 1245: + case 1246: + case 1247: + case 1248: + case 1249: + case 1250: + case 1251: + case 1252: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 1259: + case 1260: + case 1261: + case 1262: + case 1263: + case 1264: + case 1265: + case 1266: + case 1267: + case 1268: + case 1269: + case 1270: + case 1271: + case 1272: + case 1273: + case 1274: + case 1275: + case 1276: + case 1277: + case 1278: + case 1279: + case 1280: + case 1281: + case 1282: + case 1283: + case 1284: + case 1285: + case 1286: + case 1287: + case 1288: + case 1289: + case 1290: + case 1291: + case 1292: + case 1293: + case 1294: + case 1295: + case 1296: + case 1297: + case 1298: + case 1299: + case 1300: + case 1301: + case 1302: + case 1303: + case 1304: + case 1305: + case 1306: + case 1307: + case 1308: + case 1309: + case 1310: + case 1311: + case 1312: + case 1313: + case 1314: + case 1315: + case 1316: + case 1317: + case 1318: + case 1319: + case 1320: + case 1321: + case 1322: + case 1323: + case 1324: + case 1325: + case 1326: + case 1327: + case 1328: + case 1329: + case 1330: + case 1331: + case 1332: + case 1333: + case 1334: + case 1335: + case 1336: + case 1337: + case 1338: + case 1339: + case 1340: + case 1341: + case 1342: + case 1343: + case 1344: + case 1345: + case 1346: + case 1347: + case 1348: + case 1349: + case 1350: + case 1351: + case 1352: + case 1353: + case 1354: + case 1355: + case 1356: + case 1357: + case 1358: + case 1359: + case 1360: + case 1361: + case 1362: + case 1363: + case 1364: + case 1365: + case 1366: + case 1367: + case 1368: + case 1369: + case 1370: + case 1371: + case 1372: + case 1373: + case 1374: + case 1375: + case 1376: + case 1377: + case 1378: + case 1379: + case 1380: + case 1381: + case 1382: + case 1383: + case 1384: + case 1385: + case 1386: + case 1387: + case 1388: + case 1389: + case 1390: + case 1391: + case 1392: + case 1393: + case 1394: + case 1395: + case 1396: + case 1397: + case 1398: + case 1399: + case 1400: + case 1401: + case 1402: + case 1403: + case 1404: + case 1405: + case 1406: + case 1407: + case 1408: + case 1409: + case 1410: + case 1411: + case 1412: + case 1413: + case 1414: + case 1415: + case 1416: + case 1417: + case 1418: + case 1419: + case 1420: + case 1421: + case 1422: + case 1423: + case 1424: + case 1425: + case 1426: + case 1427: + case 1428: + case 1429: + case 1430: + case 1431: + case 1432: + case 1433: + case 1434: + case 1435: + case 1436: + case 1437: + case 1438: + case 1439: + case 1440: + case 1441: + case 1442: + case 1443: + case 1444: + case 1445: + case 1446: + case 1447: + case 1448: + case 1449: + case 1450: + case 1451: + case 1452: + case 1453: + case 1454: + case 1455: + case 1456: + case 1457: + case 1458: + case 1459: + case 1460: + case 1461: + case 1462: + case 1463: + case 1464: + case 1465: + case 1466: + case 1467: + case 1468: + case 1469: + case 1470: + case 1471: + case 1472: + case 1473: + case 1474: + case 1475: + case 1476: + case 1477: + case 1478: + case 1479: + case 1480: + case 1481: + case 1482: + case 1483: + case 1484: + case 1485: + case 1486: + case 1487: + case 1488: + case 1489: + case 1490: + case 1491: + case 1492: + case 1493: + case 1494: + case 1495: + case 1496: + case 1497: + case 1498: + case 1499: + case 1500: + case 1501: + case 1502: + case 1503: + case 1504: + case 1505: + case 1506: + case 1507: + case 1508: + case 1509: + case 1510: + case 1511: + case 1512: + case 1513: + case 1514: + case 1515: + case 1516: + case 1517: + case 1518: + case 1519: + case 1520: + case 1521: + case 1522: + case 1523: + case 1524: + case 1525: + case 1526: + case 1527: + case 1528: + case 1529: + case 1530: + case 1531: + case 1532: + case 1533: + case 1534: + case 1535: + case 1536: + case 1537: + case 1538: + case 1539: + case 1540: + case 1541: + case 1542: + case 1543: + case 1544: + case 1545: + case 1546: + case 1547: + case 1548: + case 1549: + case 1550: + case 1551: + case 1552: + case 1553: + case 1554: + case 1555: + case 1556: + case 1557: + case 1558: + case 1559: + case 1560: + case 1561: + case 1562: + case 1563: + case 1564: + case 1565: + case 1566: + case 1567: + case 1568: + case 1569: + case 1570: + case 1571: + case 1572: + case 1573: + case 1574: + case 1575: + case 1576: + case 1577: + case 1578: + case 1579: + case 1580: + case 1581: + case 1582: + case 1583: + case 1584: + case 1585: + case 1586: + case 1587: + case 1588: + case 1589: + case 1590: + case 1591: + case 1592: + case 1593: + case 1594: + case 1595: + case 1596: + case 1597: + case 1598: + case 1599: + case 1600: + case 1601: + case 1602: + case 1603: + case 1604: + case 1605: + case 1606: + case 1607: + case 1608: + case 1609: + case 1610: + case 1611: + case 1612: + case 1613: + case 1614: + case 1615: + case 1616: + case 1617: + case 1618: + case 1619: + case 1620: + case 1621: + case 1622: + case 1623: + case 1624: + case 1625: + case 1626: + case 1627: + case 1628: + case 1629: + case 1630: + case 1631: + case 1632: + case 1633: + case 1634: + case 1635: + case 1636: + case 1637: + case 1638: + case 1639: + case 1640: + case 1641: + case 1642: + case 1643: + case 1644: + case 1645: + case 1646: + case 1647: + case 1648: + case 1649: + case 1650: + case 1651: + case 1652: + case 1653: + case 1654: + case 1655: + case 1656: + case 1657: + case 1658: + case 1659: + case 1660: + case 1661: + case 1662: + case 1663: + case 1664: + case 1665: + case 1666: + case 1667: + case 1668: + case 1669: + case 1670: + case 1671: + case 1672: + case 1673: + case 1674: + case 1675: + case 1676: + case 1677: + case 1678: + case 1679: + case 1680: + case 1681: + case 1682: + case 1683: + case 1684: + case 1685: + case 1686: + case 1687: + case 1688: + case 1689: + case 1690: + case 1691: + case 1692: + case 1693: + case 1694: + case 1695: + case 1696: + case 1697: + case 1698: + case 1699: + case 1700: + case 1701: + case 1702: + case 1703: + case 1704: + case 1705: + case 1706: + case 1707: + case 1708: + case 1709: + case 1710: + case 1711: + case 1712: + case 1713: + case 1714: + case 1715: + case 1716: + case 1717: + case 1718: + case 1719: + case 1720: + case 1721: + case 1722: + case 1723: + case 1724: + case 1725: + case 1726: + case 1727: + case 1728: + case 1729: + case 1730: + case 1731: + case 1732: + case 1733: + case 1734: + case 1735: + case 1736: + case 1737: + case 1738: + case 1739: + case 1740: + case 1741: + case 1742: + case 1743: + case 1744: + case 1745: + case 1746: + case 1747: + case 1748: + case 1749: + case 1750: + case 1751: + case 1752: + case 1753: + case 1754: + case 1755: + case 1756: + case 1757: + case 1758: + case 1759: + case 1760: + case 1761: + case 1762: + case 1763: + case 1764: + case 1765: + case 1766: + case 1767: + case 1768: + case 1769: + case 1770: + case 1771: + case 1772: + case 1773: + case 1774: + case 1775: + case 1776: + case 1777: + case 1778: + case 1779: + case 1780: + case 1781: + case 1782: + case 1783: + case 1784: + case 1785: + case 1786: + case 1787: + case 1788: + case 1789: + case 1790: + case 1791: + case 1792: + case 1793: + case 1794: + case 1795: + case 1796: + case 1797: + case 1798: + case 1799: + case 1800: + case 1801: + case 1802: + case 1803: + case 1804: + case 1805: + case 1806: + case 1807: + case 1808: + case 1809: + case 1810: + case 1811: + case 1812: + case 1813: + case 1814: + case 1815: + case 1816: + case 1817: + case 1818: + case 1819: + case 1820: + case 1821: + case 1822: + case 1823: + case 1824: + case 1825: + case 1826: + case 1827: + case 1828: + case 1829: + case 1830: + case 1831: + case 1832: + case 1833: + case 1834: + case 1835: + case 1836: + case 1837: + case 1838: + case 1839: + case 1840: + case 1841: + case 1842: + case 1843: + case 1844: + case 1845: + case 1846: + case 1847: + case 1848: + case 1849: + case 1850: + case 1851: + case 1852: + case 1853: + case 1854: + case 1855: + case 1856: + case 1857: + case 1858: + case 1859: + case 1860: + case 1861: + case 1862: + case 1863: + case 1864: + case 1865: + case 1866: + case 1867: + case 1868: + case 1869: + case 1870: + case 1871: + case 1872: + case 1873: + case 1874: + case 1875: + case 1876: + case 1877: + case 1878: + case 1879: + case 1880: + case 1881: + case 1882: + case 1883: + case 1884: + case 1885: + case 1886: + case 1887: + case 1888: + case 1889: + case 1890: + case 1891: + case 1892: + case 1893: + case 1894: + case 1895: + case 1896: + case 1897: + case 1898: + case 1899: + case 1900: + case 1901: + case 1902: + case 1903: + case 1904: + case 1905: + case 1906: + case 1907: + case 1908: + case 1909: + case 1910: + case 1911: + case 1912: + case 1913: + case 1914: + case 1915: + case 1916: + case 1917: + case 1918: + case 1919: + case 1920: + case 1921: + case 1922: + case 1923: + case 1924: + case 1925: + case 1926: + case 1927: + case 1928: + case 1929: + case 1930: + case 1931: + case 1932: + case 1933: + case 1934: + case 1935: + case 1936: + case 1937: + case 1938: + case 1939: + case 1940: + case 1941: + case 1942: + case 1943: + case 1944: + case 1945: + case 1946: + case 1947: + case 1948: + case 1949: + case 1950: + case 1951: + case 1952: + case 1953: + case 1954: + case 1955: + case 1956: + case 1957: + case 1958: + case 1959: + case 1960: + case 1961: + case 1962: + case 1963: + case 1964: + case 1965: + case 1966: + case 1967: + case 1968: + case 1969: + case 1970: + case 1971: + case 1972: + case 1973: + case 1974: + case 1975: + case 1976: + case 1977: + case 1978: + case 1979: + case 1980: + case 1981: + case 1982: + case 1983: + case 1984: + case 1985: + case 1986: + case 1987: + case 1988: + case 1989: + case 1990: + case 1991: + case 1992: + case 1993: + case 1994: + case 1995: + case 1996: + case 1997: + case 1998: + case 1999: + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + case 2010: + case 2011: + case 2012: + case 2013: + case 2014: + case 2015: + case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: + case 2036: + case 2037: + case 2038: + case 2039: + case 2040: + case 2041: + case 2042: + case 2043: + case 2044: + case 2045: + case 2046: + case 2047: + case 2048: + case 2049: + case 2050: + case 2051: + case 2052: + case 2053: + case 2054: + case 2055: + case 2056: + case 2057: + case 2058: + case 2059: + case 2060: + case 2061: + case 2062: + case 2063: + case 2064: + case 2065: + case 2066: + case 2067: + case 2068: + case 2069: + case 2070: + case 2071: + case 2072: + case 2073: + case 2074: + case 2075: + case 2076: + case 2077: + case 2078: + case 2079: + case 2080: + case 2081: + case 2082: + case 2083: + case 2084: + case 2085: + case 2086: + case 2087: + case 2088: + case 2089: + case 2090: + case 2091: + case 2092: + case 2093: + case 2094: + case 2095: + case 2096: + case 2097: + case 2098: + case 2099: + case 2100: + case 2101: + case 2102: + case 2103: + case 2104: + case 2105: + case 2106: + case 2107: + case 2108: + case 2109: + case 2110: + case 2111: + case 2112: + case 2113: + case 2114: + case 2115: + case 2116: + case 2117: + case 2118: + case 2119: + case 2120: + case 2121: + case 2122: + case 2123: + case 2124: + case 2125: + case 2126: + case 2127: + case 2128: + case 2129: + case 2130: + case 2131: + case 2132: + case 2133: + case 2134: + case 2135: + case 2136: + case 2137: + case 2138: + case 2139: + case 2140: + case 2141: + case 2142: + case 2143: + case 2144: + case 2145: + case 2146: + case 2147: + case 2148: + case 2149: + case 2150: + case 2151: + case 2152: + case 2153: + case 2154: + case 2155: + case 2156: + case 2157: + case 2158: + case 2159: + case 2160: + case 2161: + case 2162: + case 2163: + case 2164: + case 2165: + case 2166: + case 2167: + case 2168: + case 2169: + case 2170: + case 2171: + case 2172: + case 2173: + case 2174: + case 2175: + case 2176: + case 2177: + case 2178: + case 2179: + case 2180: + case 2181: + case 2182: + case 2183: + case 2184: + case 2185: + case 2186: + case 2187: + case 2188: + case 2189: + case 2190: + case 2191: + case 2192: + case 2193: + case 2194: + case 2195: + case 2196: + case 2197: + case 2198: + case 2199: + case 2200: + case 2201: + case 2202: + case 2203: + case 2204: + case 2205: + case 2206: + case 2207: + case 2208: + case 2209: + case 2210: + case 2211: + case 2212: + case 2213: + case 2214: + case 2215: + case 2216: + case 2217: + case 2218: + case 2219: + case 2220: + case 2221: + case 2222: + case 2223: + case 2224: + case 2225: + case 2226: + case 2227: + case 2228: + case 2229: + case 2230: + case 2231: + case 2232: + case 2233: + case 2234: + case 2235: + case 2236: + case 2237: + case 2238: + case 2239: + case 2240: + case 2241: + case 2242: + case 2243: + case 2244: + case 2245: + case 2246: + case 2247: + case 2248: + case 2249: + case 2250: + case 2251: + case 2252: + case 2253: + case 2254: + case 2255: + case 2256: + case 2257: + case 2258: + case 2259: + case 2260: + case 2261: + case 2262: + case 2263: + case 2264: + case 2265: + case 2266: + case 2267: + case 2268: + case 2269: + case 2270: + case 2271: + case 2272: + case 2273: + case 2274: + case 2275: + case 2276: + case 2277: + case 2278: + case 2279: + case 2280: + case 2281: + case 2282: + case 2283: + case 2284: + case 2285: + case 2286: + case 2287: + case 2288: + case 2289: + case 2290: + case 2291: + case 2292: + case 2293: + case 2294: + case 2295: + case 2296: + case 2297: + case 2298: + case 2299: + case 2300: + case 2301: + case 2302: + case 2303: + case 2304: + case 2305: + case 2306: + case 2307: + case 2308: + case 2309: + case 2310: + case 2311: + case 2312: + case 2313: + case 2314: + case 2315: + case 2316: + case 2317: + case 2318: + case 2319: + case 2320: + case 2321: + case 2322: + case 2323: + case 2324: + case 2325: + case 2326: + case 2327: + case 2328: + case 2329: + case 2330: + case 2331: + case 2332: + case 2333: + case 2334: + case 2335: + case 2336: + case 2337: + case 2338: + case 2339: + case 2340: + case 2341: + case 2342: + case 2343: + case 2344: + case 2345: + case 2346: + case 2347: + case 2348: + case 2349: + case 2350: + case 2351: + case 2352: + case 2353: + case 2354: + case 2355: + case 2356: + case 2357: + case 2358: + case 2359: + case 2360: + case 2361: + case 2362: + case 2363: + case 2364: + case 2365: + case 2366: + case 2367: + case 2368: + case 2369: + case 2370: + case 2371: + case 2372: + case 2373: + case 2374: + case 2375: + case 2376: + case 2377: + case 2378: + case 2379: + case 2380: + case 2381: + case 2382: + case 2383: + case 2384: + case 2385: + case 2386: + case 2387: + case 2388: + case 2389: + case 2390: + case 2391: + case 2392: + case 2393: + case 2394: + case 2395: + case 2396: + case 2397: + case 2398: + case 2399: + case 2400: + case 2401: + case 2402: + case 2403: + case 2404: + case 2405: + case 2406: + case 2407: + case 2408: + case 2409: + case 2410: + case 2411: + case 2412: + case 2413: + case 2414: + case 2415: + case 2416: + case 2417: + case 2418: + case 2419: + case 2420: + case 2421: + case 2422: + case 2423: + case 2424: + case 2425: + case 2426: + case 2427: + case 2428: + case 2429: + case 2430: + case 2431: + case 2432: + case 2433: + case 2434: + case 2435: + case 2436: + case 2437: + case 2438: + case 2439: + case 2440: + case 2441: + case 2442: + case 2443: + case 2444: + case 2445: + case 2446: + case 2447: + case 2448: + case 2449: + case 2450: + case 2451: + case 2452: + case 2453: + case 2454: + case 2455: + case 2456: + case 2457: + case 2458: + case 2459: + case 2460: + case 2461: + case 2462: + case 2463: + case 2464: + case 2465: + case 2466: + case 2467: + case 2468: + case 2469: + case 2470: + case 2471: + case 2472: + case 2473: + case 2474: + case 2475: + case 2476: + case 2477: + case 2478: + case 2479: + case 2480: + case 2481: + case 2482: + case 2483: + case 2484: + case 2485: + case 2486: + case 2487: + case 2488: + case 2489: + case 2490: + case 2491: + case 2492: + case 2493: + case 2494: + case 2495: + case 2496: + case 2497: + case 2498: + case 2499: + case 2500: + case 2501: + case 2502: + case 2503: + case 2504: + case 2505: + case 2506: + case 2507: + case 2508: + case 2509: + case 2510: + case 2511: + case 2512: + case 2513: + case 2514: + case 2515: + case 2516: + case 2517: + case 2518: + case 2519: + case 2520: + case 2521: + case 2522: + case 2523: + case 2524: + case 2525: + case 2526: + case 2527: + case 2528: + case 2529: + case 2530: + case 2531: + case 2532: + case 2533: + case 2534: + case 2535: + case 2536: + case 2537: + case 2538: + case 2539: + case 2540: + case 2541: + case 2542: + case 2543: + case 2544: + case 2545: + case 2546: + case 2547: + case 2548: + case 2549: + case 2550: + case 2551: + case 2552: + case 2553: + case 2554: + case 2555: + case 2556: + case 2557: + case 2558: + case 2559: + case 2560: + case 2561: + case 2562: + case 2563: + case 2564: + case 2565: + case 2566: + case 2567: + case 2568: + case 2569: + case 2570: + case 2571: + case 2572: + case 2573: + case 2574: + case 2575: + case 2576: + case 2577: + case 2578: + case 2579: + case 2580: + case 2581: + case 2582: + case 2583: + case 2584: + case 2585: + case 2586: + case 2587: + case 2588: + case 2589: + case 2590: + case 2591: + case 2592: + case 2593: + case 2594: + case 2595: + case 2596: + case 2597: + case 2598: + case 2599: + case 2600: + case 2601: + case 2602: + case 2603: + case 2604: + case 2605: + case 2606: + case 2607: + case 2608: + case 2609: + case 2610: + case 2611: + case 2612: + case 2613: + case 2614: + case 2615: + case 2616: + case 2617: + case 2618: + case 2619: + case 2620: + case 2621: + case 2622: + case 2623: + case 2624: + case 2625: + case 2626: + case 2627: + case 2628: + case 2629: + case 2630: + case 2631: + case 2632: + case 2633: + case 2634: + case 2635: + case 2636: + case 2637: + case 2638: + case 2639: + case 2640: + case 2641: + case 2642: + case 2643: + case 2644: + case 2645: + case 2646: + case 2647: + case 2648: + case 2649: + case 2650: + case 2651: + case 2652: + case 2653: + case 2654: + case 2655: + case 2656: + case 2657: + case 2658: + case 2659: + case 2660: + case 2661: + case 2662: + case 2663: + case 2664: + case 2665: + case 2666: + case 2667: + case 2668: + case 2669: + case 2670: + case 2671: + case 2672: + case 2673: + case 2674: + case 2675: + case 2676: + case 2677: + case 2678: + case 2679: + case 2680: + case 2681: + case 2682: + case 2683: + case 2684: + case 2685: + case 2686: + case 2687: + case 2688: + case 2689: + case 2690: + case 2691: + case 2692: + case 2693: + case 2694: + case 2695: + case 2696: + case 2697: + case 2698: + case 2699: + case 2700: + case 2701: + case 2702: + case 2703: + case 2704: + case 2705: + case 2706: + case 2707: + case 2708: + case 2709: + case 2710: + case 2711: + case 2712: + case 2713: + case 2714: + case 2715: + case 2716: + case 2717: + case 2718: + case 2719: + case 2720: + case 2721: + case 2722: + case 2723: + case 2724: + case 2725: + case 2726: + case 2727: + case 2728: + case 2729: + case 2730: + case 2731: + case 2732: + case 2733: + case 2734: + case 2735: + case 2736: + case 2737: + case 2738: + case 2739: + case 2740: + case 2741: + case 2742: + case 2743: + case 2744: + case 2745: + case 2746: + case 2747: + case 2748: + case 2749: + case 2750: + case 2751: + case 2752: + case 2753: + case 2754: + case 2755: + case 2756: + case 2757: + case 2758: + case 2759: + case 2760: + case 2761: + case 2762: + case 2763: + case 2764: + case 2765: + case 2766: + case 2767: + case 2768: + case 2769: + case 2770: + case 2771: + case 2772: + case 2773: + case 2774: + case 2775: + case 2776: + case 2777: + case 2778: + case 2779: + case 2780: + case 2781: + case 2782: + case 2783: + case 2784: + case 2785: + case 2786: + case 2787: + case 2788: + case 2789: + case 2790: + case 2791: + case 2792: + case 2793: + case 2794: + case 2795: + case 2796: + case 2797: + case 2798: + case 2799: + case 2800: + case 2801: + case 2802: + case 2803: + case 2804: + case 2805: + case 2806: + case 2807: + case 2808: + case 2809: + case 2810: + case 2811: + case 2812: + case 2813: + case 2814: + case 2815: + case 2816: + case 2817: + case 2818: + case 2819: + case 2820: + case 2821: + case 2822: + case 2823: + case 2824: + case 2825: + case 2826: + case 2827: + case 2828: + case 2829: + case 2830: + case 2831: + case 2832: + case 2833: + case 2834: + case 2835: + case 2836: + case 2837: + case 2838: + case 2839: + case 2840: + case 2841: + case 2842: + case 2843: + case 2844: + case 2845: + case 2846: + case 2847: + case 2848: + case 2849: + case 2850: + case 2851: + case 2852: + case 2853: + case 2854: + case 2855: + case 2856: + case 2857: + case 2858: + case 2859: + case 2860: + case 2861: + case 2862: + case 2863: + case 2864: + case 2865: + case 2866: + case 2867: + case 2868: + case 2869: + case 2870: + case 2871: + case 2872: + case 2873: + case 2874: + case 2875: + case 2876: + case 2877: + case 2878: + case 2879: + case 2880: + case 2881: + case 2882: + case 2883: + case 2884: + case 2885: + case 2886: + case 2887: + case 2888: + case 2889: + case 2890: + case 2891: + case 2892: + case 2893: + case 2894: + case 2895: + case 2896: + case 2897: + case 2898: + case 2899: + case 2900: + case 2901: + case 2902: + case 2903: + case 2904: + case 2905: + case 2906: + case 2907: + case 2908: + case 2909: + case 2910: + case 2911: + case 2912: + case 2913: + case 2914: + case 2915: + case 2916: + case 2917: + case 2918: + case 2919: + case 2920: + case 2921: + case 2922: + case 2923: + case 2924: + case 2925: + case 2926: + case 2927: + case 2928: + case 2929: + case 2930: + case 2931: + case 2932: + case 2933: + case 2934: + case 2935: + case 2936: + case 2937: + case 2938: + case 2939: + case 2940: + case 2941: + case 2942: + case 2943: + case 2944: + case 2945: + case 2946: + case 2947: + case 2948: + case 2949: + case 2950: + case 2951: + case 2952: + case 2953: + case 2954: + case 2955: + case 2956: + case 2957: + case 2958: + case 2959: + case 2960: + case 2961: + case 2962: + case 2963: + case 2964: + case 2965: + case 2966: + case 2967: + case 2968: + case 2969: + case 2970: + case 2971: + case 2972: + case 2973: + case 2974: + case 2975: + case 2976: + case 2977: + case 2978: + case 2979: + case 2980: + case 2981: + case 2982: + case 2983: + case 2984: + case 2985: + case 2986: + case 2987: + case 2988: + case 2989: + case 2990: + case 2991: + case 2992: + case 2993: + case 2994: + case 2995: + case 2996: + case 2997: + case 2998: + case 2999: + case 3000: + case 3001: + case 3002: + case 3003: + case 3004: + case 3005: + case 3006: + case 3007: + case 3008: + case 3009: + case 3010: + case 3011: + case 3012: + case 3013: + case 3014: + case 3015: + case 3016: + case 3017: + case 3018: + case 3019: + case 3020: + case 3021: + case 3022: + case 3023: + case 3024: + case 3025: + case 3026: + case 3027: + case 3028: + case 3029: + case 3030: + case 3031: + case 3032: + case 3033: + case 3034: + case 3035: + case 3036: + case 3037: + case 3038: + case 3039: + case 3040: + case 3041: + case 3042: + case 3043: + case 3044: + case 3045: + case 3046: + case 3047: + case 3048: + case 3049: + case 3050: + case 3051: + case 3052: + case 3053: + case 3054: + case 3055: + case 3056: + case 3057: + case 3058: + case 3059: + case 3060: + case 3061: + case 3062: + case 3063: + case 3064: + case 3065: + case 3066: + case 3067: + case 3068: + case 3069: + case 3070: + case 3071: + case 3072: + case 3073: + case 3074: + case 3075: + case 3076: + case 3077: + case 3078: + case 3079: + case 3080: + case 3081: + case 3082: + case 3083: + case 3084: + case 3085: + case 3086: + case 3087: + case 3088: + case 3089: + case 3090: + case 3091: + case 3092: + case 3093: + case 3094: + case 3095: + case 3096: + case 3097: + case 3098: + case 3099: + case 3100: + case 3101: + case 3102: + case 3103: + case 3104: + case 3105: + case 3106: + case 3107: + case 3108: + case 3109: + case 3110: + case 3111: + case 3112: + case 3113: + case 3114: + case 3115: + case 3116: + case 3117: + case 3118: + case 3119: + case 3120: + case 3121: + case 3122: + case 3123: + case 3124: + case 3125: + case 3126: + case 3127: + case 3128: + case 3129: + case 3130: + case 3131: + case 3132: + case 3133: + case 3134: + case 3135: + case 3136: + case 3137: + case 3138: + case 3139: + case 3140: + case 3141: + case 3142: + case 3143: + case 3144: + case 3145: + case 3146: + case 3147: + case 3148: + case 3149: + case 3150: + case 3151: + case 3152: + case 3153: + case 3154: + case 3155: + case 3156: + case 3157: + case 3158: + case 3159: + case 3160: + case 3161: + case 3162: + case 3163: + case 3164: + case 3165: + case 3166: + case 3167: + case 3168: + case 3169: + case 3170: + case 3171: + case 3172: + case 3173: + case 3174: + case 3175: + case 3176: + case 3177: + case 3178: + case 3179: + case 3180: + case 3181: + case 3182: + case 3183: + case 3184: + case 3185: + case 3186: + case 3187: + case 3188: + case 3189: + case 3190: + case 3191: + case 3192: + case 3193: + case 3194: + case 3195: + case 3196: + case 3197: + case 3198: + case 3199: + case 3200: + case 3201: + case 3202: + case 3203: + case 3204: + case 3205: + case 3206: + case 3207: + case 3208: + case 3209: + case 3210: + case 3211: + case 3212: + case 3213: + case 3214: + case 3215: + case 3216: + case 3217: + case 3218: + case 3219: + case 3220: + case 3221: + case 3222: + case 3223: + case 3224: + case 3225: + case 3226: + case 3227: + case 3228: + case 3229: + case 3230: + case 3231: + case 3232: + case 3233: + case 3234: + case 3235: + case 3236: + case 3237: + case 3238: + case 3239: + case 3240: + case 3241: + case 3242: + case 3243: + case 3244: + case 3245: + case 3246: + case 3247: + case 3248: + case 3249: + case 3250: + case 3251: + case 3252: + case 3253: + case 3254: + case 3255: + case 3256: + case 3257: + case 3258: + case 3259: + case 3260: + case 3261: + case 3262: + case 3263: + case 3264: + case 3265: + case 3266: + case 3267: + case 3268: + case 3269: + case 3270: + case 3271: + case 3272: + case 3273: + case 3274: + case 3275: + case 3276: + case 3277: + case 3278: + case 3279: + case 3280: + case 3281: + case 3282: + case 3283: + case 3284: + case 3285: + case 3286: + case 3287: + case 3288: + case 3289: + case 3290: + case 3291: + case 3292: + case 3293: + case 3294: + case 3295: + case 3296: + case 3297: + case 3298: + case 3299: + case 3300: + case 3301: + case 3302: + case 3303: + case 3304: + case 3305: + case 3306: + case 3307: + case 3308: + case 3309: + case 3310: + case 3311: + case 3312: + case 3313: + case 3314: + case 3315: + case 3316: + case 3317: + case 3318: + case 3319: + case 3320: + case 3321: + case 3322: + case 3323: + case 3324: + case 3325: + case 3326: + case 3327: + case 3328: + case 3329: + case 3330: + case 3331: + case 3332: + case 3333: + case 3334: + case 3335: + case 3336: + case 3337: + case 3338: + case 3339: + case 3340: + case 3341: + case 3342: + case 3343: + case 3344: + case 3345: + case 3346: + case 3347: + case 3348: + case 3349: + case 3350: + case 3351: + case 3352: + case 3353: + case 3354: + case 3355: + case 3356: + case 3357: + case 3358: + case 3359: + case 3360: + case 3361: + case 3362: + case 3363: + case 3364: + case 3365: + case 3366: + case 3367: + case 3368: + case 3369: + case 3370: + case 3371: + case 3372: + case 3373: + case 3374: + case 3375: + case 3376: + case 3377: + case 3378: + case 3379: + case 3380: + case 3381: + case 3382: + case 3383: + case 3384: + case 3385: + case 3386: + case 3387: + case 3388: + case 3389: + case 3390: + case 3391: + case 3392: + case 3393: + case 3394: + case 3395: + case 3396: + case 3397: + case 3398: + case 3399: + case 3400: + case 3401: + case 3402: + case 3403: + case 3404: + case 3405: + case 3406: + case 3407: + case 3408: + case 3409: + case 3410: + case 3411: + case 3412: + case 3413: + case 3414: + case 3415: + case 3416: + case 3417: + case 3418: + case 3419: + case 3420: + case 3421: + case 3422: + case 3423: + case 3424: + case 3425: + case 3426: + case 3427: + case 3428: + case 3429: + case 3430: + case 3431: + case 3432: + case 3433: + case 3434: + case 3435: + case 3436: + case 3437: + case 3438: + case 3439: + case 3440: + case 3441: + case 3442: + case 3443: + case 3444: + case 3445: + case 3446: + case 3447: + case 3448: + case 3449: + case 3450: + case 3451: + case 3452: + case 3453: + case 3454: + case 3455: + case 3456: + case 3457: + case 3458: + case 3459: + case 3460: + case 3461: + case 3462: + case 3463: + case 3464: + case 3465: + case 3466: + case 3467: + case 3468: + case 3469: + case 3470: + case 3471: + case 3472: + case 3473: + case 3474: + case 3475: + case 3476: + case 3477: + case 3478: + case 3479: + case 3480: + case 3481: + case 3482: + case 3483: + case 3484: + case 3485: + case 3486: + case 3487: + case 3488: + case 3489: + case 3490: + case 3491: + case 3492: + case 3493: + case 3494: + case 3495: + case 3496: + case 3497: + case 3498: + case 3499: + case 3500: + case 3501: + case 3502: + case 3503: + case 3504: + case 3505: + case 3506: + case 3507: + case 3508: + case 3509: + case 3510: + case 3511: + case 3512: + case 3513: + case 3514: + case 3515: + case 3516: + case 3517: + case 3518: + case 3519: + case 3520: + case 3521: + case 3522: + case 3523: + case 3524: + case 3525: + case 3526: + case 3527: + case 3528: + case 3529: + case 3530: + case 3531: + case 3532: + case 3533: + case 3534: + case 3535: + case 3536: + case 3537: + case 3538: + case 3539: + case 3540: + case 3541: + case 3542: + case 3543: + case 3544: + case 3545: + case 3546: + case 3547: + case 3548: + case 3549: + case 3550: + case 3551: + case 3552: + case 3553: + case 3554: + case 3555: + case 3556: + case 3557: + case 3558: + case 3559: + case 3560: + case 3561: + case 3562: + case 3563: + case 3564: + case 3565: + case 3566: + case 3567: + case 3568: + case 3569: + case 3570: + case 3571: + case 3572: + case 3573: + case 3574: + case 3575: + case 3576: + case 3577: + case 3578: + case 3579: + case 3580: + case 3581: + case 3582: + case 3583: + case 3584: + case 3585: + case 3586: + case 3587: + case 3588: + case 3589: + case 3590: + case 3591: + case 3592: + case 3593: + case 3594: + case 3595: + case 3596: + case 3597: + case 3598: + case 3599: + case 3600: + case 3601: + case 3602: + case 3603: + case 3604: + case 3605: + case 3606: + case 3607: + case 3608: + case 3609: + case 3610: + case 3611: + case 3612: + case 3613: + case 3614: + case 3615: + case 3616: + case 3617: + case 3618: + case 3619: + case 3620: + case 3621: + case 3622: + case 3623: + case 3624: + case 3625: + case 3626: + case 3627: + case 3628: + case 3629: + case 3630: + case 3631: + case 3632: + case 3633: + case 3634: + case 3635: + case 3636: + case 3637: + case 3638: + case 3639: + case 3640: + case 3641: + case 3642: + case 3643: + case 3644: + case 3645: + case 3646: + case 3647: + case 3648: + case 3649: + case 3650: + case 3651: + case 3652: + case 3653: + case 3654: + case 3655: + case 3656: + case 3657: + case 3658: + case 3659: + case 3660: + case 3661: + case 3662: + case 3663: + case 3664: + case 3665: + case 3666: + case 3667: + case 3668: + case 3669: + case 3670: + case 3671: + case 3672: + case 3673: + case 3674: + case 3675: + case 3676: + case 3677: + case 3678: + case 3679: + case 3680: + case 3681: + case 3682: + case 3683: + case 3684: + case 3685: + case 3686: + case 3687: + case 3688: + case 3689: + case 3690: + case 3691: + case 3692: + case 3693: + case 3694: + case 3695: + case 3696: + case 3697: + case 3698: + case 3699: + case 3700: + case 3701: + case 3702: + case 3703: + case 3704: + case 3705: + case 3706: + case 3707: + case 3708: + case 3709: + case 3710: + case 3711: + case 3712: + case 3713: + case 3714: + case 3715: + case 3716: + case 3717: + case 3718: + case 3719: + case 3720: + case 3721: + case 3722: + case 3723: + case 3724: + case 3725: + case 3726: + case 3727: + case 3728: + case 3729: + case 3730: + case 3731: + case 3732: + case 3733: + case 3734: + case 3735: + case 3736: + case 3737: + case 3738: + case 3739: + case 3740: + case 3741: + case 3742: + case 3743: + case 3744: + case 3745: + case 3746: + case 3747: + case 3748: + case 3749: + case 3750: + case 3751: + case 3752: + case 3753: + case 3754: + case 3755: + case 3756: + case 3757: + case 3758: + case 3759: + case 3760: + case 3761: + case 3762: + case 3763: + case 3764: + case 3765: + case 3766: + case 3767: + case 3768: + case 3769: + case 3770: + case 3771: + case 3772: + case 3773: + case 3774: + case 3775: + case 3776: + case 3777: + case 3778: + case 3779: + case 3780: + case 3781: + case 3782: + case 3783: + case 3784: + case 3785: + case 3786: + case 3787: + case 3788: + case 3789: + case 3790: + case 3791: + case 3792: + case 3793: + case 3794: + case 3795: + case 3796: + case 3797: + case 3798: + case 3799: + case 3800: + case 3801: + case 3802: + case 3803: + case 3804: + case 3805: + case 3806: + case 3807: + case 3808: + case 3809: + case 3810: + case 3811: + case 3812: + case 3813: + case 3814: + case 3815: + case 3816: + case 3817: + case 3818: + case 3819: + case 3820: + case 3821: + case 3822: + case 3823: + case 3824: + case 3825: + case 3826: + case 3827: + case 3828: + case 3829: + case 3830: + case 3831: + case 3832: + case 3833: + case 3834: + case 3835: + case 3836: + case 3837: + case 3838: + case 3839: + case 3840: + case 3841: + case 3842: + case 3843: + case 3844: + case 3845: + case 3846: + case 3847: + case 3848: + case 3849: + case 3850: + case 3851: + case 3852: + case 3853: + case 3854: + case 3855: + case 3856: + case 3857: + case 3858: + case 3859: + case 3860: + case 3861: + case 3862: + case 3863: + case 3864: + case 3865: + case 3866: + case 3867: + case 3868: + case 3869: + case 3870: + case 3871: + case 3872: + case 3873: + case 3874: + case 3875: + case 3876: + case 3877: + case 3878: + case 3879: + case 3880: + case 3881: + case 3882: + case 3883: + case 3884: + case 3885: + case 3886: + case 3887: + case 3888: + case 3889: + case 3890: + case 3891: + case 3892: + case 3893: + case 3894: + case 3895: + case 3896: + case 3897: + case 3898: + case 3899: + case 3900: + case 3901: + case 3902: + case 3903: + case 3904: + case 3905: + case 3906: + case 3907: + case 3908: + case 3909: + case 3910: + case 3911: + case 3912: + case 3913: + case 3914: + case 3915: + case 3916: + case 3917: + case 3918: + case 3919: + case 3920: + case 3921: + case 3922: + case 3923: + case 3924: + case 3925: + case 3926: + case 3927: + case 3928: + case 3929: + case 3930: + case 3931: + case 3932: + case 3933: + case 3934: + case 3935: + case 3936: + case 3937: + case 3938: + case 3939: + case 3940: + case 3941: + case 3942: + case 3943: + case 3944: + case 3945: + case 3946: + case 3947: + case 3948: + case 3949: + case 3950: + case 3951: + case 3952: + case 3953: + case 3954: + case 3955: + case 3956: + case 3957: + case 3958: + case 3959: + case 3960: + case 3961: + case 3962: + case 3963: + case 3964: + case 3965: + case 3966: + case 3967: + case 3968: + case 3969: + case 3970: + case 3971: + case 3972: + case 3973: + case 3974: + case 3975: + case 3976: + case 3977: + case 3978: + case 3979: + case 3980: + case 3981: + case 3982: + case 3983: + case 3984: + case 3985: + case 3986: + case 3987: + case 3988: + case 3989: + case 3990: + case 3991: + case 3992: + case 3993: + case 3994: + case 3995: + case 3996: + case 3997: + case 3998: + case 3999: + case 4000: + case 4001: + case 4002: + case 4003: + case 4004: + case 4005: + case 4006: + case 4007: + case 4008: + case 4009: + case 4010: + case 4011: + case 4012: + case 4013: + case 4014: + case 4015: + case 4016: + case 4017: + case 4018: + case 4019: + case 4020: + case 4021: + case 4022: + case 4023: + case 4024: + case 4025: + case 4026: + case 4027: + case 4028: + case 4029: + case 4030: + case 4031: + case 4032: + case 4033: + case 4034: + case 4035: + case 4036: + case 4037: + case 4038: + case 4039: + case 4040: + case 4041: + case 4042: + case 4043: + case 4044: + case 4045: + case 4046: + case 4047: + case 4048: + case 4049: + case 4050: + case 4051: + case 4052: + case 4053: + case 4054: + case 4055: + case 4056: + case 4057: + case 4058: + case 4059: + case 4060: + case 4061: + case 4062: + case 4063: + case 4064: + case 4065: + case 4066: + case 4067: + case 4068: + case 4069: + case 4070: + case 4071: + case 4072: + case 4073: + case 4074: + case 4075: + case 4076: + case 4077: + case 4078: + case 4079: + case 4080: + case 4081: + case 4082: + case 4083: + case 4084: + case 4085: + case 4086: + case 4087: + case 4088: + case 4089: + case 4090: + case 4091: + case 4092: + case 4093: + case 4094: + case 4095: + case 4096: + case 4097: + case 4098: + case 4099: + case 4100: + case 4101: + case 4102: + case 4103: + case 4104: + case 4105: + case 4106: + case 4107: + case 4108: + case 4109: + case 4110: + case 4111: + case 4112: + case 4113: + case 4114: + case 4115: + case 4116: + case 4117: + case 4118: + case 4119: + case 4120: + case 4121: + case 4122: + case 4123: + case 4124: + case 4125: + case 4126: + case 4127: + case 4128: + case 4129: + case 4130: + case 4131: + case 4132: + case 4133: + case 4134: + case 4135: + case 4136: + case 4137: + case 4138: + case 4139: + case 4140: + case 4141: + case 4142: + case 4143: + case 4144: + case 4145: + case 4146: + case 4147: + case 4148: + case 4149: + case 4150: + case 4151: + case 4152: + case 4153: + case 4154: + case 4155: + case 4156: + case 4157: + case 4158: + case 4159: + case 4160: + case 4161: + case 4162: + case 4163: + case 4164: + case 4165: + case 4166: + case 4167: + case 4168: + case 4169: + case 4170: + case 4171: + case 4172: + case 4173: + case 4174: + case 4175: + case 4176: + case 4177: + case 4178: + case 4179: + case 4180: + case 4181: + case 4182: + case 4183: + case 4184: + case 4185: + case 4186: + case 4187: + case 4188: + case 4189: + case 4190: + case 4191: + case 4192: + case 4193: + case 4194: + case 4195: + case 4196: + case 4197: + case 4198: + case 4199: + case 4200: + case 4201: + case 4202: + case 4203: + case 4204: + case 4205: + case 4206: + case 4207: + case 4208: + case 4209: + case 4210: + case 4211: + case 4212: + case 4213: + case 4214: + case 4215: + case 4216: + case 4217: + case 4218: + case 4219: + case 4220: + case 4221: + case 4222: + case 4223: + case 4224: + case 4225: + case 4226: + case 4227: + case 4228: + case 4229: + case 4230: + case 4231: + case 4232: + case 4233: + case 4234: + case 4235: + case 4236: + case 4237: + case 4238: + case 4239: + case 4240: + case 4241: + case 4242: + case 4243: + case 4244: + case 4245: + case 4246: + case 4247: + case 4248: + case 4249: + case 4250: + case 4251: + case 4252: + case 4253: + case 4254: + case 4255: + case 4256: + case 4257: + case 4258: + case 4259: + case 4260: + case 4261: + case 4262: + case 4263: + case 4264: + case 4265: + case 4266: + case 4267: + case 4268: + case 4269: + case 4270: + case 4271: + case 4272: + case 4273: + case 4274: + case 4275: + case 4276: + case 4277: + case 4278: + case 4279: + case 4280: + case 4281: + case 4282: + case 4283: + case 4284: + case 4285: + case 4286: + case 4287: + case 4288: + case 4289: + case 4290: + case 4291: + case 4292: + case 4293: + case 4294: + case 4295: + case 4296: + case 4297: + case 4298: + case 4299: + case 4300: + case 4301: + case 4302: + case 4303: + case 4304: + case 4305: + case 4306: + case 4307: + case 4308: + case 4309: + case 4310: + case 4311: + case 4312: + case 4313: + case 4314: + case 4315: + case 4316: + case 4317: + case 4318: + case 4319: + case 4320: + case 4321: + case 4322: + case 4323: + case 4324: + case 4325: + case 4326: + case 4327: + case 4328: + case 4329: + case 4330: + case 4331: + case 4332: + case 4333: + case 4334: + case 4335: + case 4336: + case 4337: + case 4338: + case 4339: + case 4340: + case 4341: + case 4342: + case 4343: + case 4344: + case 4345: + case 4346: + case 4347: + case 4348: + case 4349: + case 4350: + case 4351: + case 4352: + case 4353: + case 4354: + case 4355: + case 4356: + case 4357: + case 4358: + case 4359: + case 4360: + case 4361: + case 4362: + case 4363: + case 4364: + case 4365: + case 4366: + case 4367: + case 4368: + case 4369: + case 4370: + case 4371: + case 4372: + case 4373: + case 4374: + case 4375: + case 4376: + case 4377: + case 4378: + case 4379: + case 4380: + case 4381: + case 4382: + case 4383: + case 4384: + case 4385: + case 4386: + case 4387: + case 4388: + case 4389: + case 4390: + case 4391: + case 4392: + case 4393: + case 4394: + case 4395: + case 4396: + case 4397: + case 4398: + case 4399: + case 4400: + case 4401: + case 4402: + case 4403: + case 4404: + case 4405: + case 4406: + case 4407: + case 4408: + case 4409: + case 4410: + case 4411: + case 4412: + case 4413: + case 4414: + case 4415: + case 4416: + case 4417: + case 4418: + case 4419: + case 4420: + case 4421: + case 4422: + case 4423: + case 4424: + case 4425: + case 4426: + case 4427: + case 4428: + case 4429: + case 4430: + case 4431: + case 4432: + case 4433: + case 4434: + case 4435: + case 4436: + case 4437: + case 4438: + case 4439: + case 4440: + case 4441: + case 4442: + case 4443: + case 4444: + case 4445: + case 4446: + case 4447: + case 4448: + case 4449: + case 4450: + case 4451: + case 4452: + case 4453: + case 4454: + case 4455: + case 4456: + case 4457: + case 4458: + case 4459: + case 4460: + case 4461: + case 4462: + case 4463: + case 4464: + case 4465: + case 4466: + case 4467: + case 4468: + case 4469: + case 4470: + case 4471: + case 4472: + case 4473: + case 4474: + case 4475: + case 4476: + case 4477: + case 4478: + case 4479: + case 4480: + case 4481: + case 4482: + case 4483: + case 4484: + case 4485: + case 4486: + case 4487: + case 4488: + case 4489: + case 4490: + case 4491: + case 4492: + case 4493: + case 4494: + case 4495: + case 4496: + case 4497: + case 4498: + case 4499: + case 4500: + case 4501: + case 4502: + case 4503: + case 4504: + case 4505: + case 4506: + case 4507: + case 4508: + case 4509: + case 4510: + case 4511: + case 4512: + case 4513: + case 4514: + case 4515: + case 4516: + case 4517: + case 4518: + case 4519: + case 4520: + case 4521: + case 4522: + case 4523: + case 4524: + case 4525: + case 4526: + case 4527: + case 4528: + case 4529: + case 4530: + case 4531: + case 4532: + case 4533: + case 4534: + case 4535: + case 4536: + case 4537: + case 4538: + case 4539: + case 4540: + case 4541: + case 4542: + case 4543: + case 4544: + case 4545: + case 4546: + case 4547: + case 4548: + case 4549: + case 4550: + case 4551: + case 4552: + case 4553: + case 4554: + case 4555: + case 4556: + case 4557: + case 4558: + case 4559: + case 4560: + case 4561: + case 4562: + case 4563: + case 4564: + case 4565: + case 4566: + case 4567: + case 4568: + case 4569: + case 4570: + case 4571: + case 4572: + case 4573: + case 4574: + case 4575: + case 4576: + case 4577: + case 4578: + case 4579: + case 4580: + case 4581: + case 4582: + case 4583: + case 4584: + case 4585: + case 4586: + case 4587: + case 4588: + case 4589: + case 4590: + case 4591: + case 4592: + case 4593: + case 4594: + case 4595: + case 4596: + case 4597: + case 4598: + case 4599: + case 4600: + case 4601: + case 4602: + case 4603: + case 4604: + case 4605: + case 4606: + case 4607: + case 4608: + case 4609: + case 4610: + case 4611: + case 4612: + case 4613: + case 4614: + case 4615: + case 4616: + case 4617: + case 4618: + case 4619: + case 4620: + case 4621: + case 4622: + case 4623: + case 4624: + case 4625: + case 4626: + case 4627: + case 4628: + case 4629: + case 4630: + case 4631: + case 4632: + case 4633: + case 4634: + case 4635: + case 4636: + case 4637: + case 4638: + case 4639: + case 4640: + case 4641: + case 4642: + case 4643: + case 4644: + case 4645: + case 4646: + case 4647: + case 4648: + case 4649: + case 4650: + case 4651: + case 4652: + case 4653: + case 4654: + case 4655: + case 4656: + case 4657: + case 4658: + case 4659: + case 4660: + case 4661: + case 4662: + case 4663: + case 4664: + case 4665: + case 4666: + case 4667: + case 4668: + case 4669: + case 4670: + case 4671: + case 4672: + case 4673: + case 4674: + case 4675: + case 4676: + case 4677: + case 4678: + case 4679: + case 4680: + case 4681: + case 4682: + case 4683: + case 4684: + case 4685: + case 4686: + case 4687: + case 4688: + case 4689: + case 4690: + case 4691: + case 4692: + case 4693: + case 4694: + case 4695: + case 4696: + case 4697: + case 4698: + case 4699: + case 4700: + case 4701: + case 4702: + case 4703: + case 4704: + case 4705: + case 4706: + case 4707: + case 4708: + case 4709: + case 4710: + case 4711: + case 4712: + case 4713: + case 4714: + case 4715: + case 4716: + case 4717: + case 4718: + case 4719: + case 4720: + case 4721: + case 4722: + case 4723: + case 4724: + case 4725: + case 4726: + case 4727: + case 4728: + case 4729: + case 4730: + case 4731: + case 4732: + case 4733: + case 4734: + case 4735: + case 4736: + case 4737: + case 4738: + case 4739: + case 4740: + case 4741: + case 4742: + case 4743: + case 4744: + case 4745: + case 4746: + case 4747: + case 4748: + case 4749: + case 4750: + case 4751: + case 4752: + case 4753: + case 4754: + case 4755: + case 4756: + case 4757: + case 4758: + case 4759: + case 4760: + case 4761: + case 4762: + case 4763: + case 4764: + case 4765: + case 4766: + case 4767: + case 4768: + case 4769: + case 4770: + case 4771: + case 4772: + case 4773: + case 4774: + case 4775: + case 4776: + case 4777: + case 4778: + case 4779: + case 4780: + case 4781: + case 4782: + case 4783: + case 4784: + case 4785: + case 4786: + case 4787: + case 4788: + case 4789: + case 4790: + case 4791: + case 4792: + case 4793: + case 4794: + case 4795: + case 4796: + case 4797: + case 4798: + case 4799: + case 4800: + case 4801: + case 4802: + case 4803: + case 4804: + case 4805: + case 4806: + case 4807: + case 4808: + case 4809: + case 4810: + case 4811: + case 4812: + case 4813: + case 4814: + case 4815: + case 4816: + case 4817: + case 4818: + case 4819: + case 4820: + case 4821: + case 4822: + case 4823: + case 4824: + case 4825: + case 4826: + case 4827: + case 4828: + case 4829: + case 4830: + case 4831: + case 4832: + case 4833: + case 4834: + case 4835: + case 4836: + case 4837: + case 4838: + case 4839: + case 4840: + case 4841: + case 4842: + case 4843: + case 4844: + case 4845: + case 4846: + case 4847: + case 4848: + case 4849: + case 4850: + case 4851: + case 4852: + case 4853: + case 4854: + case 4855: + case 4856: + case 4857: + case 4858: + case 4859: + case 4860: + case 4861: + case 4862: + case 4863: + case 4864: + case 4865: + case 4866: + case 4867: + case 4868: + case 4869: + case 4870: + case 4871: + case 4872: + case 4873: + case 4874: + case 4875: + case 4876: + case 4877: + case 4878: + case 4879: + case 4880: + case 4881: + case 4882: + case 4883: + case 4884: + case 4885: + case 4886: + case 4887: + case 4888: + case 4889: + case 4890: + case 4891: + case 4892: + case 4893: + case 4894: + case 4895: + case 4896: + case 4897: + case 4898: + case 4899: + case 4900: + case 4901: + case 4902: + case 4903: + case 4904: + case 4905: + case 4906: + case 4907: + case 4908: + case 4909: + case 4910: + case 4911: + case 4912: + case 4913: + case 4914: + case 4915: + case 4916: + case 4917: + case 4918: + case 4919: + case 4920: + case 4921: + case 4922: + case 4923: + case 4924: + case 4925: + case 4926: + case 4927: + case 4928: + case 4929: + case 4930: + case 4931: + case 4932: + case 4933: + case 4934: + case 4935: + case 4936: + case 4937: + case 4938: + case 4939: + case 4940: + case 4941: + case 4942: + case 4943: + case 4944: + case 4945: + case 4946: + case 4947: + case 4948: + case 4949: + case 4950: + case 4951: + case 4952: + case 4953: + case 4954: + case 4955: + case 4956: + case 4957: + case 4958: + case 4959: + case 4960: + case 4961: + case 4962: + case 4963: + case 4964: + case 4965: + case 4966: + case 4967: + case 4968: + case 4969: + case 4970: + case 4971: + case 4972: + case 4973: + case 4974: + case 4975: + case 4976: + case 4977: + case 4978: + case 4979: + case 4980: + case 4981: + case 4982: + case 4983: + case 4984: + case 4985: + case 4986: + case 4987: + case 4988: + case 4989: + case 4990: + case 4991: + case 4992: + case 4993: + case 4994: + case 4995: + case 4996: + case 4997: + case 4998: + case 4999: + case 5000: + case 5001: + case 5002: + case 5003: + case 5004: + case 5005: + case 5006: + case 5007: + case 5008: + case 5009: + case 5010: + case 5011: + case 5012: + case 5013: + case 5014: + case 5015: + case 5016: + case 5017: + case 5018: + case 5019: + case 5020: + case 5021: + case 5022: + case 5023: + case 5024: + case 5025: + case 5026: + case 5027: + case 5028: + case 5029: + case 5030: + case 5031: + case 5032: + case 5033: + case 5034: + case 5035: + case 5036: + case 5037: + case 5038: + case 5039: + case 5040: + case 5041: + case 5042: + case 5043: + case 5044: + case 5045: + case 5046: + case 5047: + case 5048: + case 5049: + case 5050: + case 5051: + case 5052: + case 5053: + case 5054: + case 5055: + case 5056: + case 5057: + case 5058: + case 5059: + case 5060: + case 5061: + case 5062: + case 5063: + case 5064: + case 5065: + case 5066: + case 5067: + case 5068: + case 5069: + case 5070: + case 5071: + case 5072: + case 5073: + case 5074: + case 5075: + case 5076: + case 5077: + case 5078: + case 5079: + case 5080: + case 5081: + case 5082: + case 5083: + case 5084: + case 5085: + case 5086: + case 5087: + case 5088: + case 5089: + case 5090: + case 5091: + case 5092: + case 5093: + case 5094: + case 5095: + case 5096: + case 5097: + case 5098: + case 5099: + case 5100: + case 5101: + case 5102: + case 5103: + case 5104: + case 5105: + case 5106: + case 5107: + case 5108: + case 5109: + case 5110: + case 5111: + case 5112: + case 5113: + case 5114: + case 5115: + case 5116: + case 5117: + case 5118: + case 5119: + case 5120: + case 5121: + case 5122: + case 5123: + case 5124: + case 5125: + case 5126: + case 5127: + case 5128: + case 5129: + case 5130: + case 5131: + case 5132: + case 5133: + case 5134: + case 5135: + case 5136: + case 5137: + case 5138: + case 5139: + case 5140: + case 5141: + case 5142: + case 5143: + case 5144: + case 5145: + case 5146: + case 5147: + case 5148: + case 5149: + case 5150: + case 5151: + case 5152: + case 5153: + case 5154: + case 5155: + case 5156: + case 5157: + case 5158: + case 5159: + case 5160: + case 5161: + case 5162: + case 5163: + case 5164: + case 5165: + case 5166: + case 5167: + case 5168: + case 5169: + case 5170: + case 5171: + case 5172: + case 5173: + case 5174: + case 5175: + case 5176: + case 5177: + case 5178: + case 5179: + case 5180: + case 5181: + case 5182: + case 5183: + case 5184: + case 5185: + case 5186: + case 5187: + case 5188: + case 5189: + case 5190: + case 5191: + case 5192: + case 5193: + case 5194: + case 5195: + case 5196: + case 5197: + case 5198: + case 5199: + case 5200: + case 5201: + case 5202: + case 5203: + case 5204: + case 5205: + case 5206: + case 5207: + case 5208: + case 5209: + case 5210: + case 5211: + case 5212: + case 5213: + case 5214: + case 5215: + case 5216: + case 5217: + case 5218: + case 5219: + case 5220: + case 5221: + case 5222: + case 5223: + case 5224: + case 5225: + case 5226: + case 5227: + case 5228: + case 5229: + case 5230: + case 5231: + case 5232: + case 5233: + case 5234: + case 5235: + case 5236: + case 5237: + case 5238: + case 5239: + case 5240: + case 5241: + case 5242: + case 5243: + case 5244: + case 5245: + case 5246: + case 5247: + case 5248: + case 5249: + case 5250: + case 5251: + case 5252: + case 5253: + case 5254: + case 5255: + case 5256: + case 5257: + case 5258: + case 5259: + case 5260: + case 5261: + case 5262: + case 5263: + case 5264: + case 5265: + case 5266: + case 5267: + case 5268: + case 5269: + case 5270: + case 5271: + case 5272: + case 5273: + case 5274: + case 5275: + case 5276: + case 5277: + case 5278: + case 5279: + case 5280: + case 5281: + case 5282: + case 5283: + case 5284: + case 5285: + case 5286: + case 5287: + case 5288: + case 5289: + case 5290: + case 5291: + case 5292: + case 5293: + case 5294: + case 5295: + case 5296: + case 5297: + case 5298: + case 5299: + case 5300: + case 5301: + case 5302: + case 5303: + case 5304: + case 5305: + case 5306: + case 5307: + case 5308: + case 5309: + case 5310: + case 5311: + case 5312: + case 5313: + case 5314: + case 5315: + case 5316: + case 5317: + case 5318: + case 5319: + case 5320: + case 5321: + case 5322: + case 5323: + case 5324: + case 5325: + case 5326: + case 5327: + case 5328: + case 5329: + case 5330: + case 5331: + case 5332: + case 5333: + case 5334: + case 5335: + case 5336: + case 5337: + case 5338: + case 5339: + case 5340: + case 5341: + case 5342: + case 5343: + case 5344: + case 5345: + case 5346: + case 5347: + case 5348: + case 5349: + case 5350: + case 5351: + case 5352: + case 5353: + case 5354: + case 5355: + case 5356: + case 5357: + case 5358: + case 5359: + case 5360: + case 5361: + case 5362: + case 5363: + case 5364: + case 5365: + case 5366: + case 5367: + case 5368: + case 5369: + case 5370: + case 5371: + case 5372: + case 5373: + case 5374: + case 5375: + case 5376: + case 5377: + case 5378: + case 5379: + case 5380: + case 5381: + case 5382: + case 5383: + case 5384: + case 5385: + case 5386: + case 5387: + case 5388: + case 5389: + case 5390: + case 5391: + case 5392: + case 5393: + case 5394: + case 5395: + case 5396: + case 5397: + case 5398: + case 5399: + case 5400: + case 5401: + case 5402: + case 5403: + case 5404: + case 5405: + case 5406: + case 5407: + case 5408: + case 5409: + case 5410: + case 5411: + case 5412: + case 5413: + case 5414: + case 5415: + case 5416: + case 5417: + case 5418: + case 5419: + case 5420: + case 5421: + case 5422: + case 5423: + case 5424: + case 5425: + case 5426: + case 5427: + case 5428: + case 5429: + case 5430: + case 5431: + case 5432: + case 5433: + case 5434: + case 5435: + case 5436: + case 5437: + case 5438: + case 5439: + case 5440: + case 5441: + case 5442: + case 5443: + case 5444: + case 5445: + case 5446: + case 5447: + case 5448: + case 5449: + case 5450: + case 5451: + case 5452: + case 5453: + case 5454: + case 5455: + case 5456: + case 5457: + case 5458: + case 5459: + case 5460: + case 5461: + case 5462: + case 5463: + case 5464: + case 5465: + case 5466: + case 5467: + case 5468: + case 5469: + case 5470: + case 5471: + case 5472: + case 5473: + case 5474: + case 5475: + case 5476: + case 5477: + case 5478: + case 5479: + case 5480: + case 5481: + case 5482: + case 5483: + case 5484: + case 5485: + case 5486: + case 5487: + case 5488: + case 5489: + case 5490: + case 5491: + case 5492: + case 5493: + case 5494: + case 5495: + case 5496: + case 5497: + case 5498: + case 5499: + case 5500: + case 5501: + case 5502: + case 5503: + case 5504: + case 5505: + case 5506: + case 5507: + case 5508: + case 5509: + case 5510: + case 5511: + case 5512: + case 5513: + case 5514: + case 5515: + case 5516: + case 5517: + case 5518: + case 5519: + case 5520: + case 5521: + case 5522: + case 5523: + case 5524: + case 5525: + case 5526: + case 5527: + case 5528: + case 5529: + case 5530: + case 5531: + case 5532: + case 5533: + case 5534: + case 5535: + case 5536: + case 5537: + case 5538: + case 5539: + case 5540: + case 5541: + case 5542: + case 5543: + case 5544: + case 5545: + case 5546: + case 5547: + case 5548: + case 5549: + case 5550: + case 5551: + case 5552: + case 5553: + case 5554: + case 5555: + case 5556: + case 5557: + case 5558: + case 5559: + case 5560: + case 5561: + case 5562: + case 5563: + case 5564: + case 5565: + case 5566: + case 5567: + case 5568: + case 5569: + case 5570: + case 5571: + case 5572: + case 5573: + case 5574: + case 5575: + case 5576: + case 5577: + case 5578: + case 5579: + case 5580: + case 5581: + case 5582: + case 5583: + case 5584: + case 5585: + case 5586: + case 5587: + case 5588: + case 5589: + case 5590: + case 5591: + case 5592: + case 5593: + case 5594: + case 5595: + case 5596: + case 5597: + case 5598: + case 5599: + case 5600: + case 5601: + case 5602: + case 5603: + case 5604: + case 5605: + case 5606: + case 5607: + case 5608: + case 5609: + case 5610: + case 5611: + case 5612: + case 5613: + case 5614: + case 5615: + case 5616: + case 5617: + case 5618: + case 5619: + case 5620: + case 5621: + case 5622: + case 5623: + case 5624: + case 5625: + case 5626: + case 5627: + case 5628: + case 5629: + case 5630: + case 5631: + case 5632: + case 5633: + case 5634: + case 5635: + case 5636: + case 5637: + case 5638: + case 5639: + case 5640: + case 5641: + case 5642: + case 5643: + case 5644: + case 5645: + case 5646: + case 5647: + case 5648: + case 5649: + case 5650: + case 5651: + case 5652: + case 5653: + case 5654: + case 5655: + case 5656: + case 5657: + case 5658: + case 5659: + case 5660: + case 5661: + case 5662: + case 5663: + case 5664: + case 5665: + case 5666: + case 5667: + case 5668: + case 5669: + case 5670: + case 5671: + case 5672: + case 5673: + case 5674: + case 5675: + case 5676: + case 5677: + case 5678: + case 5679: + case 5680: + case 5681: + case 5682: + case 5683: + case 5684: + case 5685: + case 5686: + case 5687: + case 5688: + case 5689: + case 5690: + case 5691: + case 5692: + case 5693: + case 5694: + case 5695: + case 5696: + case 5697: + case 5698: + case 5699: + case 5700: + case 5701: + case 5702: + case 5703: + case 5704: + case 5705: + case 5706: + case 5707: + case 5708: + case 5709: + case 5710: + case 5711: + case 5712: + case 5713: + case 5714: + case 5715: + case 5716: + case 5717: + case 5718: + case 5719: + case 5720: + case 5721: + case 5722: + case 5723: + case 5724: + case 5725: + case 5726: + case 5727: + case 5728: + case 5729: + case 5730: + case 5731: + case 5732: + case 5733: + case 5734: + case 5735: + case 5736: + case 5737: + case 5738: + case 5739: + case 5740: + case 5741: + case 5742: + case 5743: + case 5744: + case 5745: + case 5746: + case 5747: + case 5748: + case 5749: + case 5750: + case 5751: + case 5752: + case 5753: + case 5754: + case 5755: + case 5756: + case 5757: + case 5758: + case 5759: + case 5760: + case 5761: + case 5762: + case 5763: + case 5764: + case 5765: + case 5766: + case 5767: + case 5768: + case 5769: + case 5770: + case 5771: + case 5772: + case 5773: + case 5774: + case 5775: + case 5776: + case 5777: + case 5778: + case 5779: + case 5780: + case 5781: + case 5782: + case 5783: + case 5784: + case 5785: + case 5786: + case 5787: + case 5788: + case 5789: + case 5790: + case 5791: + case 5792: + case 5793: + case 5794: + case 5795: + case 5796: + case 5797: + case 5798: + case 5799: + case 5800: + case 5801: + case 5802: + case 5803: + case 5804: + case 5805: + case 5806: + case 5807: + case 5808: + case 5809: + case 5810: + case 5811: + case 5812: + case 5813: + case 5814: + case 5815: + case 5816: + case 5817: + case 5818: + case 5819: + case 5820: + case 5821: + case 5822: + case 5823: + case 5824: + case 5825: + case 5826: + case 5827: + case 5828: + case 5829: + case 5830: + case 5831: + case 5832: + case 5833: + case 5834: + case 5835: + case 5836: + case 5837: + case 5838: + case 5839: + case 5840: + case 5841: + case 5842: + case 5843: + case 5844: + case 5845: + case 5846: + case 5847: + case 5848: + case 5849: + case 5850: + case 5851: + case 5852: + case 5853: + case 5854: + case 5855: + case 5856: + case 5857: + case 5858: + case 5859: + case 5860: + case 5861: + case 5862: + case 5863: + case 5864: + case 5865: + case 5866: + case 5867: + case 5868: + case 5869: + case 5870: + case 5871: + case 5872: + case 5873: + case 5874: + case 5875: + case 5876: + case 5877: + case 5878: + case 5879: + case 5880: + case 5881: + case 5882: + case 5883: + case 5884: + case 5885: + case 5886: + case 5887: + case 5888: + case 5889: + case 5890: + case 5891: + case 5892: + case 5893: + case 5894: + case 5895: + case 5896: + case 5897: + case 5898: + case 5899: + case 5900: + case 5901: + case 5902: + case 5903: + case 5904: + case 5905: + case 5906: + case 5907: + case 5908: + case 5909: + case 5910: + case 5911: + case 5912: + case 5913: + case 5914: + case 5915: + case 5916: + case 5917: + case 5918: + case 5919: + case 5920: + case 5921: + case 5922: + case 5923: + case 5924: + case 5925: + case 5926: + case 5927: + case 5928: + case 5929: + case 5930: + case 5931: + case 5932: + case 5933: + case 5934: + case 5935: + case 5936: + case 5937: + case 5938: + case 5939: + case 5940: + case 5941: + case 5942: + case 5943: + case 5944: + case 5945: + case 5946: + case 5947: + case 5948: + case 5949: + case 5950: + case 5951: + case 5952: + case 5953: + case 5954: + case 5955: + case 5956: + case 5957: + case 5958: + case 5959: + case 5960: + case 5961: + case 5962: + case 5963: + case 5964: + case 5965: + case 5966: + case 5967: + case 5968: + case 5969: + case 5970: + case 5971: + case 5972: + case 5973: + case 5974: + case 5975: + case 5976: + case 5977: + case 5978: + case 5979: + case 5980: + case 5981: + case 5982: + case 5983: + case 5984: + case 5985: + case 5986: + case 5987: + case 5988: + case 5989: + case 5990: + case 5991: + case 5992: + case 5993: + case 5994: + case 5995: + case 5996: + case 5997: + case 5998: + case 5999: + case 6000: + case 6001: + case 6002: + case 6003: + case 6004: + case 6005: + case 6006: + case 6007: + case 6008: + case 6009: + case 6010: + case 6011: + case 6012: + case 6013: + case 6014: + case 6015: + case 6016: + case 6017: + case 6018: + case 6019: + case 6020: + case 6021: + case 6022: + case 6023: + case 6024: + case 6025: + case 6026: + case 6027: + case 6028: + case 6029: + case 6030: + case 6031: + case 6032: + case 6033: + case 6034: + case 6035: + case 6036: + case 6037: + case 6038: + case 6039: + case 6040: + case 6041: + case 6042: + case 6043: + case 6044: + case 6045: + case 6046: + case 6047: + case 6048: + case 6049: + case 6050: + case 6051: + case 6052: + case 6053: + case 6054: + case 6055: + case 6056: + case 6057: + case 6058: + case 6059: + case 6060: + case 6061: + case 6062: + case 6063: + case 6064: + case 6065: + case 6066: + case 6067: + case 6068: + case 6069: + case 6070: + case 6071: + case 6072: + case 6073: + case 6074: + case 6075: + case 6076: + case 6077: + case 6078: + case 6079: + case 6080: + case 6081: + case 6082: + case 6083: + case 6084: + case 6085: + case 6086: + case 6087: + case 6088: + case 6089: + case 6090: + case 6091: + case 6092: + case 6093: + case 6094: + case 6095: + case 6096: + case 6097: + case 6098: + case 6099: + case 6100: + case 6101: + case 6102: + case 6103: + case 6104: + case 6105: + case 6106: + case 6107: + case 6108: + case 6109: + case 6110: + case 6111: + case 6112: + case 6113: + case 6114: + case 6115: + case 6116: + case 6117: + case 6118: + case 6119: + case 6120: + case 6121: + case 6122: + case 6123: + case 6124: + case 6125: + case 6126: + case 6127: + case 6128: + case 6129: + case 6130: + case 6131: + case 6132: + case 6133: + case 6134: + case 6135: + case 6136: + case 6137: + case 6138: + case 6139: + case 6140: + case 6141: + case 6142: + case 6143: + case 6144: + case 6145: + case 6146: + case 6147: + case 6148: + case 6149: + case 6150: + case 6151: + case 6152: + case 6153: + case 6154: + case 6155: + case 6156: + case 6157: + case 6158: + case 6159: + case 6160: + case 6161: + case 6162: + case 6163: + case 6164: + case 6165: + case 6166: + case 6167: + case 6168: + case 6169: + case 6170: + case 6171: + case 6172: + case 6173: + case 6174: + case 6175: + case 6176: + case 6177: + case 6178: + case 6179: + case 6180: + case 6181: + case 6182: + case 6183: + case 6184: + case 6185: + case 6186: + case 6187: + case 6188: + case 6189: + case 6190: + case 6191: + case 6192: + case 6193: + case 6194: + case 6195: + case 6196: + case 6197: + case 6198: + case 6199: + case 6200: + case 6201: + case 6202: + case 6203: + case 6204: + case 6205: + case 6206: + case 6207: + case 6208: + case 6209: + case 6210: + case 6211: + case 6212: + case 6213: + case 6214: + case 6215: + case 6216: + case 6217: + case 6218: + case 6219: + case 6220: + case 6221: + case 6222: + case 6223: + case 6224: + case 6225: + case 6226: + case 6227: + case 6228: + case 6229: + case 6230: + case 6231: + case 6232: + case 6233: + case 6234: + case 6235: + case 6236: + case 6237: + case 6238: + case 6239: + case 6240: + case 6241: + case 6242: + case 6243: + case 6244: + case 6245: + case 6246: + case 6247: + case 6248: + case 6249: + case 6250: + case 6251: + case 6252: + case 6253: + case 6254: + case 6255: + case 6256: + case 6257: + case 6258: + case 6259: + case 6260: + case 6261: + case 6262: + case 6263: + case 6264: + case 6265: + case 6266: + case 6267: + case 6268: + case 6269: + case 6270: + case 6271: + case 6272: + case 6273: + case 6274: + case 6275: + case 6276: + case 6277: + case 6278: + case 6279: + case 6280: + case 6281: + case 6282: + case 6283: + case 6284: + case 6285: + case 6286: + case 6287: + case 6288: + case 6289: + case 6290: + case 6291: + case 6292: + case 6293: + case 6294: + case 6295: + case 6296: + case 6297: + case 6298: + case 6299: + case 6300: + case 6301: + case 6302: + case 6303: + case 6304: + case 6305: + case 6306: + case 6307: + case 6308: + case 6309: + case 6310: + case 6311: + case 6312: + case 6313: + case 6314: + case 6315: + case 6316: + case 6317: + case 6318: + case 6319: + case 6320: + case 6321: + case 6322: + case 6323: + case 6324: + case 6325: + case 6326: + case 6327: + case 6328: + case 6329: + case 6330: + case 6331: + case 6332: + case 6333: + case 6334: + case 6335: + case 6336: + case 6337: + case 6338: + case 6339: + case 6340: + case 6341: + case 6342: + case 6343: + case 6344: + case 6345: + case 6346: + case 6347: + case 6348: + case 6349: + case 6350: + case 6351: + case 6352: + case 6353: + case 6354: + case 6355: + case 6356: + case 6357: + case 6358: + case 6359: + case 6360: + case 6361: + case 6362: + case 6363: + case 6364: + case 6365: + case 6366: + case 6367: + case 6368: + case 6369: + case 6370: + case 6371: + case 6372: + case 6373: + case 6374: + case 6375: + case 6376: + case 6377: + case 6378: + case 6379: + case 6380: + case 6381: + case 6382: + case 6383: + case 6384: + case 6385: + case 6386: + case 6387: + case 6388: + case 6389: + case 6390: + case 6391: + case 6392: + case 6393: + case 6394: + case 6395: + case 6396: + case 6397: + case 6398: + case 6399: + case 6400: + case 6401: + case 6402: + case 6403: + case 6404: + case 6405: + case 6406: + case 6407: + case 6408: + case 6409: + case 6410: + case 6411: + case 6412: + case 6413: + case 6414: + case 6415: + case 6416: + case 6417: + case 6418: + case 6419: + case 6420: + case 6421: + case 6422: + case 6423: + case 6424: + case 6425: + case 6426: + case 6427: + case 6428: + case 6429: + case 6430: + case 6431: + case 6432: + case 6433: + case 6434: + case 6435: + case 6436: + case 6437: + case 6438: + case 6439: + case 6440: + case 6441: + case 6442: + case 6443: + case 6444: + case 6445: + case 6446: + case 6447: + case 6448: + case 6449: + case 6450: + case 6451: + case 6452: + case 6453: + case 6454: + case 6455: + case 6456: + case 6457: + case 6458: + case 6459: + case 6460: + case 6461: + case 6462: + case 6463: + case 6464: + case 6465: + case 6466: + case 6467: + case 6468: + case 6469: + case 6470: + case 6471: + case 6472: + case 6473: + case 6474: + case 6475: + case 6476: + case 6477: + case 6478: + case 6479: + case 6480: + case 6481: + case 6482: + case 6483: + case 6484: + case 6485: + case 6486: + case 6487: + case 6488: + case 6489: + case 6490: + case 6491: + case 6492: + case 6493: + case 6494: + case 6495: + case 6496: + case 6497: + case 6498: + case 6499: + case 6500: + case 6501: + case 6502: + case 6503: + case 6504: + case 6505: + case 6506: + case 6507: + case 6508: + case 6509: + case 6510: + case 6511: + case 6512: + case 6513: + case 6514: + case 6515: + case 6516: + case 6517: + case 6518: + case 6519: + case 6520: + case 6521: + case 6522: + case 6523: + case 6524: + case 6525: + case 6526: + case 6527: + case 6528: + case 6529: + case 6530: + case 6531: + case 6532: + case 6533: + case 6534: + case 6535: + case 6536: + case 6537: + case 6538: + case 6539: + case 6540: + case 6541: + case 6542: + case 6543: + case 6544: + case 6545: + case 6546: + case 6547: + case 6548: + case 6549: + case 6550: + case 6551: + case 6552: + case 6553: + case 6554: + case 6555: + case 6556: + case 6557: + case 6558: + case 6559: + case 6560: + case 6561: + case 6562: + case 6563: + case 6564: + case 6565: + case 6566: + case 6567: + case 6568: + case 6569: + case 6570: + case 6571: + case 6572: + case 6573: + case 6574: + case 6575: + case 6576: + case 6577: + case 6578: + case 6579: + case 6580: + case 6581: + case 6582: + case 6583: + case 6584: + case 6585: + case 6586: + case 6587: + case 6588: + case 6589: + case 6590: + case 6591: + case 6592: + case 6593: + case 6594: + case 6595: + case 6596: + case 6597: + case 6598: + case 6599: + case 6600: + case 6601: + case 6602: + case 6603: + case 6604: + case 6605: + case 6606: + case 6607: + case 6608: + case 6609: + case 6610: + case 6611: + case 6612: + case 6613: + case 6614: + case 6615: + case 6616: + case 6617: + case 6618: + case 6619: + case 6620: + case 6621: + case 6622: + case 6623: + case 6624: + case 6625: + case 6626: + case 6627: + case 6628: + case 6629: + case 6630: + case 6631: + case 6632: + case 6633: + case 6634: + case 6635: + case 6636: + case 6637: + case 6638: + case 6639: + case 6640: + case 6641: + case 6642: + case 6643: + case 6644: + case 6645: + case 6646: + case 6647: + case 6648: + case 6649: + case 6650: + case 6651: + case 6652: + case 6653: + case 6654: + case 6655: + case 6656: + case 6657: + case 6658: + case 6659: + case 6660: + case 6661: + case 6662: + case 6663: + case 6664: + case 6665: + case 6666: + case 6667: + case 6668: + case 6669: + case 6670: + case 6671: + case 6672: + case 6673: + case 6674: + case 6675: + case 6676: + case 6677: + case 6678: + case 6679: + case 6680: + case 6681: + case 6682: + case 6683: + case 6684: + case 6685: + case 6686: + case 6687: + case 6688: + case 6689: + case 6690: + case 6691: + case 6692: + case 6693: + case 6694: + case 6695: + case 6696: + case 6697: + case 6698: + case 6699: + case 6700: + case 6701: + case 6702: + case 6703: + case 6704: + case 6705: + case 6706: + case 6707: + case 6708: + case 6709: + case 6710: + case 6711: + case 6712: + case 6713: + case 6714: + case 6715: + case 6716: + case 6717: + case 6718: + case 6719: + case 6720: + case 6721: + case 6722: + case 6723: + case 6724: + case 6725: + case 6726: + case 6727: + case 6728: + case 6729: + case 6730: + case 6731: + case 6732: + case 6733: + case 6734: + case 6735: + case 6736: + case 6737: + case 6738: + case 6739: + case 6740: + case 6741: + case 6742: + case 6743: + case 6744: + case 6745: + case 6746: + case 6747: + case 6748: + case 6749: + case 6750: + case 6751: + case 6752: + case 6753: + case 6754: + case 6755: + case 6756: + case 6757: + case 6758: + case 6759: + case 6760: + case 6761: + case 6762: + case 6763: + case 6764: + case 6765: + case 6766: + case 6767: + case 6768: + case 6769: + case 6770: + case 6771: + case 6772: + case 6773: + case 6774: + case 6775: + case 6776: + case 6777: + case 6778: + case 6779: + case 6780: + case 6781: + case 6782: + case 6783: + case 6784: + case 6785: + case 6786: + case 6787: + case 6788: + case 6789: + case 6790: + case 6791: + case 6792: + case 6793: + case 6794: + case 6795: + case 6796: + case 6797: + case 6798: + case 6799: + case 6800: + case 6801: + case 6802: + case 6803: + case 6804: + case 6805: + case 6806: + case 6807: + case 6808: + case 6809: + case 6810: + case 6811: + case 6812: + case 6813: + case 6814: + case 6815: + case 6816: + case 6817: + case 6818: + case 6819: + case 6820: + case 6821: + case 6822: + case 6823: + case 6824: + case 6825: + case 6826: + case 6827: + case 6828: + case 6829: + case 6830: + case 6831: + case 6832: + case 6833: + case 6834: + case 6835: + case 6836: + case 6837: + case 6838: + case 6839: + case 6840: + case 6841: + case 6842: + case 6843: + case 6844: + case 6845: + case 6846: + case 6847: + case 6848: + case 6849: + case 6850: + case 6851: + case 6852: + case 6853: + case 6854: + case 6855: + case 6856: + case 6857: + case 6858: + case 6859: + case 6860: + case 6861: + case 6862: + case 6863: + case 6864: + case 6865: + case 6866: + case 6867: + case 6868: + case 6869: + case 6870: + case 6871: + case 6872: + case 6873: + case 6874: + case 6875: + case 6876: + case 6877: + case 6878: + case 6879: + case 6880: + case 6881: + case 6882: + case 6883: + case 6884: + case 6885: + case 6886: + case 6887: + case 6888: + case 6889: + case 6890: + case 6891: + case 6892: + case 6893: + case 6894: + case 6895: + case 6896: + case 6897: + case 6898: + case 6899: + case 6900: + case 6901: + case 6902: + case 6903: + case 6904: + case 6905: + case 6906: + case 6907: + case 6908: + case 6909: + case 6910: + case 6911: + case 6912: + case 6913: + case 6914: + case 6915: + case 6916: + case 6917: + case 6918: + case 6919: + case 6920: + case 6921: + case 6922: + case 6923: + case 6924: + case 6925: + case 6926: + case 6927: + case 6928: + case 6929: + case 6930: + case 6931: + case 6932: + case 6933: + case 6934: + case 6935: + case 6936: + case 6937: + case 6938: + case 6939: + case 6940: + case 6941: + case 6942: + case 6943: + case 6944: + case 6945: + case 6946: + case 6947: + case 6948: + case 6949: + case 6950: + case 6951: + case 6952: + case 6953: + case 6954: + case 6955: + case 6956: + case 6957: + case 6958: + case 6959: + case 6960: + case 6961: + case 6962: + case 6963: + case 6964: + case 6965: + case 6966: + case 6967: + case 6968: + case 6969: + case 6970: + case 6971: + case 6972: + case 6973: + case 6974: + case 6975: + case 6976: + case 6977: + case 6978: + case 6979: + case 6980: + case 6981: + case 6982: + case 6983: + case 6984: + case 6985: + case 6986: + case 6987: + case 6988: + case 6989: + case 6990: + case 6991: + case 6992: + case 6993: + case 6994: + case 6995: + case 6996: + case 6997: + case 6998: + case 6999: + case 7000: + case 7001: + case 7002: + case 7003: + case 7004: + case 7005: + case 7006: + case 7007: + case 7008: + case 7009: + case 7010: + case 7011: + case 7012: + case 7013: + case 7014: + case 7015: + case 7016: + case 7017: + case 7018: + case 7019: + case 7020: + case 7021: + case 7022: + case 7023: + case 7024: + case 7025: + case 7026: + case 7027: + case 7028: + case 7029: + case 7030: + case 7031: + case 7032: + case 7033: + case 7034: + case 7035: + case 7036: + case 7037: + case 7038: + case 7039: + case 7040: + case 7041: + case 7042: + case 7043: + case 7044: + case 7045: + case 7046: + case 7047: + case 7048: + case 7049: + case 7050: + case 7051: + case 7052: + case 7053: + case 7054: + case 7055: + case 7056: + case 7057: + case 7058: + case 7059: + case 7060: + case 7061: + case 7062: + case 7063: + case 7064: + case 7065: + case 7066: + case 7067: + case 7068: + case 7069: + case 7070: + case 7071: + case 7072: + case 7073: + case 7074: + case 7075: + case 7076: + case 7077: + case 7078: + case 7079: + case 7080: + case 7081: + case 7082: + case 7083: + case 7084: + case 7085: + case 7086: + case 7087: + case 7088: + case 7089: + case 7090: + case 7091: + case 7092: + case 7093: + case 7094: + case 7095: + case 7096: + case 7097: + case 7098: + case 7099: + case 7100: + case 7101: + case 7102: + case 7103: + case 7104: + case 7105: + case 7106: + case 7107: + case 7108: + case 7109: + case 7110: + case 7111: + case 7112: + case 7113: + case 7114: + case 7115: + case 7116: + case 7117: + case 7118: + case 7119: + case 7120: + case 7121: + case 7122: + case 7123: + case 7124: + case 7125: + case 7126: + case 7127: + case 7128: + case 7129: + case 7130: + case 7131: + case 7132: + case 7133: + case 7134: + case 7135: + case 7136: + case 7137: + case 7138: + case 7139: + case 7140: + case 7141: + case 7142: + case 7143: + case 7144: + case 7145: + case 7146: + case 7147: + case 7148: + case 7149: + case 7150: + case 7151: + case 7152: + case 7153: + case 7154: + case 7155: + case 7156: + case 7157: + case 7158: + case 7159: + case 7160: + case 7161: + case 7162: + case 7163: + case 7164: + case 7165: + case 7166: + case 7167: + case 7168: + case 7169: + case 7170: + case 7171: + case 7172: + case 7173: + case 7174: + case 7175: + case 7176: + case 7177: + case 7178: + case 7179: + case 7180: + case 7181: + case 7182: + case 7183: + case 7184: + case 7185: + case 7186: + case 7187: + case 7188: + case 7189: + case 7190: + case 7191: + case 7192: + case 7193: + case 7194: + case 7195: + case 7196: + case 7197: + case 7198: + case 7199: + case 7200: + case 7201: + case 7202: + case 7203: + case 7204: + case 7205: + case 7206: + case 7207: + case 7208: + case 7209: + case 7210: + case 7211: + case 7212: + case 7213: + case 7214: + case 7215: + case 7216: + case 7217: + case 7218: + case 7219: + case 7220: + case 7221: + case 7222: + case 7223: + case 7224: + case 7225: + case 7226: + case 7227: + case 7228: + case 7229: + case 7230: + case 7231: + case 7232: + case 7233: + case 7234: + case 7235: + case 7236: + case 7237: + case 7238: + case 7239: + case 7240: + case 7241: + case 7242: + case 7243: + case 7244: + case 7245: + case 7246: + case 7247: + case 7248: + case 7249: + case 7250: + case 7251: + case 7252: + case 7253: + case 7254: + case 7255: + case 7256: + case 7257: + case 7258: + case 7259: + case 7260: + case 7261: + case 7262: + case 7263: + case 7264: + case 7265: + case 7266: + case 7267: + case 7268: + case 7269: + case 7270: + case 7271: + case 7272: + case 7273: + case 7274: + case 7275: + case 7276: + case 7277: + case 7278: + case 7279: + case 7280: + case 7281: + case 7282: + case 7283: + case 7284: + case 7285: + case 7286: + case 7287: + case 7288: + case 7289: + case 7290: + case 7291: + case 7292: + case 7293: + case 7294: + case 7295: + case 7296: + case 7297: + case 7298: + case 7299: + case 7300: + case 7301: + case 7302: + case 7303: + case 7304: + case 7305: + case 7306: + case 7307: + case 7308: + case 7309: + case 7310: + case 7311: + case 7312: + case 7313: + case 7314: + case 7315: + case 7316: + case 7317: + case 7318: + case 7319: + case 7320: + case 7321: + case 7322: + case 7323: + case 7324: + case 7325: + case 7326: + case 7327: + case 7328: + case 7329: + case 7330: + case 7331: + case 7332: + case 7333: + case 7334: + case 7335: + case 7336: + case 7337: + case 7338: + case 7339: + case 7340: + case 7341: + case 7342: + case 7343: + case 7344: + case 7345: + case 7346: + case 7347: + case 7348: + case 7349: + case 7350: + case 7351: + case 7352: + case 7353: + case 7354: + case 7355: + case 7356: + case 7357: + case 7358: + case 7359: + case 7360: + case 7361: + case 7362: + case 7363: + case 7364: + case 7365: + case 7366: + case 7367: + case 7368: + case 7369: + case 7370: + case 7371: + case 7372: + case 7373: + case 7374: + case 7375: + case 7376: + case 7377: + case 7378: + case 7379: + case 7380: + case 7381: + case 7382: + case 7383: + case 7384: + case 7385: + case 7386: + case 7387: + case 7388: + case 7389: + case 7390: + case 7391: + case 7392: + case 7393: + case 7394: + case 7395: + case 7396: + case 7397: + case 7398: + case 7399: + case 7400: + case 7401: + case 7402: + case 7403: + case 7404: + case 7405: + case 7406: + case 7407: + case 7408: + case 7409: + case 7410: + case 7411: + case 7412: + case 7413: + case 7414: + case 7415: + case 7416: + case 7417: + case 7418: + case 7419: + case 7420: + case 7421: + case 7422: + case 7423: + case 7424: + case 7425: + case 7426: + case 7427: + case 7428: + case 7429: + case 7430: + case 7431: + case 7432: + case 7433: + case 7434: + case 7435: + case 7436: + case 7437: + case 7438: + case 7439: + case 7440: + case 7441: + case 7442: + case 7443: + case 7444: + case 7445: + case 7446: + case 7447: + case 7448: + case 7449: + case 7450: + case 7451: + case 7452: + case 7453: + case 7454: + case 7455: + case 7456: + case 7457: + case 7458: + case 7459: + case 7460: + case 7461: + case 7462: + case 7463: + case 7464: + case 7465: + case 7466: + case 7467: + case 7468: + case 7469: + case 7470: + case 7471: + case 7472: + case 7473: + case 7474: + case 7475: + case 7476: + case 7477: + case 7478: + case 7479: + case 7480: + case 7481: + case 7482: + case 7483: + case 7484: + case 7485: + case 7486: + case 7487: + case 7488: + case 7489: + case 7490: + case 7491: + case 7492: + case 7493: + case 7494: + case 7495: + case 7496: + case 7497: + case 7498: + case 7499: + case 7500: + case 7501: + case 7502: + case 7503: + case 7504: + case 7505: + case 7506: + case 7507: + case 7508: + case 7509: + case 7510: + case 7511: + case 7512: + case 7513: + case 7514: + case 7515: + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7525: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7535: + case 7536: + case 7537: + case 7538: + case 7539: + case 7540: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7550: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7565: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7580: + case 7581: + case 7582: + case 7583: + case 7584: + case 7585: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7595: + case 7596: + case 7597: + case 7598: + case 7599: + case 7600: + case 7601: + case 7602: + case 7603: + case 7604: + case 7605: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7620: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + case 7635: + case 7636: + case 7637: + case 7638: + case 7639: + case 7640: + case 7641: + case 7642: + case 7643: + case 7644: + case 7645: + case 7646: + case 7647: + case 7648: + case 7649: + case 7650: + case 7651: + case 7652: + case 7653: + case 7654: + case 7655: + case 7656: + case 7657: + case 7658: + case 7659: + case 7660: + case 7661: + case 7662: + case 7663: + case 7664: + case 7665: + case 7666: + case 7667: + case 7668: + case 7669: + case 7670: + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7680: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7690: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + case 7705: + case 7706: + case 7707: + case 7708: + case 7709: + case 7710: + case 7711: + case 7712: + case 7713: + case 7714: + case 7715: + case 7716: + case 7717: + case 7718: + case 7719: + case 7720: + case 7721: + case 7722: + case 7723: + case 7724: + case 7725: + case 7726: + case 7727: + case 7728: + case 7729: + case 7730: + case 7731: + case 7732: + case 7733: + case 7734: + case 7735: + case 7736: + case 7737: + case 7738: + case 7739: + case 7740: + case 7741: + case 7742: + case 7743: + case 7744: + case 7745: + case 7746: + case 7747: + case 7748: + case 7749: + case 7750: + case 7751: + case 7752: + case 7753: + case 7754: + case 7755: + case 7756: + case 7757: + case 7758: + case 7759: + case 7760: + case 7761: + case 7762: + case 7763: + case 7764: + case 7765: + case 7766: + case 7767: + case 7768: + case 7769: + case 7770: + case 7771: + case 7772: + case 7773: + case 7774: + case 7775: + case 7776: + case 7777: + case 7778: + case 7779: + case 7780: + case 7781: + case 7782: + case 7783: + case 7784: + case 7785: + case 7786: + case 7787: + case 7788: + case 7789: + case 7790: + case 7791: + case 7792: + case 7793: + case 7794: + case 7795: + case 7796: + case 7797: + case 7798: + case 7799: + case 7800: + case 7801: + case 7802: + case 7803: + case 7804: + case 7805: + case 7806: + case 7807: + case 7808: + case 7809: + case 7810: + case 7811: + case 7812: + case 7813: + case 7814: + case 7815: + case 7816: + case 7817: + case 7818: + case 7819: + case 7820: + case 7821: + case 7822: + case 7823: + case 7824: + case 7825: + case 7826: + case 7827: + case 7828: + case 7829: + case 7830: + case 7831: + case 7832: + case 7833: + case 7834: + case 7835: + case 7836: + case 7837: + case 7838: + case 7839: + case 7840: + case 7841: + case 7842: + case 7843: + case 7844: + case 7845: + case 7846: + case 7847: + case 7848: + case 7849: + case 7850: + case 7851: + case 7852: + case 7853: + case 7854: + case 7855: + case 7856: + case 7857: + case 7858: + case 7859: + case 7860: + case 7861: + case 7862: + case 7863: + case 7864: + case 7865: + case 7866: + case 7867: + case 7868: + case 7869: + case 7870: + case 7871: + case 7872: + case 7873: + case 7874: + case 7875: + case 7876: + case 7877: + case 7878: + case 7879: + case 7880: + case 7881: + case 7882: + case 7883: + case 7884: + case 7885: + case 7886: + case 7887: + case 7888: + case 7889: + case 7890: + case 7891: + case 7892: + case 7893: + case 7894: + case 7895: + case 7896: + case 7897: + case 7898: + case 7899: + case 7900: + case 7901: + case 7902: + case 7903: + case 7904: + case 7905: + case 7906: + case 7907: + case 7908: + case 7909: + case 7910: + case 7911: + case 7912: + case 7913: + case 7914: + case 7915: + case 7916: + case 7917: + case 7918: + case 7919: + case 7920: + case 7921: + case 7922: + case 7923: + case 7924: + case 7925: + case 7926: + case 7927: + case 7928: + case 7929: + case 7930: + case 7931: + case 7932: + case 7933: + case 7934: + case 7935: + case 7936: + case 7937: + case 7938: + case 7939: + case 7940: + case 7941: + case 7942: + case 7943: + case 7944: + case 7945: + case 7946: + case 7947: + case 7948: + case 7949: + case 7950: + case 7951: + case 7952: + case 7953: + case 7954: + case 7955: + case 7956: + case 7957: + case 7958: + case 7959: + case 7960: + case 7961: + case 7962: + case 7963: + case 7964: + case 7965: + case 7966: + case 7967: + case 7968: + case 7969: + case 7970: + case 7971: + case 7972: + case 7973: + case 7974: + case 7975: + case 7976: + case 7977: + case 7978: + case 7979: + case 7980: + case 7981: + case 7982: + case 7983: + case 7984: + case 7985: + case 7986: + case 7987: + case 7988: + case 7989: + case 7990: + case 7991: + case 7992: + case 7993: + case 7994: + case 7995: + case 7996: + case 7997: + case 7998: + case 7999: + case 8000: + case 8001: + case 8002: + case 8003: + case 8004: + case 8005: + case 8006: + case 8007: + case 8008: + case 8009: + case 8010: + case 8011: + case 8012: + case 8013: + case 8014: + case 8015: + case 8016: + case 8017: + case 8018: + case 8019: + case 8020: + case 8021: + case 8022: + case 8023: + case 8024: + case 8025: + case 8026: + case 8027: + case 8028: + case 8029: + case 8030: + case 8031: + case 8032: + case 8033: + case 8034: + case 8035: + case 8036: + case 8037: + case 8038: + case 8039: + case 8040: + case 8041: + case 8042: + case 8043: + case 8044: + case 8045: + case 8046: + case 8047: + case 8048: + case 8049: + case 8050: + case 8051: + case 8052: + case 8053: + case 8054: + case 8055: + case 8056: + case 8057: + case 8058: + case 8059: + case 8060: + case 8061: + case 8062: + case 8063: + case 8064: + case 8065: + case 8066: + case 8067: + case 8068: + case 8069: + case 8070: + case 8071: + case 8072: + case 8073: + case 8074: + case 8075: + case 8076: + case 8077: + case 8078: + case 8079: + case 8080: + case 8081: + case 8082: + case 8083: + case 8084: + case 8085: + case 8086: + case 8087: + case 8088: + case 8089: + case 8090: + case 8091: + case 8092: + case 8093: + case 8094: + case 8095: + case 8096: + case 8097: + case 8098: + case 8099: + case 8100: + case 8101: + case 8102: + case 8103: + case 8104: + case 8105: + case 8106: + case 8107: + case 8108: + case 8109: + case 8110: + case 8111: + case 8112: + case 8113: + case 8114: + case 8115: + case 8116: + case 8117: + case 8118: + case 8119: + case 8120: + case 8121: + case 8122: + case 8123: + case 8124: + case 8125: + case 8126: + case 8127: + case 8128: + case 8129: + case 8130: + case 8131: + case 8132: + case 8133: + case 8134: + case 8135: + case 8136: + case 8137: + case 8138: + case 8139: + case 8140: + case 8141: + case 8142: + case 8143: + case 8144: + case 8145: + case 8146: + case 8147: + case 8148: + case 8149: + case 8150: + case 8151: + case 8152: + case 8153: + case 8154: + case 8155: + case 8156: + case 8157: + case 8158: + case 8159: + case 8160: + case 8161: + case 8162: + case 8163: + case 8164: + case 8165: + case 8166: + case 8167: + case 8168: + case 8169: + case 8170: + case 8171: + case 8172: + case 8173: + case 8174: + case 8175: + case 8176: + case 8177: + case 8178: + case 8179: + case 8180: + case 8181: + case 8182: + case 8183: + case 8184: + case 8185: + case 8186: + case 8187: + case 8188: + case 8189: + case 8190: + case 8191: + case 8192: + case 8193: + case 8194: + case 8195: + case 8196: + case 8197: + case 8198: + case 8199: + case 8200: + case 8201: + case 8202: + case 8203: + case 8204: + case 8205: + case 8206: + case 8207: + case 8208: + case 8209: + case 8210: + case 8211: + case 8212: + case 8213: + case 8214: + case 8215: + case 8216: + case 8217: + case 8218: + case 8219: + case 8220: + case 8221: + case 8222: + case 8223: + case 8224: + case 8225: + case 8226: + case 8227: + case 8228: + case 8229: + case 8230: + case 8231: + case 8232: + case 8233: + case 8234: + case 8235: + case 8236: + case 8237: + case 8238: + case 8239: + case 8240: + case 8241: + case 8242: + case 8243: + case 8244: + case 8245: + case 8246: + case 8247: + case 8248: + case 8249: + case 8250: + case 8251: + case 8252: + case 8253: + case 8254: + case 8255: + case 8256: + case 8257: + case 8258: + case 8259: + case 8260: + case 8261: + case 8262: + case 8263: + case 8264: + case 8265: + case 8266: + case 8267: + case 8268: + case 8269: + case 8270: + case 8271: + case 8272: + case 8273: + case 8274: + case 8275: + case 8276: + case 8277: + case 8278: + case 8279: + case 8280: + case 8281: + case 8282: + case 8283: + case 8284: + case 8285: + case 8286: + case 8287: + case 8288: + case 8289: + case 8290: + case 8291: + case 8292: + case 8293: + case 8294: + case 8295: + case 8296: + case 8297: + case 8298: + case 8299: + case 8300: + case 8301: + case 8302: + case 8303: + case 8304: + case 8305: + case 8306: + case 8307: + case 8308: + case 8309: + case 8310: + case 8311: + case 8312: + case 8313: + case 8314: + case 8315: + case 8316: + case 8317: + case 8318: + case 8319: + case 8320: + case 8321: + case 8322: + case 8323: + case 8324: + case 8325: + case 8326: + case 8327: + case 8328: + case 8329: + case 8330: + case 8331: + case 8332: + case 8333: + case 8334: + case 8335: + case 8336: + case 8337: + case 8338: + case 8339: + case 8340: + case 8341: + case 8342: + case 8343: + case 8344: + case 8345: + case 8346: + case 8347: + case 8348: + case 8349: + case 8350: + case 8351: + case 8352: + case 8353: + case 8354: + case 8355: + case 8356: + case 8357: + case 8358: + case 8359: + case 8360: + case 8361: + case 8362: + case 8363: + case 8364: + case 8365: + case 8366: + case 8367: + case 8368: + case 8369: + case 8370: + case 8371: + case 8372: + case 8373: + case 8374: + case 8375: + case 8376: + case 8377: + case 8378: + case 8379: + case 8380: + case 8381: + case 8382: + case 8383: + case 8384: + case 8385: + case 8386: + case 8387: + case 8388: + case 8389: + case 8390: + case 8391: + case 8392: + case 8393: + case 8394: + case 8395: + case 8396: + case 8397: + case 8398: + case 8399: + case 8400: + case 8401: + case 8402: + case 8403: + case 8404: + case 8405: + case 8406: + case 8407: + case 8408: + case 8409: + case 8410: + case 8411: + case 8412: + case 8413: + case 8414: + case 8415: + case 8416: + case 8417: + case 8418: + case 8419: + case 8420: + case 8421: + case 8422: + case 8423: + case 8424: + case 8425: + case 8426: + case 8427: + case 8428: + case 8429: + case 8430: + case 8431: + case 8432: + case 8433: + case 8434: + case 8435: + case 8436: + case 8437: + case 8438: + case 8439: + case 8440: + case 8441: + case 8442: + case 8443: + case 8444: + case 8445: + case 8446: + case 8447: + case 8448: + case 8449: + case 8450: + case 8451: + case 8452: + case 8453: + case 8454: + case 8455: + case 8456: + case 8457: + case 8458: + case 8459: + case 8460: + case 8461: + case 8462: + case 8463: + case 8464: + case 8465: + case 8466: + case 8467: + case 8468: + case 8469: + case 8470: + case 8471: + case 8472: + case 8473: + case 8474: + case 8475: + case 8476: + case 8477: + case 8478: + case 8479: + case 8480: + case 8481: + case 8482: + case 8483: + case 8484: + case 8485: + case 8486: + case 8487: + case 8488: + case 8489: + case 8490: + case 8491: + case 8492: + case 8493: + case 8494: + case 8495: + case 8496: + case 8497: + case 8498: + case 8499: + case 8500: + case 8501: + case 8502: + case 8503: + case 8504: + case 8505: + case 8506: + case 8507: + case 8508: + case 8509: + case 8510: + case 8511: + case 8512: + case 8513: + case 8514: + case 8515: + case 8516: + case 8517: + case 8518: + case 8519: + case 8520: + case 8521: + case 8522: + case 8523: + case 8524: + case 8525: + case 8526: + case 8527: + case 8528: + case 8529: + case 8530: + case 8531: + case 8532: + case 8533: + case 8534: + case 8535: + case 8536: + case 8537: + case 8538: + case 8539: + case 8540: + case 8541: + case 8542: + case 8543: + case 8544: + case 8545: + case 8546: + case 8547: + case 8548: + case 8549: + case 8550: + case 8551: + case 8552: + case 8553: + case 8554: + case 8555: + case 8556: + case 8557: + case 8558: + case 8559: + case 8560: + case 8561: + case 8562: + case 8563: + case 8564: + case 8565: + case 8566: + case 8567: + case 8568: + case 8569: + case 8570: + case 8571: + case 8572: + case 8573: + case 8574: + case 8575: + case 8576: + case 8577: + case 8578: + case 8579: + case 8580: + case 8581: + case 8582: + case 8583: + case 8584: + case 8585: + case 8586: + case 8587: + case 8588: + case 8589: + case 8590: + case 8591: + case 8592: + case 8593: + case 8594: + case 8595: + case 8596: + case 8597: + case 8598: + case 8599: + case 8600: + case 8601: + case 8602: + case 8603: + case 8604: + case 8605: + case 8606: + case 8607: + case 8608: + case 8609: + case 8610: + case 8611: + case 8612: + case 8613: + case 8614: + case 8615: + case 8616: + case 8617: + case 8618: + case 8619: + case 8620: + case 8621: + case 8622: + case 8623: + case 8624: + case 8625: + case 8626: + case 8627: + case 8628: + case 8629: + case 8630: + case 8631: + case 8632: + case 8633: + case 8634: + case 8635: + case 8636: + case 8637: + case 8638: + case 8639: + case 8640: + case 8641: + case 8642: + case 8643: + case 8644: + case 8645: + case 8646: + case 8647: + case 8648: + case 8649: + case 8650: + case 8651: + case 8652: + case 8653: + case 8654: + case 8655: + case 8656: + case 8657: + case 8658: + case 8659: + case 8660: + case 8661: + case 8662: + case 8663: + case 8664: + case 8665: + case 8666: + case 8667: + case 8668: + case 8669: + case 8670: + case 8671: + case 8672: + case 8673: + case 8674: + case 8675: + case 8676: + case 8677: + case 8678: + case 8679: + case 8680: + case 8681: + case 8682: + case 8683: + case 8684: + case 8685: + case 8686: + case 8687: + case 8688: + case 8689: + case 8690: + case 8691: + case 8692: + case 8693: + case 8694: + case 8695: + case 8696: + case 8697: + case 8698: + case 8699: + case 8700: + case 8701: + case 8702: + case 8703: + case 8704: + case 8705: + case 8706: + case 8707: + case 8708: + case 8709: + case 8710: + case 8711: + case 8712: + case 8713: + case 8714: + case 8715: + case 8716: + case 8717: + case 8718: + case 8719: + case 8720: + case 8721: + case 8722: + case 8723: + case 8724: + case 8725: + case 8726: + case 8727: + case 8728: + case 8729: + case 8730: + case 8731: + case 8732: + case 8733: + case 8734: + case 8735: + case 8736: + case 8737: + case 8738: + case 8739: + case 8740: + case 8741: + case 8742: + case 8743: + case 8744: + case 8745: + case 8746: + case 8747: + case 8748: + case 8749: + case 8750: + case 8751: + case 8752: + case 8753: + case 8754: + case 8755: + case 8756: + case 8757: + case 8758: + case 8759: + case 8760: + case 8761: + case 8762: + case 8763: + case 8764: + case 8765: + case 8766: + case 8767: + case 8768: + case 8769: + case 8770: + case 8771: + case 8772: + case 8773: + case 8774: + case 8775: + case 8776: + case 8777: + case 8778: + case 8779: + case 8780: + case 8781: + case 8782: + case 8783: + case 8784: + case 8785: + case 8786: + case 8787: + case 8788: + case 8789: + case 8790: + case 8791: + case 8792: + case 8793: + case 8794: + case 8795: + case 8796: + case 8797: + case 8798: + case 8799: + case 8800: + case 8801: + case 8802: + case 8803: + case 8804: + case 8805: + case 8806: + case 8807: + case 8808: + case 8809: + case 8810: + case 8811: + case 8812: + case 8813: + case 8814: + case 8815: + case 8816: + case 8817: + case 8818: + case 8819: + case 8820: + case 8821: + case 8822: + case 8823: + case 8824: + case 8825: + case 8826: + case 8827: + case 8828: + case 8829: + case 8830: + case 8831: + case 8832: + case 8833: + case 8834: + case 8835: + case 8836: + case 8837: + case 8838: + case 8839: + case 8840: + case 8841: + case 8842: + case 8843: + case 8844: + case 8845: + case 8846: + case 8847: + case 8848: + case 8849: + case 8850: + case 8851: + case 8852: + case 8853: + case 8854: + case 8855: + case 8856: + case 8857: + case 8858: + case 8859: + case 8860: + case 8861: + case 8862: + case 8863: + case 8864: + case 8865: + case 8866: + case 8867: + case 8868: + case 8869: + case 8870: + case 8871: + case 8872: + case 8873: + case 8874: + case 8875: + case 8876: + case 8877: + case 8878: + case 8879: + case 8880: + case 8881: + case 8882: + case 8883: + case 8884: + case 8885: + case 8886: + case 8887: + case 8888: + case 8889: + case 8890: + case 8891: + case 8892: + case 8893: + case 8894: + case 8895: + case 8896: + case 8897: + case 8898: + case 8899: + case 8900: + case 8901: + case 8902: + case 8903: + case 8904: + case 8905: + case 8906: + case 8907: + case 8908: + case 8909: + case 8910: + case 8911: + case 8912: + case 8913: + case 8914: + case 8915: + case 8916: + case 8917: + case 8918: + case 8919: + case 8920: + case 8921: + case 8922: + case 8923: + case 8924: + case 8925: + case 8926: + case 8927: + case 8928: + case 8929: + case 8930: + case 8931: + case 8932: + case 8933: + case 8934: + case 8935: + case 8936: + case 8937: + case 8938: + case 8939: + case 8940: + case 8941: + case 8942: + case 8943: + case 8944: + case 8945: + case 8946: + case 8947: + case 8948: + case 8949: + case 8950: + case 8951: + case 8952: + case 8953: + case 8954: + case 8955: + case 8956: + case 8957: + case 8958: + case 8959: + case 8960: + case 8961: + case 8962: + case 8963: + case 8964: + case 8965: + case 8966: + case 8967: + case 8968: + case 8969: + case 8970: + case 8971: + case 8972: + case 8973: + case 8974: + case 8975: + case 8976: + case 8977: + case 8978: + case 8979: + case 8980: + case 8981: + case 8982: + case 8983: + case 8984: + case 8985: + case 8986: + case 8987: + case 8988: + case 8989: + case 8990: + case 8991: + case 8992: + case 8993: + case 8994: + case 8995: + case 8996: + case 8997: + case 8998: + case 8998: // DUPLICATE LABEL + actual += 'a'; + case 8999: + actual += 'b'; +} +expect = 'ab'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js new file mode 100644 index 0000000..8bde123 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js @@ -0,0 +1,48 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 01 June 2001 +* +* SUMMARY: Testing that we don't crash on switch case -1... +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83532 +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = 83532; +var summary = "Testing that we don't crash on switch case -1"; + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + // Just testing that we don't crash on these - + function f () {switch(1) {case -1:}} + function g(){switch(1){case (-1):}} + var h = function() {switch(1) {case -1:}} + f(); + g(); + h(); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js new file mode 100644 index 0000000..085eebf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js @@ -0,0 +1,51 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 01 June 2001 +* +* SUMMARY: Testing that we don't crash on switch case -1... +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83532 +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = 83532; +var summary = "Testing that we don't crash on switch case -1"; +var sToEval = ''; + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + // Just testing that we don't crash on these - + sToEval += 'function f () {switch(1) {case -1:}};'; + sToEval += 'function g(){switch(1){case (-1):}};'; + sToEval += 'var h = function() {switch(1) {case -1:}};' + sToEval += 'f();'; + sToEval += 'g();'; + sToEval += 'h();'; + eval(sToEval); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js new file mode 100644 index 0000000..5dd8b47 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js @@ -0,0 +1,122 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 07 May 2001 +* +* SUMMARY: Testing the switch statement +* +* See ECMA3 Section 12.11, "The switch Statement" +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the switch statement'; +var cnMatch = 'Match'; +var cnNoMatch = 'NoMatch'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + + +status = 'Section A of test'; +actual = match(17, f(fInverse(17)), f, fInverse); +expect = cnMatch; +addThis(); + +status = 'Section B of test'; +actual = match(17, 18, f, fInverse); +expect = cnNoMatch; +addThis(); + +status = 'Section C of test'; +actual = match(1, 1, Math.exp, Math.log); +expect = cnMatch; +addThis(); + +status = 'Section D of test'; +actual = match(1, 2, Math.exp, Math.log); +expect = cnNoMatch; +addThis(); + +status = 'Section E of test'; +actual = match(1, 1, Math.sin, Math.cos); +expect = cnNoMatch; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +/* + * If F,G are inverse functions and x==y, this should return cnMatch - + */ +function match(x, y, F, G) +{ + switch (x) + { + case F(G(y)): + return cnMatch; + + default: + return cnNoMatch; + } +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function f(m) +{ + return 2*(m+1); +} + + +function fInverse(n) +{ + return (n-2)/2; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js new file mode 100644 index 0000000..42b5ce2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js @@ -0,0 +1,95 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): k.mike@gmx.net, pschwartau@netscape.com +* Date: 12 October 2001 +* +* SUMMARY: Regression test for string.replace bug 104375 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=104375 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 104375; +var summary = 'Testing string.replace() with backreferences'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Use the regexp to replace 'uid=31' with 'uid=15' + * + * In the second parameter of string.replace() method, + * "$1" refers to the first backreference: 'uid=' + */ +var str = 'uid=31'; +var re = /(uid=)(\d+)/; + +// try the numeric literal 15 +status = inSection(1); +actual = str.replace (re, "$1" + 15); +expect = 'uid=15'; +addThis(); + +// try the string literal '15' +status = inSection(2); +actual = str.replace (re, "$1" + '15'); +expect = 'uid=15'; +addThis(); + +// try a letter before the '15' +status = inSection(3); +actual = str.replace (re, "$1" + 'A15'); +expect = 'uid=A15'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js new file mode 100644 index 0000000..e237152 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js @@ -0,0 +1,152 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 January 2003 +* SUMMARY: Regression test for bug 189898 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=189898 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 189898; +var summary = 'Regression test for bug 189898'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = 'XaXY'.replace('XY', '--') +expect = 'Xa--'; +addThis(); + +status = inSection(2); +actual = '$a$^'.replace('$^', '--') +expect = '$a--'; +addThis(); + +status = inSection(3); +actual = 'ababc'.replace('abc', '--') +expect = 'ab--'; +addThis(); + +status = inSection(4); +actual = 'ababc'.replace('abc', '^$') +expect = 'ab^$'; +addThis(); + + + +/* + * Same as above, but providing a regexp in the first parameter + * to String.prototype.replace() instead of a string. + * + * See http://bugzilla.mozilla.org/show_bug.cgi?id=83293 + * for subtleties on this issue - + */ +status = inSection(5); +actual = 'XaXY'.replace(/XY/, '--') +expect = 'Xa--'; +addThis(); + +status = inSection(6); +actual = 'XaXY'.replace(/XY/g, '--') +expect = 'Xa--'; +addThis(); + +status = inSection(7); +actual = '$a$^'.replace(/\$\^/, '--') +expect = '$a--'; +addThis(); + +status = inSection(8); +actual = '$a$^'.replace(/\$\^/g, '--') +expect = '$a--'; +addThis(); + +status = inSection(9); +actual = 'ababc'.replace(/abc/, '--') +expect = 'ab--'; +addThis(); + +status = inSection(10); +actual = 'ababc'.replace(/abc/g, '--') +expect = 'ab--'; +addThis(); + +status = inSection(11); +actual = 'ababc'.replace(/abc/, '^$') +expect = 'ab^$'; +addThis(); + +status = inSection(12); +actual = 'ababc'.replace(/abc/g, '^$') +expect = 'ab^$'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js new file mode 100644 index 0000000..02a7834 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js @@ -0,0 +1,193 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, jim@jibbering.com +* Creation Date: 30 May 2001 +* Correction Date: 14 Aug 2001 +* +* SUMMARY: Regression test for bugs 83293, 103351 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83293 +* http://bugzilla.mozilla.org/show_bug.cgi?id=103351 +* http://bugzilla.mozilla.org/show_bug.cgi?id=92942 +* +* +* ******************** CORRECTION !!! ***************************** +* +* When I originally wrote this test, I thought this was true: +* str.replace(strA, strB) == str.replace(new RegExp(strA),strB). +* See ECMA-262 Final Draft, 15.5.4.11 String.prototype.replace +* +* However, in http://bugzilla.mozilla.org/show_bug.cgi?id=83293 +* Jim Ley points out the ECMA-262 Final Edition changed on this. +* String.prototype.replace (searchValue, replaceValue), if provided +* a searchValue that is not a RegExp, is NO LONGER to replace it with +* +* new RegExp(searchValue) +* but rather: +* String(searchValue) +* +* This puts the replace() method at variance with search() and match(), +* which continue to follow the RegExp conversion of the Final Draft. +* It also makes most of this testcase, as originally written, invalid. +********************************************************************** +*/ +//----------------------------------------------------------------------------- +var bug = 103351; // <--- (Outgrowth of original bug 83293) +var summ_OLD = 'Testing str.replace(strA, strB) == str.replace(new RegExp(strA),strB)'; +var summ_NEW = 'Testing String.prototype.replace(x,y) when x is a string'; +var summary = summ_NEW; +var status = ''; +var actual = ''; +var expect= ''; +var cnEmptyString = ''; +var str = 'abc'; +var strA = cnEmptyString; +var strB = 'Z'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +/* + * In this test, it's important to reportCompare() each other case + * BEFORE the last two cases are attempted. Don't store all results + * in an array and reportCompare() them at the end, as we usually do. + * + * When this bug was filed, str.replace(strA, strB) would return no value + * whatsoever if strA == cnEmptyString, and no error, either - + */ +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + +/******************* THESE WERE INCORRECT; SEE ABOVE ************************ + status = 'Section A of test'; + strA = 'a'; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + status = 'Section B of test'; + strA = 'x'; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + status = 'Section C of test'; + strA = undefined; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + status = 'Section D of test'; + strA = null; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + + * This example is from jim@jibbering.com (see Bugzilla bug 92942) + * It is a variation on the example below. + * + * Namely, we are using the regexp /$/ instead of the regexp //. + * The regexp /$/ means we should match the "empty string" at the + * end-boundary of the word, instead of the one at the beginning. + * + status = 'Section E of test'; + var strJim = 'aa$aa'; + strA = '$'; + actual = strJim.replace(strA, strB); // bug -> 'aaZaa' + expect = strJim.replace(new RegExp(strA), strB); // expect 'aa$aaZ' + reportCompare(expect, actual, status); + + + * + * Note: 'Zabc' is the result we expect for 'abc'.replace('', 'Z'). + * + * The string '' is supposed to be equivalent to new RegExp('') = //. + * The regexp // means we should match the "empty string" conceived of + * at the beginning boundary of the word, before the first character. + * + status = 'Section F of test'; + strA = cnEmptyString; + actual = str.replace(strA, strB); + expect = 'Zabc'; + reportCompare(expect, actual, status); + + status = 'Section G of test'; + strA = cnEmptyString; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + +************************* END OF INCORRECT CASES ****************************/ + + +////////////////////////// OK, LET'S START OVER ////////////////////////////// + + status = 'Section 1 of test'; + actual = 'abc'.replace('a', 'Z'); + expect = 'Zbc'; + reportCompare(expect, actual, status); + + status = 'Section 2 of test'; + actual = 'abc'.replace('b', 'Z'); + expect = 'aZc'; + reportCompare(expect, actual, status); + + status = 'Section 3 of test'; + actual = 'abc'.replace(undefined, 'Z'); + expect = 'abc'; // String(undefined) == 'undefined'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 4 of test'; + actual = 'abc'.replace(null, 'Z'); + expect = 'abc'; // String(null) == 'null'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 5 of test'; + actual = 'abc'.replace(true, 'Z'); + expect = 'abc'; // String(true) == 'true'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 6 of test'; + actual = 'abc'.replace(false, 'Z'); + expect = 'abc'; // String(false) == 'false'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 7 of test'; + actual = 'aa$aa'.replace('$', 'Z'); + expect = 'aaZaa'; // NOT 'aa$aaZ' as in ECMA Final Draft; see above + reportCompare(expect, actual, status); + + status = 'Section 8 of test'; + actual = 'abc'.replace('.*', 'Z'); + expect = 'abc'; // not 'Z' as in EMCA Final Draft + reportCompare(expect, actual, status); + + status = 'Section 9 of test'; + actual = 'abc'.replace('', 'Z'); + expect = 'Zabc'; // Still expect 'Zabc' for this + reportCompare(expect, actual, status); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js new file mode 100644 index 0000000..6527c16 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode Characters 1C-1F negative test."); + printBugNumber (23612); + + reportCompare ("error", eval ("'no'\u001C+' error'"), + "Unicode whitespace test (1C.)"); + reportCompare ("error", eval ("'no'\u001D+' error'"), + "Unicode whitespace test (1D.)"); + reportCompare ("error", eval ("'no'\u001E+' error'"), + "Unicode whitespace test (1E.)"); + reportCompare ("error", eval ("'no'\u001F+' error'"), + "Unicode whitespace test (1F.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js new file mode 100644 index 0000000..470e8bc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode format-control character (Category Cf) test."); + printBugNumber (23610); + + reportCompare ("no error", eval('"no\u200E error"'), + "Unicode format-control character test (Category Cf.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js new file mode 100644 index 0000000..9c54a26 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Non-character escapes in identifiers negative test."); + printBugNumber (23607); + + reportCompare ("error", eval("\u0020 = 5"), + "Non-character escapes in identifiers negative test."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js new file mode 100644 index 0000000..3b05d83 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode non-breaking space character test."); + printBugNumber (23613); + + reportCompare ("no error", eval("'no'\u00A0+ ' error'"), + "Unicode non-breaking space character test."); + + var str = "\u00A0foo"; + reportCompare (0, str.search(/^\sfoo$/), + "Unicode non-breaking space character regexp test."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js new file mode 100644 index 0000000..7004cf4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var \u0041 = 5; + var A\u03B2 = 15; + var c\u0061se = 25; + + printStatus ("Escapes in identifiers test."); + printBugNumber (23608); + printBugNumber (23607); + + reportCompare (5, eval("\u0041"), + "Escaped ASCII Identifier test."); + reportCompare (6, eval("++\u0041"), + "Escaped ASCII Identifier test"); + reportCompare (15, eval("A\u03B2"), + "Escaped non-ASCII Identifier test"); + reportCompare (16, eval("++A\u03B2"), + "Escaped non-ASCII Identifier test"); + reportCompare (25, eval("c\\u00" + "61se"), + "Escaped keyword Identifier test"); + reportCompare (26, eval("++c\\u00" + "61se"), + "Escaped keyword Identifier test"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js new file mode 100644 index 0000000..2518124 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode Characters 1C-1F with regexps test."); + printBugNumber (23612); + + var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"]; + + for (var i in ary) + { + reportCompare (0, ary[Number(i)].search(/^\Sfoo$/), + "Unicode characters 1C-1F in regexps, ary[" + + i + "] did not match \\S test (it should not.)"); + reportCompare (-1, ary[Number(i)].search(/^\sfoo$/), + "Unicode characters 1C-1F in regexps, ary[" + + i + "] matched \\s test (it should not.)"); + } + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js new file mode 100644 index 0000000..5b1be03 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js @@ -0,0 +1,271 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 15 July 2002 +* SUMMARY: Testing identifiers with double-byte names +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274 +* +* Here is a sample of the problem: +* +* js> function f\u02B1 () {} +* +* js> f\u02B1.toSource(); +* function f¦() {} +* +* js> f\u02B1.toSource().toSource(); +* (new String("function f\xB1() {}")) +* +* +* See how the high-byte information (the 02) has been lost? +* The same thing was happening with the toString() method: +* +* js> f\u02B1.toString(); +* +* function f¦() { +* } +* +* js> f\u02B1.toString().toSource(); +* (new String("\nfunction f\xB1() {\n}\n")) +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 58274; +var summary = 'Testing identifiers with double-byte names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Define a function that uses double-byte identifiers in + * "every possible way" + * + * Then recover each double-byte identifier via f.toString(). + * To make this easier, put a 'Z' token before every one. + * + * Our eval string will be: + * + * sEval = "function Z\u02b1(Z\u02b2, b) { + * try { Z\u02b3 : var Z\u02b4 = Z\u02b1; } + * catch (Z\u02b5) { for (var Z\u02b6 in Z\u02b5) + * {for (1; 1<0; Z\u02b7++) {new Array()[Z\u02b6] = 1;} };} }"; + * + * It will be helpful to build this string in stages: + */ +var s0 = 'function Z'; +var s1 = '\u02b1(Z'; +var s2 = '\u02b2, b) {try { Z'; +var s3 = '\u02b3 : var Z'; +var s4 = '\u02b4 = Z'; +var s5 = '\u02b1; } catch (Z' +var s6 = '\u02b5) { for (var Z'; +var s7 = '\u02b6 in Z'; +var s8 = '\u02b5){for (1; 1<0; Z'; +var s9 = '\u02b7++) {new Array()[Z'; +var s10 = '\u02b6] = 1;} };} }'; + + +/* + * Concatenate these and eval() to create the function Z\u02b1 + */ +var sEval = s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10; +eval(sEval); + + +/* + * Recover all the double-byte identifiers via Z\u02b1.toString(). + * We'll recover the 1st one as arrID[1], the 2nd one as arrID[2], + * and so on ... + */ +var arrID = getIdentifiers(Z\u02b1); + + +/* + * Now check that we got back what we put in - + */ +status = inSection(1); +actual = arrID[1]; +expect = s1.charAt(0); +addThis(); + +status = inSection(2); +actual = arrID[2]; +expect = s2.charAt(0); +addThis(); + +status = inSection(3); +actual = arrID[3]; +expect = s3.charAt(0); +addThis(); + +status = inSection(4); +actual = arrID[4]; +expect = s4.charAt(0); +addThis(); + +status = inSection(5); +actual = arrID[5]; +expect = s5.charAt(0); +addThis(); + +status = inSection(6); +actual = arrID[6]; +expect = s6.charAt(0); +addThis(); + +status = inSection(7); +actual = arrID[7]; +expect = s7.charAt(0); +addThis(); + +status = inSection(8); +actual = arrID[8]; +expect = s8.charAt(0); +addThis(); + +status = inSection(9); +actual = arrID[9]; +expect = s9.charAt(0); +addThis(); + +status = inSection(10); +actual = arrID[10]; +expect = s10.charAt(0); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Goal: recover the double-byte identifiers from f.toString() + * by getting the very next character after each 'Z' token. + * + * The return value will be an array |arr| indexed such that + * |arr[1]| is the 1st identifier, |arr[2]| the 2nd, and so on. + * + * Note, however, f.toString() is implementation-independent. + * For example, it may begin with '\nfunction' instead of 'function'. + * + * Rhino uses a Unicode representation for f.toString(); whereas + * SpiderMonkey uses an ASCII representation, putting escape sequences + * for non-ASCII characters. For example, if a function is called f\u02B1, + * then in Rhino the toString() method will present a 2-character Unicode + * string for its name, whereas SpiderMonkey will present a 7-character + * ASCII string for its name: the string literal 'f\u02B1'. + * + * So we force the lexer to condense the string before we use it. + * This will give uniform results in Rhino and SpiderMonkey. + */ +function getIdentifiers(f) +{ + var str = condenseStr(f.toString()); + var arr = str.split('Z'); + + /* + * The identifiers are the 1st char of each split substring + * EXCEPT the first one, which is just ('\n' +) 'function '. + * + * Thus note the 1st identifier will be stored in |arr[1]|, + * the 2nd one in |arr[2]|, etc., making the indexing easy - + */ + for (i in arr) + arr[i] = arr[i].charAt(0); + return arr; +} + + +/* + * This function is the opposite of a functions like escape(), which take + * Unicode characters and return escape sequences for them. Here, we force + * the lexer to turn escape sequences back into single characters. + * + * Note we can't simply do |eval(str)|, since in practice |str| will be an + * identifier somewhere in the program (e.g. a function name); thus |eval(str)| + * would return the object that the identifier represents: not what we want. + * + * So we surround |str| lexicographically with quotes to force the lexer to + * evaluate it as a string. Have to strip out any linefeeds first, however - + */ +function condenseStr(str) +{ + /* + * You won't be able to do the next step if |str| has + * any carriage returns or linefeeds in it. For example: + * + * js> eval("'" + '\nHello' + "'"); + * 1: SyntaxError: unterminated string literal: + * 1: ' + * 1: ^ + * + * So replace them with the empty string - + */ + str = str.replace(/[\r\n]/g, '') + return eval("'" + str + "'") +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js new file mode 100644 index 0000000..4fde9bc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js @@ -0,0 +1,180 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +var FAILED = "FAILED!: "; +var STATUS = "STATUS: "; +var BUGNUMBER = "BUGNUMBER: "; +var SECT_PREFIX = 'Section '; +var SECT_SUFFIX = ' of test -'; +var VERBOSE = false; +var callStack = new Array(); + +/* + * The test driver searches for such a phrase in the test output. + * If such phrase exists, it will set n as the expected exit code. + */ +function expectExitCode(n) +{ + + print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---'); + +} + +/* + * Statuses current section of a test + */ +function inSection(x) +{ + + return SECT_PREFIX + x + SECT_SUFFIX; + +} + +/* + * Some tests need to know if we are in Rhino as opposed to SpiderMonkey + */ +function inRhino() +{ + return (typeof defineClass == "function"); +} + +/* + * Report a failure in the 'accepted' manner + */ +function reportFailure (msg) +{ + var lines = msg.split ("\n"); + var l; + var funcName = currentFunc(); + var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; + + for (var i=0; i<lines.length; i++) + print (FAILED + prefix + lines[i]); + +} + +/* + * Print a non-failure message. + */ +function printStatus (msg) +{ + var lines = msg.split ("\n"); + var l; + + for (var i=0; i<lines.length; i++) + print (STATUS + lines[i]); + +} + +/* + * Print a bugnumber message. + */ +function printBugNumber (num) +{ + + print (BUGNUMBER + num); + +} + +/* + * Compare expected result to actual result, if they differ (in value and/or + * type) report a failure. If description is provided, include it in the + * failure report. + */ +function reportCompare (expected, actual, description) +{ + var expected_t = typeof expected; + var actual_t = typeof actual; + var output = ""; + + if ((VERBOSE) && (typeof description != "undefined")) + printStatus ("Comparing '" + description + "'"); + + if (expected_t != actual_t) + output += "Type mismatch, expected type " + expected_t + + ", actual type " + actual_t + "\n"; + else if (VERBOSE) + printStatus ("Expected type '" + actual_t + "' matched actual " + + "type '" + expected_t + "'"); + + if (expected != actual) + output += "Expected value '" + expected + "', Actual value '" + actual + + "'\n"; + else if (VERBOSE) + printStatus ("Expected value '" + actual + "' matched actual " + + "value '" + expected + "'"); + + if (output != "") + { + if (typeof description != "undefined") + reportFailure (description); + reportFailure (output); + } + +} + +/* + * Puts funcName at the top of the call stack. This stack is used to show + * a function-reported-from field when reporting failures. + */ +function enterFunc (funcName) +{ + + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + callStack.push(funcName); + +} + +/* + * Pops the top funcName off the call stack. funcName is optional, and can be + * used to check push-pop balance. + */ +function exitFunc (funcName) +{ + var lastFunc = callStack.pop(); + + if (funcName) + { + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + if (lastFunc != funcName) + reportFailure ("Test driver failure, expected to exit function '" + + funcName + "' but '" + lastFunc + "' came off " + + "the stack"); + } + +} + +/* + * Peeks at the top of the call stack. + */ +function currentFunc() +{ + + return callStack[callStack.length - 1]; + +} diff --git a/Source/JavaScriptCore/tests/mozilla/expected.html b/Source/JavaScriptCore/tests/mozilla/expected.html new file mode 100644 index 0000000..785378d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/expected.html @@ -0,0 +1,461 @@ +<html><head> +<title>Test results, squirrelfish</title> +</head> +<body bgcolor='white'> +<a name='tippy_top'></a> +<h2>Test results, squirrelfish</h2><br> +<p class='results_summary'> +Test List: All tests<br> +Skip List: ecma/Date/15.9.2.1.js, ecma/Date/15.9.2.2-1.js, ecma/Date/15.9.2.2-2.js, ecma/Date/15.9.2.2-3.js, ecma/Date/15.9.2.2-4.js, ecma/Date/15.9.2.2-5.js, ecma/Date/15.9.2.2-6.js, ecma_3/Date/15.9.5.7.js<br> +1127 test(s) selected, 1119 test(s) completed, 46 failures reported (4.11% failed)<br> +Engine command line: "/home/stampho/webkit/WebKitBuild/Release/JavaScriptCore/jsc" <br> +OS type: Linux euclides 2.6.35-gentoo-r5 #1 SMP Tue Aug 31 13:19:25 CEST 2010 i686 Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz GenuineIntel GNU/Linux<br> +Testcase execution time: 16 seconds.<br> +Tests completed on Fri Oct 15 00:29:31 2010.<br><br> +[ <a href='#fail_detail'>Failure Details</a> | <a href='#retest_list'>Retest List</a> | <a href='menu.html'>Test Selection Page</a> ]<br> +<hr> +<a name='fail_detail'></a> +<h2>Failure Details</h2><br> +<dl><a name='failure1'></a><dd><b>Testcase <a target='other_window' href='./ecma/TypeConversion/9.3.1-3.js'>ecma/TypeConversion/9.3.1-3.js</a> failed</b> <br> + [ <a href='#failure2'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +- "-0x123456789abcde8" = NaN FAILED! expected: 81985529216486880<br> +- "-0x123456789abcde8" = NaN FAILED! expected: 81985529216486880<br> +</tt><br> +<a name='failure2'></a><dd><b>Testcase <a target='other_window' href='./ecma_2/Exceptions/function-001.js'>ecma_2/Exceptions/function-001.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=10278' target='other_window'>Bug Number 10278</a><br> + [ <a href='#failure1'>Previous Failure</a> | <a href='#failure3'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +eval("function f(){}function g(){}") (threw no exception thrown = fail FAILED! expected: pass<br> +</tt><br> +<a name='failure3'></a><dd><b>Testcase <a target='other_window' href='./ecma_3/FunExpr/fe-001.js'>ecma_3/FunExpr/fe-001.js</a> failed</b> <br> + [ <a href='#failure2'>Previous Failure</a> | <a href='#failure4'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: Function Expression Statements basic test.<br> +Failure messages were:<br> +FAILED!: [reported from test()] Both functions were defined.<br> +FAILED!: [reported from test()] Expected value '1', Actual value '0'<br> +FAILED!: [reported from test()] <br> +</tt><br> +<a name='failure4'></a><dd><b>Testcase <a target='other_window' href='./ecma_3/Statements/regress-194364.js'>ecma_3/Statements/regress-194364.js</a> failed</b> <br> + [ <a href='#failure3'>Previous Failure</a> | <a href='#failure5'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure5'></a><dd><b>Testcase <a target='other_window' href='./ecma_3/Unicode/uc-001.js'>ecma_3/Unicode/uc-001.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=23610' target='other_window'>Bug Number 23610</a><br> + [ <a href='#failure4'>Previous Failure</a> | <a href='#failure6'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: Unicode format-control character (Category Cf) test.<br> +Failure messages were:<br> +FAILED!: [reported from test()] Unicode format-control character test (Category Cf.)<br> +FAILED!: [reported from test()] Expected value 'no error', Actual value 'no‎ error'<br> +FAILED!: [reported from test()] <br> +</tt><br> +<a name='failure6'></a><dd><b>Testcase <a target='other_window' href='./js1_2/Objects/toString-001.js'>js1_2/Objects/toString-001.js</a> failed</b> <br> + [ <a href='#failure5'>Previous Failure</a> | <a href='#failure7'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +var o = new Object(); o.toString() = [object Object] FAILED! expected: {}<br> +o = {}; o.toString() = [object Object] FAILED! expected: {}<br> +o = { name:"object", length:0, value:"hello" }; o.toString() = false FAILED! expected: true<br> +</tt><br> +<a name='failure7'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/Function_object.js'>js1_2/function/Function_object.js</a> failed</b> <br> + [ <a href='#failure6'>Previous Failure</a> | <a href='#failure8'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +f.arity = undefined FAILED! expected: 3<br> +} FAILED! expected: <br> +</tt><br> +<a name='failure8'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/function-001-n.js'>js1_2/function/function-001-n.js</a> failed</b> <br> + [ <a href='#failure7'>Previous Failure</a> | <a href='#failure9'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 3, got 0<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +function-001.js functions not separated by semicolons are errors in version 120 and higher<br> +eval("function f(){}function g(){}") = undefined FAILED! expected: error<br> +</tt><br> +<a name='failure9'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/tostring-1.js'>js1_2/function/tostring-1.js</a> failed</b> <br> + [ <a href='#failure8'>Previous Failure</a> | <a href='#failure10'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +</tt><br> +<a name='failure10'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/tostring-2.js'>js1_2/function/tostring-2.js</a> failed</b> <br> + [ <a href='#failure9'>Previous Failure</a> | <a href='#failure11'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +} FAILED! expected: <br> +</tt><br> +<a name='failure11'></a><dd><b>Testcase <a target='other_window' href='./js1_2/operator/equality.js'>js1_2/operator/equality.js</a> failed</b> <br> + [ <a href='#failure10'>Previous Failure</a> | <a href='#failure12'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +(new String('x') == 'x') = true FAILED! expected: false<br> +('x' == new String('x')) = true FAILED! expected: false<br> +</tt><br> +<a name='failure12'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/RegExp_lastIndex.js'>js1_2/regexp/RegExp_lastIndex.js</a> failed</b> <br> + [ <a href='#failure11'>Previous Failure</a> | <a href='#failure13'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +re=/x./g; re.lastIndex=4; re.exec('xyabcdxa') = xa FAILED! expected: ["xa"]<br> +re.exec('xyabcdef') = xy FAILED! expected: ["xy"]<br> +</tt><br> +<a name='failure13'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/RegExp_multiline.js'>js1_2/regexp/RegExp_multiline.js</a> failed</b> <br> + [ <a href='#failure12'>Previous Failure</a> | <a href='#failure14'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +(multiline == true) '123\n456'.match(/^4../) = null FAILED! expected: 456<br> +(multiline == true) 'a11\na22\na23\na24'.match(/^a../g) = a11 FAILED! expected: a11,a22,a23,a24<br> +(multiline == true) '123\n456'.match(/.3$/) = null FAILED! expected: 23<br> +(multiline == true) 'a11\na22\na23\na24'.match(/a..$/g) = a24 FAILED! expected: a11,a22,a23,a24<br> +(multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) = a24 FAILED! expected: a11,a22,a23,a24<br> +</tt><br> +<a name='failure14'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/RegExp_multiline_as_array.js'>js1_2/regexp/RegExp_multiline_as_array.js</a> failed</b> <br> + [ <a href='#failure13'>Previous Failure</a> | <a href='#failure15'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +(['$*'] == true) '123\n456'.match(/^4../) = null FAILED! expected: 456<br> +(['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g) = a11 FAILED! expected: a11,a22,a23,a24<br> +(['$*'] == true) '123\n456'.match(/.3$/) = null FAILED! expected: 23<br> +(['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g) = a24 FAILED! expected: a11,a22,a23,a24<br> +(['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) = a24 FAILED! expected: a11,a22,a23,a24<br> +</tt><br> +<a name='failure15'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/beginLine.js'>js1_2/regexp/beginLine.js</a> failed</b> <br> + [ <a href='#failure14'>Previous Failure</a> | <a href='#failure16'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +123xyz'.match(new RegExp('^\d+')) = null FAILED! expected: 123<br> +</tt><br> +<a name='failure16'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/endLine.js'>js1_2/regexp/endLine.js</a> failed</b> <br> + [ <a href='#failure15'>Previous Failure</a> | <a href='#failure17'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +xyz'.match(new RegExp('\d+$')) = null FAILED! expected: 890<br> +</tt><br> +<a name='failure17'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/string_split.js'>js1_2/regexp/string_split.js</a> failed</b> <br> + [ <a href='#failure16'>Previous Failure</a> | <a href='#failure18'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +'abc'.split(/[a-z]/) = ,,, FAILED! expected: ,,<br> +'abc'.split(/[a-z]/) = ,,, FAILED! expected: ,,<br> +'abc'.split(new RegExp('[a-z]')) = ,,, FAILED! expected: ,,<br> +'abc'.split(new RegExp('[a-z]')) = ,,, FAILED! expected: ,,<br> +</tt><br> +<a name='failure18'></a><dd><b>Testcase <a target='other_window' href='./js1_2/version120/boolean-001.js'>js1_2/version120/boolean-001.js</a> failed</b> <br> + [ <a href='#failure17'>Previous Failure</a> | <a href='#failure19'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt><br> +Failure messages were:<br> +new Boolean(false) = true FAILED! expected: false<br> +</tt><br> +<a name='failure19'></a><dd><b>Testcase <a target='other_window' href='./js1_2/version120/regress-99663.js'>js1_2/version120/regress-99663.js</a> failed</b> <br> + [ <a href='#failure18'>Previous Failure</a> | <a href='#failure20'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: Regression test for Bugzilla bug 99663<br> +Failure messages were:<br> +Section 1 of test - got Error: Can't find variable: it FAILED! expected: a "read-only" error<br> +Section 2 of test - got Error: Can't find variable: it FAILED! expected: a "read-only" error<br> +Section 3 of test - got Error: Can't find variable: it FAILED! expected: a "read-only" error<br> +</tt><br> +<a name='failure20'></a><dd><b>Testcase <a target='other_window' href='./js1_3/Script/function-001-n.js'>js1_3/Script/function-001-n.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=10278' target='other_window'>Bug Number 10278</a><br> + [ <a href='#failure19'>Previous Failure</a> | <a href='#failure21'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 3, got 0<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +BUGNUMBER: 10278<br> +function-001.js functions not separated by semicolons are errors in version 120 and higher<br> +eval("function f(){}function g(){}") = undefined FAILED! expected: error<br> +</tt><br> +<a name='failure21'></a><dd><b>Testcase <a target='other_window' href='./js1_3/Script/script-001.js'>js1_3/Script/script-001.js</a> failed</b> <br> + [ <a href='#failure20'>Previous Failure</a> | <a href='#failure22'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +script-001 NativeScript<br> +</tt><br> +<a name='failure22'></a><dd><b>Testcase <a target='other_window' href='./js1_3/regress/function-001-n.js'>js1_3/regress/function-001-n.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=10278' target='other_window'>Bug Number 10278</a><br> + [ <a href='#failure21'>Previous Failure</a> | <a href='#failure23'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 3, got 0<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +BUGNUMBER: 10278<br> +function-001.js functions not separated by semicolons are errors in version 120 and higher<br> +eval("function f(){}function g(){}") = undefined FAILED! expected: error<br> +</tt><br> +<a name='failure23'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/catchguard-001.js'>js1_5/Exceptions/catchguard-001.js</a> failed</b> <br> + [ <a href='#failure22'>Previous Failure</a> | <a href='#failure24'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure24'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/catchguard-002.js'>js1_5/Exceptions/catchguard-002.js</a> failed</b> <br> + [ <a href='#failure23'>Previous Failure</a> | <a href='#failure25'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure25'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/catchguard-003.js'>js1_5/Exceptions/catchguard-003.js</a> failed</b> <br> + [ <a href='#failure24'>Previous Failure</a> | <a href='#failure26'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure26'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/errstack-001.js'>js1_5/Exceptions/errstack-001.js</a> failed</b> <br> + [ <a href='#failure25'>Previous Failure</a> | <a href='#failure27'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure27'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/regress-50447.js'>js1_5/Exceptions/regress-50447.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=50447' target='other_window'>Bug Number 50447</a><br> + [ <a href='#failure26'>Previous Failure</a> | <a href='#failure28'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +BUGNUMBER: 50447<br> +STATUS: Test (non-ECMA) Error object properties fileName, lineNumber<br> +</tt><br> +<a name='failure28'></a><dd><b>Testcase <a target='other_window' href='./js1_5/GetSet/getset-001.js'>js1_5/GetSet/getset-001.js</a> failed</b> <br> + [ <a href='#failure27'>Previous Failure</a> | <a href='#failure29'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure29'></a><dd><b>Testcase <a target='other_window' href='./js1_5/GetSet/getset-002.js'>js1_5/GetSet/getset-002.js</a> failed</b> <br> + [ <a href='#failure28'>Previous Failure</a> | <a href='#failure30'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure30'></a><dd><b>Testcase <a target='other_window' href='./js1_5/GetSet/getset-003.js'>js1_5/GetSet/getset-003.js</a> failed</b> <br> + [ <a href='#failure29'>Previous Failure</a> | <a href='#failure31'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure31'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-90596-001.js'>js1_5/Object/regress-90596-001.js</a> failed</b> <br> + [ <a href='#failure30'>Previous Failure</a> | <a href='#failure32'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure32'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-90596-002.js'>js1_5/Object/regress-90596-002.js</a> failed</b> <br> + [ <a href='#failure31'>Previous Failure</a> | <a href='#failure33'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure33'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-96284-001.js'>js1_5/Object/regress-96284-001.js</a> failed</b> <br> + [ <a href='#failure32'>Previous Failure</a> | <a href='#failure34'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure34'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-96284-002.js'>js1_5/Object/regress-96284-002.js</a> failed</b> <br> + [ <a href='#failure33'>Previous Failure</a> | <a href='#failure35'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure35'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-44009.js'>js1_5/Regress/regress-44009.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=44009' target='other_window'>Bug Number 44009</a><br> + [ <a href='#failure34'>Previous Failure</a> | <a href='#failure36'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +BUGNUMBER: 44009<br> +STATUS: Testing that we don't crash on obj.toSource()<br> +</tt><br> +<a name='failure36'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-103602.js'>js1_5/Regress/regress-103602.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=103602' target='other_window'>Bug Number 103602</a><br> + [ <a href='#failure35'>Previous Failure</a> | <a href='#failure37'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: Reassignment to a const is NOT an error per ECMA<br> +Failure messages were:<br> +FAILED!: [reported from test()] Section 1 of test -<br> +FAILED!: [reported from test()] Expected value '', Actual value 'Redeclaration of a const FAILED to cause an error'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 3 of test -<br> +FAILED!: [reported from test()] Expected value '1', Actual value '2'<br> +FAILED!: [reported from test()] <br> +</tt><br> +<a name='failure37'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-104077.js'>js1_5/Regress/regress-104077.js</a> failed</b> <br> + [ <a href='#failure36'>Previous Failure</a> | <a href='#failure38'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure38'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-127557.js'>js1_5/Regress/regress-127557.js</a> failed</b> <br> + [ <a href='#failure37'>Previous Failure</a> | <a href='#failure39'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure39'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-172699.js'>js1_5/Regress/regress-172699.js</a> failed</b> <br> + [ <a href='#failure38'>Previous Failure</a> | <a href='#failure40'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure40'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-179524.js'>js1_5/Regress/regress-179524.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=179524' target='other_window'>Bug Number 179524</a><br> + [ <a href='#failure39'>Previous Failure</a> | <a href='#failure41'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: Don't crash on extraneous arguments to str.match(), etc.<br> +Failure messages were:<br> +FAILED!: [reported from test()] Section 14 of test -<br> +FAILED!: [reported from test()] Expected value 'A', Actual value 'a'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 15 of test -<br> +FAILED!: [reported from test()] Expected value 'A,a', Actual value 'a'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 17 of test -<br> +FAILED!: [reported from test()] Expected value 'A', Actual value 'a'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 18 of test -<br> +FAILED!: [reported from test()] Expected value 'A,a', Actual value 'a'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 20 of test -<br> +FAILED!: [reported from test()] Expected value 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!', Actual value 'a'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 22 of test -<br> +FAILED!: [reported from test()] Expected value '0', Actual value '4'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 23 of test -<br> +FAILED!: [reported from test()] Expected value '0', Actual value '4'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 25 of test -<br> +FAILED!: [reported from test()] Expected value '0', Actual value '4'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 26 of test -<br> +FAILED!: [reported from test()] Expected value '0', Actual value '4'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 28 of test -<br> +FAILED!: [reported from test()] Type mismatch, expected type string, actual type number<br> +FAILED!: [reported from test()] Expected value 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!', Actual value '4'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 30 of test -<br> +FAILED!: [reported from test()] Expected value 'ZBC abc', Actual value 'ABC Zbc'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 31 of test -<br> +FAILED!: [reported from test()] Expected value 'ZBC Zbc', Actual value 'ABC Zbc'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 33 of test -<br> +FAILED!: [reported from test()] Expected value 'ZBC abc', Actual value 'ABC Zbc'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 34 of test -<br> +FAILED!: [reported from test()] Expected value 'ZBC Zbc', Actual value 'ABC Zbc'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Section 36 of test -<br> +FAILED!: [reported from test()] Expected value 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!', Actual value 'ABC Zbc'<br> +FAILED!: [reported from test()] <br> +</tt><br> +<a name='failure41'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Scope/regress-220584.js'>js1_5/Scope/regress-220584.js</a> failed</b> <br> + [ <a href='#failure40'>Previous Failure</a> | <a href='#failure42'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure42'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Scope/scope-001.js'>js1_5/Scope/scope-001.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=53268' target='other_window'>Bug Number 53268</a><br> + [ <a href='#failure41'>Previous Failure</a> | <a href='#failure43'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: Testing scope after changing obj.__proto__<br> +Failure messages were:<br> +FAILED!: [reported from test()] Step 1: setting obj.__proto__ = global object<br> +FAILED!: [reported from test()] Expected value '5', Actual value '1'<br> +FAILED!: [reported from test()] <br> +FAILED!: [reported from test()] Step 2: setting obj.__proto__ = null<br> +FAILED!: [reported from test()] Type mismatch, expected type undefined, actual type number<br> +FAILED!: [reported from test()] Expected value 'undefined', Actual value '1'<br> +FAILED!: [reported from test()] <br> +</tt><br> +<a name='failure43'></a><dd><b>Testcase <a target='other_window' href='./js1_6/Regress/regress-301574.js'>js1_6/Regress/regress-301574.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=301574' target='other_window'>Bug Number 301574</a><br> + [ <a href='#failure42'>Previous Failure</a> | <a href='#failure44'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>STATUS: E4X should be enabled even when e4x=1 not specified<br> +Failure messages were:<br> +FAILED!: E4X should be enabled even when e4x=1 not specified: XML()<br> +FAILED!: Expected value 'No error', Actual value 'error: ReferenceError: Can't find variable: XML'<br> +FAILED!: <br> +FAILED!: E4X should be enabled even when e4x=1 not specified: XMLList()<br> +FAILED!: Expected value 'No error', Actual value 'error: ReferenceError: Can't find variable: XML'<br> +FAILED!: <br> +</tt><br> +<a name='failure44'></a><dd><b>Testcase <a target='other_window' href='./js1_6/Regress/regress-309242.js'>js1_6/Regress/regress-309242.js</a> failed</b> <br> + [ <a href='#failure43'>Previous Failure</a> | <a href='#failure45'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure45'></a><dd><b>Testcase <a target='other_window' href='./js1_6/Regress/regress-314887.js'>js1_6/Regress/regress-314887.js</a> failed</b> <br> + [ <a href='#failure44'>Previous Failure</a> | <a href='#failure46'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +Testcase produced no output!</tt><br> +<a name='failure46'></a><dd><b>Testcase <a target='other_window' href='./js1_6/String/regress-306591.js'>js1_6/String/regress-306591.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=306591' target='other_window'>Bug Number 306591</a><br> + [ <a href='#failure45'>Previous Failure</a> | <a href='#failure47'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br> +<tt>Expected exit code 0, got 3<br> +Testcase terminated with signal 0<br> +Complete testcase output was:<br> +BUGNUMBER: 306591<br> +STATUS: String static methods<br> +STATUS: See https://bugzilla.mozilla.org/show_bug.cgi?id=304828<br> +</tt><br> +</dl> +[ <a href='#tippy_top'>Top of Page</a> | <a href='#fail_detail'>Top of Failures</a> ]<br> +<hr> +<pre> +<a name='retest_list'></a> +<h2>Retest List</h2><br> +# Retest List, squirrelfish, generated Fri Oct 15 00:29:31 2010. +# Original test base was: All tests. +# 1119 of 1127 test(s) were completed, 46 failures reported. +ecma/TypeConversion/9.3.1-3.js +ecma_2/Exceptions/function-001.js +ecma_3/FunExpr/fe-001.js +ecma_3/Statements/regress-194364.js +ecma_3/Unicode/uc-001.js +js1_2/Objects/toString-001.js +js1_2/function/Function_object.js +js1_2/function/function-001-n.js +js1_2/function/tostring-1.js +js1_2/function/tostring-2.js +js1_2/operator/equality.js +js1_2/regexp/RegExp_lastIndex.js +js1_2/regexp/RegExp_multiline.js +js1_2/regexp/RegExp_multiline_as_array.js +js1_2/regexp/beginLine.js +js1_2/regexp/endLine.js +js1_2/regexp/string_split.js +js1_2/version120/boolean-001.js +js1_2/version120/regress-99663.js +js1_3/Script/function-001-n.js +js1_3/Script/script-001.js +js1_3/regress/function-001-n.js +js1_5/Exceptions/catchguard-001.js +js1_5/Exceptions/catchguard-002.js +js1_5/Exceptions/catchguard-003.js +js1_5/Exceptions/errstack-001.js +js1_5/Exceptions/regress-50447.js +js1_5/GetSet/getset-001.js +js1_5/GetSet/getset-002.js +js1_5/GetSet/getset-003.js +js1_5/Object/regress-90596-001.js +js1_5/Object/regress-90596-002.js +js1_5/Object/regress-96284-001.js +js1_5/Object/regress-96284-002.js +js1_5/Regress/regress-44009.js +js1_5/Regress/regress-103602.js +js1_5/Regress/regress-104077.js +js1_5/Regress/regress-127557.js +js1_5/Regress/regress-172699.js +js1_5/Regress/regress-179524.js +js1_5/Scope/regress-220584.js +js1_5/Scope/scope-001.js +js1_6/Regress/regress-301574.js +js1_6/Regress/regress-309242.js +js1_6/Regress/regress-314887.js +js1_6/String/regress-306591.js
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/importList.html b/Source/JavaScriptCore/tests/mozilla/importList.html new file mode 100644 index 0000000..f9f167f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/importList.html @@ -0,0 +1,69 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Import Test List</title> + <script language="JavaScript"> + function onRadioClick (name) + { + var radio = document.forms["foo"].elements[name]; + radio.checked = !radio.checked; + return false; + } + + function doImport() + { + var lines = + document.forms["foo"].elements["testList"].value.split(/\r?\n/); + var suites = window.opener.suites; + var elems = window.opener.document.forms["testCases"].elements; + + if (document.forms["foo"].elements["clear_all"].checked) + window.opener.selectNone(); + + for (var l in lines) + { + if (lines[l].search(/^\s$|\s*\#/) == -1) + { + var ary = lines[l].match (/(.*)\/(.*)\/(.*)/); + + if (!ary) + if (!confirm ("Line " + lines[l] + " is confusing, " + + "continue with import?")) + return; + else + continue; + + if (suites[ary[1]] && suites[ary[1]].testDirs[ary[2]] && + suites[ary[1]].testDirs[ary[2]].tests[ary[3]]) + elems[suites[ary[1]].testDirs[ary[2]].tests[ary[3]]]. + checked = true; + } + } + + window.opener.updateTotals(); + + window.close(); + + } + </script> + </head> + + <body> + + <form name="foo"> + <textarea rows="25" cols="50" name="testList"></textarea><br> + <input type="radio" name="clear_all" checked + onclick="return onRadioClick('clear_all');"> + Clear all selections berofe import.<br> + <input type="button" value="Import" onclick="doImport();"> + <input type="button" value="Cancel" onclick="window.close();"> + </form> + + <hr> + <address><a href="mailto:rginda@netscape.com"></a></address> +<!-- Created: Wed Nov 17 13:52:23 PST 1999 --> +<!-- hhmts start --> +Last modified: Wed Nov 17 14:18:42 PST 1999 +<!-- hhmts end --> + </body> +</html> diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_1/browser.js new file mode 100644 index 0000000..5bbdf7c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_1/browser.js @@ -0,0 +1,80 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/* + * JavaScript test library shared functions file for running the tests + * in the browser. Overrides the shell's print function with document.write + * and make everything HTML pretty. + * + * To run the tests in the browser, use the mkhtml.pl script to generate + * html pages that include the shell.js, browser.js (this file), and the + * test js file in script tags. + * + * The source of the page that is generated should look something like this: + * <script src="./../shell.js"></script> + * <script src="./../browser.js"></script> + * <script src="./mytest.js"></script> + */ + +onerror = err; + +function startTest() { + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + +function writeLineToLog( string ) { + document.write( string + "<br>\n"); +} +function writeHeaderToLog( string ) { + document.write( "<h2>" + string + "</h2>" ); +} +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } + document.write( "<hr>" ); +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = "<tt>"+ string ; + s += "<b>" ; + s += ( passed ) ? "<font color=#009900> " + PASSED + : "<font color=#aa0000> " + FAILED + expect + "</tt>"; + writeLineToLog( s + "</font></b></tt>" ); + return passed; +} +function err( msg, page, line ) { + writeLineToLog( "Test failed with the message: " + msg ); + + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js new file mode 100644 index 0000000..05fcdc8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js @@ -0,0 +1,170 @@ +var completed = false; +var testcases; + +var BUGNUMBER=""; +var EXCLUDE = ""; + +var TT = ""; +var TT_ = ""; +var BR = ""; +var NBSP = " "; +var CR = "\n"; +var FONT = ""; +var FONT_ = ""; +var FONT_RED = ""; +var FONT_GREEN = ""; +var B = ""; +var B_ = "" +var H2 = ""; +var H2_ = ""; +var HR = ""; + +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +version( 110 ); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); +} +function startTest() { +/* + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.3" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.2" ) { + version ( "120" ); + } + if ( VERSION == "JS_1.1" ) { + version ( "110" ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). +*/ +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, give a little leeway for rounding. + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = TT + string ; + + for ( k = 0; + k < (60 - string.length >= 0 ? 60 - string.length : 5) ; + k++ ) { +// s += NBSP; + } + + s += B ; + s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; + + writeLineToLog( s + FONT_ + B_ + TT_ ); + + return passed; +} + +function writeLineToLog( string ) { + print( string + BR + CR ); +} +function writeHeaderToLog( string ) { + print( H2 + string + H2_ ); +} +function stopTest() { + var sizeTag = "<#TEST CASES SIZE>"; + var doneTag = "<#TEST CASES DONE>"; + var beginTag = "<#TEST CASE "; + var endTag = ">"; + + print(sizeTag); + print(testcases.length); + for (tc = 0; tc < testcases.length; tc++) + { + print(beginTag + 'PASSED' + endTag); + print(testcases[tc].passed); + print(beginTag + 'NAME' + endTag); + print(testcases[tc].name); + print(beginTag + 'EXPECTED' + endTag); + print(testcases[tc].expect); + print(beginTag + 'ACTUAL' + endTag); + print(testcases[tc].actual); + print(beginTag + 'DESCRIPTION' + endTag); + print(testcases[tc].description); + print(beginTag + 'REASON' + endTag); + print(( testcases[tc].passed ) ? "" : "wrong value "); + print(beginTag + 'BUGNUMBER' + endTag); + print( BUGNUMBER ); + } + print(doneTag); + gc(); +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js b/Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js new file mode 100644 index 0000000..2a08b31 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js @@ -0,0 +1,76 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: boolean-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 + * + * eval("function f(){}function g(){}") at top level is an error for JS1.2 + and above (missing ; between named function expressions), but declares f + and g as functions below 1.2. + * + * Fails to produce error regardless of version: + * js> version(100) +120 +js> eval("function f(){}function g(){}") +js> version(120); +100 +js> eval("function f(){}function g(){}") +js> + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "boolean-001.js"; + var VERSION = "JS1_1"; + var TITLE = "functions not separated by semicolons are not errors in version 110 "; + var BUGNUMBER="99232"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + result = "passed"; + + testcases[tc++] = new TestCase( + SECTION, + "eval(\"function f(){}function g(){}\")", + void 0, + eval("function f(){}function g(){}") ); + + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_1/shell.js new file mode 100644 index 0000000..191e8e7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_1/shell.js @@ -0,0 +1,143 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; + +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + + this.passed = getTestCaseResult( this.expect, this.actual ); +} +function startTest() { + version(110); + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, give a little leeway for rounding. + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +/* + * Begin printing functions. These functions use the shell's + * print function. When running tests in the browser, these + * functions, override these functions with functions that use + * document.write. + */ + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +/* end of print functions */ + +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js new file mode 100644 index 0000000..4076111 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: array_split_1.js + ECMA Section: Array.split() + Description: + + These are tests from free perl suite. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "Free Perl"; + var VERSION = "JS1_2"; + var TITLE = "Array.split()"; + + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + testcases[tc++] = new TestCase( SECTION, + "('a,b,c'.split(',')).length", + 3, + ('a,b,c'.split(',')).length ); + + testcases[tc++] = new TestCase( SECTION, + "('a,b'.split(',')).length", + 2, + ('a,b'.split(',')).length ); + + testcases[tc++] = new TestCase( SECTION, + "('a'.split(',')).length", + 1, + ('a'.split(',')).length ); + +/* + * Mozilla deviates from ECMA by never splitting an empty string by any separator + * string into a non-empty array (an array of length 1 that contains the empty string). + * But Internet Explorer does not do this, so we won't do it in JavaScriptCore either. + */ + testcases[tc++] = new TestCase( SECTION, + "(''.split(',')).length", + 1, + (''.split(',')).length ); + + + + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js new file mode 100644 index 0000000..7762ec4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js @@ -0,0 +1,62 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: general1.js + Description: 'This tests out some of the functionality on methods on the Array objects' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:push,unshift,shift'; + + writeHeaderToLog('Executing script: general1.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var array1 = []; + + array1.push(123); //array1 = [123] + array1.push("dog"); //array1 = [123,dog] + array1.push(-99); //array1 = [123,dog,-99] + array1.push("cat"); //array1 = [123,dog,-99,cat] + testcases[count++] = new TestCase( SECTION, "array1.pop()", array1.pop(),'cat'); + //array1 = [123,dog,-99] + array1.push("mouse"); //array1 = [123,dog,-99,mouse] + testcases[count++] = new TestCase( SECTION, "array1.shift()", array1.shift(),123); + //array1 = [dog,-99,mouse] + array1.unshift(96); //array1 = [96,dog,-99,mouse] + testcases[count++] = new TestCase( SECTION, "state of array", String([96,"dog",-99,"mouse"]), String(array1)); + testcases[count++] = new TestCase( SECTION, "array1.length", array1.length,4); + array1.shift(); //array1 = [dog,-99,mouse] + array1.shift(); //array1 = [-99,mouse] + array1.shift(); //array1 = [mouse] + testcases[count++] = new TestCase( SECTION, "array1.shift()", array1.shift(),"mouse"); + testcases[count++] = new TestCase( SECTION, "array1.shift()", "undefined", String(array1.shift())); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js new file mode 100644 index 0000000..afa4529 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js @@ -0,0 +1,78 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: general2.js + Description: 'This tests out some of the functionality on methods on the Array objects' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:push,splice,concat,unshift,sort'; + + writeHeaderToLog('Executing script: general2.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + array1 = new Array(); + array2 = []; + size = 10; + + // this for loop populates array1 and array2 as follows: + // array1 = [0,1,2,3,4,....,size - 2,size - 1] + // array2 = [size - 1, size - 2,...,4,3,2,1,0] + for (var i = 0; i < size; i++) + { + array1.push(i); + array2.push(size - 1 - i); + } + + // the following for loop reverses the order of array1 so + // that it should be similarly ordered to array2 + for (i = array1.length; i > 0; i--) + { + array3 = array1.slice(1,i); + array1.splice(1,i-1); + array1 = array3.concat(array1); + } + + // the following for loop reverses the order of array1 + // and array2 + for (i = 0; i < size; i++) + { + array1.push(array1.shift()); + array2.unshift(array2.pop()); + } + + testcases[count++] = new TestCase( SECTION, "Array.push,pop,shift,unshift,slice,splice", true,String(array1) == String(array2)); + array1.sort(); + array2.sort(); + testcases[count++] = new TestCase( SECTION, "Array.sort", true,String(array1) == String(array2)); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js new file mode 100644 index 0000000..7b9c55d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js @@ -0,0 +1,123 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: slice.js + Description: 'This tests out some of the functionality on methods on the Array objects' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:slice'; + + writeHeaderToLog('Executing script: slice.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + function mySlice(a, from, to) + { + var from2 = from; + var to2 = to; + var returnArray = []; + var i; + + if (from2 < 0) from2 = a.length + from; + if (to2 < 0) to2 = a.length + to; + + if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length)) + { + if (from2 < 0) from2 = 0; + if (to2 > a.length) to2 = a.length; + + for (i = from2; i < to2; ++i) returnArray.push(a[i]); + } + return returnArray; + } + + // This function tests the slice command on an Array + // passed in. The arguments passed into slice range in + // value from -5 to the length of the array + 4. Every + // combination of the two arguments is tested. The expected + // result of the slice(...) method is calculated and + // compared to the actual result from the slice(...) method. + // If the Arrays are not similar false is returned. + function exhaustiveSliceTest(testname, a) + { + var x = 0; + var y = 0; + var errorMessage; + var reason = ""; + var passed = true; + + for (x = -(2 + a.length); x <= (2 + a.length); x++) + for (y = (2 + a.length); y >= -(2 + a.length); y--) + { + var b = a.slice(x,y); + var c = mySlice(a,x,y); + + if (String(b) != String(c)) + { + errorMessage = + "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" + + " test: " + "a.slice(" + x + "," + y + ")\n" + + " a: " + String(a) + "\n" + + " actual result: " + String(b) + "\n" + + " expected result: " + String(c) + "\n"; + writeHeaderToLog(errorMessage); + reason = reason + errorMessage; + passed = false; + } + } + var testCase = new TestCase(SECTION, testname, true, passed); + if (passed == false) + testCase.reason = reason; + return testCase; + } + + var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']]; + var b = [1,2,3,4,5,6,7,8,9,0]; + + testcases[count++] = exhaustiveSliceTest("exhaustive slice test 1", a); + testcases[count++] = exhaustiveSliceTest("exhaustive slice test 2", b); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js new file mode 100644 index 0000000..b2164f4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js @@ -0,0 +1,152 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: splice1.js + Description: 'Tests Array.splice(x,y) w/no var args' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:splice 1'; + var BUGNUMBER="123795"; + + writeHeaderToLog('Executing script: splice1.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + function mySplice(testArray, splicedArray, first, len, elements) + { + var removedArray = []; + var adjustedFirst = first; + var adjustedLen = len; + + if (adjustedFirst < 0) adjustedFirst = testArray.length + first; + if (adjustedFirst < 0) adjustedFirst = 0; + + if (adjustedLen < 0) adjustedLen = 0; + + for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i) + splicedArray.push(testArray[i]); + + if (adjustedFirst < testArray.length) + for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) && + (i < testArray.length); ++i) + { + removedArray.push(testArray[i]); + } + + for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]); + + for (i = adjustedFirst + adjustedLen; i < testArray.length; i++) + splicedArray.push(testArray[i]); + + return removedArray; + } + + function exhaustiveSpliceTest(testname, testArray) + { + var errorMessage; + var passed = true; + var reason = ""; + + for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++) + { + var actualSpliced = []; + var expectedSpliced = []; + var actualRemoved = []; + var expectedRemoved = []; + + for (var len = 0; len < testArray.length + 2; len++) + { + actualSpliced = []; + expectedSpliced = []; + + for (var i = 0; i < testArray.length; ++i) + actualSpliced.push(testArray[i]); + + actualRemoved = actualSpliced.splice(first,len); + expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[]); + + var adjustedFirst = first; + if (adjustedFirst < 0) adjustedFirst = testArray.length + first; + if (adjustedFirst < 0) adjustedFirst = 0; + + if ( (String(actualSpliced) != String(expectedSpliced)) + ||(String(actualRemoved) != String(expectedRemoved))) + { + if ( (String(actualSpliced) == String(expectedSpliced)) + &&(String(actualRemoved) != String(expectedRemoved)) ) + { + if ( (expectedRemoved.length == 1) + &&(String(actualRemoved) == String(expectedRemoved[0]))) continue; + if ( expectedRemoved.length == 0 && actualRemoved == void 0) continue; + } + + errorMessage = + "ERROR: 'TEST FAILED'\n" + + " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" + + " a: " + String(testArray) + "\n" + + " actual spliced: " + String(actualSpliced) + "\n" + + " expected spliced: " + String(expectedSpliced) + "\n" + + " actual removed: " + String(actualRemoved) + "\n" + + " expected removed: " + String(expectedRemoved) + "\n"; + writeHeaderToLog(errorMessage); + reason = reason + errorMessage; + passed = false; + } + } + } + var testcase = new TestCase( SECTION, testname, true, passed); + if (!passed) + testcase.reason = reason; + return testcase; + } + + var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']]; + var b = [1,2,3,4,5,6,7,8,9,0]; + + testcases[count++] = exhaustiveSpliceTest("exhaustive splice w/no optional args 1",a); + testcases[count++] = exhaustiveSpliceTest("exhaustive splice w/no optional args 1",b); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js new file mode 100644 index 0000000..30861a5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js @@ -0,0 +1,150 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: splice2.js + Description: 'Tests Array.splice(x,y) w/4 var args' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:splice 2'; + var BUGNUMBER="123795"; + + writeHeaderToLog('Executing script: splice2.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + function mySplice(testArray, splicedArray, first, len, elements) + { + var removedArray = []; + var adjustedFirst = first; + var adjustedLen = len; + + if (adjustedFirst < 0) adjustedFirst = testArray.length + first; + if (adjustedFirst < 0) adjustedFirst = 0; + + if (adjustedLen < 0) adjustedLen = 0; + + for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i) + splicedArray.push(testArray[i]); + + if (adjustedFirst < testArray.length) + for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) && (i < testArray.length); ++i) + removedArray.push(testArray[i]); + + for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]); + + for (i = adjustedFirst + adjustedLen; i < testArray.length; i++) + splicedArray.push(testArray[i]); + + return removedArray; + } + + function exhaustiveSpliceTestWithArgs(testname, testArray) + { + var passed = true; + var errorMessage; + var reason = ""; + for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++) + { + var actualSpliced = []; + var expectedSpliced = []; + var actualRemoved = []; + var expectedRemoved = []; + + for (var len = 0; len < testArray.length + 2; len++) + { + actualSpliced = []; + expectedSpliced = []; + + for (var i = 0; i < testArray.length; ++i) + actualSpliced.push(testArray[i]); + + actualRemoved = actualSpliced.splice(first,len,-97,new String("test arg"),[],9.8); + expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[-97,new String("test arg"),[],9.8]); + + var adjustedFirst = first; + if (adjustedFirst < 0) adjustedFirst = testArray.length + first; + if (adjustedFirst < 0) adjustedFirst = 0; + + + if ( (String(actualSpliced) != String(expectedSpliced)) + ||(String(actualRemoved) != String(expectedRemoved))) + { + if ( (String(actualSpliced) == String(expectedSpliced)) + &&(String(actualRemoved) != String(expectedRemoved)) ) + { + + if ( (expectedRemoved.length == 1) + &&(String(actualRemoved) == String(expectedRemoved[0]))) continue; + if ( expectedRemoved.length == 0 && actualRemoved == void 0 ) continue; + } + + errorMessage = + "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" + + " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" + + " a: " + String(testArray) + "\n" + + " actual spliced: " + String(actualSpliced) + "\n" + + " expected spliced: " + String(expectedSpliced) + "\n" + + " actual removed: " + String(actualRemoved) + "\n" + + " expected removed: " + String(expectedRemoved); + reason = reason + errorMessage; + writeHeaderToLog(errorMessage); + passed = false; + } + } + } + var testcase = new TestCase(SECTION, testname, true, passed); + if (!passed) testcase.reason = reason; + return testcase; + } + + + var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']]; + var b = [1,2,3,4,5,6,7,8,9,0]; + + testcases[count++] = exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 1",a); + testcases[count++] = exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 2",b); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js new file mode 100644 index 0000000..b74228e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js @@ -0,0 +1,138 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: tostring_1.js + ECMA Section: Array.toString() + Description: + + This checks the ToString value of Array objects under JavaScript 1.2. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "JS1_2"; + var VERSION = "JS1_2"; + startTest(); + var TITLE = "Array.toString()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var a = new Array(); + + var VERSION = 0; + + /* This test assumes that if version() exists, it can set the JavaScript + * interpreter to an arbitrary version. To prevent unhandled exceptions in + * other tests, jsc implements version() as a stub function, but + * JavaScriptCore doesn't support setting the JavaScript engine's version. + + * Commenting out the following lines forces the test to expect JavaScript + * 1.5 results. + + * If JavaScriptCore changes to support versioning, this test should split + * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/. + */ + + /* + if ( typeof version == "function" ) { + version(120); + VERSION = "120"; + } else { + function version() { return 0; }; + } + */ + + testcases[tc++] = new TestCase ( SECTION, + "var a = new Array(); a.toString()", + ( VERSION == "120" ? "[]" : "" ), + a.toString() ); + + a[0] = void 0; + + testcases[tc++] = new TestCase ( SECTION, + "a[0] = void 0; a.toString()", + ( VERSION == "120" ? "[, ]" : "" ), + a.toString() ); + + + testcases[tc++] = new TestCase( SECTION, + "a.length", + 1, + a.length ); + + a[1] = void 0; + + testcases[tc++] = new TestCase( SECTION, + "a[1] = void 0; a.toString()", + ( VERSION == "120" ? "[, , ]" : "," ), + a.toString() ); + + a[1] = "hi"; + + testcases[tc++] = new TestCase( SECTION, + "a[1] = \"hi\"; a.toString()", + ( VERSION == "120" ? "[, \"hi\"]" : ",hi" ), + a.toString() ); + + a[2] = void 0; + + testcases[tc++] = new TestCase( SECTION, + "a[2] = void 0; a.toString()", + ( VERSION == "120" ?"[, \"hi\", , ]":",hi,"), + a.toString() ); + + var b = new Array(1000); + var bstring = ""; + for ( blen=0; blen<999; blen++) { + bstring += ","; + } + + + testcases[tc++] = new TestCase ( SECTION, + "var b = new Array(1000); b.toString()", + ( VERSION == "120" ? "[1000]" : bstring ), + b.toString() ); + + + testcases[tc++] = new TestCase( SECTION, + "b.length", + ( VERSION == "120" ? 1 : 1000 ), + b.length ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js new file mode 100644 index 0000000..5ed7425 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: tostring_2.js + Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114564 + Description: toString in version 120 + + + Author: christine@netscape.com + Date: 15 June 1998 +*/ + + var SECTION = "Array/tostring_2.js"; + var VERSION = "JS_12"; + startTest(); + var TITLE = "Array.toString"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var a = []; + + var VERSION = 0; + + /* This test assumes that if version() exists, it can set the JavaScript + * interpreter to an arbitrary version. To prevent unhandled exceptions in + * other tests, jsc implements version() as a stub function, but + * JavaScriptCore doesn't support setting the JavaScript engine's version. + + * Commenting out the following lines forces the test to expect JavaScript + * 1.5 results. + + * If JavaScriptCore changes to support versioning, this test should split + * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/. + */ + + /* + if ( typeof version == "function" ) { + writeLineToLog("version 120"); + version(120); + VERSION = "120"; + } else { + function version() { return 0; }; + } + */ + + testcases[tc++] = new TestCase ( SECTION, + "a.toString()", + ( VERSION == "120" ? "[]" : "" ), + a.toString() ); + + testcases[tc++] = new TestCase ( SECTION, + "String( a )", + ( VERSION == "120" ? "[]" : "" ), + String( a ) ); + + testcases[tc++] = new TestCase ( SECTION, + "a +''", + ( VERSION == "120" ? "[]" : "" ), + a+"" ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js new file mode 100644 index 0000000..33976bd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js @@ -0,0 +1,117 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: toString_1.js + ECMA Section: Object.toString() + Description: + + This checks the ToString value of Object objects under JavaScript 1.2. + + In JavaScript 1.2, Object.toString() + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "JS1_2"; + var VERSION = "JS1_2"; + startTest(); + var TITLE = "Object.toString()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var o = new Object(); + + testcases[testcases.length] = new TestCase( SECTION, + "var o = new Object(); o.toString()", + "{}", + o.toString() ); + + o = {}; + + testcases[testcases.length] = new TestCase( SECTION, + "o = {}; o.toString()", + "{}", + o.toString() ); + + o = { name:"object", length:0, value:"hello" } + + testcases[testcases.length] = new TestCase( SECTION, + "o = { name:\"object\", length:0, value:\"hello\" }; o.toString()", + true, + checkObjectToString(o.toString(), ['name:"object"', 'length:0', + 'value:"hello"'])); + + o = { name:"object", length:0, value:"hello", + toString:new Function( "return this.value+''" ) } + + testcases[testcases.length] = new TestCase( SECTION, + "o = { name:\"object\", length:0, value:\"hello\", "+ + "toString:new Function( \"return this.value+''\" ) }; o.toString()", + "hello", + o.toString() ); + + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +/** + * checkObjectToString + * + * In JS1.2, Object.prototype.toString returns a representation of the + * object's properties as a string. However, the order of the properties + * in the resulting string is not specified. This function compares the + * resulting string with an array of strings to make sure that the + * resulting string is some permutation of the strings in the array. + */ +function checkObjectToString(s, a) { + var m = /^\{(.*)\}$/(s); + if (!m) + return false; // should begin and end with curly brackets + var a2 = m[1].split(", "); + if (a.length != a2.length) + return false; // should be same length + a.sort(); + a2.sort(); + for (var i=0; i < a.length; i++) { + if (a[i] != a2[i]) + return false; // should have identical elements + } + return true; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js new file mode 100644 index 0000000..ec4a7a2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: charCodeAt.js + Description: 'This tests new String object method: charCodeAt' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:charCodeAt'; + + writeHeaderToLog('Executing script: charCodeAt.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + var aString = new String("tEs5"); + + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-2)", NaN, aString.charCodeAt(-2)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-1)", NaN, aString.charCodeAt(-1)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 0)", 116, aString.charCodeAt( 0)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 1)", 69, aString.charCodeAt( 1)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 2)", 115, aString.charCodeAt( 2)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 3)", 53, aString.charCodeAt( 3)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 4)", NaN, aString.charCodeAt( 4)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 5)", NaN, aString.charCodeAt( 5)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( Infinity)", NaN, aString.charCodeAt( Infinity)); + testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-Infinity)", NaN, aString.charCodeAt(-Infinity)); + //testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( )", 116, aString.charCodeAt( )); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js new file mode 100644 index 0000000..725abb7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: concat.js + Description: 'This tests the new String object method: concat' + + Author: NickLerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:concat'; + + writeHeaderToLog('Executing script: concat.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + var aString = new String("test string"); + var bString = new String(" another "); + + testcases[count++] = new TestCase( SECTION, "aString.concat(' more')", "test string more", aString.concat(' more').toString()); + testcases[count++] = new TestCase( SECTION, "aString.concat(bString)", "test string another ", aString.concat(bString).toString()); + testcases[count++] = new TestCase( SECTION, "aString ", "test string", aString.toString()); + testcases[count++] = new TestCase( SECTION, "bString ", " another ", bString.toString()); + testcases[count++] = new TestCase( SECTION, "aString.concat(345) ", "test string345", aString.concat(345).toString()); + testcases[count++] = new TestCase( SECTION, "aString.concat(true) ", "test stringtrue", aString.concat(true).toString()); + testcases[count++] = new TestCase( SECTION, "aString.concat(null) ", "test stringnull", aString.concat(null).toString()); + /* + http://bugs.webkit.org/show_bug.cgi?id=11545#c3 + According to ECMA 15.5.4.6, the argument of concat should send to ToString and + convert into a string value (not String object). So these arguments will be + convert into '' and '1,2,3' under ECMA-262v3, not the js1.2 expected '[]' and + '[1,2,3]' + */ + //testcases[count++] = new TestCase( SECTION, "aString.concat([]) ", "test string[]", aString.concat([]).toString()); + //testcases[count++] = new TestCase( SECTION, "aString.concat([1,2,3])", "test string[1, 2, 3]", aString.concat([1,2,3]).toString()); + + testcases[count++] = new TestCase( SECTION, "'abcde'.concat(' more')", "abcde more", 'abcde'.concat(' more').toString()); + testcases[count++] = new TestCase( SECTION, "'abcde'.concat(bString)", "abcde another ", 'abcde'.concat(bString).toString()); + testcases[count++] = new TestCase( SECTION, "'abcde' ", "abcde", 'abcde'); + testcases[count++] = new TestCase( SECTION, "'abcde'.concat(345) ", "abcde345", 'abcde'.concat(345).toString()); + testcases[count++] = new TestCase( SECTION, "'abcde'.concat(true) ", "abcdetrue", 'abcde'.concat(true).toString()); + testcases[count++] = new TestCase( SECTION, "'abcde'.concat(null) ", "abcdenull", 'abcde'.concat(null).toString()); + /* + http://bugs.webkit.org/show_bug.cgi?id=11545#c3 + According to ECMA 15.5.4.6, the argument of concat should send to ToString and + convert into a string value (not String object). So these arguments will be + convert into '' and '1,2,3' under ECMA-262v3, not the js1.2 expected '[]' and + '[1,2,3]' + */ + //testcases[count++] = new TestCase( SECTION, "'abcde'.concat([]) ", "abcde[]", 'abcde'.concat([]).toString()); + //testcases[count++] = new TestCase( SECTION, "'abcde'.concat([1,2,3])", "abcde[1, 2, 3]", 'abcde'.concat([1,2,3]).toString()); + + //what should this do: + testcases[count++] = new TestCase( SECTION, "'abcde'.concat() ", "abcde", 'abcde'.concat().toString()); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js new file mode 100644 index 0000000..6c4efb4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js @@ -0,0 +1,62 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: match.js + Description: 'This tests the new String object method: match' + + Author: NickLerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String:match'; + + writeHeaderToLog('Executing script: match.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + var aString = new String("this is a test string"); + + testcases[count++] = new TestCase( SECTION, "aString.match(/is.*test/) ", String(["is is a test"]), String(aString.match(/is.*test/))); + testcases[count++] = new TestCase( SECTION, "aString.match(/s.*s/) ", String(["s is a test s"]), String(aString.match(/s.*s/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js new file mode 100644 index 0000000..f0e901e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js @@ -0,0 +1,123 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: slice.js + Description: 'This tests the String object method: slice' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String.slice'; + + writeHeaderToLog('Executing script: slice.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + function myStringSlice(a, from, to) + { + var from2 = from; + var to2 = to; + var returnString = new String(""); + var i; + + if (from2 < 0) from2 = a.length + from; + if (to2 < 0) to2 = a.length + to; + + if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length)) + { + if (from2 < 0) from2 = 0; + if (to2 > a.length) to2 = a.length; + + for (i = from2; i < to2; ++i) returnString += a.charAt(i); + } + return returnString; + } + + // This function tests the slice command on a String + // passed in. The arguments passed into slice range in + // value from -5 to the length of the array + 4. Every + // combination of the two arguments is tested. The expected + // result of the slice(...) method is calculated and + // compared to the actual result from the slice(...) method. + // If the Strings are not similar false is returned. + function exhaustiveStringSliceTest(testname, a) + { + var x = 0; + var y = 0; + var errorMessage; + var reason = ""; + var passed = true; + + for (x = -(2 + a.length); x <= (2 + a.length); x++) + for (y = (2 + a.length); y >= -(2 + a.length); y--) + { + var b = a.slice(x,y); + var c = myStringSlice(a,x,y); + + if (String(b) != String(c)) + { + errorMessage = + "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" + + " test: " + "a.slice(" + x + "," + y + ")\n" + + " a: " + String(a) + "\n" + + " actual result: " + String(b) + "\n" + + " expected result: " + String(c) + "\n"; + writeHeaderToLog(errorMessage); + reason = reason + errorMessage; + passed = false; + } + } + var testCase = new TestCase(SECTION, testname, true, passed); + if (passed == false) + testCase.reason = reason; + return testCase; + } + + var a = new String("abcdefghijklmnopqrstuvwxyz1234567890"); + var b = new String("this is a test string"); + + testcases[count++] = exhaustiveStringSliceTest("exhaustive String.slice test 1", a); + testcases[count++] = exhaustiveStringSliceTest("exhaustive String.slice test 2", b); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_2/browser.js new file mode 100644 index 0000000..8b298a0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/browser.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/* + * JavaScript test library shared functions file for running the tests + * in the browser. Overrides the shell's print function with document.write + * and make everything HTML pretty. + * + * To run the tests in the browser, use the mkhtml.pl script to generate + * html pages that include the shell.js, browser.js (this file), and the + * test js file in script tags. + * + * The source of the page that is generated should look something like this: + * <script src="./../shell.js"></script> + * <script src="./../browser.js"></script> + * <script src="./mytest.js"></script> + */ + +onerror = err; + +var GLOBAL = "[object Window]"; + +function startTest() { + writeHeaderToLog( SECTION + " "+ TITLE); + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + +function writeLineToLog( string ) { + document.write( string + "<br>\n"); +} +function writeHeaderToLog( string ) { + document.write( "<h2>" + string + "</h2>" ); +} +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } + document.write( "<hr>" ); +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = "<tt>"+ string ; + s += "<b>" ; + s += ( passed ) ? "<font color=#009900> " + PASSED + : "<font color=#aa0000> " + FAILED + expect + "</tt>"; + writeLineToLog( s + "</font></b></tt>" ); + return passed; +} +function err ( msg, page, line ) { + writeLineToLog( "Test " + page + " failed on line " + line +" with the message: " + msg ); + + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js new file mode 100644 index 0000000..1dec16a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: Function_object.js + Description: 'Testing Function objects' + + Author: Nick Lerissa + Date: April 17, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'functions: Function_object'; + + writeHeaderToLog('Executing script: Function_object.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + function a_test_function(a,b,c) + { + return a + b + c; + } + + f = a_test_function; + + + testcases[count++] = new TestCase( SECTION, "f.name", + 'a_test_function', f.name); + + testcases[count++] = new TestCase( SECTION, "f.length", + 3, f.length); + + testcases[count++] = new TestCase( SECTION, "f.arity", + 3, f.arity); + + testcases[count++] = new TestCase( SECTION, "f(2,3,4)", + 9, f(2,3,4)); + + var fnName = version() == 120 ? '' : 'anonymous'; + + testcases[count++] = new TestCase( SECTION, "(new Function()).name", + fnName, (new Function()).name); + + testcases[count++] = new TestCase( SECTION, "(new Function()).toString()", + '\nfunction ' + fnName + '() {\n}\n', (new Function()).toString()); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js new file mode 100644 index 0000000..9586f78 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: Number.js + Description: 'This tests the function Number(Object)' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'functions: Number'; + var BUGNUMBER="123435"; + + writeHeaderToLog('Executing script: Number.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + date = new Date(2200); + + testcases[count++] = new TestCase( SECTION, "Number(new Date(2200)) ", + 2200, (Number(date))); + testcases[count++] = new TestCase( SECTION, "Number(true) ", + 1, (Number(true))); + testcases[count++] = new TestCase( SECTION, "Number(false) ", + 0, (Number(false))); + testcases[count++] = new TestCase( SECTION, "Number('124') ", + 124, (Number('124'))); + testcases[count++] = new TestCase( SECTION, "Number('1.23') ", + 1.23, (Number('1.23'))); + testcases[count++] = new TestCase( SECTION, "Number({p:1}) ", + NaN, (Number({p:1}))); + testcases[count++] = new TestCase( SECTION, "Number(null) ", + 0, (Number(null))); + testcases[count++] = new TestCase( SECTION, "Number(-45) ", + -45, (Number(-45))); + + // http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123435 + // under js1.2, Number([1,2,3]) should return 3. + + /* + http://bugs.webkit.org/show_bug.cgi?id=11545#c4 + According to ECMA 9.3, when input type was Object, should call + ToPrimitive(input arg, hint Number) first, and than ToNumber() later. However, + ToPrimitive() will use [[DefaultValue]](hint) rule when input Type was Object + (ECMA 8.6.2.6). So the input [1,2,3] will applied [[DefaultValue]](hint) rule + with hint Number, and it looks like this: + + toString(valuOf([1,2,3])) => toString(1,2,3) => '1,2,3' + + Than ToNumber('1,2,3') results NaN based on ECMA 9.3.1: If the grammar cannot + interpret the string as an expansion of StringNumericLiteral, then the result + of ToNumber is NaN. + */ + + //testcases[count++] = new TestCase( SECTION, "Number([1,2,3]) ", + // 3, (Number([1,2,3]))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js new file mode 100644 index 0000000..724c392 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: String.js + Description: 'This tests the function String(Object)' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'functions: String'; + + writeHeaderToLog('Executing script: String.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + testcases[count++] = new TestCase( SECTION, "String(true) ", + 'true', (String(true))); + testcases[count++] = new TestCase( SECTION, "String(false) ", + 'false', (String(false))); + testcases[count++] = new TestCase( SECTION, "String(-124) ", + '-124', (String(-124))); + testcases[count++] = new TestCase( SECTION, "String(1.23) ", + '1.23', (String(1.23))); + /* + http://bugs.webkit.org/show_bug.cgi?id=11545#c5 + According to ECMA 9.8, when input type of String object argument was Object, we + should applied ToPrimitive(input arg, hint String) first, and later ToString(). + And just like previous one, ToPrimitive() will use [[DefaultValue]](hint) + with hint String to convert the input (toString() below uses the rule in ECMA 15.2.4.2): + + valueOf(toString({p:1}) => valueOf('[object Object]') => '[object Object]' + + And ToString() called after ToPrimitive(), so the correct result would be: + + [object Object] + */ + //testcases[count++] = new TestCase( SECTION, "String({p:1}) ", + // '{p:1}', (String({p:1}))); + testcases[count++] = new TestCase( SECTION, "String(null) ", + 'null', (String(null))); + /* + http://bugs.webkit.org/show_bug.cgi?id=11545#c5 + According to ECMA 9.8, when input type of String object argument was Object, we + should applied ToPrimitive(input arg, hint String) first, and later ToString(). + And just like previous one, ToPrimitive() will use [[DefaultValue]](hint) + with hint String to convert the input (toString() below uses the rule in ECMA 15.2.4.2): + + valueOf(toString([1,2,3])) => valueOf('1,2,3') => '1,2,3' + + And ToString() called after ToPrimitive(), so the correct result would be: + + 1,2,3 + */ + //testcases[count++] = new TestCase( SECTION, "String([1,2,3]) ", + // '[1, 2, 3]', (String([1,2,3]))); + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js new file mode 100644 index 0000000..6daea71 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: definition-1.js + Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=111284 + Description: Regression test for declaring functions. + + Author: christine@netscape.com + Date: 15 June 1998 +*/ + + var SECTION = "function/definition-1.js"; + var VERSION = "JS_12"; + startTest(); + var TITLE = "Regression test for 111284"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + f1 = function() { return "passed!" } + + function f2() { f3 = function() { return "passed!" }; return f3(); } + + testcases[tc++] = new TestCase( SECTION, + 'f1 = function() { return "passed!" }; f1()', + "passed!", + f1() ); + + testcases[tc++] = new TestCase( SECTION, + 'function f2() { f3 = function { return "passed!" }; return f3() }; f2()', + "passed!", + f2() ); + + testcases[tc++] = new TestCase( SECTION, + 'f3()', + "passed!", + f3() ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js new file mode 100644 index 0000000..5ae01a9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: boolean-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 + * + * eval("function f(){}function g(){}") at top level is an error for JS1.2 + * and above (missing ; between named function expressions), but declares f + * and g as functions below 1.2. + * + * Fails to produce error regardless of version: + * js> version(100) + * 120 + * js> eval("function f(){}function g(){}") + * js> version(120); + * 100 + * js> eval("function f(){}function g(){}") + * js> + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "function-001.js"; + var VERSION = "JS1_1"; + startTest(); + var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; + var BUGNUMBER="99232"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "eval(\"function f(){}function g(){}\")", + "error", + eval("function f(){}function g(){}") ); + + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js new file mode 100644 index 0000000..aae30d5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js @@ -0,0 +1,93 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.3.5.1.js + ECMA Section: Function.length + Description: + + The value of the length property is usually an integer that indicates the + "typical" number of arguments expected by the function. However, the + language permits the function to be invoked with some other number of + arguments. The behavior of a function when invoked on a number of arguments + other than the number specified by its length property depends on the function. + + This checks the pre-ecma behavior Function.length. + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204 + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "function/length.js"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Function.length"; + var BUGNUMBER="104204"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var f = new Function( "a","b", "c", "return f.length"); + + if ( version() <= 120 ) { + + testcases[tc++] = new TestCase( SECTION, + 'var f = new Function( "a","b", "c", "return f.length"); f()', + 0, + f() ); + + testcases[tc++] = new TestCase( SECTION, + 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', + 5, + f(1,2,3,4,5) ); + } else { + + testcases[tc++] = new TestCase( SECTION, + 'var f = new Function( "a","b", "c", "return f.length"); f()', + 3, + f() ); + + testcases[tc++] = new TestCase( SECTION, + 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', + 3, + f(1,2,3,4,5) ); + + + } + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js new file mode 100644 index 0000000..391f926 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js @@ -0,0 +1,61 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: nesting-1.js + Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122040 + Description: Regression test for a nested function + + Author: christine@netscape.com + Date: 15 June 1998 +*/ + + var SECTION = "function/nesting-1.js"; + var VERSION = "JS_12"; + startTest(); + var TITLE = "Regression test for 122040"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + function f(a) {function g(b) {return a+b;}; return g;}; f(7) + + testcases[tc++] = new TestCase( SECTION, + 'function f(a) {function g(b) {return a+b;}; return g;}; typeof f(7)', + "function", + typeof f(7) ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js new file mode 100644 index 0000000..b626da5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: nesting.js + Description: 'This tests the nesting of functions' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'functions: nesting'; + + writeHeaderToLog('Executing script: nesting.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + function outer_func(x) + { + var y = "outer"; + + testcases[count++] = new TestCase( SECTION, "outer:x ", + 1111, x); + testcases[count++] = new TestCase( SECTION, "outer:y ", + 'outer', y); + function inner_func(x) + { + var y = "inner"; + testcases[count++] = new TestCase( SECTION, "inner:x ", + 2222, x); + testcases[count++] = new TestCase( SECTION, "inner:y ", + 'inner', y); + }; + + inner_func(2222); + testcases[count++] = new TestCase( SECTION, "outer:x ", + 1111, x); + testcases[count++] = new TestCase( SECTION, "outer:y ", + 'outer', y); + } + + outer_func(1111); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js new file mode 100644 index 0000000..b01825c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js @@ -0,0 +1,98 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: regexparg-1.js + Description: + + Regression test for + http://scopus/bugsplat/show_bug.cgi?id=122787 + Passing a regular expression as the first constructor argument fails + + Author: christine@netscape.com + Date: 15 June 1998 +*/ + + var SECTION = "JS_1.2"; + var VERSION = "JS_1.2"; + startTest(); + var TITLE = "The variable statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + function f(x) {return x;} + + x = f(/abc/); + + testcases[tc++] = new TestCase( SECTION, + "function f(x) {return x;}; f()", + void 0, + f() ); + + testcases[tc++] = new TestCase( SECTION, + "f(\"hi\")", + "hi", + f("hi") ); + + testcases[tc++] = new TestCase( SECTION, + "new f(/abc/) +''", + "/abc/", + new f(/abc/) +"" ); + + testcases[tc++] = new TestCase( SECTION, + "f(/abc/)+'')", + "/abc/", + f(/abc/) +''); + + testcases[tc++] = new TestCase( SECTION, + "typeof f(/abc/)", + "function", + typeof f(/abc/) ); + + testcases[tc++] = new TestCase( SECTION, + "typeof new f(/abc/)", + "function", + typeof new f(/abc/) ); + + testcases[tc++] = new TestCase( SECTION, + "x = new f(/abc/); x(\"hi\")", + null, + x("hi") ); + + + // js> x() + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js new file mode 100644 index 0000000..e8bf951 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: regexparg-1.js + Description: + + Regression test for + http://scopus/bugsplat/show_bug.cgi?id=122787 + Passing a regular expression as the first constructor argument fails + + Author: christine@netscape.com + Date: 15 June 1998 +*/ + + var SECTION = "JS_1.2"; + var VERSION = "JS_1.2"; + startTest(); + var TITLE = "The variable statment"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + function f(x) {return x;} + + x = f(/abc/); + + testcases[tc++] = new TestCase( SECTION, + "function f(x) {return x;}; x = f(/abc/); x()", + "error", + x() ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js new file mode 100644 index 0000000..d532d65 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js @@ -0,0 +1,143 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: tostring-1.js + Section: Function.toString + Description: + + Since the behavior of Function.toString() is implementation-dependent, + toString tests for function are not in the ECMA suite. + + Currently, an attempt to parse the toString output for some functions + and verify that the result is something reasonable. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "tostring-1"; + var VERSION = "JS1_2"; + startTest(); + var TITLE = "Function.toString()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var tab = " "; + + t1 = new TestFunction( "stub", "value", tab + "return value;" ); + + t2 = new TestFunction( "ToString", "object", tab+"return object + \"\";" ); + + t3 = new TestFunction( "Add", "a, b, c, d, e", tab +"var s = a + b + c + d + e;\n" + + tab + "return s;" ); + + t4 = new TestFunction( "noop", "value" ); + + t5 = new TestFunction( "anonymous", "", tab+"return \"hello!\";" ); + + var f = new Function( "return \"hello!\""); + + testcases[tc++] = new TestCase( SECTION, + "stub.toString()", + t1.valueOf(), + stub.toString() ); + + testcases[tc++] = new TestCase( SECTION, + "ToString.toString()", + t2.valueOf(), + ToString.toString() ); + + testcases[tc++] = new TestCase( SECTION, + "Add.toString()", + t3.valueOf(), + Add.toString() ); + + testcases[tc++] = new TestCase( SECTION, + "noop.toString()", + t4.toString(), + noop.toString() ); + + testcases[tc++] = new TestCase( SECTION, + "f.toString()", + t5.toString(), + f.toString() ); + test(); + +function noop( value ) { +} +function Add( a, b, c, d, e ) { + var s = a + b + c + d + e; + return s; +} +function stub( value ) { + return value; +} +function ToString( object ) { + return object + ""; +} + +function ToBoolean( value ) { + if ( value == 0 || value == NaN || value == false ) { + return false; + } else { + return true; + } +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function TestFunction( name, args, body ) { + if ( name == "anonymous" && version() == 120 ) { + name = ""; + } + + this.name = name; + this.arguments = args.toString(); + this.body = body; + + /* the format of Function.toString() in JavaScript 1.2 is: + /n + function name ( arguments ) { + body + } + */ + this.value = "\nfunction " + (name ? name : "" )+ + "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}\n"; + + this.toString = new Function( "return this.value" ); + this.valueOf = new Function( "return this.value" ); + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js new file mode 100644 index 0000000..146764d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js @@ -0,0 +1,185 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: tostring-1.js + Section: Function.toString + Description: + + Since the behavior of Function.toString() is implementation-dependent, + toString tests for function are not in the ECMA suite. + + Currently, an attempt to parse the toString output for some functions + and verify that the result is something reasonable. + + This verifies + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99212 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "tostring-2"; + var VERSION = "JS1_2"; + startTest(); + var TITLE = "Function.toString()"; + var BUGNUMBER="123444"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var tab = " "; + + +var equals = new TestFunction( "Equals", "a, b", tab+ "return a == b;" ); +function Equals (a, b) { + return a == b; +} + +var reallyequals = new TestFunction( "ReallyEquals", "a, b", + ( version() <= 120 ) ? tab +"return a == b;" : tab +"return a === b;" ); +function ReallyEquals( a, b ) { + return a === b; +} + +var doesntequal = new TestFunction( "DoesntEqual", "a, b", tab + "return a != b;" ); +function DoesntEqual( a, b ) { + return a != b; +} + +var reallydoesntequal = new TestFunction( "ReallyDoesntEqual", "a, b", + ( version() <= 120 ) ? tab +"return a != b;" : tab +"return a !== b;" ); +function ReallyDoesntEqual( a, b ) { + return a !== b; +} + +var testor = new TestFunction( "TestOr", "a", tab+"if (a == null || a == void 0) {\n"+ + tab +tab+"return 0;\n"+tab+"} else {\n"+tab+tab+"return a;\n"+tab+"}" ); +function TestOr( a ) { + if ( a == null || a == void 0 ) + return 0; + else + return a; +} + +var testand = new TestFunction( "TestAnd", "a", tab+"if (a != null && a != void 0) {\n"+ + tab+tab+"return a;\n" + tab+ "} else {\n"+tab+tab+"return 0;\n"+tab+"}" ); +function TestAnd( a ) { + if ( a != null && a != void 0 ) + return a; + else + return 0; +} + +var or = new TestFunction( "Or", "a, b", tab + "return a | b;" ); +function Or( a, b ) { + return a | b; +} + +var and = new TestFunction( "And", "a, b", tab + "return a & b;" ); +function And( a, b ) { + return a & b; +} + +var xor = new TestFunction( "XOr", "a, b", tab + "return a ^ b;" ); +function XOr( a, b ) { + return a ^ b; +} + + testcases[testcases.length] = new TestCase( SECTION, + "Equals.toString()", + equals.valueOf(), + Equals.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "ReallyEquals.toString()", + reallyequals.valueOf(), + ReallyEquals.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "DoesntEqual.toString()", + doesntequal.valueOf(), + DoesntEqual.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "ReallyDoesntEqual.toString()", + reallydoesntequal.valueOf(), + ReallyDoesntEqual.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "TestOr.toString()", + testor.valueOf(), + TestOr.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "TestAnd.toString()", + testand.valueOf(), + TestAnd.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "Or.toString()", + or.valueOf(), + Or.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "And.toString()", + and.valueOf(), + And.toString() ); + + testcases[testcases.length] = new TestCase( SECTION, + "XOr.toString()", + xor.valueOf(), + XOr.toString() ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function TestFunction( name, args, body ) { + this.name = name; + this.arguments = args.toString(); + this.body = body; + + /* the format of Function.toString() in JavaScript 1.2 is: + /n + function name ( arguments ) { + body + } + */ + this.value = "\nfunction " + (name ? name : "anonymous" )+ + "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}\n"; + + this.toString = new Function( "return this.value" ); + this.valueOf = new Function( "return this.value" ); + return this; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js new file mode 100644 index 0000000..3ecb4c1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js @@ -0,0 +1,215 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; +EXCLUDE = ""; + +/* + * constant strings + */ +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +var DEBUG = false; + +version("120"); +/* + * change this for date tests if you're not in PST + */ + +TZ_DIFF = -8; +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); +} +function startTest() { + version(120); + + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). + // print out bugnumber + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; + +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, give a little leeway for rounding. + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +/* + * Begin printing functions. These functions use the shell's + * print function. When running tests in the browser, these + * functions, override these functions with functions that use + * document.write. + */ + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +/* end of print functions */ + + +function stopTest() { + var sizeTag = "<#TEST CASES SIZE>"; + var doneTag = "<#TEST CASES DONE>"; + var beginTag = "<#TEST CASE "; + var endTag = ">"; + + print(sizeTag); + print(testcases.length); + for (tc = 0; tc < testcases.length; tc++) + { + print(beginTag + 'PASSED' + endTag); + print(testcases[tc].passed); + print(beginTag + 'NAME' + endTag); + print(testcases[tc].name); + print(beginTag + 'EXPECTED' + endTag); + print(testcases[tc].expect); + print(beginTag + 'ACTUAL' + endTag); + print(testcases[tc].actual); + print(beginTag + 'DESCRIPTION' + endTag); + print(testcases[tc].description); + print(beginTag + 'REASON' + endTag); + print(( testcases[tc].passed ) ? "" : "wrong value "); + print(beginTag + 'BUGNUMBER' + endTag); + print( BUGNUMBER ); + } + print(doneTag); + gc(); +} + +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} +function err( msg, page, line ) { + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} +function Enumerate ( o ) { + var p; + for ( p in o ) { + print( p +": " + o[p] ); + } +} +function GetContext() { + return Packages.com.netscape.javascript.Context.getCurrentContext(); +} +function OptLevel( i ) { + i = Number(i); + var cx = GetContext(); + cx.setOptimizationLevel(i); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js new file mode 100644 index 0000000..855b5a8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: equality.js + Description: 'This tests the operator ==' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'operator "=="'; + + writeHeaderToLog('Executing script: equality.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + // the following two tests are incorrect + //testcases[count++] = new TestCase( SECTION, "(new String('') == new String('')) ", + // true, (new String('') == new String(''))); + + //testcases[count++] = new TestCase( SECTION, "(new Boolean(true) == new Boolean(true)) ", + // true, (new Boolean(true) == new Boolean(true))); + + testcases[count++] = new TestCase( SECTION, "(new String('x') == 'x') ", + false, (new String('x') == 'x')); + + testcases[count++] = new TestCase( SECTION, "('x' == new String('x')) ", + false, ('x' == new String('x'))); + + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js new file mode 100644 index 0000000..0f8acea --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js @@ -0,0 +1,92 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: strictEquality.js + Description: 'This tests the operator ===' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'operator "==="'; + + writeHeaderToLog('Executing script: strictEquality.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + testcases[count++] = new TestCase( SECTION, "('8' === 8) ", + false, ('8' === 8)); + + testcases[count++] = new TestCase( SECTION, "(8 === 8) ", + true, (8 === 8)); + + testcases[count++] = new TestCase( SECTION, "(8 === true) ", + false, (8 === true)); + + testcases[count++] = new TestCase( SECTION, "(new String('') === new String('')) ", + false, (new String('') === new String(''))); + + testcases[count++] = new TestCase( SECTION, "(new Boolean(true) === new Boolean(true))", + false, (new Boolean(true) === new Boolean(true))); + + var anObject = { one:1 , two:2 }; + + testcases[count++] = new TestCase( SECTION, "(anObject === anObject) ", + true, (anObject === anObject)); + + testcases[count++] = new TestCase( SECTION, "(anObject === { one:1 , two:2 }) ", + false, (anObject === { one:1 , two:2 })); + + testcases[count++] = new TestCase( SECTION, "({ one:1 , two:2 } === anObject) ", + false, ({ one:1 , two:2 } === anObject)); + + testcases[count++] = new TestCase( SECTION, "(null === null) ", + true, (null === null)); + + testcases[count++] = new TestCase( SECTION, "(null === 0) ", + false, (null === 0)); + + testcases[count++] = new TestCase( SECTION, "(true === !false) ", + true, (true === !false)); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js new file mode 100644 index 0000000..58f9264 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js @@ -0,0 +1,108 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_dollar_number.js + Description: 'Tests RegExps $1, ..., $9 properties' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $1, ..., $9'; + var BUGNUMBER="123802"; + + writeHeaderToLog('Executing script: RegExp_dollar_number.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1 + 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1", + 'abcdefghi', RegExp.$1); + + // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2 + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2", + 'bcdefgh', RegExp.$2); + + // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3 + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3", + 'cdefg', RegExp.$3); + + // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4 + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4", + 'def', RegExp.$4); + + // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5 + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5", + 'e', RegExp.$5); + + // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6 + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6", + '', RegExp.$6); + + var a_to_z = 'abcdefghijklmnopqrstuvwxyz'; + var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/ + // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1 + a_to_z.match(regexp1); + + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1", + 'a', RegExp.$1); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2", + 'c', RegExp.$2); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3", + 'e', RegExp.$3); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4", + 'g', RegExp.$4); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5", + 'i', RegExp.$5); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6", + 'k', RegExp.$6); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7", + 'm', RegExp.$7); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8", + 'o', RegExp.$8); + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9", + 'q', RegExp.$9); +/* + testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10", + 's', RegExp.$10); +*/ + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js new file mode 100644 index 0000000..01c145c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_input.js + Description: 'Tests RegExps input property' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: input'; + + writeHeaderToLog('Executing script: RegExp_input.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + RegExp.input = "abcd12357efg"; + + // RegExp.input = "abcd12357efg"; RegExp.input + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; RegExp.input", + "abcd12357efg", RegExp.input); + + // RegExp.input = "abcd12357efg"; /\d+/.exec('2345') + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec('2345')", + String(["2345"]), String(/\d+/.exec('2345'))); + + // RegExp.input = "abcd12357efg"; /\d+/.exec() + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec()", + String(["12357"]), String(/\d+/.exec())); + + // RegExp.input = "abcd12357efg"; /[h-z]+/.exec() + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.exec()", + null, /[h-z]+/.exec()); + + // RegExp.input = "abcd12357efg"; /\d+/.test('2345') + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test('2345')", + true, /\d+/.test('2345')); + + // RegExp.input = "abcd12357efg"; /\d+/.test() + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test()", + true, /\d+/.test()); + + // RegExp.input = "abcd12357efg"; (new RegExp('d+')).test() + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('d+')).test()", + true, (new RegExp('d+')).test()); + + // RegExp.input = "abcd12357efg"; /[h-z]+/.test() + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.test()", + false, /[h-z]+/.test()); + + // RegExp.input = "abcd12357efg"; (new RegExp('[h-z]+')).test() + RegExp.input = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('[h-z]+')).test()", + false, (new RegExp('[h-z]+')).test()); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js new file mode 100644 index 0000000..a1ed113 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js @@ -0,0 +1,102 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_input_as_array.js + Description: 'Tests RegExps $_ property (same tests as RegExp_input.js but using $_)' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: input'; + + writeHeaderToLog('Executing script: RegExp_input.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + RegExp['$_'] = "abcd12357efg"; + + // RegExp['$_'] = "abcd12357efg"; RegExp['$_'] + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; RegExp['$_']", + "abcd12357efg", RegExp['$_']); + + // RegExp['$_'] = "abcd12357efg"; /\d+/.exec('2345') + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec('2345')", + String(["2345"]), String(/\d+/.exec('2345'))); + + // RegExp['$_'] = "abcd12357efg"; /\d+/.exec() + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec()", + String(["12357"]), String(/\d+/.exec())); + + // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.exec() + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.exec()", + null, /[h-z]+/.exec()); + + // RegExp['$_'] = "abcd12357efg"; /\d+/.test('2345') + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test('2345')", + true, /\d+/.test('2345')); + + // RegExp['$_'] = "abcd12357efg"; /\d+/.test() + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test()", + true, /\d+/.test()); + + // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.test() + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.test()", + false, /[h-z]+/.test()); + + // RegExp['$_'] = "abcd12357efg"; (new RegExp('\d+')).test() + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('\d+')).test()", + true, (new RegExp('\d+')).test()); + + // RegExp['$_'] = "abcd12357efg"; (new RegExp('[h-z]+')).test() + RegExp['$_'] = "abcd12357efg"; + testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('[h-z]+')).test()", + false, (new RegExp('[h-z]+')).test()); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js new file mode 100644 index 0000000..b48836f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js @@ -0,0 +1,83 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_lastIndex.js + Description: 'Tests RegExps lastIndex property' + + Author: Nick Lerissa + Date: March 17, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: lastIndex'; + var BUGNUMBER="123802"; + + writeHeaderToLog('Executing script: RegExp_lastIndex.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // re=/x./g; re.lastIndex=4; re.exec('xyabcdxa'); + re=/x./g; + re.lastIndex=4; + testcases[count++] = new TestCase ( SECTION, "re=/x./g; re.lastIndex=4; re.exec('xyabcdxa')", + '["xa"]', String(re.exec('xyabcdxa'))); + + // re.lastIndex + testcases[count++] = new TestCase ( SECTION, "re.lastIndex", + 8, re.lastIndex); + + // re.exec('xyabcdef'); + testcases[count++] = new TestCase ( SECTION, "re.exec('xyabcdef')", + null, re.exec('xyabcdef')); + + // re.lastIndex + testcases[count++] = new TestCase ( SECTION, "re.lastIndex", + 0, re.lastIndex); + + // re.exec('xyabcdef'); + testcases[count++] = new TestCase ( SECTION, "re.exec('xyabcdef')", + '["xy"]', String(re.exec('xyabcdef'))); + + // re.lastIndex=30; re.exec('123xaxbxc456'); + re.lastIndex=30; + testcases[count++] = new TestCase ( SECTION, "re.lastIndex=30; re.exec('123xaxbxc456')", + null, re.exec('123xaxbxc456')); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js new file mode 100644 index 0000000..2b0c72d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_lastMatch.js + Description: 'Tests RegExps lastMatch property' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: lastMatch'; + + writeHeaderToLog('Executing script: RegExp_lastMatch.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'foo'.match(/foo/); RegExp.lastMatch + 'foo'.match(/foo/); + testcases[count++] = new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch", + 'foo', RegExp.lastMatch); + + // 'foo'.match(new RegExp('foo')); RegExp.lastMatch + 'foo'.match(new RegExp('foo')); + testcases[count++] = new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch", + 'foo', RegExp.lastMatch); + + // 'xxx'.match(/bar/); RegExp.lastMatch + 'xxx'.match(/bar/); + testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch", + 'foo', RegExp.lastMatch); + + // 'xxx'.match(/$/); RegExp.lastMatch + 'xxx'.match(/$/); + testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch", + '', RegExp.lastMatch); + + // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch + 'abcdefg'.match(/^..(cd)[a-z]+/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch", + 'abcdefg', RegExp.lastMatch); + + // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch + 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); + testcases[count++] = new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch", + 'abcdefgabcdefg', RegExp.lastMatch); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js new file mode 100644 index 0000000..b59b2c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_lastMatch_as_array.js + Description: 'Tests RegExps $& property (same tests as RegExp_lastMatch.js but using $&)' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $&'; + + writeHeaderToLog('Executing script: RegExp_lastMatch_as_array.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'foo'.match(/foo/); RegExp['$&'] + 'foo'.match(/foo/); + testcases[count++] = new TestCase ( SECTION, "'foo'.match(/foo/); RegExp['$&']", + 'foo', RegExp['$&']); + + // 'foo'.match(new RegExp('foo')); RegExp['$&'] + 'foo'.match(new RegExp('foo')); + testcases[count++] = new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp['$&']", + 'foo', RegExp['$&']); + + // 'xxx'.match(/bar/); RegExp['$&'] + 'xxx'.match(/bar/); + testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp['$&']", + 'foo', RegExp['$&']); + + // 'xxx'.match(/$/); RegExp['$&'] + 'xxx'.match(/$/); + testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/$/); RegExp['$&']", + '', RegExp['$&']); + + // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&'] + 'abcdefg'.match(/^..(cd)[a-z]+/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&']", + 'abcdefg', RegExp['$&']); + + // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp['$&'] + 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); + testcases[count++] = new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp['$&']", + 'abcdefgabcdefg', RegExp['$&']); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js new file mode 100644 index 0000000..1dd0791 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_lastParen.js + Description: 'Tests RegExps lastParen property' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: lastParen'; + + writeHeaderToLog('Executing script: RegExp_lastParen.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcd'.match(/(abc)d/); RegExp.lastParen + 'abcd'.match(/(abc)d/); + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp.lastParen", + 'abc', RegExp.lastParen); + + // 'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen + 'abcd'.match(new RegExp('(abc)d')); + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen", + 'abc', RegExp.lastParen); + + // 'abcd'.match(/(bcd)e/); RegExp.lastParen + 'abcd'.match(/(bcd)e/); + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp.lastParen", + 'abc', RegExp.lastParen); + + // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen + 'abcdefg'.match(/(a(b(c(d)e)f)g)/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen", + 'd', RegExp.lastParen); + + // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen + 'abcdefg'.match(/(a(b)c)(d(e)f)/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen", + 'e', RegExp.lastParen); + + // 'abcdefg'.match(/(^)abc/); RegExp.lastParen + 'abcdefg'.match(/(^)abc/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp.lastParen", + '', RegExp.lastParen); + + // 'abcdefg'.match(/(^a)bc/); RegExp.lastParen + 'abcdefg'.match(/(^a)bc/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp.lastParen", + 'a', RegExp.lastParen); + + // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen + 'abcdefg'.match(new RegExp('(^a)bc')); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen", + 'a', RegExp.lastParen); + + // 'abcdefg'.match(/bc/); RegExp.lastParen + 'abcdefg'.match(/bc/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp.lastParen", + '', RegExp.lastParen); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js new file mode 100644 index 0000000..d8dcd52 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js @@ -0,0 +1,100 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_lastParen_as_array.js + Description: 'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $+'; + + writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcd'.match(/(abc)d/); RegExp['$+'] + 'abcd'.match(/(abc)d/); + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']", + 'abc', RegExp['$+']); + + // 'abcd'.match(/(bcd)e/); RegExp['$+'] + 'abcd'.match(/(bcd)e/); + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']", + 'abc', RegExp['$+']); + + // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+'] + 'abcdefg'.match(/(a(b(c(d)e)f)g)/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']", + 'd', RegExp['$+']); + + // 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+'] + 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']", + 'd', RegExp['$+']); + + // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+'] + 'abcdefg'.match(/(a(b)c)(d(e)f)/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']", + 'e', RegExp['$+']); + + // 'abcdefg'.match(/(^)abc/); RegExp['$+'] + 'abcdefg'.match(/(^)abc/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']", + '', RegExp['$+']); + + // 'abcdefg'.match(/(^a)bc/); RegExp['$+'] + 'abcdefg'.match(/(^a)bc/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']", + 'a', RegExp['$+']); + + // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+'] + 'abcdefg'.match(new RegExp('(^a)bc')); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']", + 'a', RegExp['$+']); + + // 'abcdefg'.match(/bc/); RegExp['$+'] + 'abcdefg'.match(/bc/); + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']", + '', RegExp['$+']); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js new file mode 100644 index 0000000..025915a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_leftContext.js + Description: 'Tests RegExps leftContext property' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: leftContext'; + + writeHeaderToLog('Executing script: RegExp_leftContext.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc123xyz'.match(/123/); RegExp.leftContext + 'abc123xyz'.match(/123/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.leftContext", + 'abc', RegExp.leftContext); + + // 'abc123xyz'.match(/456/); RegExp.leftContext + 'abc123xyz'.match(/456/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.leftContext", + 'abc', RegExp.leftContext); + + // 'abc123xyz'.match(/abc123xyz/); RegExp.leftContext + 'abc123xyz'.match(/abc123xyz/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.leftContext", + '', RegExp.leftContext); + + // 'xxxx'.match(/$/); RegExp.leftContext + 'xxxx'.match(/$/); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.leftContext", + 'xxxx', RegExp.leftContext); + + // 'test'.match(/^/); RegExp.leftContext + 'test'.match(/^/); + testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp.leftContext", + '', RegExp.leftContext); + + // 'xxxx'.match(new RegExp('$')); RegExp.leftContext + 'xxxx'.match(new RegExp('$')); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.leftContext", + 'xxxx', RegExp.leftContext); + + // 'test'.match(new RegExp('^')); RegExp.leftContext + 'test'.match(new RegExp('^')); + testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.leftContext", + '', RegExp.leftContext); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js new file mode 100644 index 0000000..5a86b4f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_leftContext_as_array.js + Description: 'Tests RegExps leftContext property (same tests as RegExp_leftContext.js but using $`)' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $`'; + + writeHeaderToLog('Executing script: RegExp_leftContext_as_array.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc123xyz'.match(/123/); RegExp['$`'] + 'abc123xyz'.match(/123/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$`']", + 'abc', RegExp['$`']); + + // 'abc123xyz'.match(/456/); RegExp['$`'] + 'abc123xyz'.match(/456/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$`']", + 'abc', RegExp['$`']); + + // 'abc123xyz'.match(/abc123xyz/); RegExp['$`'] + 'abc123xyz'.match(/abc123xyz/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$`']", + '', RegExp['$`']); + + // 'xxxx'.match(/$/); RegExp['$`'] + 'xxxx'.match(/$/); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$`']", + 'xxxx', RegExp['$`']); + + // 'test'.match(/^/); RegExp['$`'] + 'test'.match(/^/); + testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp['$`']", + '', RegExp['$`']); + + // 'xxxx'.match(new RegExp('$')); RegExp['$`'] + 'xxxx'.match(new RegExp('$')); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$`']", + 'xxxx', RegExp['$`']); + + // 'test'.match(new RegExp('^')); RegExp['$`'] + 'test'.match(new RegExp('^')); + testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$`']", + '', RegExp['$`']); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js new file mode 100644 index 0000000..be22261 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js @@ -0,0 +1,129 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_multiline.js + Description: 'Tests RegExps multiline property' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: multiline'; + + writeHeaderToLog('Executing script: RegExp_multiline.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // First we do a series of tests with RegExp.multiline set to false (default value) + // Following this we do the same tests with RegExp.multiline set true(**). + // RegExp.multiline + testcases[count++] = new TestCase ( SECTION, "RegExp.multiline", + false, RegExp.multiline); + + // (multiline == false) '123\n456'.match(/^4../) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/^4../)", + null, '123\n456'.match(/^4../)); + + // (multiline == false) 'a11\na22\na23\na24'.match(/^a../g) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/^a../g)", + String(['a11']), String('a11\na22\na23\na24'.match(/^a../g))); + + // (multiline == false) 'a11\na22'.match(/^.+^./) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\na22'.match(/^.+^./)", + null, 'a11\na22'.match(/^.+^./)); + + // (multiline == false) '123\n456'.match(/.3$/) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/.3$/)", + null, '123\n456'.match(/.3$/)); + + // (multiline == false) 'a11\na22\na23\na24'.match(/a..$/g) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)", + String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g))); + + // (multiline == false) 'abc\ndef'.match(/c$...$/) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(/c$...$/)", + null, 'abc\ndef'.match(/c$...$/)); + + // (multiline == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", + String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); + + // (multiline == false) 'abc\ndef'.match(new RegExp('c$...$')) + testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))", + null, 'abc\ndef'.match(new RegExp('c$...$'))); + + // **Now we do the tests with RegExp.multiline set to true + // RegExp.multiline = true; RegExp.multiline + RegExp.multiline = true; + testcases[count++] = new TestCase ( SECTION, "RegExp.multiline = true; RegExp.multiline", + true, RegExp.multiline); + + // (multiline == true) '123\n456'.match(/^4../) + testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/^4../)", + String(['456']), String('123\n456'.match(/^4../))); + + // (multiline == true) 'a11\na22\na23\na24'.match(/^a../g) + testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/^a../g)", + String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g))); + + // (multiline == true) 'a11\na22'.match(/^.+^./) + //testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\na22'.match(/^.+^./)", + // String(['a11\na']), String('a11\na22'.match(/^.+^./))); + + // (multiline == true) '123\n456'.match(/.3$/) + testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/.3$/)", + String(['23']), String('123\n456'.match(/.3$/))); + + // (multiline == true) 'a11\na22\na23\na24'.match(/a..$/g) + testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)", + String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g))); + + // (multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) + testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", + String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); + + // (multiline == true) 'abc\ndef'.match(/c$....$/) + //testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'abc\ndef'.match(/c$.+$/)", + // 'c\ndef', String('abc\ndef'.match(/c$.+$/))); + + RegExp.multiline = false; + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js new file mode 100644 index 0000000..690653f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js @@ -0,0 +1,129 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_multiline_as_array.js + Description: 'Tests RegExps $* property (same tests as RegExp_multiline.js but using $*)' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $*'; + + writeHeaderToLog('Executing script: RegExp_multiline_as_array.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // First we do a series of tests with RegExp['$*'] set to false (default value) + // Following this we do the same tests with RegExp['$*'] set true(**). + // RegExp['$*'] + testcases[count++] = new TestCase ( SECTION, "RegExp['$*']", + false, RegExp['$*']); + + // (['$*'] == false) '123\n456'.match(/^4../) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/^4../)", + null, '123\n456'.match(/^4../)); + + // (['$*'] == false) 'a11\na22\na23\na24'.match(/^a../g) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/^a../g)", + String(['a11']), String('a11\na22\na23\na24'.match(/^a../g))); + + // (['$*'] == false) 'a11\na22'.match(/^.+^./) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\na22'.match(/^.+^./)", + null, 'a11\na22'.match(/^.+^./)); + + // (['$*'] == false) '123\n456'.match(/.3$/) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/.3$/)", + null, '123\n456'.match(/.3$/)); + + // (['$*'] == false) 'a11\na22\na23\na24'.match(/a..$/g) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)", + String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g))); + + // (['$*'] == false) 'abc\ndef'.match(/c$...$/) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(/c$...$/)", + null, 'abc\ndef'.match(/c$...$/)); + + // (['$*'] == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", + String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); + + // (['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$')) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))", + null, 'abc\ndef'.match(new RegExp('c$...$'))); + + // **Now we do the tests with RegExp['$*'] set to true + // RegExp['$*'] = true; RegExp['$*'] + RegExp['$*'] = true; + testcases[count++] = new TestCase ( SECTION, "RegExp['$*'] = true; RegExp['$*']", + true, RegExp['$*']); + + // (['$*'] == true) '123\n456'.match(/^4../) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/^4../)", + String(['456']), String('123\n456'.match(/^4../))); + + // (['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/^a../g)", + String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g))); + + // (['$*'] == true) 'a11\na22'.match(/^.+^./) + //testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\na22'.match(/^.+^./)", + // String(['a11\na']), String('a11\na22'.match(/^.+^./))); + + // (['$*'] == true) '123\n456'.match(/.3$/) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/.3$/)", + String(['23']), String('123\n456'.match(/.3$/))); + + // (['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)", + String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g))); + + // (['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) + testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", + String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); + + // (['$*'] == true) 'abc\ndef'.match(/c$....$/) + //testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'abc\ndef'.match(/c$.+$/)", + // 'c\ndef', String('abc\ndef'.match(/c$.+$/))); + + RegExp['$*'] = false; + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js new file mode 100644 index 0000000..6bf2353 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js @@ -0,0 +1,88 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_object.js + Description: 'Tests regular expressions creating RexExp Objects' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: object'; + + writeHeaderToLog('Executing script: RegExp_object.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var SSN_pattern = new RegExp("\\d{3}-\\d{2}-\\d{4}"); + + // testing SSN pattern + testcases[count++] = new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))", + String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern))); + + // testing SSN pattern + testcases[count++] = new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))", + String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern))); + + var PHONE_pattern = new RegExp("\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})"); + // testing PHONE pattern + testcases[count++] = new TestCase ( SECTION, "'Our phone number is (408)345-2345.'.match(PHONE_pattern))", + String(["(408)345-2345","408","345","2345"]), String('Our phone number is (408)345-2345.'.match(PHONE_pattern))); + + // testing PHONE pattern + testcases[count++] = new TestCase ( SECTION, "'The phone number is 408-345-2345!'.match(PHONE_pattern))", + String(["408-345-2345","408","345","2345"]), String('The phone number is 408-345-2345!'.match(PHONE_pattern))); + + // testing PHONE pattern + testcases[count++] = new TestCase ( SECTION, "String(PHONE_pattern.toString())", + "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/", String(PHONE_pattern.toString())); + + // testing conversion to String + testcases[count++] = new TestCase ( SECTION, "PHONE_pattern + ' is the string'", + "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/ is the string",PHONE_pattern + ' is the string'); + + // testing conversion to int + testcases[count++] = new TestCase ( SECTION, "SSN_pattern - 8", + NaN,SSN_pattern - 8); + + var testPattern = new RegExp("(\\d+)45(\\d+)90"); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js new file mode 100644 index 0000000..ede5e21 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_rightContext.js + Description: 'Tests RegExps rightContext property' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: rightContext'; + + writeHeaderToLog('Executing script: RegExp_rightContext.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc123xyz'.match(/123/); RegExp.rightContext + 'abc123xyz'.match(/123/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.rightContext", + 'xyz', RegExp.rightContext); + + // 'abc123xyz'.match(/456/); RegExp.rightContext + 'abc123xyz'.match(/456/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.rightContext", + 'xyz', RegExp.rightContext); + + // 'abc123xyz'.match(/abc123xyz/); RegExp.rightContext + 'abc123xyz'.match(/abc123xyz/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.rightContext", + '', RegExp.rightContext); + + // 'xxxx'.match(/$/); RegExp.rightContext + 'xxxx'.match(/$/); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.rightContext", + '', RegExp.rightContext); + + // 'test'.match(/^/); RegExp.rightContext + 'test'.match(/^/); + testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp.rightContext", + 'test', RegExp.rightContext); + + // 'xxxx'.match(new RegExp('$')); RegExp.rightContext + 'xxxx'.match(new RegExp('$')); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.rightContext", + '', RegExp.rightContext); + + // 'test'.match(new RegExp('^')); RegExp.rightContext + 'test'.match(new RegExp('^')); + testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.rightContext", + 'test', RegExp.rightContext); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js new file mode 100644 index 0000000..e182774 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: RegExp_rightContext_as_array.js + Description: 'Tests RegExps $\' property (same tests as RegExp_rightContext.js but using $\)' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $\''; + + writeHeaderToLog('Executing script: RegExp_rightContext.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc123xyz'.match(/123/); RegExp['$\''] + 'abc123xyz'.match(/123/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$\'']", + 'xyz', RegExp['$\'']); + + // 'abc123xyz'.match(/456/); RegExp['$\''] + 'abc123xyz'.match(/456/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$\'']", + 'xyz', RegExp['$\'']); + + // 'abc123xyz'.match(/abc123xyz/); RegExp['$\''] + 'abc123xyz'.match(/abc123xyz/); + testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$\'']", + '', RegExp['$\'']); + + // 'xxxx'.match(/$/); RegExp['$\''] + 'xxxx'.match(/$/); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$\'']", + '', RegExp['$\'']); + + // 'test'.match(/^/); RegExp['$\''] + 'test'.match(/^/); + testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp['$\'']", + 'test', RegExp['$\'']); + + // 'xxxx'.match(new RegExp('$')); RegExp['$\''] + 'xxxx'.match(new RegExp('$')); + testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$\'']", + '', RegExp['$\'']); + + // 'test'.match(new RegExp('^')); RegExp['$\''] + 'test'.match(new RegExp('^')); + testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$\'']", + 'test', RegExp['$\'']); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js new file mode 100644 index 0000000..36f5280 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js @@ -0,0 +1,129 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: alphanumeric.js + Description: 'Tests regular expressions with \w and \W special characters' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \\w and \\W'; + + writeHeaderToLog('Executing script: alphanumeric.js'); + writeHeaderToLog( SECTION + " " + TITLE); + + var count = 0; + var testcases = new Array(); + + var non_alphanumeric = "~`!@#$%^&*()-+={[}]|\\:;'<,>./?\f\n\r\t\v " + '"'; + var alphanumeric = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + + // be sure all alphanumerics are matched by \w + testcases[count++] = new TestCase ( SECTION, + "'" + alphanumeric + "'.match(new RegExp('\\w+'))", + String([alphanumeric]), String(alphanumeric.match(new RegExp('\\w+')))); + + // be sure all non-alphanumerics are matched by \W + testcases[count++] = new TestCase ( SECTION, + "'" + non_alphanumeric + "'.match(new RegExp('\\W+'))", + String([non_alphanumeric]), String(non_alphanumeric.match(new RegExp('\\W+')))); + + // be sure all non-alphanumerics are not matched by \w + testcases[count++] = new TestCase ( SECTION, + "'" + non_alphanumeric + "'.match(new RegExp('\\w'))", + null, non_alphanumeric.match(new RegExp('\\w'))); + + // be sure all alphanumerics are not matched by \W + testcases[count++] = new TestCase ( SECTION, + "'" + alphanumeric + "'.match(new RegExp('\\W'))", + null, alphanumeric.match(new RegExp('\\W'))); + + var s = non_alphanumeric + alphanumeric; + + // be sure all alphanumerics are matched by \w + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\w+'))", + String([alphanumeric]), String(s.match(new RegExp('\\w+')))); + + s = alphanumeric + non_alphanumeric; + + // be sure all non-alphanumerics are matched by \W + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\W+'))", + String([non_alphanumeric]), String(s.match(new RegExp('\\W+')))); + + // be sure all alphanumerics are matched by \w (using literals) + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\w+/)", + String([alphanumeric]), String(s.match(/\w+/))); + + s = alphanumeric + non_alphanumeric; + + // be sure all non-alphanumerics are matched by \W (using literals) + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\W+/)", + String([non_alphanumeric]), String(s.match(/\W+/))); + + s = 'abcd*&^%$$'; + // be sure the following test behaves consistently + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/(\w+)...(\W+)/)", + String([s , 'abcd' , '%$$']), String(s.match(/(\w+)...(\W+)/))); + + var i; + + // be sure all alphanumeric characters match individually + for (i = 0; i < alphanumeric.length; ++i) + { + s = '#$' + alphanumeric[i] + '%^'; + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\w'))", + String([alphanumeric[i]]), String(s.match(new RegExp('\\w')))); + } + // be sure all non_alphanumeric characters match individually + for (i = 0; i < non_alphanumeric.length; ++i) + { + s = 'sd' + non_alphanumeric[i] + String((i+10) * (i+10) - 2 * (i+10)); + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\W'))", + String([non_alphanumeric[i]]), String(s.match(new RegExp('\\W')))); + } + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js new file mode 100644 index 0000000..dfa8343 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js @@ -0,0 +1,105 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: asterisk.js + Description: 'Tests regular expressions containing *' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: *'; + + writeHeaderToLog('Executing script: aterisk.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcddddefg'.match(new RegExp('d*')) + testcases[count++] = new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('d*'))", + String([""]), String('abcddddefg'.match(new RegExp('d*')))); + + // 'abcddddefg'.match(new RegExp('cd*')) + testcases[count++] = new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('cd*'))", + String(["cdddd"]), String('abcddddefg'.match(new RegExp('cd*')))); + + // 'abcdefg'.match(new RegExp('cx*d')) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('cx*d'))", + String(["cd"]), String('abcdefg'.match(new RegExp('cx*d')))); + + // 'xxxxxxx'.match(new RegExp('(x*)(x+)')) + testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x*)(x+)'))", + String(["xxxxxxx","xxxxxx","x"]), String('xxxxxxx'.match(new RegExp('(x*)(x+)')))); + + // '1234567890'.match(new RegExp('(\\d*)(\\d+)')) + testcases[count++] = new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)(\\d+)'))", + String(["1234567890","123456789","0"]), + String('1234567890'.match(new RegExp('(\\d*)(\\d+)')))); + + // '1234567890'.match(new RegExp('(\\d*)\\d(\\d+)')) + testcases[count++] = new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))", + String(["1234567890","12345678","0"]), + String('1234567890'.match(new RegExp('(\\d*)\\d(\\d+)')))); + + // 'xxxxxxx'.match(new RegExp('(x+)(x*)')) + testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x+)(x*)'))", + String(["xxxxxxx","xxxxxxx",""]), String('xxxxxxx'.match(new RegExp('(x+)(x*)')))); + + // 'xxxxxxyyyyyy'.match(new RegExp('x*y+$')) + testcases[count++] = new TestCase ( SECTION, "'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))", + String(["xxxxxxyyyyyy"]), String('xxxxxxyyyyyy'.match(new RegExp('x*y+$')))); + + // 'abcdef'.match(/[\d]*[\s]*bc./) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/[\\d]*[\\s]*bc./)", + String(["bcd"]), String('abcdef'.match(/[\d]*[\s]*bc./))); + + // 'abcdef'.match(/bc..[\d]*[\s]*/) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/bc..[\\d]*[\\s]*/)", + String(["bcde"]), String('abcdef'.match(/bc..[\d]*[\s]*/))); + + // 'a1b2c3'.match(/.*/) + testcases[count++] = new TestCase ( SECTION, "'a1b2c3'.match(/.*/)", + String(["a1b2c3"]), String('a1b2c3'.match(/.*/))); + + // 'a0.b2.c3'.match(/[xyz]*1/) + testcases[count++] = new TestCase ( SECTION, "'a0.b2.c3'.match(/[xyz]*1/)", + null, 'a0.b2.c3'.match(/[xyz]*1/)); + +function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js new file mode 100644 index 0000000..61c5d61 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: backslash.js + Description: 'Tests regular expressions containing \' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \\'; + + writeHeaderToLog('Executing script: backslash.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcde'.match(new RegExp('\e')) + testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('\e'))", + String(["e"]), String('abcde'.match(new RegExp('\e')))); + + // 'ab\\cde'.match(new RegExp('\\\\')) + testcases[count++] = new TestCase ( SECTION, "'ab\\cde'.match(new RegExp('\\\\'))", + String(["\\"]), String('ab\\cde'.match(new RegExp('\\\\')))); + + // 'ab\\cde'.match(/\\/) (using literal) + testcases[count++] = new TestCase ( SECTION, "'ab\\cde'.match(/\\\\/)", + String(["\\"]), String('ab\\cde'.match(/\\/))); + + // 'before ^$*+?.()|{}[] after'.match(new RegExp('\^\$\*\+\?\.\(\)\|\{\}\[\]')) + testcases[count++] = new TestCase ( SECTION, + "'before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]'))", + String(["^$*+?.()|{}[]"]), + String('before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]')))); + + // 'before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/) (using literal) + testcases[count++] = new TestCase ( SECTION, + "'before ^$*+?.()|{}[] after'.match(/\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]/)", + String(["^$*+?.()|{}[]"]), + String('before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js new file mode 100644 index 0000000..bd3c064 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: backspace.js + Description: 'Tests regular expressions containing [\b]' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: [\b]'; + + writeHeaderToLog('Executing script: backspace.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc\bdef'.match(new RegExp('.[\b].')) + testcases[count++] = new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('.[\\b].'))", + String(["c\bd"]), String('abc\bdef'.match(new RegExp('.[\\b].')))); + + // 'abc\\bdef'.match(new RegExp('.[\b].')) + testcases[count++] = new TestCase ( SECTION, "'abc\\bdef'.match(new RegExp('.[\\b].'))", + null, 'abc\\bdef'.match(new RegExp('.[\\b].'))); + + // 'abc\b\b\bdef'.match(new RegExp('c[\b]{3}d')) + testcases[count++] = new TestCase ( SECTION, "'abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))", + String(["c\b\b\bd"]), String('abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d')))); + + // 'abc\bdef'.match(new RegExp('[^\\[\b\\]]+')) + testcases[count++] = new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))", + String(["abc"]), String('abc\bdef'.match(new RegExp('[^\\[\\b\\]]+')))); + + // 'abcdef'.match(new RegExp('[^\\[\b\\]]+')) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('[^\\[\\b\\]]+'))", + String(["abcdef"]), String('abcdef'.match(new RegExp('[^\\[\\b\\]]+')))); + + // 'abcdef'.match(/[^\[\b\]]+/) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/[^\\[\\b\\]]+/)", + String(["abcdef"]), String('abcdef'.match(/[^\[\b\]]+/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js new file mode 100644 index 0000000..c5ccbdc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: beginLine.js + Description: 'Tests regular expressions containing ^' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: ^'; + + writeHeaderToLog('Executing script: beginLine.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcde'.match(new RegExp('^ab')) + testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('^ab'))", + String(["ab"]), String('abcde'.match(new RegExp('^ab')))); + + // 'ab\ncde'.match(new RegExp('^..^e')) + testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('^..^e'))", + null, 'ab\ncde'.match(new RegExp('^..^e'))); + + // 'yyyyy'.match(new RegExp('^xxx')) + testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('^xxx'))", + null, 'yyyyy'.match(new RegExp('^xxx'))); + + // '^^^x'.match(new RegExp('^\\^+')) + testcases[count++] = new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))", + String(['^^^']), String('^^^x'.match(new RegExp('^\\^+')))); + + // '^^^x'.match(/^\^+/) + testcases[count++] = new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)", + String(['^^^']), String('^^^x'.match(/^\^+/))); + + RegExp.multiline = true; + // 'abc\n123xyz'.match(new RegExp('^\d+')) <multiline==true> + testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))", + String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+')))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js new file mode 100644 index 0000000..da0b59e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js @@ -0,0 +1,107 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: character_class.js + Description: 'Tests regular expressions containing []' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: []'; + + writeHeaderToLog('Executing script: character_class.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcde'.match(new RegExp('ab[ercst]de')) + testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[ercst]de'))", + String(["abcde"]), String('abcde'.match(new RegExp('ab[ercst]de')))); + + // 'abcde'.match(new RegExp('ab[erst]de')) + testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[erst]de'))", + null, 'abcde'.match(new RegExp('ab[erst]de'))); + + // 'abcdefghijkl'.match(new RegExp('[d-h]+')) + testcases[count++] = new TestCase ( SECTION, "'abcdefghijkl'.match(new RegExp('[d-h]+'))", + String(["defgh"]), String('abcdefghijkl'.match(new RegExp('[d-h]+')))); + + // 'abc6defghijkl'.match(new RegExp('[1234567].{2}')) + testcases[count++] = new TestCase ( SECTION, "'abc6defghijkl'.match(new RegExp('[1234567].{2}'))", + String(["6de"]), String('abc6defghijkl'.match(new RegExp('[1234567].{2}')))); + + // '\n\n\abc324234\n'.match(new RegExp('[a-c\d]+')) + testcases[count++] = new TestCase ( SECTION, "'\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+'))", + String(["abc324234"]), String('\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+')))); + + // 'abc'.match(new RegExp('ab[.]?c')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('ab[.]?c'))", + String(["abc"]), String('abc'.match(new RegExp('ab[.]?c')))); + + // 'abc'.match(new RegExp('a[b]c')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[b]c'))", + String(["abc"]), String('abc'.match(new RegExp('a[b]c')))); + + // 'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]')) + testcases[count++] = new TestCase ( SECTION, "'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))", + String(["def"]), String('a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]')))); + + // '123*&$abc'.match(new RegExp('[*&$]{3}')) + testcases[count++] = new TestCase ( SECTION, "'123*&$abc'.match(new RegExp('[*&$]{3}'))", + String(["*&$"]), String('123*&$abc'.match(new RegExp('[*&$]{3}')))); + + // 'abc'.match(new RegExp('a[^1-9]c')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[^1-9]c'))", + String(["abc"]), String('abc'.match(new RegExp('a[^1-9]c')))); + + // 'abc'.match(new RegExp('a[^b]c')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[^b]c'))", + null, 'abc'.match(new RegExp('a[^b]c'))); + + // 'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}')) + testcases[count++] = new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))", + String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}')))); + + // 'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/) + testcases[count++] = new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)", + String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js new file mode 100644 index 0000000..973fff2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js @@ -0,0 +1,94 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: compile.js + Description: 'Tests regular expressions method compile' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: compile'; + + writeHeaderToLog('Executing script: compile.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var regularExpression = new RegExp(); + + regularExpression.compile("[0-9]{3}x[0-9]{4}","i"); + + testcases[count++] = new TestCase ( SECTION, + "(compile '[0-9]{3}x[0-9]{4}','i')", + String(["456X7890"]), String('234X456X7890'.match(regularExpression))); + + testcases[count++] = new TestCase ( SECTION, + "source of (compile '[0-9]{3}x[0-9]{4}','i')", + "[0-9]{3}x[0-9]{4}", regularExpression.source); + + testcases[count++] = new TestCase ( SECTION, + "global of (compile '[0-9]{3}x[0-9]{4}','i')", + false, regularExpression.global); + + testcases[count++] = new TestCase ( SECTION, + "ignoreCase of (compile '[0-9]{3}x[0-9]{4}','i')", + true, regularExpression.ignoreCase); + + regularExpression.compile("[0-9]{3}X[0-9]{3}","g"); + + testcases[count++] = new TestCase ( SECTION, + "(compile '[0-9]{3}X[0-9]{3}','g')", + String(["234X456"]), String('234X456X7890'.match(regularExpression))); + + testcases[count++] = new TestCase ( SECTION, + "source of (compile '[0-9]{3}X[0-9]{3}','g')", + "[0-9]{3}X[0-9]{3}", regularExpression.source); + + testcases[count++] = new TestCase ( SECTION, + "global of (compile '[0-9]{3}X[0-9]{3}','g')", + true, regularExpression.global); + + testcases[count++] = new TestCase ( SECTION, + "ignoreCase of (compile '[0-9]{3}X[0-9]{3}','g')", + false, regularExpression.ignoreCase); + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js new file mode 100644 index 0000000..fb54a7f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: control_characters.js + Description: 'Tests regular expressions containing .' + + Author: Nick Lerissa + Date: April 8, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: .'; + var BUGNUMBER="123802"; + + writeHeaderToLog('Executing script: control_characters.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'àOÐ ê:i¢Ø'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'àOÐ ê:i¢Ø'.match(new RegExp('.+'))", + String(['àOÐ ê:i¢Ø']), String('àOÐ ê:i¢Ø'.match(new RegExp('.+')))); + + // string1.match(new RegExp(string1)) + var string1 = 'àOÐ ê:i¢Ø'; + testcases[count++] = new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)", + String([string1]), String(string1.match(string1))); + + string1 = ""; + for (var i = 0; i < 32; i++) + string1 += String.fromCharCode(i); + testcases[count++] = new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)", + String([string1]), String(string1.match(string1))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js new file mode 100644 index 0000000..d476823 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js @@ -0,0 +1,119 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: digit.js + Description: 'Tests regular expressions containing \d' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \\d'; + + writeHeaderToLog('Executing script: digit.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var non_digits = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"'; + + var digits = "1234567890"; + + // be sure all digits are matched by \d + testcases[count++] = new TestCase ( SECTION, + "'" + digits + "'.match(new RegExp('\\d+'))", + String([digits]), String(digits.match(new RegExp('\\d+')))); + + // be sure all non-digits are matched by \D + testcases[count++] = new TestCase ( SECTION, + "'" + non_digits + "'.match(new RegExp('\\D+'))", + String([non_digits]), String(non_digits.match(new RegExp('\\D+')))); + + // be sure all non-digits are not matched by \d + testcases[count++] = new TestCase ( SECTION, + "'" + non_digits + "'.match(new RegExp('\\d'))", + null, non_digits.match(new RegExp('\\d'))); + + // be sure all digits are not matched by \D + testcases[count++] = new TestCase ( SECTION, + "'" + digits + "'.match(new RegExp('\\D'))", + null, digits.match(new RegExp('\\D'))); + + var s = non_digits + digits; + + // be sure all digits are matched by \d + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\d+'))", + String([digits]), String(s.match(new RegExp('\\d+')))); + + var s = digits + non_digits; + + // be sure all non-digits are matched by \D + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\D+'))", + String([non_digits]), String(s.match(new RegExp('\\D+')))); + + var i; + + // be sure all digits match individually + for (i = 0; i < digits.length; ++i) + { + s = 'ab' + digits[i] + 'cd'; + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\d'))", + String([digits[i]]), String(s.match(new RegExp('\\d')))); + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\\d/)", + String([digits[i]]), String(s.match(/\d/))); + } + // be sure all non_digits match individually + for (i = 0; i < non_digits.length; ++i) + { + s = '12' + non_digits[i] + '34'; + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\D'))", + String([non_digits[i]]), String(s.match(new RegExp('\\D')))); + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\\D/)", + String([non_digits[i]]), String(s.match(/\D/))); + } + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js new file mode 100644 index 0000000..1e9bbab --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: dot.js + Description: 'Tests regular expressions containing .' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: .'; + + writeHeaderToLog('Executing script: dot.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcde'.match(new RegExp('ab.de')) + testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab.de'))", + String(["abcde"]), String('abcde'.match(new RegExp('ab.de')))); + + // 'line 1\nline 2'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'line 1\nline 2'.match(new RegExp('.+'))", + String(["line 1"]), String('line 1\nline 2'.match(new RegExp('.+')))); + + // 'this is a test'.match(new RegExp('.*a.*')) + testcases[count++] = new TestCase ( SECTION, "'this is a test'.match(new RegExp('.*a.*'))", + String(["this is a test"]), String('this is a test'.match(new RegExp('.*a.*')))); + + // 'this is a *&^%$# test'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'this is a *&^%$# test'.match(new RegExp('.+'))", + String(["this is a *&^%$# test"]), String('this is a *&^%$# test'.match(new RegExp('.+')))); + + // '....'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'....'.match(new RegExp('.+'))", + String(["...."]), String('....'.match(new RegExp('.+')))); + + // 'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))", + String(["abcdefghijklmnopqrstuvwxyz"]), String('abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+')))); + + // 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))", + String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+')))); + + // '`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))", + String(["`1234567890-=~!@#$%^&*()_+"]), String('`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+')))); + + // '|\\[{]};:"\',<>.?/'.match(new RegExp('.+')) + testcases[count++] = new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))", + String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(new RegExp('.+')))); + + // '|\\[{]};:"\',<>.?/'.match(/.+/) + testcases[count++] = new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(/.+/)", + String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(/.+/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js new file mode 100644 index 0000000..655d6ec --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: endLine.js + Description: 'Tests regular expressions containing $' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: $'; + + writeHeaderToLog('Executing script: endLine.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcde'.match(new RegExp('de$')) + testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))", + String(["de"]), String('abcde'.match(new RegExp('de$')))); + + // 'ab\ncde'.match(new RegExp('..$e$')) + testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))", + null, 'ab\ncde'.match(new RegExp('..$e$'))); + + // 'yyyyy'.match(new RegExp('xxx$')) + testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))", + null, 'yyyyy'.match(new RegExp('xxx$'))); + + // 'a$$$'.match(new RegExp('\\$+$')) + testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))", + String(['$$$']), String('a$$$'.match(new RegExp('\\$+$')))); + + // 'a$$$'.match(/\$+$/) + testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)", + String(['$$$']), String('a$$$'.match(/\$+$/))); + + RegExp.multiline = true; + // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true> + testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))", + String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$')))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js new file mode 100644 index 0000000..1cb6acb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: everything.js + Description: 'Tests regular expressions' + + Author: Nick Lerissa + Date: March 24, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp'; + + writeHeaderToLog('Executing script: everything.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'Sally and Fred are sure to come.'.match(/^[a-z\s]*/i) + testcases[count++] = new TestCase ( SECTION, "'Sally and Fred are sure to come'.match(/^[a-z\\s]*/i)", + String(["Sally and Fred are sure to come"]), String('Sally and Fred are sure to come'.match(/^[a-z\s]*/i))); + + // 'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$')) + testcases[count++] = new TestCase ( SECTION, "'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))", + String(["test123W+xyz","xyz"]), String('test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$')))); + + // 'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/) + testcases[count++] = new TestCase ( SECTION, "'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)", + String(["12365 number two 9898","12365","9898"]), String('number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/))); + + var simpleSentence = /(\s?[^\!\?\.]+[\!\?\.])+/; + // 'See Spot run.'.match(simpleSentence) + testcases[count++] = new TestCase ( SECTION, "'See Spot run.'.match(simpleSentence)", + String(["See Spot run.","See Spot run."]), String('See Spot run.'.match(simpleSentence))); + + // 'I like it. What's up? I said NO!'.match(simpleSentence) + testcases[count++] = new TestCase ( SECTION, "'I like it. What's up? I said NO!'.match(simpleSentence)", + String(["I like it. What's up? I said NO!",' I said NO!']), String('I like it. What\'s up? I said NO!'.match(simpleSentence))); + + // 'the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/) + testcases[count++] = new TestCase ( SECTION, "'the quick brown fox jumped over the lazy dogs'.match(/((\\w+)\\s*)+/)", + String(['the quick brown fox jumped over the lazy dogs','dogs','dogs']),String('the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js new file mode 100644 index 0000000..f1a9d8b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: exec.js + Description: 'Tests regular expressions exec compile' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: exec'; + + writeHeaderToLog('Executing script: exec.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + testcases[count++] = new TestCase ( SECTION, + "/[0-9]{3}/.exec('23 2 34 678 9 09')", + String(["678"]), String(/[0-9]{3}/.exec('23 2 34 678 9 09'))); + + testcases[count++] = new TestCase ( SECTION, + "/3.{4}8/.exec('23 2 34 678 9 09')", + String(["34 678"]), String(/3.{4}8/.exec('23 2 34 678 9 09'))); + + var re = new RegExp('3.{4}8'); + testcases[count++] = new TestCase ( SECTION, + "re.exec('23 2 34 678 9 09')", + String(["34 678"]), String(re.exec('23 2 34 678 9 09'))); + + testcases[count++] = new TestCase ( SECTION, + "(/3.{4}8/.exec('23 2 34 678 9 09').length", + 1, (/3.{4}8/.exec('23 2 34 678 9 09')).length); + + re = new RegExp('3.{4}8'); + testcases[count++] = new TestCase ( SECTION, + "(re.exec('23 2 34 678 9 09').length", + 1, (re.exec('23 2 34 678 9 09')).length); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js new file mode 100644 index 0000000..5c25c8f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js @@ -0,0 +1,84 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: regexp.js + Description: 'Tests regular expressions using flags "i" and "g"' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'regular expression flags with flags "i" and "g"'; + + writeHeaderToLog('Executing script: flags.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // testing optional flag 'i' + testcases[count++] = new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(/fghijk/i)", + String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(/fghijk/i))); + + testcases[count++] = new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(new RegExp('fghijk','i'))", + String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(new RegExp("fghijk","i")))); + + // testing optional flag 'g' + testcases[count++] = new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(/x./g)", + String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(/x./g))); + + testcases[count++] = new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(new RegExp('x.','g'))", + String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(new RegExp('x.','g')))); + + // testing optional flags 'g' and 'i' + testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./gi)", + String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./gi))); + + testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','gi'))", + String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','gi')))); + + testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./ig)", + String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./ig))); + + testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','ig'))", + String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','ig')))); + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js new file mode 100644 index 0000000..ce43520 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: global.js + Description: 'Tests RegExp attribute global' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: global'; + + writeHeaderToLog('Executing script: global.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // /xyz/g.global + testcases[count++] = new TestCase ( SECTION, "/xyz/g.global", + true, /xyz/g.global); + + // /xyz/.global + testcases[count++] = new TestCase ( SECTION, "/xyz/.global", + false, /xyz/.global); + + // '123 456 789'.match(/\d+/g) + testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/\\d+/g)", + String(["123","456","789"]), String('123 456 789'.match(/\d+/g))); + + // '123 456 789'.match(/(\d+)/g) + testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/(\\d+)/g)", + String(["123","456","789"]), String('123 456 789'.match(/(\d+)/g))); + + // '123 456 789'.match(/\d+/) + testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/\\d+/)", + String(["123"]), String('123 456 789'.match(/\d+/))); + + // (new RegExp('[a-z]','g')).global + testcases[count++] = new TestCase ( SECTION, "(new RegExp('[a-z]','g')).global", + true, (new RegExp('[a-z]','g')).global); + + // (new RegExp('[a-z]','i')).global + testcases[count++] = new TestCase ( SECTION, "(new RegExp('[a-z]','i')).global", + false, (new RegExp('[a-z]','i')).global); + + // '123 456 789'.match(new RegExp('\\d+','g')) + testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','g'))", + String(["123","456","789"]), String('123 456 789'.match(new RegExp('\\d+','g')))); + + // '123 456 789'.match(new RegExp('(\\d+)','g')) + testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('(\\\\d+)','g'))", + String(["123","456","789"]), String('123 456 789'.match(new RegExp('(\\d+)','g')))); + + // '123 456 789'.match(new RegExp('\\d+','i')) + testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','i'))", + String(["123"]), String('123 456 789'.match(new RegExp('\\d+','i')))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js new file mode 100644 index 0000000..8f68c9a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js @@ -0,0 +1,108 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: hexadecimal.js + Description: 'Tests regular expressions containing \<number> ' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \x# (hex) '; + + writeHeaderToLog('Executing script: hexadecimal.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + var testPattern = '\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A'; + + var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A'; + + testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33'; + + testString = "abc !\"#$%&'()*+,-./0123ZBC"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40'; + + testString = "123456789:;<=>?@ABC"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\x7B\\x7C\\x7D\\x7E'; + + testString = "1234{|}~ABC"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["{|}~"]), String(testString.match(new RegExp(testPattern)))); + + testcases[count++] = new TestCase ( SECTION, + "'canthisbeFOUND'.match(new RegExp('[A-\\x5A]+'))", + String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\x5A]+')))); + + testcases[count++] = new TestCase ( SECTION, + "'canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))", + String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+')))); + + testcases[count++] = new TestCase ( SECTION, + "'canthisbeFOUND'.match(/[\\x61-\\x7A]+/)", + String(["canthisbe"]), String('canthisbeFOUND'.match(/[\x61-\x7A]+/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js new file mode 100644 index 0000000..fec4d2c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js @@ -0,0 +1,111 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: ignoreCase.js + Description: 'Tests RegExp attribute ignoreCase' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: ignoreCase'; + + writeHeaderToLog('Executing script: ignoreCase.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // /xyz/i.ignoreCase + testcases[count++] = new TestCase ( SECTION, "/xyz/i.ignoreCase", + true, /xyz/i.ignoreCase); + + // /xyz/.ignoreCase + testcases[count++] = new TestCase ( SECTION, "/xyz/.ignoreCase", + false, /xyz/.ignoreCase); + + // 'ABC def ghi'.match(/[a-z]+/ig) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/ig)", + String(["ABC","def","ghi"]), String('ABC def ghi'.match(/[a-z]+/ig))); + + // 'ABC def ghi'.match(/[a-z]+/i) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/i)", + String(["ABC"]), String('ABC def ghi'.match(/[a-z]+/i))); + + // 'ABC def ghi'.match(/([a-z]+)/ig) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/ig)", + String(["ABC","def","ghi"]), String('ABC def ghi'.match(/([a-z]+)/ig))); + + // 'ABC def ghi'.match(/([a-z]+)/i) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/i)", + String(["ABC","ABC"]), String('ABC def ghi'.match(/([a-z]+)/i))); + + // 'ABC def ghi'.match(/[a-z]+/) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/)", + String(["def"]), String('ABC def ghi'.match(/[a-z]+/))); + + // (new RegExp('xyz','i')).ignoreCase + testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz','i')).ignoreCase", + true, (new RegExp('xyz','i')).ignoreCase); + + // (new RegExp('xyz')).ignoreCase + testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz')).ignoreCase", + false, (new RegExp('xyz')).ignoreCase); + + // 'ABC def ghi'.match(new RegExp('[a-z]+','ig')) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','ig'))", + String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('[a-z]+','ig')))); + + // 'ABC def ghi'.match(new RegExp('[a-z]+','i')) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','i'))", + String(["ABC"]), String('ABC def ghi'.match(new RegExp('[a-z]+','i')))); + + // 'ABC def ghi'.match(new RegExp('([a-z]+)','ig')) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))", + String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','ig')))); + + // 'ABC def ghi'.match(new RegExp('([a-z]+)','i')) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','i'))", + String(["ABC","ABC"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','i')))); + + // 'ABC def ghi'.match(new RegExp('[a-z]+')) + testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+'))", + String(["def"]), String('ABC def ghi'.match(new RegExp('[a-z]+')))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js new file mode 100644 index 0000000..7e80777 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js @@ -0,0 +1,115 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: interval.js + Description: 'Tests regular expressions containing {}' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: {}'; + + writeHeaderToLog('Executing script: interval.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))", + String(["bbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c')))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))", + null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))", + String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c')))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))", + null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))", + String(["bbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c')))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))", + null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))", + String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c')))); + + // 'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c')) + testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))", + String(["bc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c')))); + + // 'weirwerdf'.match(new RegExp('.{0,93}')) + testcases[count++] = new TestCase ( SECTION, "'weirwerdf'.match(new RegExp('.{0,93}'))", + String(["weirwerdf"]), String('weirwerdf'.match(new RegExp('.{0,93}')))); + + // 'wqe456646dsff'.match(new RegExp('\d{1,}')) + testcases[count++] = new TestCase ( SECTION, "'wqe456646dsff'.match(new RegExp('\\d{1,}'))", + String(["456646"]), String('wqe456646dsff'.match(new RegExp('\\d{1,}')))); + + // '123123'.match(new RegExp('(123){1,}')) + testcases[count++] = new TestCase ( SECTION, "'123123'.match(new RegExp('(123){1,}'))", + String(["123123","123"]), String('123123'.match(new RegExp('(123){1,}')))); + + // '123123x123'.match(new RegExp('(123){1,}x\1')) + testcases[count++] = new TestCase ( SECTION, "'123123x123'.match(new RegExp('(123){1,}x\\1'))", + String(["123123x123","123"]), String('123123x123'.match(new RegExp('(123){1,}x\\1')))); + + // '123123x123'.match(/(123){1,}x\1/) + testcases[count++] = new TestCase ( SECTION, "'123123x123'.match(/(123){1,}x\\1/)", + String(["123123x123","123"]), String('123123x123'.match(/(123){1,}x\1/))); + + // 'xxxxxxx'.match(new RegExp('x{1,2}x{1,}')) + testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))", + String(["xxxxxxx"]), String('xxxxxxx'.match(new RegExp('x{1,2}x{1,}')))); + + // 'xxxxxxx'.match(/x{1,2}x{1,}/) + testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(/x{1,2}x{1,}/)", + String(["xxxxxxx"]), String('xxxxxxx'.match(/x{1,2}x{1,}/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js new file mode 100644 index 0000000..2fe6588 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js @@ -0,0 +1,108 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: octal.js + Description: 'Tests regular expressions containing \<number> ' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \# (octal) '; + + writeHeaderToLog('Executing script: octal.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + var testPattern = '\\101\\102\\103\\104\\105\\106\\107\\110\\111\\112\\113\\114\\115\\116\\117\\120\\121\\122\\123\\124\\125\\126\\127\\130\\131\\132'; + + var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\141\\142\\143\\144\\145\\146\\147\\150\\151\\152\\153\\154\\155\\156\\157\\160\\161\\162\\163\\164\\165\\166\\167\\170\\171\\172'; + + testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\40\\41\\42\\43\\44\\45\\46\\47\\50\\51\\52\\53\\54\\55\\56\\57\\60\\61\\62\\63'; + + testString = "abc !\"#$%&'()*+,-./0123ZBC"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\64\\65\\66\\67\\70\\71\\72\\73\\74\\75\\76\\77\\100'; + + testString = "123456789:;<=>?@ABC"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern)))); + + testPattern = '\\173\\174\\175\\176'; + + testString = "1234{|}~ABC"; + + testcases[count++] = new TestCase ( SECTION, + "'" + testString + "'.match(new RegExp('" + testPattern + "'))", + String(["{|}~"]), String(testString.match(new RegExp(testPattern)))); + + testcases[count++] = new TestCase ( SECTION, + "'canthisbeFOUND'.match(new RegExp('[A-\\132]+'))", + String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\132]+')))); + + testcases[count++] = new TestCase ( SECTION, + "'canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))", + String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\141-\\172]+')))); + + testcases[count++] = new TestCase ( SECTION, + "'canthisbeFOUND'.match(/[\\141-\\172]+/)", + String(["canthisbe"]), String('canthisbeFOUND'.match(/[\141-\172]+/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js new file mode 100644 index 0000000..6fe1948 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js @@ -0,0 +1,107 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: parentheses.js + Description: 'Tests regular expressions containing ()' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: ()'; + + writeHeaderToLog('Executing script: parentheses.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc'.match(new RegExp('(abc)')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('(abc)'))", + String(["abc","abc"]), String('abc'.match(new RegExp('(abc)')))); + + // 'abcdefg'.match(new RegExp('a(bc)d(ef)g')) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(bc)d(ef)g'))", + String(["abcdefg","bc","ef"]), String('abcdefg'.match(new RegExp('a(bc)d(ef)g')))); + + // 'abcdefg'.match(new RegExp('(.{3})(.{4})')) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(.{3})(.{4})'))", + String(["abcdefg","abc","defg"]), String('abcdefg'.match(new RegExp('(.{3})(.{4})')))); + + // 'aabcdaabcd'.match(new RegExp('(aa)bcd\1')) + testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa)bcd\\1'))", + String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa)bcd\\1')))); + + // 'aabcdaabcd'.match(new RegExp('(aa).+\1')) + testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa).+\\1'))", + String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa).+\\1')))); + + // 'aabcdaabcd'.match(new RegExp('(.{2}).+\1')) + testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(.{2}).+\\1'))", + String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(.{2}).+\\1')))); + + // '123456123456'.match(new RegExp('(\d{3})(\d{3})\1\2')) + testcases[count++] = new TestCase ( SECTION, "'123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2'))", + String(["123456123456","123","456"]), String('123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2')))); + + // 'abcdefg'.match(new RegExp('a(..(..)..)')) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(..(..)..)'))", + String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(new RegExp('a(..(..)..)')))); + + // 'abcdefg'.match(/a(..(..)..)/) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/a(..(..)..)/)", + String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(/a(..(..)..)/))); + + // 'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))')) + testcases[count++] = new TestCase ( SECTION, "'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))", + String(["abcdef","abc","bc","c","def","ef","f"]), String('xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))')))); + + // 'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\2\5')) + testcases[count++] = new TestCase ( SECTION, "'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5'))", + String(["abcdefbcef","abc","bc","c","def","ef","f"]), String('xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5')))); + + // 'abcd'.match(new RegExp('a(.?)b\1c\1d\1')) + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1'))", + String(["abcd",""]), String('abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1')))); + + // 'abcd'.match(/a(.?)b\1c\1d\1/) + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/a(.?)b\\1c\\1d\\1/)", + String(["abcd",""]), String('abcd'.match(/a(.?)b\1c\1d\1/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js new file mode 100644 index 0000000..f3e44ea --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: plus.js + Description: 'Tests regular expressions containing +' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: +'; + + writeHeaderToLog('Executing script: plus.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcdddddefg'.match(new RegExp('d+')) + testcases[count++] = new TestCase ( SECTION, "'abcdddddefg'.match(new RegExp('d+'))", + String(["ddddd"]), String('abcdddddefg'.match(new RegExp('d+')))); + + // 'abcdefg'.match(new RegExp('o+')) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('o+'))", + null, 'abcdefg'.match(new RegExp('o+'))); + + // 'abcdefg'.match(new RegExp('d+')) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('d+'))", + String(['d']), String('abcdefg'.match(new RegExp('d+')))); + + // 'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)')) + testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))", + String(["bbbbbbb","bbbbb","b","b"]), String('abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)')))); + + // 'abbbbbbbc'.match(new RegExp('(b+)(b*)')) + testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b*)'))", + String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(new RegExp('(b+)(b*)')))); + + // 'abbbbbbbc'.match(new RegExp('b*b+')) + testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('b*b+'))", + String(['bbbbbbb']), String('abbbbbbbc'.match(new RegExp('b*b+')))); + + // 'abbbbbbbc'.match(/(b+)(b*)/) + testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(/(b+)(b*)/)", + String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(/(b+)(b*)/))); + + // 'abbbbbbbc'.match(new RegExp('b*b+')) + testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(/b*b+/)", + String(['bbbbbbb']), String('abbbbbbbc'.match(/b*b+/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js new file mode 100644 index 0000000..f17cd0b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js @@ -0,0 +1,99 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: question_mark.js + Description: 'Tests regular expressions containing ?' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: ?'; + + writeHeaderToLog('Executing script: question_mark.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcdef'.match(new RegExp('cd?e')) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('cd?e'))", + String(["cde"]), String('abcdef'.match(new RegExp('cd?e')))); + + // 'abcdef'.match(new RegExp('cdx?e')) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('cdx?e'))", + String(["cde"]), String('abcdef'.match(new RegExp('cdx?e')))); + + // 'pqrstuvw'.match(new RegExp('o?pqrst')) + testcases[count++] = new TestCase ( SECTION, "'pqrstuvw'.match(new RegExp('o?pqrst'))", + String(["pqrst"]), String('pqrstuvw'.match(new RegExp('o?pqrst')))); + + // 'abcd'.match(new RegExp('x?y?z?')) + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('x?y?z?'))", + String([""]), String('abcd'.match(new RegExp('x?y?z?')))); + + // 'abcd'.match(new RegExp('x?ay?bz?c')) + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('x?ay?bz?c'))", + String(["abc"]), String('abcd'.match(new RegExp('x?ay?bz?c')))); + + // 'abcd'.match(/x?ay?bz?c/) + testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/x?ay?bz?c/)", + String(["abc"]), String('abcd'.match(/x?ay?bz?c/))); + + // 'abbbbc'.match(new RegExp('b?b?b?b')) + testcases[count++] = new TestCase ( SECTION, "'abbbbc'.match(new RegExp('b?b?b?b'))", + String(["bbbb"]), String('abbbbc'.match(new RegExp('b?b?b?b')))); + + // '123az789'.match(new RegExp('ab?c?d?x?y?z')) + testcases[count++] = new TestCase ( SECTION, "'123az789'.match(new RegExp('ab?c?d?x?y?z'))", + String(["az"]), String('123az789'.match(new RegExp('ab?c?d?x?y?z')))); + + // '123az789'.match(/ab?c?d?x?y?z/) + testcases[count++] = new TestCase ( SECTION, "'123az789'.match(/ab?c?d?x?y?z/)", + String(["az"]), String('123az789'.match(/ab?c?d?x?y?z/))); + + // '?????'.match(new RegExp('\\??\\??\\??\\??\\??')) + testcases[count++] = new TestCase ( SECTION, "'?????'.match(new RegExp('\\??\\??\\??\\??\\??'))", + String(["?????"]), String('?????'.match(new RegExp('\\??\\??\\??\\??\\??')))); + + // 'test'.match(new RegExp('.?.?.?.?.?.?.?')) + testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('.?.?.?.?.?.?.?'))", + String(["test"]), String('test'.match(new RegExp('.?.?.?.?.?.?.?')))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js new file mode 100644 index 0000000..20ac50f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js @@ -0,0 +1,68 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: regress-6359.js + * Reference: ** replace with bugzilla URL or document reference ** + * Description: ** replace with description of test ** + * Author: ** replace with your e-mail address ** + */ + + var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) + var VERSION = "ECMA_2"; // Version of JavaScript or ECMA + var TITLE = "Regression test for bugzilla # 6359"; // Provide ECMA section title or a description + var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=6359"; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + /* + * Calls to AddTestCase here. AddTestCase is a function that is defined + * in shell.js and takes three arguments: + * - a string representation of what is being tested + * - the expected result + * - the actual result + * + * For example, a test might look like this: + * + * var zip = /[\d]{5}$/; + * + * AddTestCase( + * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test + * "02134", // expected result + * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result + * + */ + + AddTestCase( '/(a*)b\1+/("baaac").length', + 2, + /(a*)b\1+/("baaac").length ); + + AddTestCase( '/(a*)b\1+/("baaac")[0]', + "b", + /(a*)b\1+/("baaac")[0]); + + AddTestCase( '/(a*)b\1+/("baaac")[1]', + "", + /(a*)b\1+/("baaac")[1]); + + + test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js new file mode 100644 index 0000000..3601bcf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js @@ -0,0 +1,86 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: regress-9141.js + * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; + * Description: + * From waldemar@netscape.com: + * + * The following page crashes the system: + * + * <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + * "http://www.w3.org/TR/REC-html40/loose.dtd"> + * <HTML> + * <HEAD> + * </HEAD> + * <BODY> + * <SCRIPT type="text/javascript"> + * var s = "x"; + * for (var i = 0; i != 13; i++) s += s; + * var a = /(?:xx|x)*[slash](s); + * var b = /(xx|x)*[slash](s); + * document.write("Results = " + a.length + "," + b.length); + * </SCRIPT> + * </BODY> + */ + + var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) + var VERSION = "ECMA_2"; // Version of JavaScript or ECMA + var TITLE = "Regression test for bugzilla # 9141"; // Provide ECMA section title or a description + var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + /* + * Calls to AddTestCase here. AddTestCase is a function that is defined + * in shell.js and takes three arguments: + * - a string representation of what is being tested + * - the expected result + * - the actual result + * + * For example, a test might look like this: + * + * var zip = /[\d]{5}$/; + * + * AddTestCase( + * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test + * "02134", // expected result + * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result + * + */ + + var s = "x"; + for (var i = 0; i != 13; i++) s += s; + var a = /(?:xx|x)*/(s); + var b = /(xx|x)*/(s); + + AddTestCase( "var s = 'x'; for (var i = 0; i != 13; i++) s += s; " + + "a = /(?:xx|x)*/(s); a.length", + 1, + a.length ); + + AddTestCase( "var b = /(xx|x)*/(s); b.length", + 2, + b.length ); + + test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js new file mode 100644 index 0000000..e369c3e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js @@ -0,0 +1,90 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: simple_form.js + Description: 'Tests regular expressions using simple form: re(...)' + + Author: Nick Lerissa + Date: March 19, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: simple form'; + + writeHeaderToLog('Executing script: simple_form.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + testcases[count++] = new TestCase ( SECTION, + "/[0-9]{3}/('23 2 34 678 9 09')", + String(["678"]), String(/[0-9]{3}/('23 2 34 678 9 09'))); + + testcases[count++] = new TestCase ( SECTION, + "/3.{4}8/('23 2 34 678 9 09')", + String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09'))); + + testcases[count++] = new TestCase ( SECTION, + "(/3.{4}8/('23 2 34 678 9 09').length", + 1, (/3.{4}8/('23 2 34 678 9 09')).length); + + var re = /[0-9]{3}/; + testcases[count++] = new TestCase ( SECTION, + "re('23 2 34 678 9 09')", + String(["678"]), String(re('23 2 34 678 9 09'))); + + re = /3.{4}8/; + testcases[count++] = new TestCase ( SECTION, + "re('23 2 34 678 9 09')", + String(["34 678"]), String(re('23 2 34 678 9 09'))); + + testcases[count++] = new TestCase ( SECTION, + "/3.{4}8/('23 2 34 678 9 09')", + String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09'))); + + re =/3.{4}8/; + testcases[count++] = new TestCase ( SECTION, + "(re('23 2 34 678 9 09').length", + 1, (re('23 2 34 678 9 09')).length); + + testcases[count++] = new TestCase ( SECTION, + "(/3.{4}8/('23 2 34 678 9 09').length", + 1, (/3.{4}8/('23 2 34 678 9 09')).length); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js new file mode 100644 index 0000000..589d2b9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: source.js + Description: 'Tests RegExp attribute source' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: source'; + + writeHeaderToLog('Executing script: source.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // /xyz/g.source + testcases[count++] = new TestCase ( SECTION, "/xyz/g.source", + "xyz", /xyz/g.source); + + // /xyz/.source + testcases[count++] = new TestCase ( SECTION, "/xyz/.source", + "xyz", /xyz/.source); + + // /abc\\def/.source + testcases[count++] = new TestCase ( SECTION, "/abc\\\\def/.source", + "abc\\\\def", /abc\\def/.source); + + // /abc[\b]def/.source + testcases[count++] = new TestCase ( SECTION, "/abc[\\b]def/.source", + "abc[\\b]def", /abc[\b]def/.source); + + // (new RegExp('xyz')).source + testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz')).source", + "xyz", (new RegExp('xyz')).source); + + // (new RegExp('xyz','g')).source + testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz','g')).source", + "xyz", (new RegExp('xyz','g')).source); + + // (new RegExp('abc\\\\def')).source + testcases[count++] = new TestCase ( SECTION, "(new RegExp('abc\\\\\\\\def')).source", + "abc\\\\def", (new RegExp('abc\\\\def')).source); + + // (new RegExp('abc[\\b]def')).source + testcases[count++] = new TestCase ( SECTION, "(new RegExp('abc[\\\\b]def')).source", + "abc[\\b]def", (new RegExp('abc[\\b]def')).source); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js new file mode 100644 index 0000000..8675980 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js @@ -0,0 +1,157 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: special_characters.js + Description: 'Tests regular expressions containing special characters' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: special_charaters'; + + writeHeaderToLog('Executing script: special_characters.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // testing backslash '\' + testcases[count++] = new TestCase ( SECTION, "'^abcdefghi'.match(/\^abc/)", String(["^abc"]), String('^abcdefghi'.match(/\^abc/))); + + // testing beginning of line '^' + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/^abc/)", String(["abc"]), String('abcdefghi'.match(/^abc/))); + + // testing end of line '$' + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/fghi$/)", String(["ghi"]), String('abcdefghi'.match(/ghi$/))); + + // testing repeat '*' + testcases[count++] = new TestCase ( SECTION, "'eeeefghi'.match(/e*/)", String(["eeee"]), String('eeeefghi'.match(/e*/))); + + // testing repeat 1 or more times '+' + testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e+/)", String(["eeee"]), String('abcdeeeefghi'.match(/e+/))); + + // testing repeat 0 or 1 time '?' + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/abc?de/)", String(["abcde"]), String('abcdefghi'.match(/abc?de/))); + + // testing any character '.' + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/c.e/)", String(["cde"]), String('abcdefghi'.match(/c.e/))); + + // testing remembering () + testcases[count++] = new TestCase ( SECTION, "'abcewirjskjdabciewjsdf'.match(/(abc).+\\1'/)", + String(["abcewirjskjdabc","abc"]), String('abcewirjskjdabciewjsdf'.match(/(abc).+\1/))); + + // testing or match '|' + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/xyz|def/)", String(["def"]), String('abcdefghi'.match(/xyz|def/))); + + // testing repeat n {n} + testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3}/)", String(["eee"]), String('abcdeeeefghi'.match(/e{3}/))); + + // testing min repeat n {n,} + testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3,}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{3,}/))); + + // testing min/max repeat {min, max} + testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{2,8}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{2,8}/))); + + // testing any in set [abc...] + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/cd[xey]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[xey]fgh/))); + + // testing any in set [a-z] + testcases[count++] = new TestCase ( SECTION, "'netscape inc'.match(/t[r-v]ca/)", String(["tsca"]), String('netscape inc'.match(/t[r-v]ca/))); + + // testing any not in set [^abc...] + testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/cd[^xy]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[^xy]fgh/))); + + // testing any not in set [^a-z] + testcases[count++] = new TestCase ( SECTION, "'netscape inc'.match(/t[^a-c]ca/)", String(["tsca"]), String('netscape inc'.match(/t[^a-c]ca/))); + + // testing backspace [\b] + testcases[count++] = new TestCase ( SECTION, "'this is b\ba test'.match(/is b[\b]a test/)", + String(["is b\ba test"]), String('this is b\ba test'.match(/is b[\b]a test/))); + + // testing word boundary \b + testcases[count++] = new TestCase ( SECTION, "'today is now - day is not now'.match(/\bday.*now/)", + String(["day is not now"]), String('today is now - day is not now'.match(/\bday.*now/))); + + // control characters??? + + // testing any digit \d + testcases[count++] = new TestCase ( SECTION, "'a dog - 1 dog'.match(/\d dog/)", String(["1 dog"]), String('a dog - 1 dog'.match(/\d dog/))); + + // testing any non digit \d + testcases[count++] = new TestCase ( SECTION, "'a dog - 1 dog'.match(/\D dog/)", String(["a dog"]), String('a dog - 1 dog'.match(/\D dog/))); + + // testing form feed '\f' + testcases[count++] = new TestCase ( SECTION, "'a b a\fb'.match(/a\fb/)", String(["a\fb"]), String('a b a\fb'.match(/a\fb/))); + + // testing line feed '\n' + testcases[count++] = new TestCase ( SECTION, "'a b a\nb'.match(/a\nb/)", String(["a\nb"]), String('a b a\nb'.match(/a\nb/))); + + // testing carriage return '\r' + testcases[count++] = new TestCase ( SECTION, "'a b a\rb'.match(/a\rb/)", String(["a\rb"]), String('a b a\rb'.match(/a\rb/))); + + // testing whitespace '\s' + testcases[count++] = new TestCase ( SECTION, "'xa\f\n\r\t\vbz'.match(/a\s+b/)", String(["a\f\n\r\t\vb"]), String('xa\f\n\r\t\vbz'.match(/a\s+b/))); + + // testing non whitespace '\S' + testcases[count++] = new TestCase ( SECTION, "'a\tb a b a-b'.match(/a\Sb/)", String(["a-b"]), String('a\tb a b a-b'.match(/a\Sb/))); + + // testing tab '\t' + testcases[count++] = new TestCase ( SECTION, "'a\t\tb a b'.match(/a\t{2}/)", String(["a\t\t"]), String('a\t\tb a b'.match(/a\t{2}/))); + + // testing vertical tab '\v' + testcases[count++] = new TestCase ( SECTION, "'a\v\vb a b'.match(/a\v{2}/)", String(["a\v\v"]), String('a\v\vb a b'.match(/a\v{2}/))); + + // testing alphnumeric characters '\w' + testcases[count++] = new TestCase ( SECTION, "'%AZaz09_$'.match(/\w+/)", String(["AZaz09_"]), String('%AZaz09_$'.match(/\w+/))); + + // testing non alphnumeric characters '\W' + testcases[count++] = new TestCase ( SECTION, "'azx$%#@*4534'.match(/\W+/)", String(["$%#@*"]), String('azx$%#@*4534'.match(/\W+/))); + + // testing back references '\<number>' + testcases[count++] = new TestCase ( SECTION, "'test'.match(/(t)es\\1/)", String(["test","t"]), String('test'.match(/(t)es\1/))); + + // testing hex excaping with '\' + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/\x63\x64/)", String(["cd"]), String('abcdef'.match(/\x63\x64/))); + + // testing oct excaping with '\' + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/\\143\\144/)", String(["cd"]), String('abcdef'.match(/\143\144/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js new file mode 100644 index 0000000..b95ddf3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: string_replace.js + Description: 'Tests the replace method on Strings using regular expressions' + + Author: Nick Lerissa + Date: March 11, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String: replace'; + + writeHeaderToLog('Executing script: string_replace.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'adddb'.replace(/ddd/,"XX") + testcases[count++] = new TestCase ( SECTION, "'adddb'.replace(/ddd/,'XX')", + "aXXb", 'adddb'.replace(/ddd/,'XX')); + + // 'adddb'.replace(/eee/,"XX") + testcases[count++] = new TestCase ( SECTION, "'adddb'.replace(/eee/,'XX')", + 'adddb', 'adddb'.replace(/eee/,'XX')); + + // '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**') + testcases[count++] = new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')", + "34 56 ** 12", '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')); + + // '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX') + testcases[count++] = new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')", + "34 56 78b 12", '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')); + + // 'original'.replace(new RegExp(),'XX') + testcases[count++] = new TestCase ( SECTION, "'original'.replace(new RegExp(),'XX')", + "XXoriginal", 'original'.replace(new RegExp(),'XX')); + + // 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\s*\d+(..)$'),'****') + testcases[count++] = new TestCase ( SECTION, "'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****')", + "qwe ert ****", 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****')); + + +function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js new file mode 100644 index 0000000..8d229c6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: string_search.js + Description: 'Tests the search method on Strings using regular expressions' + + Author: Nick Lerissa + Date: March 12, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String: search'; + + writeHeaderToLog('Executing script: string_search.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abcdefg'.search(/d/) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.search(/d/)", + 3, 'abcdefg'.search(/d/)); + + // 'abcdefg'.search(/x/) + testcases[count++] = new TestCase ( SECTION, "'abcdefg'.search(/x/)", + -1, 'abcdefg'.search(/x/)); + + // 'abcdefg123456hijklmn'.search(/\d+/) + testcases[count++] = new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(/\d+/)", + 7, 'abcdefg123456hijklmn'.search(/\d+/)); + + // 'abcdefg123456hijklmn'.search(new RegExp()) + testcases[count++] = new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(new RegExp())", + 0, 'abcdefg123456hijklmn'.search(new RegExp())); + + // 'abc'.search(new RegExp('$')) + testcases[count++] = new TestCase ( SECTION, "'abc'.search(new RegExp('$'))", + 3, 'abc'.search(new RegExp('$'))); + + // 'abc'.search(new RegExp('^')) + testcases[count++] = new TestCase ( SECTION, "'abc'.search(new RegExp('^'))", + 0, 'abc'.search(new RegExp('^'))); + + // 'abc1'.search(/.\d/) + testcases[count++] = new TestCase ( SECTION, "'abc1'.search(/.\d/)", + 2, 'abc1'.search(/.\d/)); + + // 'abc1'.search(/\d{2}/) + testcases[count++] = new TestCase ( SECTION, "'abc1'.search(/\d{2}/)", + -1, 'abc1'.search(/\d{2}/)); + +function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js new file mode 100644 index 0000000..f824998 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js @@ -0,0 +1,91 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: string_split.js + Description: 'Tests the split method on Strings using regular expressions' + + Author: Nick Lerissa + Date: March 11, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'String: split'; + + writeHeaderToLog('Executing script: string_split.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'a b c de f'.split(/\s/) + testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/\s/)", + String(["a","b","c","de","f"]), String('a b c de f'.split(/\s/))); + + // 'a b c de f'.split(/\s/,3) + testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/\s/,3)", + String(["a","b","c"]), String('a b c de f'.split(/\s/,3))); + + // 'a b c de f'.split(/X/) + testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/X/)", + String(["a b c de f"]), String('a b c de f'.split(/X/))); + + // 'dfe23iu 34 =+65--'.split(/\d+/) + testcases[count++] = new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(/\d+/)", + String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(/\d+/))); + + // 'dfe23iu 34 =+65--'.split(new RegExp('\d+')) + testcases[count++] = new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(new RegExp('\\d+'))", + String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(new RegExp('\\d+')))); + + // 'abc'.split(/[a-z]/) + testcases[count++] = new TestCase ( SECTION, "'abc'.split(/[a-z]/)", + String(["","",""]), String('abc'.split(/[a-z]/))); + + // 'abc'.split(/[a-z]/) + testcases[count++] = new TestCase ( SECTION, "'abc'.split(/[a-z]/)", + String(["","",""]), String('abc'.split(/[a-z]/))); + + // 'abc'.split(new RegExp('[a-z]')) + testcases[count++] = new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))", + String(["","",""]), String('abc'.split(new RegExp('[a-z]')))); + + // 'abc'.split(new RegExp('[a-z]')) + testcases[count++] = new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))", + String(["","",""]), String('abc'.split(new RegExp('[a-z]')))); + +function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js new file mode 100644 index 0000000..2325af1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js @@ -0,0 +1,87 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: test.js + Description: 'Tests regular expressions method compile' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: test'; + + writeHeaderToLog('Executing script: test.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + testcases[count++] = new TestCase ( SECTION, + "/[0-9]{3}/.test('23 2 34 678 9 09')", + true, /[0-9]{3}/.test('23 2 34 678 9 09')); + + testcases[count++] = new TestCase ( SECTION, + "/[0-9]{3}/.test('23 2 34 78 9 09')", + false, /[0-9]{3}/.test('23 2 34 78 9 09')); + + testcases[count++] = new TestCase ( SECTION, + "/\w+ \w+ \w+/.test('do a test')", + true, /\w+ \w+ \w+/.test("do a test")); + + testcases[count++] = new TestCase ( SECTION, + "/\w+ \w+ \w+/.test('a test')", + false, /\w+ \w+ \w+/.test("a test")); + + testcases[count++] = new TestCase ( SECTION, + "(new RegExp('[0-9]{3}')).test('23 2 34 678 9 09')", + true, (new RegExp('[0-9]{3}')).test('23 2 34 678 9 09')); + + testcases[count++] = new TestCase ( SECTION, + "(new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')", + false, (new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')); + + testcases[count++] = new TestCase ( SECTION, + "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('do a test')", + true, (new RegExp('\\w+ \\w+ \\w+')).test("do a test")); + + testcases[count++] = new TestCase ( SECTION, + "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('a test')", + false, (new RegExp('\\w+ \\w+ \\w+')).test("a test")); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js new file mode 100644 index 0000000..b08b772 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: toString.js + Description: 'Tests RegExp method toString' + + Author: Nick Lerissa + Date: March 13, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: toString'; + + writeHeaderToLog('Executing script: toString.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // var re = new RegExp(); re.toString() + var re = new RegExp(); + testcases[count++] = new TestCase ( SECTION, "var re = new RegExp(); re.toString()", + '/(?:)/', re.toString()); + + // re = /.+/; re.toString(); + re = /.+/; + testcases[count++] = new TestCase ( SECTION, "re = /.+/; re.toString()", + '/.+/', re.toString()); + + // re = /test/gi; re.toString() + re = /test/gi; + testcases[count++] = new TestCase ( SECTION, "re = /test/gi; re.toString()", + '/test/gi', re.toString()); + + // re = /test2/ig; re.toString() + re = /test2/ig; + testcases[count++] = new TestCase ( SECTION, "re = /test2/ig; re.toString()", + '/test2/gi', re.toString()); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js new file mode 100644 index 0000000..39b428a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js @@ -0,0 +1,95 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: vertical_bar.js + Description: 'Tests regular expressions containing |' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: |'; + + writeHeaderToLog('Executing script: vertical_bar.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'abc'.match(new RegExp('xyz|abc')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|abc'))", + String(["abc"]), String('abc'.match(new RegExp('xyz|abc')))); + + // 'this is a test'.match(new RegExp('quiz|exam|test|homework')) + testcases[count++] = new TestCase ( SECTION, "'this is a test'.match(new RegExp('quiz|exam|test|homework'))", + String(["test"]), String('this is a test'.match(new RegExp('quiz|exam|test|homework')))); + + // 'abc'.match(new RegExp('xyz|...')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|...'))", + String(["abc"]), String('abc'.match(new RegExp('xyz|...')))); + + // 'abc'.match(new RegExp('(.)..|abc')) + testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('(.)..|abc'))", + String(["abc","a"]), String('abc'.match(new RegExp('(.)..|abc')))); + + // 'color: grey'.match(new RegExp('.+: gr(a|e)y')) + testcases[count++] = new TestCase ( SECTION, "'color: grey'.match(new RegExp('.+: gr(a|e)y'))", + String(["color: grey","e"]), String('color: grey'.match(new RegExp('.+: gr(a|e)y')))); + + // 'no match'.match(new RegExp('red|white|blue')) + testcases[count++] = new TestCase ( SECTION, "'no match'.match(new RegExp('red|white|blue'))", + null, 'no match'.match(new RegExp('red|white|blue'))); + + // 'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)')) + testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))", + String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)')))); + + // 'abcdef'.match(new RegExp('abc|bcd|cde|def')) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('abc|bcd|cde|def'))", + String(["abc"]), String('abcdef'.match(new RegExp('abc|bcd|cde|def')))); + + // 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/) + testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)", + String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/))); + + // 'abcdef'.match(/abc|bcd|cde|def/) + testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/abc|bcd|cde|def/)", + String(["abc"]), String('abcdef'.match(/abc|bcd|cde|def/))); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js new file mode 100644 index 0000000..40c78c3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: whitespace.js + Description: 'Tests regular expressions containing \f\n\r\t\v\s\S\ ' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \\f\\n\\r\\t\\v\\s\\S '; + + writeHeaderToLog('Executing script: whitespace.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var non_whitespace = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()-+={[}]|\\:;'<,>./?1234567890" + '"'; + var whitespace = "\f\n\r\t\v "; + + // be sure all whitespace is matched by \s + testcases[count++] = new TestCase ( SECTION, + "'" + whitespace + "'.match(new RegExp('\\s+'))", + String([whitespace]), String(whitespace.match(new RegExp('\\s+')))); + + // be sure all non-whitespace is matched by \S + testcases[count++] = new TestCase ( SECTION, + "'" + non_whitespace + "'.match(new RegExp('\\S+'))", + String([non_whitespace]), String(non_whitespace.match(new RegExp('\\S+')))); + + // be sure all non-whitespace is not matched by \s + testcases[count++] = new TestCase ( SECTION, + "'" + non_whitespace + "'.match(new RegExp('\\s'))", + null, non_whitespace.match(new RegExp('\\s'))); + + // be sure all whitespace is not matched by \S + testcases[count++] = new TestCase ( SECTION, + "'" + whitespace + "'.match(new RegExp('\\S'))", + null, whitespace.match(new RegExp('\\S'))); + + var s = non_whitespace + whitespace; + + // be sure all digits are matched by \s + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\s+'))", + String([whitespace]), String(s.match(new RegExp('\\s+')))); + + s = whitespace + non_whitespace; + + // be sure all non-whitespace are matched by \S + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\S+'))", + String([non_whitespace]), String(s.match(new RegExp('\\S+')))); + + // '1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+')) + testcases[count++] = new TestCase ( SECTION, "'1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))", + String(["find me"]), String('1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+')))); + + var i; + + // be sure all whitespace characters match individually + for (i = 0; i < whitespace.length; ++i) + { + s = 'ab' + whitespace[i] + 'cd'; + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\\\s'))", + String([whitespace[i]]), String(s.match(new RegExp('\\s')))); + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\s/)", + String([whitespace[i]]), String(s.match(/\s/))); + } + // be sure all non_whitespace characters match individually + for (i = 0; i < non_whitespace.length; ++i) + { + s = ' ' + non_whitespace[i] + ' '; + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\\\S'))", + String([non_whitespace[i]]), String(s.match(new RegExp('\\S')))); + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\S/)", + String([non_whitespace[i]]), String(s.match(/\S/))); + } + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js new file mode 100644 index 0000000..581499c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js @@ -0,0 +1,119 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: word_boundary.js + Description: 'Tests regular expressions containing \b and \B' + + Author: Nick Lerissa + Date: March 10, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'RegExp: \\b and \\B'; + + writeHeaderToLog('Executing script: word_boundary.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // 'cowboy boyish boy'.match(new RegExp('\bboy\b')) + testcases[count++] = new TestCase ( SECTION, "'cowboy boyish boy'.match(new RegExp('\\bboy\\b'))", + String(["boy"]), String('cowboy boyish boy'.match(new RegExp('\\bboy\\b')))); + + var boundary_characters = "\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"'; + var non_boundary_characters = '1234567890_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + var s = ''; + var i; + + // testing whether all boundary characters are matched when they should be + for (i = 0; i < boundary_characters.length; ++i) + { + s = '123ab' + boundary_characters.charAt(i) + '123c' + boundary_characters.charAt(i); + + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\b123[a-z]\\b'))", + String(["123c"]), String(s.match(new RegExp('\\b123[a-z]\\b')))); + } + + // testing whether all non-boundary characters are matched when they should be + for (i = 0; i < non_boundary_characters.length; ++i) + { + s = '123ab' + non_boundary_characters.charAt(i) + '123c' + non_boundary_characters.charAt(i); + + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\B123[a-z]\\B'))", + String(["123c"]), String(s.match(new RegExp('\\B123[a-z]\\B')))); + } + + s = ''; + + // testing whether all boundary characters are not matched when they should not be + for (i = 0; i < boundary_characters.length; ++i) + { + s += boundary_characters[i] + "a" + i + "b"; + } + s += "xa1111bx"; + + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\Ba\\d+b\\B'))", + String(["a1111b"]), String(s.match(new RegExp('\\Ba\\d+b\\B')))); + + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\\Ba\\d+b\\B/)", + String(["a1111b"]), String(s.match(/\Ba\d+b\B/))); + + s = ''; + + // testing whether all non-boundary characters are not matched when they should not be + for (i = 0; i < non_boundary_characters.length; ++i) + { + s += non_boundary_characters[i] + "a" + i + "b"; + } + s += "(a1111b)"; + + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(new RegExp('\\ba\\d+b\\b'))", + String(["a1111b"]), String(s.match(new RegExp('\\ba\\d+b\\b')))); + + testcases[count++] = new TestCase ( SECTION, + "'" + s + "'.match(/\\ba\\d+b\\b/)", + String(["a1111b"]), String(s.match(/\ba\d+b\b/))); + + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js new file mode 100644 index 0000000..cfbfc1b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js @@ -0,0 +1,76 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): bzbarsky@mit.edu, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 05 July 2002 +* SUMMARY: Testing local var having same name as switch label inside function +* +* The code below crashed while compiling in JS1.1 or JS1.2 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=144834 +* +*/ +//----------------------------------------------------------------------------- +var bug = 144834; +var summary = 'Local var having same name as switch label inside function'; + +print(bug); +print(summary); + + +function RedrawSched() +{ + var MinBound; + + switch (i) + { + case MinBound : + } +} + + +/* + * Also try eval scope - + */ +var s = ''; +s += 'function RedrawSched()'; +s += '{'; +s += ' var MinBound;'; +s += ''; +s += ' switch (i)'; +s += ' {'; +s += ' case MinBound :'; +s += ' }'; +s += '}'; +eval(s); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js new file mode 100644 index 0000000..7808d9b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js @@ -0,0 +1,83 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: regress-7703.js + * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; + * Description: See the text of the bugnumber above + */ + + var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) + var VERSION = "JS1_2"; // Version of JavaScript or ECMA + var TITLE = "Regression test for bugzilla # 7703"; // Provide ECMA section title or a description + var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + /* + * Calls to AddTestCase here. AddTestCase is a function that is defined + * in shell.js and takes three arguments: + * - a string representation of what is being tested + * - the expected result + * - the actual result + * + * For example, a test might look like this: + * + * var zip = /[\d]{5}$/; + * + * AddTestCase( + * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test + * "02134", // expected result + * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result + * + */ + + types = []; + function inspect(object) { + for (prop in object) { + var x = object[prop]; + types[types.length] = (typeof x); + } + } + + var o = {a: 1, b: 2}; + inspect(o); + + AddTestCase( "inspect(o),length", 2, types.length ); + AddTestCase( "inspect(o)[0]", "number", types[0] ); + AddTestCase( "inspect(o)[1]", "number", types[1] ); + + types_2 = []; + + function inspect_again(object) { + for (prop in object) { + types_2[types_2.length] = (typeof object[prop]); + } + } + + inspect_again(o); + AddTestCase( "inspect_again(o),length", 2, types.length ); + AddTestCase( "inspect_again(o)[0]", "number", types[0] ); + AddTestCase( "inspect_again(o)[1]", "number", types[1] ); + + + test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_2/shell.js new file mode 100644 index 0000000..ba57d61 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/shell.js @@ -0,0 +1,147 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +var completed = false; +var testcases; + +var SECTION = ""; +var VERSION = ""; +var BUGNUMBER = ""; + +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +startTest(); + + version(120); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + + this.passed = getTestCaseResult( this.expect, this.actual ); +} +function startTest() { + version(120); + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, give a little leeway for rounding. + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +/* + * Begin printing functions. These functions use the shell's + * print function. When running tests in the browser, these + * functions, override these functions with functions that use + * document.write. + */ + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +/* end of print functions */ + +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js new file mode 100644 index 0000000..ffe177d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js @@ -0,0 +1,162 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: break.js + Description: 'Tests the break statement' + + Author: Nick Lerissa + Date: March 18, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'statements: break'; + + writeHeaderToLog("Executing script: break.js"); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var i,j; + + for (i = 0; i < 1000; i++) + { + if (i == 100) break; + } + + // 'breaking out of "for" loop' + testcases[count++] = new TestCase ( SECTION, 'breaking out of "for" loop', + 100, i); + + j = 2000; + + out1: + for (i = 0; i < 1000; i++) + { + if (i == 100) + { + out2: + for (j = 0; j < 1000; j++) + { + if (j == 500) break out1; + } + j = 2001; + } + j = 2002; + } + + // 'breaking out of a "for" loop with a "label"' + testcases[count++] = new TestCase ( SECTION, 'breaking out of a "for" loop with a "label"', + 500, j); + + i = 0; + + while (i < 1000) + { + if (i == 100) break; + i++; + } + + // 'breaking out of a "while" loop' + testcases[count++] = new TestCase ( SECTION, 'breaking out of a "while" loop', + 100, i ); + + + j = 2000; + i = 0; + + out3: + while (i < 1000) + { + if (i == 100) + { + j = 0; + out4: + while (j < 1000) + { + if (j == 500) break out3; + j++; + } + j = 2001; + } + j = 2002; + i++; + } + + // 'breaking out of a "while" loop with a "label"' + testcases[count++] = new TestCase ( SECTION, 'breaking out of a "while" loop with a "label"', + 500, j); + + i = 0; + + do + { + if (i == 100) break; + i++; + } while (i < 1000); + + // 'breaking out of a "do" loop' + testcases[count++] = new TestCase ( SECTION, 'breaking out of a "do" loop', + 100, i ); + + j = 2000; + i = 0; + + out5: + do + { + if (i == 100) + { + j = 0; + out6: + do + { + if (j == 500) break out5; + j++; + }while (j < 1000); + j = 2001; + } + j = 2002; + i++; + }while (i < 1000); + + // 'breaking out of a "do" loop with a "label"' + testcases[count++] = new TestCase ( SECTION, 'breaking out of a "do" loop with a "label"', + 500, j); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js new file mode 100644 index 0000000..e27b9df --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js @@ -0,0 +1,175 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: continue.js + Description: 'Tests the continue statement' + + Author: Nick Lerissa + Date: March 18, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'statements: continue'; + + writeHeaderToLog("Executing script: continue.js"); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var i,j; + + j = 0; + for (i = 0; i < 200; i++) + { + if (i == 100) + continue; + j++; + } + + // '"continue" in a "for" loop' + testcases[count++] = new TestCase ( SECTION, '"continue" in "for" loop', + 199, j); + + + j = 0; + out1: + for (i = 0; i < 1000; i++) + { + if (i == 100) + { + out2: + for (var k = 0; k < 1000; k++) + { + if (k == 500) continue out1; + } + j = 3000; + } + j++; + } + + // '"continue" in a "for" loop with a "label"' + testcases[count++] = new TestCase ( SECTION, '"continue" in "for" loop with a "label"', + 999, j); + + i = 0; + j = 1; + + while (i != j) + { + i++; + if (i == 100) continue; + j++; + } + + // '"continue" in a "while" loop' + testcases[count++] = new TestCase ( SECTION, '"continue" in a "while" loop', + 100, j ); + + j = 0; + i = 0; + out3: + while (i < 1000) + { + if (i == 100) + { + var k = 0; + out4: + while (k < 1000) + { + if (k == 500) + { + i++; + continue out3; + } + k++; + } + j = 3000; + } + j++; + i++; + } + + // '"continue" in a "while" loop with a "label"' + testcases[count++] = new TestCase ( SECTION, '"continue" in a "while" loop with a "label"', + 999, j); + + i = 0; + j = 1; + + do + { + i++; + if (i == 100) continue; + j++; + } while (i != j); + + + // '"continue" in a "do" loop' + testcases[count++] = new TestCase ( SECTION, '"continue" in a "do" loop', + 100, j ); + + j = 0; + i = 0; + out5: + do + { + if (i == 100) + { + var k = 0; + out6: + do + { + if (k == 500) + { + i++; + continue out5; + } + k++; + }while (k < 1000); + j = 3000; + } + j++; + i++; + }while (i < 1000); + + // '"continue" in a "do" loop with a "label"' + testcases[count++] = new TestCase ( SECTION, '"continue" in a "do" loop with a "label"', + 999, j); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js new file mode 100644 index 0000000..d54ac78 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js @@ -0,0 +1,68 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: do_while.js + Description: 'This tests the new do_while loop' + + Author: Nick Lerissa + Date: Fri Feb 13 09:58:28 PST 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'statements: do_while'; + + writeHeaderToLog('Executing script: do_while.js'); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + + var done = false; + var x = 0; + do + { + if (x++ == 3) done = true; + } while (!done); + + testcases[count++] = new TestCase( SECTION, "do_while ", + 4, x); + + //load('d:/javascript/tests/output/statements/do_while.js') + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js new file mode 100644 index 0000000..f6678c5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js @@ -0,0 +1,127 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: switch.js + Description: 'Tests the switch statement' + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696 + + Author: Nick Lerissa + Date: March 19, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'statements: switch'; + var BUGNUMBER="323696"; + + writeHeaderToLog("Executing script: switch.js"); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + var var1 = "match string"; + var match1 = false; + var match2 = false; + var match3 = false; + + switch (var1) + { + case "match string": + match1 = true; + case "bad string 1": + match2 = true; + break; + case "bad string 2": + match3 = true; + } + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + true, match1); + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + true, match2); + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + false, match3); + + var var2 = 3; + + var match1 = false; + var match2 = false; + var match3 = false; + var match4 = false; + var match5 = false; + + switch (var2) + { + case 1: +/* switch (var1) + { + case "foo": + match1 = true; + break; + case 3: + match2 = true; + break; + }*/ + match3 = true; + break; + case 2: + match4 = true; + break; + case 3: + match5 = true; + break; + } + testcases[count++] = new TestCase ( SECTION, 'switch statement', + false, match1); + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + false, match2); + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + false, match3); + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + false, match4); + + testcases[count++] = new TestCase ( SECTION, 'switch statement', + true, match5); + + function test() + { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js new file mode 100644 index 0000000..5d35f8c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js @@ -0,0 +1,188 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + Filename: switch2.js + Description: 'Tests the switch statement' + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696 + + Author: Norris Boyd + Date: July 31, 1998 +*/ + + var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; + var VERSION = 'no version'; + startTest(); + var TITLE = 'statements: switch'; + var BUGNUMBER="323626"; + + writeHeaderToLog("Executing script: switch2.js"); + writeHeaderToLog( SECTION + " "+ TITLE); + + var count = 0; + var testcases = new Array(); + + // test defaults not at the end; regression test for a bug that + // nearly made it into 4.06 + function f0(i) { + switch(i) { + default: + case "a": + case "b": + return "ab*" + case "c": + return "c"; + case "d": + return "d"; + } + return ""; + } + testcases[count++] = new TestCase(SECTION, 'switch statement', + f0("a"), "ab*"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f0("b"), "ab*"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f0("*"), "ab*"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f0("c"), "c"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f0("d"), "d"); + + function f1(i) { + switch(i) { + case "a": + case "b": + default: + return "ab*" + case "c": + return "c"; + case "d": + return "d"; + } + return ""; + } + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f1("a"), "ab*"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f1("b"), "ab*"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f1("*"), "ab*"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f1("c"), "c"); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f1("d"), "d"); + + // Switch on integer; will use TABLESWITCH opcode in C engine + function f2(i) { + switch (i) { + case 0: + case 1: + return 1; + case 2: + return 2; + } + // with no default, control will fall through + return 3; + } + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f2(0), 1); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f2(1), 1); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f2(2), 2); + + testcases[count++] = new TestCase(SECTION, 'switch statement', + f2(3), 3); + + // empty switch: make sure expression is evaluated + var se = 0; + switch (se = 1) { + } + testcases[count++] = new TestCase(SECTION, 'switch statement', + se, 1); + + // only default + se = 0; + switch (se) { + default: + se = 1; + } + testcases[count++] = new TestCase(SECTION, 'switch statement', + se, 1); + + // in loop, break should only break out of switch + se = 0; + for (var i=0; i < 2; i++) { + switch (i) { + case 0: + case 1: + break; + } + se = 1; + } + testcases[count++] = new TestCase(SECTION, 'switch statement', + se, 1); + + // test "fall through" + se = 0; + i = 0; + switch (i) { + case 0: + se++; + /* fall through */ + case 1: + se++; + break; + } + testcases[count++] = new TestCase(SECTION, 'switch statement', + se, 2); + + test(); + + // Needed: tests for evaluation time of case expressions. + // This issue was under debate at ECMA, so postponing for now. + + function test() { + writeLineToLog("hi"); + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); + } diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js new file mode 100644 index 0000000..55fafe4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: boolean-001.js + * Description: + * + * In JavaScript 1.2, new Boolean(false) evaluates to false. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "boolean-001.js"; + var VERSION = "JS1_2"; + startTest(); + var TITLE = "new Boolean(false) should evaluate to false"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + BooleanTest( "new Boolean(true)", new Boolean(true), true ); + BooleanTest( "new Boolean(false)", new Boolean(false), false ); + BooleanTest( "true", true, true ); + BooleanTest( "false", false, false ); + + test(); + +function BooleanTest( string, object, expect ) { + if ( object ) { + result = true; + } else { + result = false; + } + + testcases[tc++] = new TestCase( + SECTION, + string, + expect, + result ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js new file mode 100644 index 0000000..75131ee --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js @@ -0,0 +1,172 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 09 October 2001 +* +* SUMMARY: Regression test for Bugzilla bug 99663 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=99663 +* +******************************************************************************* +******************************************************************************* +* ESSENTIAL!: this test should contain, or be loaded after, a call to +* +* version(120); +* +* Only JS version 1.2 or less has the behavior we're expecting here - +* +* Brendan: "The JS_SetVersion stickiness is necessary for tests such as +* this one to work properly. I think the existing js/tests have been lucky +* in dodging the buggy way that JS_SetVersion's effect can be undone by +* function return." +* +* Note: it is the function statements for f1(), etc. that MUST be compiled +* in JS version 1.2 or less for the test to pass - +* +******************************************************************************* +******************************************************************************* +* +* +* NOTE: the test uses the |it| object of SpiderMonkey; don't run it in Rhino - +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 99663; +var summary = 'Regression test for Bugzilla bug 99663'; +/* + * This testcase expects error messages containing + * the phrase 'read-only' or something similar - + */ +var READONLY = /read\s*-?\s*only/; +var READONLY_TRUE = 'a "read-only" error'; +var READONLY_FALSE = 'Error: '; +var FAILURE = 'NO ERROR WAS GENERATED!'; +var status = ''; +var actual = ''; +var expect= ''; +var statusitems = []; +var expectedvalues = []; +var actualvalues = []; + + +/* + * These MUST be compiled in JS1.2 or less for the test to work - see above + */ +function f1() +{ + with (it) + { + for (rdonly in this); + } +} + + +function f2() +{ + for (it.rdonly in this); +} + + +function f3(s) +{ + for (it[s] in this); +} + + + +/* + * Begin testing by capturing actual vs. expected values. + * Initialize to FAILURE; this will get reset if all goes well - + */ +actual = FAILURE; +try +{ + f1(); +} +catch(e) +{ + actual = readOnly(e.message); +} +expect= READONLY_TRUE; +status = 'Section 1 of test - got ' + actual; +addThis(); + + +actual = FAILURE; +try +{ + f2(); +} +catch(e) +{ + actual = readOnly(e.message); +} +expect= READONLY_TRUE; +status = 'Section 2 of test - got ' + actual; +addThis(); + + +actual = FAILURE; +try +{ + f3('rdonly'); +} +catch(e) +{ + actual = readOnly(e.message); +} +expect= READONLY_TRUE; +status = 'Section 3 of test - got ' + actual; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function readOnly(msg) +{ + if (msg.match(READONLY)) + return READONLY_TRUE; + return READONLY_FALSE + msg; +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + writeLineToLog ('Bug Number ' + bug); + writeLineToLog ('STATUS: ' + summary); + + for (var i=0; i<UBound; i++) + { + writeTestCaseResult(expectedvalues[i], actualvalues[i], statusitems[i]); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js new file mode 100644 index 0000000..e453344 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js @@ -0,0 +1,24 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/* all files in this dir need version(120) called before they are *loaded* */ + +version(120);
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js new file mode 100644 index 0000000..991730d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: boolean-001.js + * Description: + * + * In JavaScript 1.2, new Boolean(false) evaluates to false. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "boolean-001.js"; + var VERSION = "JS_1.3"; + var TITLE = "new Boolean(false) should evaluate to false"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + BooleanTest( "new Boolean(true)", new Boolean(true), true ); + BooleanTest( "new Boolean(false)", new Boolean(false), true ); + BooleanTest( "true", true, true ); + BooleanTest( "false", false, false ); + + test(); + +function BooleanTest( string, object, expect ) { + if ( object ) { + result = true; + } else { + result = false; + } + + testcases[tc++] = new TestCase( + SECTION, + string, + expect, + result ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js new file mode 100644 index 0000000..e2f4332 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: delete-001.js + Section: regress + Description: + + Regression test for + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "JS1_2"; + var VERSION = "JS1_2"; + var TITLE = "The variable statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // delete all properties of the global object + // per ecma, this does not affect variables in the global object declared + // with var or functions + + for ( p in this ) { + delete p; + } + + var result =""; + + for ( p in this ) { + result += String( p ); + } + + // not too picky here... just want to make sure we didn't crash or something + + testcases[testcases.length] = new TestCase( SECTION, + "delete all properties of the global object", + "PASSED", + result == "" ? "FAILED" : "PASSED" ); + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js new file mode 100644 index 0000000..5b4add0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: boolean-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 + * + * eval("function f(){}function g(){}") at top level is an error for JS1.2 + * and above (missing ; between named function expressions), but declares f + * and g as functions below 1.2. + * + * Fails to produce error regardless of version: + * js> version(100) + * 120 + * js> eval("function f(){}function g(){}") + * js> version(120); + * 100 + * js> eval("function f(){}function g(){}") + * js> + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "function-001.js"; + var VERSION = "JS_1.3"; + var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; + var BUGNUMBER="10278"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "eval(\"function f(){}function g(){}\")", + "error", + eval("function f(){}function g(){}") ); + + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js new file mode 100644 index 0000000..d3d1d85 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: function-002.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579 + + function definitions in conditional statements should be allowed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "function-002"; + var VERSION = "JS1_3"; + var TITLE = "Regression test for 249579"; + var BUGNUMBER="249579"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "0?function(){}:0", + 0, + 0?function(){}:0 ); + + + bar = true; + foo = bar ? function () { return true; } : function() { return false; }; + + testcases[tc++] = new TestCase( + SECTION, + "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", + true, + foo() ); + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js new file mode 100644 index 0000000..d9d76fe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js @@ -0,0 +1,52 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: in-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109 + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "in-001"; + var VERSION = "JS1_3"; + var TITLE = "Regression test for 196109"; + var BUGNUMBER="196109"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + o = {}; + o.foo = 'sil'; + + testcases[tc++] = new TestCase( + SECTION, + "\"foo\" in o", + true, + "foo" in o ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js new file mode 100644 index 0000000..2868eca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: new-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "new-001"; + var VERSION = "JS1_3"; + var TITLE = "new-001"; + var BUGNUMBER="31567"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + function Test_One (x) { + this.v = x+1; + return x*2 + } + + function Test_Two( x, y ) { + this.v = x; + return y; + } + + testcases[tc++] = new TestCase( + SECTION, + "Test_One(18)", + 36, + Test_One(18) ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_One(18)", + "[object Object]", + new Test_One(18) +"" ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_One(18).v", + 19, + new Test_One(18).v ); + + testcases[tc++] = new TestCase( + SECTION, + "Test_Two(2,7)", + 7, + Test_Two(2,7) ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_Two(2,7)", + "[object Object]", + new Test_Two(2,7) +"" ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_Two(2,7).v", + 2, + new Test_Two(2,7).v ); + + testcases[tc++] = new TestCase( + SECTION, + "new (Function)(\"x\", \"return x+3\")(5,6)", + 8, + new (Function)("x","return x+3")(5,6) ); + + testcases[tc++] = new TestCase( + SECTION, + "new new Test_Two(String, 2).v(0123)", + "83", + new new Test_Two(String, 2).v(0123) +""); + + testcases[tc++] = new TestCase( + SECTION, + "new new Test_Two(String, 2).v(0123).length", + 2, + new new Test_Two(String, 2).v(0123).length ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js new file mode 100644 index 0000000..5e7ec89 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js @@ -0,0 +1,159 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: script-001.js + Section: + Description: new NativeScript object + + +js> parseInt(123,"hi") +123 +js> parseInt(123, "blah") +123 +js> s +js: s is not defined +js> s = new Script + +undefined; + + +js> s = new Script() + +undefined; + + +js> s.getJSClass +js> s.getJSClass = Object.prototype.toString +function toString() { + [native code] +} + +js> s.getJSClass() +[object Script] +js> s.compile( "return 3+4" ) +js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr +js> s.compile( "3+4" ) + +3 + 4; + + +js> typeof s +function +js> s() +Jit failure! +invalid opcode: 1 +Jit Pass1 Failure! +javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V +An internal JIT error has occurred. Please report this with .class +jit-bugs@itools.symantec.com + +7 +js> s.compile("3+4") + +3 + 4; + + +js> s() +Jit failure! +invalid opcode: 1 +Jit Pass1 Failure! +javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V +An internal JIT error has occurred. Please report this with .class +jit-bugs@itools.symantec.com + +7 +js> quit() + +C:\src\ns_priv\js\tests\ecma>shell + +C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; +:\src\ns_priv\js\tests javax.javascript.examples.Shell +Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 +Copyright (C) 1996-97 Symantec Corporation + +js> s = new Script("3+4") + +3 + 4; + + +js> s() +7 +js> s2 = new Script(); + +undefined; + + +js> s.compile( "3+4") + +3 + 4; + + +js> s() +Jit failure! +invalid opcode: 1 +Jit Pass1 Failure! +javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V +An internal JIT error has occurred. Please report this with .class +jit-bugs@itools.symantec.com + +7 +js> quit() + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "script-001"; + var VERSION = "JS1_3"; + var TITLE = "NativeScript"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var s = new Script(); + s.getJSClass = Object.prototype.toString; + + testcases[tc++] = new TestCase( SECTION, + "var s = new Script(); typeof s", + "function", + typeof s ); + + testcases[tc++] = new TestCase( SECTION, + "s.getJSClass()", + "[object Script]", + s.getJSClass() ); + + test(); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js new file mode 100644 index 0000000..b3f71d7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: switch-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 + + Verify that switches do not use strict equality in + versions of JavaScript < 1.4 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "switch-001"; + var VERSION = "JS1_3"; + var TITLE = "switch-001"; + var BUGNUMBER="315767"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + result = "fail: did not enter switch"; + + switch (true) { + case 1: + result = "fail: for backwards compatibility, version 130 use strict equality"; + break; + case true: + result = "pass"; + break; + default: + result = "fail: evaluated default statement"; + } + + testcases[tc++] = new TestCase( + SECTION, + "switch / case should use strict equality in version of JS < 1.4", + "pass", + result ); + + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js new file mode 100644 index 0000000..1d9915e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js @@ -0,0 +1,166 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_1.js + Section: + Description: new PrototypeObject + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_1"; + var VERSION = "JS1_3"; + var TITLE = "new PrototypeObject"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee () { + this.name = ""; + this.dept = "general"; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee () { + this.projects = new Array(); +} +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer () { + this.dept = "engineering"; + this.machine = ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var jim = new Employee(); + + testcases[tc++] = new TestCase( SECTION, + "jim = new Employee(); jim.name", + "", + jim.name ); + + + testcases[tc++] = new TestCase( SECTION, + "jim = new Employee(); jim.dept", + "general", + jim.dept ); + + var sally = new Manager(); + + testcases[tc++] = new TestCase( SECTION, + "sally = new Manager(); sally.name", + "", + sally.name ); + testcases[tc++] = new TestCase( SECTION, + "sally = new Manager(); sally.dept", + "general", + sally.dept ); + + testcases[tc++] = new TestCase( SECTION, + "sally = new Manager(); sally.reports.length", + 0, + sally.reports.length ); + + testcases[tc++] = new TestCase( SECTION, + "sally = new Manager(); typeof sally.reports", + "object", + typeof sally.reports ); + + var fred = new SalesPerson(); + + testcases[tc++] = new TestCase( SECTION, + "fred = new SalesPerson(); fred.name", + "", + fred.name ); + + testcases[tc++] = new TestCase( SECTION, + "fred = new SalesPerson(); fred.dept", + "sales", + fred.dept ); + + testcases[tc++] = new TestCase( SECTION, + "fred = new SalesPerson(); fred.quota", + 100, + fred.quota ); + + testcases[tc++] = new TestCase( SECTION, + "fred = new SalesPerson(); fred.projects.length", + 0, + fred.projects.length ); + + var jane = new Engineer(); + + testcases[tc++] = new TestCase( SECTION, + "jane = new Engineer(); jane.name", + "", + jane.name ); + + testcases[tc++] = new TestCase( SECTION, + "jane = new Engineer(); jane.dept", + "engineering", + jane.dept ); + + testcases[tc++] = new TestCase( SECTION, + "jane = new Engineer(); jane.projects.length", + 0, + jane.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "jane = new Engineer(); jane.machine", + "", + jane.machine ); + + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js new file mode 100644 index 0000000..e6d1b9a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js @@ -0,0 +1,152 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_10.js + Section: + Description: Determining Instance Relationships + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_10"; + var VERSION = "JS1_3"; + var TITLE = "Determining Instance Relationships"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function InstanceOf( object, constructor ) { + while ( object != null ) { + if ( object == constructor.prototype ) { + return true; + } + object = object.__proto__; + } + return false; +} +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} + +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer ( name, projs, machine ) { + this.base = WorkerBee; + this.base( name, "engineering", projs ) + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var pat = new Engineer() + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__ == Engineer.prototype", + true, + pat.__proto__ == Engineer.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__ == WorkerBee.prototype", + true, + pat.__proto__.__proto__ == WorkerBee.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__.__proto__ == Employee.prototype", + true, + pat.__proto__.__proto__.__proto__ == Employee.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype", + true, + pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null", + true, + pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null ); + + + testcases[tc++] = new TestCase( SECTION, + "InstanceOf( pat, Engineer )", + true, + InstanceOf( pat, Engineer ) ); + + testcases[tc++] = new TestCase( SECTION, + "InstanceOf( pat, WorkerBee )", + true, + InstanceOf( pat, WorkerBee ) ); + + testcases[tc++] = new TestCase( SECTION, + "InstanceOf( pat, Employee )", + true, + InstanceOf( pat, Employee ) ); + + testcases[tc++] = new TestCase( SECTION, + "InstanceOf( pat, Object )", + true, + InstanceOf( pat, Object ) ); + + testcases[tc++] = new TestCase( SECTION, + "InstanceOf( pat, SalesPerson )", + false, + InstanceOf ( pat, SalesPerson ) ); + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js new file mode 100644 index 0000000..4e92b9b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js @@ -0,0 +1,115 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_11.js + Section: + Description: Global Information in Constructors + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_11"; + var VERSION = "JS1_3"; + var TITLE = "Global Information in Constructors"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + var idCounter = 1; + + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; + this.id = idCounter++; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer ( name, projs, machine ) { + this.base = WorkerBee; + this.base( name, "engineering", projs ) + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var pat = new Employee( "Toonces, Pat", "Tech Pubs" ) + var terry = new Employee( "O'Sherry Terry", "Marketing" ); + + var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" ); + + testcases[tc++] = new TestCase( SECTION, + "pat.id", + 5, + pat.id ); + + testcases[tc++] = new TestCase( SECTION, + "terry.id", + 6, + terry.id ); + + testcases[tc++] = new TestCase( SECTION, + "les.id", + 7, + les.id ); + + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js new file mode 100644 index 0000000..93081a0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js @@ -0,0 +1,142 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_12.js + Section: + Description: new PrototypeObject + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + No Multiple Inheritance + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_12"; + var VERSION = "JS1_3"; + var TITLE = "No Multiple Inheritance"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; + this.id = idCounter++; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Hobbyist( hobby ) { + this.hobby = hobby || "yodeling"; +} + +function Engineer ( name, projs, machine, hobby ) { + this.base1 = WorkerBee; + this.base1( name, "engineering", projs ) + + this.base2 = Hobbyist; + this.base2( hobby ); + + this.projects = projs || new Array(); + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var idCounter = 1; + + var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" ); + + Hobbyist.prototype.equipment = [ "horn", "mountain", "goat" ]; + + testcases[tc++] = new TestCase( SECTION, + "les.name", + "Morris, Les", + les.name ); + + testcases[tc++] = new TestCase( SECTION, + "les.dept", + "engineering", + les.dept ); + + Array.prototype.getClass = Object.prototype.toString; + + testcases[tc++] = new TestCase( SECTION, + "les.projects.getClass()", + "[object Array]", + les.projects.getClass() ); + + testcases[tc++] = new TestCase( SECTION, + "les.projects[0]", + "JavaScript", + les.projects[0] ); + + testcases[tc++] = new TestCase( SECTION, + "les.machine", + "indy", + les.machine ); + + testcases[tc++] = new TestCase( SECTION, + "les.hobby", + "yodeling", + les.hobby ); + + testcases[tc++] = new TestCase( SECTION, + "les.equpment", + void 0, + les.equipment ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js new file mode 100644 index 0000000..1300ed3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js @@ -0,0 +1,122 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_2.js + Section: + Description: new PrototypeObject + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_2"; + var VERSION = "JS1_3"; + var TITLE = "new PrototypeObject"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee () { + this.name = ""; + this.dept = "general"; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee () { + this.projects = new Array(); +} + +WorkerBee.prototype = new Employee; + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee; + +function Engineer () { + this.dept = "engineering"; + this.machine = ""; +} +Engineer.prototype = new WorkerBee; + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + + var employee = new Employee(); + var manager = new Manager(); + var workerbee = new WorkerBee(); + var salesperson = new SalesPerson(); + var engineer = new Engineer(); + + testcases[tc++] = new TestCase( SECTION, + "employee.__proto__ == Employee.prototype", + true, + employee.__proto__ == Employee.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "manager.__proto__ == Manager.prototype", + true, + manager.__proto__ == Manager.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "workerbee.__proto__ == WorkerBee.prototype", + true, + workerbee.__proto__ == WorkerBee.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "salesperson.__proto__ == SalesPerson.prototype", + true, + salesperson.__proto__ == SalesPerson.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "engineer.__proto__ == Engineer.prototype", + true, + engineer.__proto__ == Engineer.prototype ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js new file mode 100644 index 0000000..61fa033 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js @@ -0,0 +1,103 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_3.js + Section: + Description: Adding properties to an instance + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_3"; + var VERSION = "JS1_3"; + var TITLE = "Adding properties to an Instance"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee () { + this.name = ""; + this.dept = "general"; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee () { + this.projects = new Array(); +} + +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer () { + this.dept = "engineering"; + this.machine = ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var jim = new Employee(); + var pat = new Employee(); + + jim.bonus = 300; + + testcases[tc++] = new TestCase( SECTION, + "jim = new Employee(); jim.bonus = 300; jim.bonus", + 300, + jim.bonus ); + + + testcases[tc++] = new TestCase( SECTION, + "pat = new Employee(); pat.bonus", + void 0, + pat.bonus ); + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js new file mode 100644 index 0000000..2006f76 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js @@ -0,0 +1,156 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_4.js + Section: + Description: new PrototypeObject + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + If you add a property to an object in the prototype chain, instances of + objects that derive from that prototype should inherit that property, even + if they were instatiated after the property was added to the prototype object. + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_3"; + var VERSION = "JS1_3"; + var TITLE = "Adding properties to the prototype"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee () { + this.name = ""; + this.dept = "general"; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee () { + this.projects = new Array(); +} + +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer () { + this.dept = "engineering"; + this.machine = ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + + var jim = new Employee(); + var terry = new Engineer(); + var sean = new SalesPerson(); + var wally = new Manager(); + + Employee.prototype.specialty = "none"; + + var pat = new Employee(); + var leslie = new Engineer(); + var bubbles = new SalesPerson(); + var furry = new Manager(); + + Engineer.prototype.specialty = "code"; + + var chris = new Engineer(); + + + testcases[tc++] = new TestCase( SECTION, + "jim = new Employee(); jim.specialty", + "none", + jim.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "terry = new Engineer(); terry.specialty", + "code", + terry.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "sean = new SalesPerson(); sean.specialty", + "none", + sean.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "wally = new Manager(); wally.specialty", + "none", + wally.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "furry = new Manager(); furry.specialty", + "none", + furry.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "pat = new Employee(); pat.specialty", + "none", + pat.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "leslie = new Engineer(); leslie.specialty", + "code", + leslie.specialty ); + + testcases[tc++] = new TestCase( SECTION, + "bubbles = new SalesPerson(); bubbles.specialty", + "none", + bubbles.specialty ); + + + testcases[tc++] = new TestCase( SECTION, + "chris = new Employee(); chris.specialty", + "code", + chris.specialty ); + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js new file mode 100644 index 0000000..4c84d33 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js @@ -0,0 +1,146 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_5.js + Section: + Description: Logical OR || in Constructors + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + This tests the logical OR opererator || syntax in constructors. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_5"; + var VERSION = "JS1_3"; + var TITLE = "Logical OR || in Constructors"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee ( projs ) { + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer ( machine ) { + this.dept = "engineering"; + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + + + var pat = new Engineer( "indy" ); + + var les = new Engineer(); + + testcases[tc++] = new TestCase( SECTION, + "var pat = new Engineer(\"indy\"); pat.name", + "", + pat.name ); + + testcases[tc++] = new TestCase( SECTION, + "pat.dept", + "engineering", + pat.dept ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects.length", + 0, + pat.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "pat.machine", + "indy", + pat.machine ); + + testcases[tc++] = new TestCase( SECTION, + "pat.__proto__ == Engineer.prototype", + true, + pat.__proto__ == Engineer.prototype ); + + testcases[tc++] = new TestCase( SECTION, + "var les = new Engineer(); les.name", + "", + les.name ); + + testcases[tc++] = new TestCase( SECTION, + "les.dept", + "engineering", + les.dept ); + + testcases[tc++] = new TestCase( SECTION, + "les.projects.length", + 0, + les.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "les.machine", + "", + les.machine ); + + testcases[tc++] = new TestCase( SECTION, + "les.__proto__ == Engineer.prototype", + true, + les.__proto__ == Engineer.prototype ); + + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js new file mode 100644 index 0000000..15d4bdd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js @@ -0,0 +1,171 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_6.js + Section: + Description: Logical OR || in constructors + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + This tests the logical OR opererator || syntax in constructors. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_6"; + var VERSION = "JS1_3"; + var TITLE = "Logical OR || in constructors"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} +function Manager () { + this.reports = []; +} +Manager.prototype = new Employee(); + +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} + +WorkerBee.prototype = new Employee(); + +function SalesPerson () { + this.dept = "sales"; + this.quota = 100; +} +SalesPerson.prototype = new WorkerBee(); + +function Engineer ( name, projs, machine ) { + this.base = WorkerBee; + this.base( name, "engineering", projs ) + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + + var pat = new Engineer( "Toonces, Pat", + ["SpiderMonkey", "Rhino"], + "indy" ); + + var les = new WorkerBee( "Morris, Les", + "Training", + ["Hippo"] ) + + var terry = new Employee( "Boomberi, Terry", + "Marketing" ); + + // Pat, the Engineer + + testcases[tc++] = new TestCase( SECTION, + "pat.name", + "Toonces, Pat", + pat.name ); + + testcases[tc++] = new TestCase( SECTION, + "pat.dept", + "engineering", + pat.dept ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects.length", + 2, + pat.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects[0]", + "SpiderMonkey", + pat.projects[0] ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects[1]", + "Rhino", + pat.projects[1] ); + + testcases[tc++] = new TestCase( SECTION, + "pat.machine", + "indy", + pat.machine ); + + + // Les, the WorkerBee + + testcases[tc++] = new TestCase( SECTION, + "les.name", + "Morris, Les", + les.name ); + + testcases[tc++] = new TestCase( SECTION, + "les.dept", + "Training", + les.dept ); + + testcases[tc++] = new TestCase( SECTION, + "les.projects.length", + 1, + les.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "les.projects[0]", + "Hippo", + les.projects[0] ); + + // Terry, the Employee + testcases[tc++] = new TestCase( SECTION, + "terry.name", + "Boomberi, Terry", + terry.name ); + + testcases[tc++] = new TestCase( SECTION, + "terry.dept", + "Marketing", + terry.dept ); + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js new file mode 100644 index 0000000..207fa17 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js @@ -0,0 +1,125 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_7.js + Section: + Description: Adding Properties to the Prototype Object + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + This tests + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_6"; + var VERSION = "JS1_3"; + var TITLE = "Adding properties to the Prototype Object"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function Engineer ( name, projs, machine ) { + this.base = WorkerBee; + this.base( name, "engineering", projs ) + this.machine = machine || ""; +} +// Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var pat = new Engineer( "Toonces, Pat", + ["SpiderMonkey", "Rhino"], + "indy" ); + + Employee.prototype.specialty = "none"; + + + // Pat, the Engineer + + testcases[tc++] = new TestCase( SECTION, + "pat.name", + "Toonces, Pat", + pat.name ); + + testcases[tc++] = new TestCase( SECTION, + "pat.dept", + "engineering", + pat.dept ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects.length", + 2, + pat.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects[0]", + "SpiderMonkey", + pat.projects[0] ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects[1]", + "Rhino", + pat.projects[1] ); + + testcases[tc++] = new TestCase( SECTION, + "pat.machine", + "indy", + pat.machine ); + + testcases[tc++] = new TestCase( SECTION, + "pat.specialty", + void 0, + pat.specialty ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js new file mode 100644 index 0000000..fa92d70 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js @@ -0,0 +1,123 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_8.js + Section: + Description: Adding Properties to the Prototype Object + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_8"; + var VERSION = "JS1_3"; + var TITLE = "Adding Properties to the Prototype Object"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} +function WorkerBee ( name, dept, projs ) { + this.base = Employee; + this.base( name, dept) + this.projects = projs || new Array(); +} +WorkerBee.prototype = new Employee(); + +function Engineer ( name, projs, machine ) { + this.base = WorkerBee; + this.base( name, "engineering", projs ) + this.machine = machine || ""; +} +Engineer.prototype = new WorkerBee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var pat = new Engineer( "Toonces, Pat", + ["SpiderMonkey", "Rhino"], + "indy" ); + + Employee.prototype.specialty = "none"; + + + // Pat, the Engineer + + testcases[tc++] = new TestCase( SECTION, + "pat.name", + "Toonces, Pat", + pat.name ); + + testcases[tc++] = new TestCase( SECTION, + "pat.dept", + "engineering", + pat.dept ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects.length", + 2, + pat.projects.length ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects[0]", + "SpiderMonkey", + pat.projects[0] ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects[1]", + "Rhino", + pat.projects[1] ); + + testcases[tc++] = new TestCase( SECTION, + "pat.machine", + "indy", + pat.machine ); + + testcases[tc++] = new TestCase( SECTION, + "pat.specialty", + "none", + pat.specialty ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js new file mode 100644 index 0000000..93989ca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js @@ -0,0 +1,101 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: proto_9.js + Section: + Description: Local versus Inherited Values + + This tests Object Hierarchy and Inheritance, as described in the document + Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 + 15:19:34 on http://devedge.netscape.com/. Current URL: + http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm + + This tests the syntax ObjectName.prototype = new PrototypeObject using the + Employee example in the document referenced above. + + This tests + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "proto_9"; + var VERSION = "JS1_3"; + var TITLE = "Local versus Inherited Values"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + +function Employee ( name, dept ) { + this.name = name || ""; + this.dept = dept || "general"; +} +function WorkerBee ( name, dept, projs ) { + this.projects = new Array(); +} +WorkerBee.prototype = new Employee(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + var pat = new WorkerBee() + + Employee.prototype.specialty = "none"; + Employee.prototype.name = "Unknown"; + + Array.prototype.getClass = Object.prototype.toString; + + // Pat, the WorkerBee + + testcases[tc++] = new TestCase( SECTION, + "pat.name", + "", + pat.name ); + + testcases[tc++] = new TestCase( SECTION, + "pat.dept", + "general", + pat.dept ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects.getClass", + "[object Array]", + pat.projects.getClass() ); + + testcases[tc++] = new TestCase( SECTION, + "pat.projects.length", + 0, + pat.projects.length ); + + test();
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js new file mode 100644 index 0000000..dd611a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js @@ -0,0 +1,198 @@ +var completed = false; +var testcases; + +SECTION = ""; +VERSION = ""; + +BUGNUMBER =""; +var EXCLUDE = ""; + +TZ_DIFF = -8; + +var TT = ""; +var TT_ = ""; +var BR = ""; +var NBSP = " "; +var CR = "\n"; +var FONT = ""; +var FONT_ = ""; +var FONT_RED = ""; +var FONT_GREEN = ""; +var B = ""; +var B_ = "" +var H2 = ""; +var H2_ = ""; +var HR = ""; +var DEBUG = false; + +version(130); + +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} +function startTest() { + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.3" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.2" ) { + version ( "120" ); + } + if ( VERSION == "JS_1.1" ) { + version ( "110" ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = TT + string ; + + for ( k = 0; + k < (60 - string.length >= 0 ? 60 - string.length : 5) ; + k++ ) { + } + + s += B ; + s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; + + writeLineToLog( s + FONT_ + B_ + TT_ ); + + return passed; +} + +function writeLineToLog( string ) { + print( string + BR + CR ); +} +function writeHeaderToLog( string ) { + print( H2 + string + H2_ ); +} +function stopTest() +{ + var sizeTag = "<#TEST CASES SIZE>"; + var doneTag = "<#TEST CASES DONE>"; + var beginTag = "<#TEST CASE "; + var endTag = ">"; + + print(sizeTag); + print(testcases.length); + for (tc = 0; tc < testcases.length; tc++) + { + print(beginTag + 'PASSED' + endTag); + print(testcases[tc].passed); + print(beginTag + 'NAME' + endTag); + print(testcases[tc].name); + print(beginTag + 'EXPECTED' + endTag); + print(testcases[tc].expect); + print(beginTag + 'ACTUAL' + endTag); + print(testcases[tc].actual); + print(beginTag + 'DESCRIPTION' + endTag); + print(testcases[tc].description); + print(beginTag + 'REASON' + endTag); + print(( testcases[tc].passed ) ? "" : "wrong value "); + print(beginTag + 'BUGNUMBER' + endTag); + print( BUGNUMBER ); + } + print(doneTag); + + print( HR ); + gc(); +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} +function err( msg, page, line ) { + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} + +function Enumerate ( o ) { + var p; + for ( p in o ) { + writeLineToLog( p +": " + o[p] ); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js new file mode 100644 index 0000000..e2f4332 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: delete-001.js + Section: regress + Description: + + Regression test for + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "JS1_2"; + var VERSION = "JS1_2"; + var TITLE = "The variable statment"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + // delete all properties of the global object + // per ecma, this does not affect variables in the global object declared + // with var or functions + + for ( p in this ) { + delete p; + } + + var result =""; + + for ( p in this ) { + result += String( p ); + } + + // not too picky here... just want to make sure we didn't crash or something + + testcases[testcases.length] = new TestCase( SECTION, + "delete all properties of the global object", + "PASSED", + result == "" ? "FAILED" : "PASSED" ); + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js new file mode 100644 index 0000000..5b4add0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js @@ -0,0 +1,74 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: boolean-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 + * + * eval("function f(){}function g(){}") at top level is an error for JS1.2 + * and above (missing ; between named function expressions), but declares f + * and g as functions below 1.2. + * + * Fails to produce error regardless of version: + * js> version(100) + * 120 + * js> eval("function f(){}function g(){}") + * js> version(120); + * 100 + * js> eval("function f(){}function g(){}") + * js> + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "function-001.js"; + var VERSION = "JS_1.3"; + var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; + var BUGNUMBER="10278"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "eval(\"function f(){}function g(){}\")", + "error", + eval("function f(){}function g(){}") ); + + test(); + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js new file mode 100644 index 0000000..d3d1d85 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: function-002.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579 + + function definitions in conditional statements should be allowed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "function-002"; + var VERSION = "JS1_3"; + var TITLE = "Regression test for 249579"; + var BUGNUMBER="249579"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "0?function(){}:0", + 0, + 0?function(){}:0 ); + + + bar = true; + foo = bar ? function () { return true; } : function() { return false; }; + + testcases[tc++] = new TestCase( + SECTION, + "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", + true, + foo() ); + + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js new file mode 100644 index 0000000..f524870 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js @@ -0,0 +1,66 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: in-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109 + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "in-001"; + var VERSION = "JS1_3"; + var TITLE = "Regression test for 196109"; + var BUGNUMBER="196109"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + o = {}; + o.foo = 'sil'; + + testcases[tc++] = new TestCase( + SECTION, + "\"foo\" in o", + true, + "foo" in o ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js new file mode 100644 index 0000000..2868eca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js @@ -0,0 +1,120 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: new-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "new-001"; + var VERSION = "JS1_3"; + var TITLE = "new-001"; + var BUGNUMBER="31567"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + function Test_One (x) { + this.v = x+1; + return x*2 + } + + function Test_Two( x, y ) { + this.v = x; + return y; + } + + testcases[tc++] = new TestCase( + SECTION, + "Test_One(18)", + 36, + Test_One(18) ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_One(18)", + "[object Object]", + new Test_One(18) +"" ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_One(18).v", + 19, + new Test_One(18).v ); + + testcases[tc++] = new TestCase( + SECTION, + "Test_Two(2,7)", + 7, + Test_Two(2,7) ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_Two(2,7)", + "[object Object]", + new Test_Two(2,7) +"" ); + + testcases[tc++] = new TestCase( + SECTION, + "new Test_Two(2,7).v", + 2, + new Test_Two(2,7).v ); + + testcases[tc++] = new TestCase( + SECTION, + "new (Function)(\"x\", \"return x+3\")(5,6)", + 8, + new (Function)("x","return x+3")(5,6) ); + + testcases[tc++] = new TestCase( + SECTION, + "new new Test_Two(String, 2).v(0123)", + "83", + new new Test_Two(String, 2).v(0123) +""); + + testcases[tc++] = new TestCase( + SECTION, + "new new Test_Two(String, 2).v(0123).length", + 2, + new new Test_Two(String, 2).v(0123).length ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js new file mode 100644 index 0000000..47d8a44 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: switch-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 + + Verify that switches do not use strict equality in + versions of JavaScript < 1.4. It's now been decided that + we won't put in version switches, so all switches will + be ECMA. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + var SECTION = "switch-001"; + var VERSION = "JS1_3"; + var TITLE = "switch-001"; + var BUGNUMBER="315767"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + result = "fail: did not enter switch"; + + switch (true) { + case 1: + result = "fail: version 130 should force strict equality"; + break; + case true: + result = "pass"; + break; + default: + result = "fail: evaluated default statement"; + } + + testcases[tc++] = new TestCase( + SECTION, + "switch / case should use strict equality in version of JS < 1.4", + "pass", + result ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_3/shell.js new file mode 100644 index 0000000..dc0ec4e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/shell.js @@ -0,0 +1,163 @@ +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; +DEBUG = false; + +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} + +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) { + writeLineToLog( "added " + this.description ); + } +} +function startTest() { + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( 130 ); + } + if ( VERSION == "JS_1.3" ) { + version ( 130 ); + } + if ( VERSION == "JS_1.2" ) { + version ( 120 ); + } + if ( VERSION == "JS_1.1" ) { + version ( 110 ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers + // need to replace w/ IEEE standard for rounding + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = TT + string ; + + for ( k = 0; + k < (60 - string.length >= 0 ? 60 - string.length : 5) ; + k++ ) { + } + + s += B ; + s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; + + writeLineToLog( s + FONT_ + B_ + TT_ ); + + return passed; +} +/* + * Begin printing functions. These functions use the shell's + * print function. When running tests in the browser, these + * functions, override these functions with functions that use + * document.write. + */ + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +/* end of print functions */ + +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/template.js b/Source/JavaScriptCore/tests/mozilla/js1_3/template.js new file mode 100644 index 0000000..1958832 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_3/template.js @@ -0,0 +1,44 @@ +/** + File Name: switch_1.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 + + Verify that switches do not use strict equality in + versions of JavaScript < 1.4 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +// onerror = err; + + var SECTION = "script_1; + var VERSION = "JS1_3"; + var TITLE = "NativeScript"; + var BUGNUMBER="31567"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var tc = 0; + var testcases = new Array(); + + + testcases[tc++] = new TestCase( SECTION, + + + test(); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js new file mode 100644 index 0000000..38f9d04 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js @@ -0,0 +1,75 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: eval-001.js + * Original Description: (SEE REVISED DESCRIPTION FURTHER BELOW) + * + * The global eval function may not be accessed indirectly and then called. + * This feature will continue to work in JavaScript 1.3 but will result in an + * error in JavaScript 1.4. This restriction is also in place for the With and + * Closure constructors. + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + * + * REVISION: 05 February 2001 + * Author: pschwartau@netscape.com + * + * Indirect eval IS NOT ILLEGAL per ECMA3!!! See + * + * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 + * + * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- + * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, + * see the short, section-less Chapter 16. It does say an implementation that + * doesn't throw EvalError must allow assignment to eval and indirect calls + * of the evalnative method. + * + */ + var SECTION = "eval-001.js"; + var VERSION = "JS1_4"; + var TITLE = "Calling eval indirectly should NOT fail in version 140"; + var BUGNUMBER="38512"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var MY_EVAL = eval; + var RESULT = ""; + var EXPECT = "abcdefg"; + + MY_EVAL( "RESULT = EXPECT" ); + + testcases[tc++] = new TestCase( + SECTION, + "Call eval indirectly", + EXPECT, + RESULT ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js new file mode 100644 index 0000000..159a9bd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js @@ -0,0 +1,80 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: eval-002.js + * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) + * + * The global eval function may not be accessed indirectly and then called. + * This feature will continue to work in JavaScript 1.3 but will result in an + * error in JavaScript 1.4. This restriction is also in place for the With and + * Closure constructors. + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + * + * REVISION: 05 February 2001 + * Author: pschwartau@netscape.com + * + * Indirect eval IS NOT ILLEGAL per ECMA3!!! See + * + * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 + * + * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- + * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, + * see the short, section-less Chapter 16. It does say an implementation that + * doesn't throw EvalError must allow assignment to eval and indirect calls + * of the evalnative method. + * + */ + var SECTION = "eval-002.js"; + var VERSION = "JS1_4"; + var TITLE = "Calling eval indirectly should NOT fail in version 140"; + var BUGNUMBER="38512"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var MY_EVAL = eval; + var RESULT = ""; + var EXPECT = 1 + "testString" + + EvalTest(); + + test(); + + +function EvalTest() +{ + MY_EVAL( "RESULT = EXPECT" ); + + testcases[tc++] = new TestCase( + SECTION, + "Call eval indirectly", + EXPECT, + RESULT ); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js new file mode 100644 index 0000000..5c9f1ea --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js @@ -0,0 +1,85 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: eval-003.js + * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) + * + * The global eval function may not be accessed indirectly and then called. + * This feature will continue to work in JavaScript 1.3 but will result in an + * error in JavaScript 1.4. This restriction is also in place for the With and + * Closure constructors. + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * + * + * REVISION: 05 February 2001 + * Author: pschwartau@netscape.com + * + * Indirect eval IS NOT ILLEGAL per ECMA3!!! See + * + * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 + * + * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- + * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, + * see the short, section-less Chapter 16. It does say an implementation that + * doesn't throw EvalError must allow assignment to eval and indirect calls + * of the evalnative method. + * + */ + var SECTION = "eval-003.js"; + var VERSION = "JS1_4"; + var TITLE = "Calling eval indirectly should NOT fail in version 140"; + var BUGNUMBER="38512"; + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var MY_EVAL = eval; + var RESULT = ""; + var EXPECT= ""; + var h = function f(x,y){var g = function(z){return Math.exp(z);}; return g(x+y);}; + + + new EvalTest(); + + test(); + +function EvalTest() +{ + with( this ) + { + MY_EVAL( "RESULT = h(-1, 1)" ); + EXPECT = 1; //The base e to the power (-1 + 1), i.e. the power 0, equals 1 .... + + testcases[tc++] = new TestCase( + SECTION, + "Call eval indirectly", + EXPECT, + RESULT ); + } +} + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js new file mode 100644 index 0000000..c1e6a3d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js @@ -0,0 +1,106 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: function-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324455 + * + * Earlier versions of JavaScript supported access to the arguments property + * of the function object. This property held the arguments to the function. + * function f() { + * return f.arguments[0]; // deprecated + * } + * var x = f(3); // x will be 3 + * + * This feature is not a part of the final ECMA standard. Instead, scripts + * should simply use just "arguments": + * + * function f() { + * return arguments[0]; // okay + * } + * + * var x = f(3); // x will be 3 + * + * Again, this feature was motivated by performance concerns. Access to the + * arguments property is not threadsafe, which is of particular concern in + * server environments. Also, the compiler can generate better code for + * functions because it can tell when the arguments are being accessed only by + * name and avoid setting up the arguments object. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "function-001.js"; + var VERSION = "JS1_4"; + var TITLE = "Accessing the arguments property of a function object"; + var BUGNUMBER="324455"; + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "return function.arguments", + "P", + TestFunction_2("P", "A","S","S")[0] +""); + + + testcases[tc++] = new TestCase( + SECTION, + "return arguments", + "P", + TestFunction_1( "P", "A", "S", "S" )[0] +""); + + testcases[tc++] = new TestCase( + SECTION, + "return arguments when function contains an arguments property", + "PASS", + TestFunction_3( "P", "A", "S", "S" ) +""); + + testcases[tc++] = new TestCase( + SECTION, + "return function.arguments when function contains an arguments property", + "PASS", + TestFunction_4( "F", "A", "I", "L" ) +""); + + test(); + + function TestFunction_1( a, b, c, d, e ) { + return arguments; + } + + function TestFunction_2( a, b, c, d, e ) { + return TestFunction_2.arguments; + } + + function TestFunction_3( a, b, c, d, e ) { + var arguments = "PASS"; + return arguments; + } + + function TestFunction_4( a, b, c, d, e ) { + var arguments = "PASS"; + return TestFunction_4.arguments; + } + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js new file mode 100644 index 0000000..d6f9f59 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js @@ -0,0 +1,55 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: date-001-n.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=299903 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "date-001-n.js"; + var VERSION = "JS1_4"; + var TITLE = "Regression test case for 299903"; + var BUGNUMBER="299903"; + + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + function MyDate() { + this.foo = "bar"; + } + MyDate.prototype = new Date(); + + testcases[tc++] = new TestCase( + SECTION, + "function MyDate() { this.foo = \"bar\"; }; "+ + "MyDate.prototype = new Date(); " + + "new MyDate().toString()", + "error", + new MyDate().toString() ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js new file mode 100644 index 0000000..4fed009 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: function-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=325843 + * js> function f(a){var a,b;} + * + * causes an an assert on a null 'sprop' in the 'Variables' function in + * jsparse.c This will crash non-debug build. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "function-001.js"; + var VERSION = "JS1_4"; + var TITLE = "Regression test case for 325843"; + var BUGNUMBER="3258435"; + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + eval("function f1 (a){ var a,b; }"); + + function f2( a ) { var a, b; }; + + testcases[tc++] = new TestCase( + SECTION, + "eval(\"function f1 (a){ var a,b; }\"); "+ + "function f2( a ) { var a, b; }; typeof f1", + "function", + typeof f1 ); + + // force a function decompilation + + testcases[tc++] = new TestCase( + SECTION, + "typeof f1.toString()", + "string", + typeof f1.toString() ); + + testcases[tc++] = new TestCase( + SECTION, + "typeof f2", + "function", + typeof f2 ); + + // force a function decompilation + + testcases[tc++] = new TestCase( + SECTION, + "typeof f2.toString()", + "string", + typeof f2.toString() ); + + test(); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js new file mode 100644 index 0000000..0476869 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js @@ -0,0 +1,123 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: function-002.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=330462 + * js> function f(a){var a,b;} + * + * causes an an assert on a null 'sprop' in the 'Variables' function in + * jsparse.c This will crash non-debug build. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + * REVISED: 04 February 2001 + * (changed the comma expressions from trivial to non-trivial) + * Author: pschwartau@netscape.com + * + * Brendan: "The test seemed to require something that ECMA does not + * guarantee, and that JS1.4 didn't either. For example, given + * + * dec2 = "function f2(){1,2}"; + * + * the engine is free to decompile a function object compiled from this source, + * via Function.prototype.toString(), into some other string that compiles to + * an equivalent function. The engine now eliminates the useless comma expression + * 1,2, giving function f2(){}. This should be legal by the testsuite's lights." + * + */ + var SECTION = "function-002.js"; + var VERSION = "JS1_4"; + var TITLE = "Regression test case for 325843"; + var BUGNUMBER="330462"; + + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + dec1 = "function f1(x,y){++x, --y}"; + dec2 = "function f2(){var y; f1(1,2); y=new Date(); print(y.toString())}"; + + eval(dec1); + eval(dec2); + + testcases[tc++] = new TestCase( + SECTION, + "typeof f1", + "function", + typeof f1 ); + + + // force a function decompilation + testcases[tc++] = new TestCase( + SECTION, + "f1.toString() == dec1", + true, + StripSpaces(f1.toString()) == StripSpaces(dec1)); + + testcases[tc++] = new TestCase( + SECTION, + "typeof f2", + "function", + typeof f2 ); + + // force a function decompilation + + testcases[tc++] = new TestCase( + SECTION, + "f2.toString() == dec2", + true, + StripSpaces(f2.toString()) == StripSpaces(dec2)); + + test(); + + function StripSpaces( s ) { + var strippedString = ""; + for ( var currentChar = 0; currentChar < s.length; currentChar++ ) { + if (!IsWhiteSpace(s.charAt(currentChar))) { + strippedString += s.charAt(currentChar); + } + } + return strippedString; + } + + function IsWhiteSpace( string ) { + var cc = string.charCodeAt(0); + + switch (cc) { + case (0x0009): + case (0x000B): + case (0x000C): + case (0x0020): + case (0x000A): + case (0x000D): + case ( 59 ): // let's strip out semicolons, too + return true; + break; + default: + return false; + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js new file mode 100644 index 0000000..1cf1ea3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: function-003.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104766 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "toString-001.js"; + var VERSION = "JS1_4"; + var TITLE = "Regression test case for 104766"; + var BUGNUMBER="310514"; + + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( + SECTION, + "StripSpaces(Array.prototype.concat.toString()).substring(0,17)", + "functionconcat(){", + StripSpaces(Array.prototype.concat.toString()).substring(0,17)); + + test(); + + function StripSpaces( s ) { + for ( var currentChar = 0, strippedString=""; + currentChar < s.length; currentChar++ ) + { + if (!IsWhiteSpace(s.charAt(currentChar))) { + strippedString += s.charAt(currentChar); + } + } + return strippedString; + } + + function IsWhiteSpace( string ) { + var cc = string.charCodeAt(0); + switch (cc) { + case (0x0009): + case (0x000B): + case (0x000C): + case (0x0020): + case (0x000A): + case (0x000D): + case ( 59 ): // let's strip out semicolons, too + return true; + break; + default: + return false; + } + } + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js new file mode 100644 index 0000000..5b94505 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js @@ -0,0 +1,51 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: function-004.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=310502 + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "funtion-004-n.js"; + var VERSION = "JS1_4"; + var TITLE = "Regression test case for 310502"; + var BUGNUMBER="310502"; + + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + var o = {}; + o.call = Function.prototype.call; + + testcases[tc++] = new TestCase( + SECTION, + "var o = {}; o.call = Function.prototype.call; o.call()", + "error", + o.call() ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js new file mode 100644 index 0000000..b63ecaa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js @@ -0,0 +1,72 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: regress-7224.js + * Reference: js1_2 + * Description: Remove support for the arg + * Author: ** replace with your e-mail address ** + */ + + var SECTION = "regress"; // provide a document reference (ie, ECMA section) + var VERSION = "JS1_4"; // Version of JavaScript or ECMA + var TITLE = "Regression test for bugzilla #7224"; // Provide ECMA section title or a description + var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7224"; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + /* + * Calls to AddTestCase here. AddTestCase is a function that is defined + * in shell.js and takes three arguments: + * - a string representation of what is being tested + * - the expected result + * - the actual result + * + * For example, a test might look like this: + * + * var zip = /[\d]{5}$/; + * + * AddTestCase( + * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test + * "02134", // expected result + * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result + * + */ + + var f = new Function( "return arguments.caller" ); + var o = {}; + + o.foo = f; + o.foo("a", "b", "c") + + + AddTestCase( + "var f = new Function( 'return arguments.caller' ); f()", + undefined, + f() ); + + AddTestCase( + "var o = {}; o.foo = f; o.foo('a')", + undefined, + o.foo('a') ); + + test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js new file mode 100644 index 0000000..c075373 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js @@ -0,0 +1,53 @@ +/* The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + * File Name: toString-001-n.js + * Description: + * + * Function.prototype.toString is not generic. + * + * Author: christine@netscape.com + * Date: 11 August 1998 + */ + var SECTION = "toString-001.js"; + var VERSION = "JS1_4"; + var TITLE = "Regression test case for 310514"; + var BUGNUMBER="310514"; + + startTest(); + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + + var o = {}; + o.toString = Function.prototype.toString; + + + testcases[tc++] = new TestCase( + SECTION, + "var o = {}; o.toString = Function.prototype.toString; o.toString();", + "error", + o.toString() ); + + test(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_4/browser.js new file mode 100644 index 0000000..5bbdf7c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/browser.js @@ -0,0 +1,80 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/* + * JavaScript test library shared functions file for running the tests + * in the browser. Overrides the shell's print function with document.write + * and make everything HTML pretty. + * + * To run the tests in the browser, use the mkhtml.pl script to generate + * html pages that include the shell.js, browser.js (this file), and the + * test js file in script tags. + * + * The source of the page that is generated should look something like this: + * <script src="./../shell.js"></script> + * <script src="./../browser.js"></script> + * <script src="./mytest.js"></script> + */ + +onerror = err; + +function startTest() { + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + +function writeLineToLog( string ) { + document.write( string + "<br>\n"); +} +function writeHeaderToLog( string ) { + document.write( "<h2>" + string + "</h2>" ); +} +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } + document.write( "<hr>" ); +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = "<tt>"+ string ; + s += "<b>" ; + s += ( passed ) ? "<font color=#009900> " + PASSED + : "<font color=#aa0000> " + FAILED + expect + "</tt>"; + writeLineToLog( s + "</font></b></tt>" ); + return passed; +} +function err( msg, page, line ) { + writeLineToLog( "Test failed with the message: " + msg ); + + testcases[tc].actual = "error"; + testcases[tc].reason = msg; + writeTestCaseResult( testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual + + ": " + testcases[tc].reason ); + stopTest(); + return true; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js new file mode 100644 index 0000000..982d14a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js @@ -0,0 +1,169 @@ +var completed = false; +var testcases; + +var BUGNUMBER=""; +var EXCLUDE = ""; + +var TT = ""; +var TT_ = ""; +var BR = ""; +var NBSP = " "; +var CR = "\n"; +var FONT = ""; +var FONT_ = ""; +var FONT_RED = ""; +var FONT_GREEN = ""; +var B = ""; +var B_ = "" +var H2 = ""; +var H2_ = ""; +var HR = ""; + +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +version( 140 ); +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + + this.passed = getTestCaseResult( this.expect, this.actual ); +} +function startTest() { +/* + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.3" ) { + version ( "130" ); + } + if ( VERSION == "JS_1.2" ) { + version ( "120" ); + } + if ( VERSION == "JS_1.1" ) { + version ( "110" ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). +*/ +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, give a little leeway for rounding. + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = TT + string ; + + for ( k = 0; + k < (60 - string.length >= 0 ? 60 - string.length : 5) ; + k++ ) { +// s += NBSP; + } + + s += B ; + s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; + + writeLineToLog( s + FONT_ + B_ + TT_ ); + + return passed; +} + +function writeLineToLog( string ) { + print( string + BR + CR ); +} +function writeHeaderToLog( string ) { + print( H2 + string + H2_ ); +} +function stopTest() { + var sizeTag = "<#TEST CASES SIZE>"; + var doneTag = "<#TEST CASES DONE>"; + var beginTag = "<#TEST CASE "; + var endTag = ">"; + + print(sizeTag); + print(testcases.length); + for (tc = 0; tc < testcases.length; tc++) + { + print(beginTag + 'PASSED' + endTag); + print(testcases[tc].passed); + print(beginTag + 'NAME' + endTag); + print(testcases[tc].name); + print(beginTag + 'EXPECTED' + endTag); + print(testcases[tc].expect); + print(beginTag + 'ACTUAL' + endTag); + print(testcases[tc].actual); + print(beginTag + 'DESCRIPTION' + endTag); + print(testcases[tc].description); + print(beginTag + 'REASON' + endTag); + print(( testcases[tc].passed ) ? "" : "wrong value "); + print(beginTag + 'BUGNUMBER' + endTag); + print( BUGNUMBER ); + + } + print(doneTag); + gc(); +} +function getFailedCases() { + for ( var i = 0; i < testcases.length; i++ ) { + if ( ! testcases[i].passed ) { + print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_4/shell.js new file mode 100644 index 0000000..3afdc78 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_4/shell.js @@ -0,0 +1,138 @@ +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; + +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +/* wrapper for test cas constructor that doesn't require the SECTION + * argument. + */ + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + +function TestCase( n, d, e, a ) { + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + + this.passed = getTestCaseResult( this.expect, this.actual ); +} +function startTest() { +/* + // JavaScript 1.3 is supposed to be compliant ecma version 1.0 + if ( VERSION == "ECMA_1" ) { + version ( 130 ); + } + if ( VERSION == "JS_1.3" ) { + version ( 130 ); + } + if ( VERSION == "JS_1.2" ) { + version ( 120 ); + } + if ( VERSION == "JS_1.1" ) { + version ( 110 ); + } + // for ecma version 2.0, we will leave the javascript version to + // the default ( for now ). +*/ + + if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} +function getTestCaseResult( expect, actual ) { + // because ( NaN == NaN ) always returns false, need to do + // a special compare to see if we got the right result. + if ( actual != actual ) { + if ( typeof actual == "object" ) { + actual = "NaN object"; + } else { + actual = "NaN number"; + } + } + if ( expect != expect ) { + if ( typeof expect == "object" ) { + expect = "NaN object"; + } else { + expect = "NaN number"; + } + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, give a little leeway for rounding. + if ( !passed + && typeof(actual) == "number" + && typeof(expect) == "number" + ) { + if ( Math.abs(actual-expect) < 0.0000001 ) { + passed = true; + } + } + + // verify type is the same + if ( typeof(expect) != typeof(actual) ) { + passed = false; + } + + return passed; +} +/* + * Begin printing functions. These functions use the shell's + * print function. When running tests in the browser, these + * functions, override these functions with functions that use + * document.write. + */ + +function writeTestCaseResult( expect, actual, string ) { + var passed = getTestCaseResult( expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} +function writeFormattedResult( expect, actual, string, passed ) { + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} +function writeLineToLog( string ) { + print( string ); +} +function writeHeaderToLog( string ) { + print( string ); +} +/* end of print functions */ + +function stopTest() { + var gc; + if ( gc != undefined ) { + gc(); + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js new file mode 100644 index 0000000..fbb6440 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js @@ -0,0 +1,101 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* Date: 24 September 2001 +* +* SUMMARY: Truncating arrays that have decimal property names. +* From correspondence with Igor Bukanov <igor@icesoft.no>: +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Truncating arrays that have decimal property names'; +var BIG_INDEX = 4294967290; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var arr = Array(BIG_INDEX); +arr[BIG_INDEX - 1] = 'a'; +arr[BIG_INDEX - 10000] = 'b'; +arr[BIG_INDEX - 0.5] = 'c'; // not an array index - but a valid property name +// Truncate the array - +arr.length = BIG_INDEX - 5000; + + +// Enumerate its properties with for..in +var s = ''; +for (var i in arr) +{ + s += arr[i]; +} + + +/* + * We expect s == 'cb' or 'bc' (EcmaScript does not fix the order). + * Note 'c' is included: for..in includes ALL enumerable properties, + * not just array-index properties. The bug was: Rhino gave s == ''. + */ +status = inSection(1); +actual = sortThis(s); +expect = 'bc'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function sortThis(str) +{ + var chars = str.split(''); + chars = chars.sort(); + return chars.join(''); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js new file mode 100644 index 0000000..72232f8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js @@ -0,0 +1,98 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 27 September 2001 +* +* SUMMARY: Performance: truncating even very large arrays should be fast! +* See http://bugzilla.mozilla.org/show_bug.cgi?id=101964 +* +* Adjust this testcase if necessary. The FAST constant defines +* an upper bound in milliseconds for any truncation to take. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 101964; +var summary = 'Performance: truncating even very large arrays should be fast!'; +var BIG = 10000000; +var LITTLE = 10; +var FAST = 50; // array truncation should be 50 ms or less to pass the test +var MSG_FAST = 'Truncation took less than ' + FAST + ' ms'; +var MSG_SLOW = 'Truncation took '; +var MSG_MS = ' ms'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + + +status = inSection(1); +var arr = Array(BIG); +var start = new Date(); +arr.length = LITTLE; +actual = elapsedTime(start); +expect = FAST; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function elapsedTime(startTime) +{ + return new Date() - startTime; +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isThisFast(actual); + expectedvalues[UBound] = isThisFast(expect); + UBound++; +} + + +function isThisFast(ms) +{ + if (ms <= FAST) + return MSG_FAST; + return MSG_SLOW + ms + MSG_MS; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js new file mode 100644 index 0000000..41527df --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js @@ -0,0 +1,190 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): morse@netscape.com, pschwartau@netscape.com +* Date: 29 October 2001 +* +* SUMMARY: Regression test for bug 107138 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=107138 +* +* The bug: arr['1'] == undefined instead of arr['1'] == 'one'. +* The bug was intermittent and did not always occur... +* +* The cnSTRESS constant defines how many times to repeat this test. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var cnSTRESS = 10; +var cnDASH = '-'; +var bug = 107138; +var summary = 'Regression test for bug 107138'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var arr = ['zero', 'one', 'two', 'three', 'four', 'five', + 'six', 'seven', 'eight', 'nine', 'ten']; + + +// This bug was intermittent. Stress-test it. +for (var j=0; j<cnSTRESS; j++) +{ + status = inSection(j + cnDASH + 1); + actual = arr[0]; + expect = 'zero'; + addThis(); + + status = inSection(j + cnDASH + 2); + actual = arr['0']; + expect = 'zero'; + addThis(); + + status = inSection(j + cnDASH + 3); + actual = arr[1]; + expect = 'one'; + addThis(); + + status = inSection(j + cnDASH + 4); + actual = arr['1']; + expect = 'one'; + addThis(); + + status = inSection(j + cnDASH + 5); + actual = arr[2]; + expect = 'two'; + addThis(); + + status = inSection(j + cnDASH + 6); + actual = arr['2']; + expect = 'two'; + addThis(); + + status = inSection(j + cnDASH + 7); + actual = arr[3]; + expect = 'three'; + addThis(); + + status = inSection(j + cnDASH + 8); + actual = arr['3']; + expect = 'three'; + addThis(); + + status = inSection(j + cnDASH + 9); + actual = arr[4]; + expect = 'four'; + addThis(); + + status = inSection(j + cnDASH + 10); + actual = arr['4']; + expect = 'four'; + addThis(); + + status = inSection(j + cnDASH + 11); + actual = arr[5]; + expect = 'five'; + addThis(); + + status = inSection(j + cnDASH + 12); + actual = arr['5']; + expect = 'five'; + addThis(); + + status = inSection(j + cnDASH + 13); + actual = arr[6]; + expect = 'six'; + addThis(); + + status = inSection(j + cnDASH + 14); + actual = arr['6']; + expect = 'six'; + addThis(); + + status = inSection(j + cnDASH + 15); + actual = arr[7]; + expect = 'seven'; + addThis(); + + status = inSection(j + cnDASH + 16); + actual = arr['7']; + expect = 'seven'; + addThis(); + + status = inSection(j + cnDASH + 17); + actual = arr[8]; + expect = 'eight'; + addThis(); + + status = inSection(j + cnDASH + 18); + actual = arr['8']; + expect = 'eight'; + addThis(); + + status = inSection(j + cnDASH + 19); + actual = arr[9]; + expect = 'nine'; + addThis(); + + status = inSection(j + cnDASH + 20); + actual = arr['9']; + expect = 'nine'; + addThis(); + + status = inSection(j + cnDASH + 21); + actual = arr[10]; + expect = 'ten'; + addThis(); + + status = inSection(j + cnDASH + 22); + actual = arr['10']; + expect = 'ten'; + addThis(); +} + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js new file mode 100644 index 0000000..f3d83fb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js @@ -0,0 +1,103 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, Liorean@user.bip.net +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 30 October 2001 +* SUMMARY: Regression test for bug 108440 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=108440 +* +* We shouldn't crash trying to add an array as an element of itself (!) +* +* Brendan: "...it appears that Array.prototype.toString is unsafe, +* and what's more, ECMA-262 Edition 3 has no helpful words about +* avoiding recursive death on a cycle." +*/ +//----------------------------------------------------------------------------- +var bug = 108440; +var summary = "Shouldn't crash trying to add an array as an element of itself"; +var self = this; +var temp = ''; + +printBugNumber(bug); +printStatus(summary); + +/* + * Explicit test: + */ +var a=[]; +temp = (a[a.length]=a); + +/* + * Implicit test (one of the properties of |self| is |a|) + */ +a=[]; +for(var prop in self) +{ + temp = prop; + temp = (a[a.length] = self[prop]); +} + +/* + * Stressful explicit test + */ +a=[]; +for (var i=0; i<10; i++) +{ + a[a.length] = a; +} + +/* + * Test toString() + */ +a=[]; +for (var i=0; i<10; i++) +{ + a[a.length] = a.toString(); +} + +/* + * Test toSource() - but Rhino doesn't have this, so try...catch it + */ +a=[]; +try +{ + for (var i=0; i<10; i++) + { + a[a.length] = a.toSource(); + } +} +catch(e) +{ +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js new file mode 100644 index 0000000..ced8ef5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js @@ -0,0 +1,119 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 June 2002 +* SUMMARY: Testing array.join() when separator is a variable, not a literal +* See http://bugzilla.mozilla.org/show_bug.cgi?id=154338 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 154338; +var summary = 'Test array.join() when separator is a variable, not a literal'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Note that x === 'H' and y === 'ome'. + * + * Yet for some reason, using |x| or |y| as the separator + * in arr.join() was causing out-of-memory errors, whereas + * using the literals 'H', 'ome' was not - + * + */ +var x = 'Home'[0]; +var y = ('Home'.split('H'))[1]; + + +status = inSection(1); +var arr = Array('a', 'b'); +actual = arr.join('H'); +expect = 'aHb'; +addThis(); + +status = inSection(2); +arr = Array('a', 'b'); +actual = arr.join(x); +expect = 'aHb'; +addThis(); + +status = inSection(3); +arr = Array('a', 'b'); +actual = arr.join('ome'); +expect = 'aomeb'; +addThis(); + +status = inSection(4); +arr = Array('a', 'b'); +actual = arr.join(y); +expect = 'aomeb'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js new file mode 100644 index 0000000..226b871 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js @@ -0,0 +1,136 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): zen-parse@gmx.net, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 16 July 2002 +* SUMMARY: Testing that Array.sort() doesn't crash on very large arrays +* See http://bugzilla.mozilla.org/show_bug.cgi?id=157652 +* +* How large can a JavaScript array be? +* ECMA-262 Ed.3 Final, Section 15.4.2.2 : new Array(len) +* +* This states that |len| must be a a uint32 (unsigned 32-bit integer). +* Note the UBound for uint32's is 2^32 -1 = 0xFFFFFFFF = 4,294,967,295. +* +* Check: +* js> var arr = new Array(0xFFFFFFFF) +* js> arr.length +* 4294967295 +* +* js> var arr = new Array(0x100000000) +* RangeError: invalid array length +* +* +* We'll try the largest possible array first, then a couple others. +* We're just testing that we don't crash on Array.sort(). +* +* Try to be good about memory by nulling each array variable after it is +* used. This will tell the garbage collector the memory is no longer needed. +* +* As of 2002-08-13, the JS shell runs out of memory no matter what we do, +* when trying to sort such large arrays. +* +* We only want to test that we don't CRASH on the sort. So it will be OK +* if we get the JS "out of memory" error. Note this terminates the test +* with exit code 3. Therefore we put +* +* |expectExitCode(3);| +* +* The only problem will arise if the JS shell ever DOES have enough memory +* to do the sort. Then this test will terminate with the normal exit code 0 +* and fail. +* +* Right now, I can't see any other way to do this, because "out of memory" +* is not a catchable error: it cannot be trapped with try...catch. +* +* +* FURTHER HEADACHE: Rhino can't seem to handle the largest array: it hangs. +* So we skip this case in Rhino. Here is correspondence with Igor Bukanov. +* He explains that Rhino isn't actually hanging; it's doing the huge sort: +* +* Philip Schwartau wrote: +* +* > Hi, +* > +* > I'm getting a graceful OOM message on trying to sort certain large +* > arrays. But if the array is too big, Rhino simply hangs. Note that ECMA +* > allows array lengths to be anything less than Math.pow(2,32), so the +* > arrays I'm sorting are legal. +* > +* > Note below, I'm getting an instantaneous OOM error on arr.sort() for LEN +* > = Math.pow(2, 30). So shouldn't I also get one for every LEN between +* > that and Math.pow(2, 32)? For some reason, I start to hang with 100% CPU +* > as LEN hits, say, Math.pow(2, 31) and higher. SpiderMonkey gives OOM +* > messages for all of these. Should I file a bug on this? +* +* Igor Bukanov wrote: +* +* This is due to different sorting algorithm Rhino uses when sorting +* arrays with length > Integer.MAX_VALUE. If length can fit Java int, +* Rhino first copies internal spare array to a temporary buffer, and then +* sorts it, otherwise it sorts array directly. In case of very spare +* arrays, that Array(big_number) generates, it is rather inefficient and +* generates OutOfMemory if length fits int. It may be worth in your case +* to optimize sorting to take into account array spareness, but then it +* would be a good idea to file a bug about ineficient sorting of spare +* arrays both in case of Rhino and SpiderMonkey as SM always uses a +* temporary buffer. +* +*/ +//----------------------------------------------------------------------------- +var bug = 157652; +var summary = "Testing that Array.sort() doesn't crash on very large arrays"; + +printBugNumber(bug); +printStatus(summary); + +// JSC doesn't run out of memory, so we don't expect an abnormal exit code +//expectExitCode(3); +var IN_RHINO = inRhino(); + +if (!IN_RHINO) +{ + var a1=Array(0xFFFFFFFF); + a1.sort(); + a1 = null; +} + +var a2 = Array(0x40000000); +a2.sort(); +a2=null; + +var a3=Array(0x10000000/4); +a3.sort(); +a3=null; diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js new file mode 100644 index 0000000..994b381 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js @@ -0,0 +1,175 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 06 November 2002 +* SUMMARY: arr.sort() should not output |undefined| when |arr| is empty +* See http://bugzilla.mozilla.org/show_bug.cgi?id=178722 +* +* ECMA-262 Ed.3: 15.4.4.11 Array.prototype.sort (comparefn) +* +* 1. Call the [[Get]] method of this object with argument "length". +* 2. Call ToUint32(Result(1)). +* 3. Perform an implementation-dependent sequence of calls to the [[Get]], +* [[Put]], and [[Delete]] methods of this object, etc. etc. +* 4. Return this object. +* +* +* Note that sort() is done in-place on |arr|. In other words, sort() is a +* "destructive" method rather than a "functional" method. The return value +* of |arr.sort()| and |arr| are the same object. +* +* If |arr| is an empty array, the return value of |arr.sort()| should be +* an empty array, not the value |undefined| as was occurring in bug 178722. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 178722; +var summary = 'arr.sort() should not output |undefined| when |arr| is empty'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr; + + +// create empty array or pseudo-array objects in various ways +var arr1 = Array(); +var arr2 = new Array(); +var arr3 = []; +var arr4 = [1]; +arr4.pop(); +function f () {return arguments}; +var arr5 = f(); +arr5.__proto__ = Array.prototype; + + +status = inSection(1); +arr = arr1.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr1; +expect = true; +addThis(); + +status = inSection(2); +arr = arr2.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr2; +expect = true; +addThis(); + +status = inSection(3); +arr = arr3.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr3; +expect = true; +addThis(); + +status = inSection(4); +arr = arr4.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr4; +expect = true; +addThis(); + +status = inSection(5); +arr = arr5.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr5; +expect = true; +addThis(); + + +// now do the same thing, with non-default sorting: +function g() {return 1;} + +status = inSection('1a'); +arr = arr1.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr1; +expect = true; +addThis(); + +status = inSection('2a'); +arr = arr2.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr2; +expect = true; +addThis(); + +status = inSection('3a'); +arr = arr3.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr3; +expect = true; +addThis(); + +status = inSection('4a'); +arr = arr4.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr4; +expect = true; +addThis(); + +status = inSection('5a'); +arr = arr5.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr5; +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js new file mode 100644 index 0000000..28ab667 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js @@ -0,0 +1,99 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): wtam@bigfoot.com, pschwartau@netscape.com +* Date: 30 October 2001 +* +* SUMMARY: Regression test for bug 94257 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=94257 +* +* Rhino used to crash on this code; specifically, on the line +* +* arr[1+1] += 2; +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 94257; +var summary = "Making sure we don't crash on this code -"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var arr = new Array(6); +arr[1+1] = 1; +arr[1+1] += 2; + + +status = inSection(1); +actual = arr[1+1]; +expect = 3; +addThis(); + +status = inSection(2); +actual = arr[1+1+1]; +expect = undefined; +addThis(); + +status = inSection(3); +actual = arr[1]; +expect = undefined; +addThis(); + + +arr[1+2] = 'Hello'; + + +status = inSection(4); +actual = arr[1+1+1]; +expect = 'Hello'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js new file mode 100644 index 0000000..37b10ae --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var EXCEPTION_DATA = "String exception"; + var e; + + printStatus ("Catchguard syntax negative test."); + + try + { + throw EXCEPTION_DATA; + } + catch (e) /* the non-guarded catch should HAVE to appear last */ + { + + } + catch (e if true) + { + + } + catch (e if false) + { + + } + + reportFailure ("Illegally constructed catchguard should have thrown " + + "an exception."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js new file mode 100644 index 0000000..e65723e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var EXCEPTION_DATA = "String exception"; + var e = "foo"; + var caught = false; + + printStatus ("Basic catchguard test."); + + try + { + throw EXCEPTION_DATA; + } + catch (e if true) + { + caught = true; + e = "this change should not propagate outside of this scope"; + } + catch (e if false) + { + reportFailure ("Catch block (e if false) should not have executed."); + } + catch (e) + { + reportFailure ("Catch block (e) should not have executed."); + } + + if (!caught) + reportFailure ("Execption was never caught."); + + if (e != "foo") + reportFailure ("Exception data modified inside catch() scope should " + + "not be visible in the function scope (e = '" + + e + "'.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js new file mode 100644 index 0000000..4446dd4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +function test() +{ + enterFunc ("test"); + + var EXCEPTION_DATA = "String exception"; + var e; + + printStatus ("Catchguard var declaration negative test."); + + try + { + throw EXCEPTION_DATA; + } + catch (var e) + { + + } + + reportFailure ("var in catch clause should have caused an error."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js new file mode 100644 index 0000000..4e89078 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var EXCEPTION_DATA = "String exception"; + var e; + var caught = false; + + printStatus ("Basic catchguard test."); + + try + { + throw EXCEPTION_DATA; + } + catch (e if true) + { + caught = true; + } + catch (e if true) + { + reportFailure ("Second (e if true) catch block should not have " + + "executed."); + } + catch (e) + { + reportFailure ("Catch block (e) should not have executed."); + } + + if (!caught) + reportFailure ("Execption was never caught."); + + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js new file mode 100644 index 0000000..b5fca02 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var EXCEPTION_DATA = "String exception"; + var e; + + printStatus ("Catchguard syntax negative test #2."); + + try + { + throw EXCEPTION_DATA; + } + catch (e) + { + + } + catch (e) /* two non-guarded catch statements shoud generate an error */ + { + + } + + reportFailure ("Illegally constructed catchguard should have thrown " + + "an exception."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js new file mode 100644 index 0000000..2cb64a6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var EXCEPTION_DATA = "String exception"; + var e = "foo", x = "foo"; + var caught = false; + + printStatus ("Catchguard 'Common Scope' test."); + + try + { + throw EXCEPTION_DATA; + } + catch (e if ((x = 1) && false)) + { + reportFailure ("Catch block (e if ((x = 1) && false) should not " + + "have executed."); + } + catch (e if (x == 1)) + { + caught = true; + } + catch (e) + { + reportFailure ("Same scope should be used across all catchguards."); + } + + if (!caught) + reportFailure ("Execption was never caught."); + + if (e != "foo") + reportFailure ("Exception data modified inside catch() scope should " + + "not be visible in the function scope (e ='" + + e + "'.)"); + + if (x != 1) + reportFailure ("Data modified in 'catchguard expression' should " + + "be visible in the function scope (x = '" + + x + "'.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js new file mode 100644 index 0000000..4850d20 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js @@ -0,0 +1,274 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 28 Feb 2002 +* SUMMARY: Testing that Error.stack distinguishes between: +* +* A) top-level calls: myFunc(); +* B) no-name function calls: function() { myFunc();} () +* +* The stack frame for A) should begin with '@' +* The stack frame for B) should begin with '()' +* +* This behavior was coded by Brendan during his fix for bug 127136. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=127136#c13 +* +* Note: our function getStackFrames(err) orders the array of stack frames +* so that the 0th element will correspond to the highest frame, i.e. will +* correspond to a line in top-level code. The 1st element will correspond +* to the function that is called first, and so on... +* +* NOTE: At present Rhino does not have an Error.stack property. It is an +* ECMA extension, see http://bugzilla.mozilla.org/show_bug.cgi?id=123177 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Error.stack'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var myErr = ''; +var stackFrames = ''; + + +function A(x,y) +{ + return B(x+1,y+1); +} + +function B(x,z) +{ + return C(x+1,z+1); +} + +function C(x,y) +{ + return D(x+1,y+1); +} + +function D(x,z) +{ + try + { + throw new Error('meep!'); + } + catch (e) + { + return e; + } +} + + +myErr = A(44,13); +stackFrames = getStackFrames(myErr); + status = inSection(1); + actual = stackFrames[0].substring(0,1); + expect = '@'; + addThis(); + + status = inSection(2); + actual = stackFrames[1].substring(0,9); + expect = 'A(44,13)@'; + addThis(); + + status = inSection(3); + actual = stackFrames[2].substring(0,9); + expect = 'B(45,14)@'; + addThis(); + + status = inSection(4); + actual = stackFrames[3].substring(0,9); + expect = 'C(46,15)@'; + addThis(); + + status = inSection(5); + actual = stackFrames[4].substring(0,9); + expect = 'D(47,16)@'; + addThis(); + + + +myErr = A('44:foo','13:bar'); +stackFrames = getStackFrames(myErr); + status = inSection(6); + actual = stackFrames[0].substring(0,1); + expect = '@'; + addThis(); + + status = inSection(7); + actual = stackFrames[1].substring(0,21); + expect = 'A("44:foo","13:bar")@'; + addThis(); + + status = inSection(8); + actual = stackFrames[2].substring(0,23); + expect = 'B("44:foo1","13:bar1")@'; + addThis(); + + status = inSection(9); + actual = stackFrames[3].substring(0,25); + expect = 'C("44:foo11","13:bar11")@'; + addThis(); + + status = inSection(10); + actual = stackFrames[4].substring(0,27); + expect = 'D("44:foo111","13:bar111")@';; + addThis(); + + + +/* + * Make the first frame occur in a function with an empty name - + */ +myErr = function() { return A(44,13); } (); +stackFrames = getStackFrames(myErr); + status = inSection(11); + actual = stackFrames[0].substring(0,1); + expect = '@'; + addThis(); + + status = inSection(12); + actual = stackFrames[1].substring(0,3); + expect = '()@'; + addThis(); + + status = inSection(13); + actual = stackFrames[2].substring(0,9); + expect = 'A(44,13)@'; + addThis(); + +// etc. for the rest of the frames as above + + + +/* + * Make the first frame occur in a function with name 'anonymous' - + */ +var f = Function('return A(44,13);'); +myErr = f(); +stackFrames = getStackFrames(myErr); + status = inSection(14); + actual = stackFrames[0].substring(0,1); + expect = '@'; + addThis(); + + status = inSection(15); + actual = stackFrames[1].substring(0,12); + expect = 'anonymous()@'; + addThis(); + + status = inSection(16); + actual = stackFrames[2].substring(0,9); + expect = 'A(44,13)@'; + addThis(); + +// etc. for the rest of the frames as above + + + +/* + * Make a user-defined error via the Error() function - + */ +var message = 'Hi there!'; var fileName = 'file name'; var lineNumber = 0; +myErr = Error(message, fileName, lineNumber); +stackFrames = getStackFrames(myErr); + status = inSection(17); + actual = stackFrames[0].substring(0,1); + expect = '@'; + addThis(); + + +/* + * Now use the |new| keyword. Re-use the same params - + */ +myErr = new Error(message, fileName, lineNumber); +stackFrames = getStackFrames(myErr); + status = inSection(18); + actual = stackFrames[0].substring(0,1); + expect = '@'; + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Split the string |err.stack| along its '\n' delimiter. + * As of 2002-02-28 |err.stack| ends with the delimiter, so + * the resulting array has an empty string as its last element. + * + * Pop that useless element off before doing anything. + * Then reverse the array, for convenience of indexing - + */ +function getStackFrames(err) +{ + var arr = err.stack.split('\n'); + arr.pop(); + return arr.reverse(); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js new file mode 100644 index 0000000..7328749 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js @@ -0,0 +1,152 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): timeless@mac.com,pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 24 Jan 2002 +* SUMMARY: "Too much recursion" errors should be safely caught by try...catch +* See http://bugzilla.mozilla.org/show_bug.cgi?id=121658 +* +* In the cases below, we expect i>0. The bug was filed because we were getting +* i===0; i.e. |i| did not retain the value it had at the location of the error. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 121658; +var msg = '"Too much recursion" errors should be safely caught by try...catch'; +var TEST_PASSED = 'i retained the value it had at location of error'; +var TEST_FAILED = 'i did NOT retain this value'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var i; + + +function f() +{ + ++i; + + // try...catch should catch the "too much recursion" error to ensue + try + { + f(); + } + catch(e) + { + } +} + +i=0; +f(); +status = inSection(1); +actual = (i>0); +expect = true; +addThis(); + + + +// Now try in function scope - +function g() +{ + f(); +} + +i=0; +g(); +status = inSection(2); +actual = (i>0); +expect = true; +addThis(); + + + +// Now try in eval scope - +var sEval = 'function h(){++i; try{h();} catch(e){}}; i=0; h();'; +eval(sEval); +status = inSection(3); +actual = (i>0); +expect = true; +addThis(); + + + +// Try in eval scope and mix functions up - +sEval = 'function a(){++i; try{h();} catch(e){}}; i=0; a();'; +eval(sEval); +status = inSection(4); +actual = (i>0); +expect = true; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = formatThis(actual); + expectedvalues[UBound] = formatThis(expect); + UBound++; +} + + +function formatThis(bool) +{ + return bool? TEST_PASSED : TEST_FAILED; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(msg); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js new file mode 100644 index 0000000..aee6893 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js @@ -0,0 +1,129 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 01 Feb 2002 +* SUMMARY: Testing Error.length +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123002 +* +* NOTE: Error.length should equal the length of FormalParameterList of the +* Error constructor. This is currently 1 in Rhino, 3 in SpiderMonkey. +* +* The difference is due to http://bugzilla.mozilla.org/show_bug.cgi?id=50447. +* As a result of that bug, SpiderMonkey has extended ECMA to allow two new +* parameters to Error constructors: +* +* Rhino: new Error (message) +* SpiderMonkey: new Error (message, fileName, lineNumber) +* +* NOTE: since we have hard-coded the length expectations, this testcase will +* have to be changed if the Error FormalParameterList is ever changed again. +* +* To do this, just change the two LENGTH constants below - +*/ +//----------------------------------------------------------------------------- +var LENGTH_RHINO = 1; +var LENGTH_SPIDERMONKEY = 3; +var UBound = 0; +var bug = 123002; +var summary = 'Testing Error.length'; +var QUOTE = '"'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Are we in Rhino or SpiderMonkey? + */ +// var LENGTH_EXPECTED = inRhino()? LENGTH_RHINO : LENGTH_SPIDERMONKEY; +// ECMA spec says length should be 1 +var LENGTH_EXPECTED = 1; + +/* + * The various NativeError objects; see ECMA-262 Edition 3, Section 15.11.6 + */ +var errObjects = [new Error(), new EvalError(), new RangeError(), +new ReferenceError(), new SyntaxError(), new TypeError(), new URIError()]; + + +for (var i in errObjects) +{ + var err = errObjects[i]; + status = inSection(quoteThis(err.name)); + actual = Error.length; + expect = LENGTH_EXPECTED; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function quoteThis(text) +{ + return QUOTE + text + QUOTE; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js new file mode 100644 index 0000000..0133e88 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is Mozilla Communicator client code, released March +* 31, 1998. +* +* The Initial Developer of the Original Code is Netscape Communications +* Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): Rob Ginda rginda@netscape.com +* +* SUMMARY: New properties fileName, lineNumber have been added to Error objects +* in SpiderMonkey. These are non-ECMA extensions and do not exist in Rhino. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=50447 +*/ +//----------------------------------------------------------------------------- +var bug = 50447; +var summary = 'Test (non-ECMA) Error object properties fileName, lineNumber'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + testRealError(); + test1(); + test2(); + test3(); + test4(); + + exitFunc('test'); +} + + +function testRealError() +{ + /* throw a real error, and see what it looks like */ + enterFunc ("testRealError"); + + try + { + blabla; + } + catch (e) + { + if (e.fileName.search (/-50447\.js$/i) == -1) + reportFailure ("expected fileName to end with '-50447.js'"); + + reportCompare (61, e.lineNumber, + "lineNumber property returned unexpected value."); + } + + exitFunc ("testRealError"); +} + + +function test1() +{ + /* generate an error with msg, file, and lineno properties */ + enterFunc ("test1"); + + var e = new InternalError ("msg", "file", 2); + reportCompare ("(new InternalError(\"msg\", \"file\", 2))", + e.toSource(), + "toSource() returned unexpected result."); + reportCompare ("file", e.fileName, + "fileName property returned unexpected value."); + reportCompare (2, e.lineNumber, + "lineNumber property returned unexpected value."); + + exitFunc ("test1"); +} + + +function test2() +{ + /* generate an error with only msg property */ + enterFunc ("test2"); + + var e = new InternalError ("msg"); + reportCompare ("(new InternalError(\"msg\", \"\"))", + e.toSource(), + "toSource() returned unexpected result."); + reportCompare ("", e.fileName, + "fileName property returned unexpected value."); + reportCompare (0, e.lineNumber, + "lineNumber property returned unexpected value."); + + exitFunc ("test2"); +} + + +function test3() +{ + /* generate an error with only msg and lineNo properties */ + enterFunc ("test3"); + + var e = new InternalError ("msg"); + e.lineNumber = 10; + reportCompare ("(new InternalError(\"msg\", \"\", 10))", + e.toSource(), + "toSource() returned unexpected result."); + reportCompare ("", e.fileName, + "fileName property returned unexpected value."); + reportCompare (10, e.lineNumber, + "lineNumber property returned unexpected value."); + + exitFunc ("test3"); +} + + +function test4() +{ + /* generate an error with only msg and filename properties */ + enterFunc ("test4"); + + var e = new InternalError ("msg", "file"); + reportCompare ("(new InternalError(\"msg\", \"file\"))", + e.toSource(), + "toSource() returned unexpected result."); + reportCompare ("file", e.fileName, + "fileName property returned unexpected value."); + reportCompare (0, e.lineNumber, + "lineNumber property returned unexpected value."); + + exitFunc ("test4"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js new file mode 100644 index 0000000..830ec7d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js @@ -0,0 +1,114 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 07 February 2003 +* SUMMARY: Testing 0/0 inside functions +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=192288 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 192288; +var summary = 'Testing 0/0 inside functions '; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f() +{ + return 0/0; +} + +status = inSection(1); +actual = isNaN(f()); +expect = true; +addThis(); + +status = inSection(2); +actual = isNaN(f.apply(this)); +expect = true; +addThis(); + +status = inSection(3); +actual = isNaN(eval("f.apply(this)")); +expect = true; +addThis(); + +status = inSection(4); +actual = isNaN(Function('return 0/0;')()); +expect = true; +addThis(); + +status = inSection(5); +actual = isNaN(eval("Function('return 0/0;')()")); +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js new file mode 100644 index 0000000..13806bb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 29 Oct 2002 +* SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k] +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52 +* +* Brendan: "The idea is to cover all the 'use' and 'set' (as in modify) +* operations you can do on an expression like a[i][j][k], including variations +* where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc. +* (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)." +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 96526; +var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var z='magic'; +Number.prototype.magic=42; + +status = inSection(1); +actual = f(2,1,[1,2,[3,4]]); +expect = 42; +addThis(); + + +function f(j,k) +{ + status = inSection(2); + actual = formatArray(arguments[2]); + expect = formatArray([1,2,[3,4]]); + addThis(); + + status = inSection(3); + actual = formatArray(arguments[2][j]); + expect = formatArray([3,4]); + addThis(); + + status = inSection(4); + actual = arguments[2][j][k]; + expect = 4; + addThis(); + + status = inSection(5); + actual = arguments[2][j][k][z]; + expect = 42; + addThis(); + + return arguments[2][j][k][z]; +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js new file mode 100644 index 0000000..940bd79 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 29 Oct 2002 +* SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k] +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52 +* +* Brendan: "The idea is to cover all the 'use' and 'set' (as in modify) +* operations you can do on an expression like a[i][j][k], including variations +* where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc. +* (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)." +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 96526; +var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var z='magic'; +Number.prototype.magic=42; +f(2,1,[-1,0,[1,2,[3,4]]]); + +function f(j,k,a) +{ + status = inSection(1); + actual = formatArray(a[2]); + expect = formatArray([1,2,[3,4]]); + addThis(); + + status = inSection(2); + actual = formatArray(a[2][j]); + expect = formatArray([3,4]); + addThis(); + + status = inSection(3); + actual = a[2][j][k]; + expect = 4; + addThis(); + + status = inSection(4); + actual = a[2][j][k][z]; + expect = 42; + addThis(); + + delete a[2][j][k]; + + status = inSection(5); + actual = formatArray(a[2][j]); + expect = formatArray([3, undefined]); + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js new file mode 100644 index 0000000..33c28a3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 29 Oct 2002 +* SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k] +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52 +* +* Brendan: "The idea is to cover all the 'use' and 'set' (as in modify) +* operations you can do on an expression like a[i][j][k], including variations +* where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc. +* (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)." +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 96526; +var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var z='magic'; +Number.prototype.magic=42; + +status = inSection(1); +actual = f(2,1,[-1,0,[1,2,[3,4]]]); +expect = 42; +addThis(); + + +function f(j,k,a) +{ + status = inSection(2); + actual = formatArray(a[2]); + expect = formatArray([1,2,[3,4]]); + addThis(); + + status = inSection(3); + actual = formatArray(a[2][j]); + expect = formatArray([3,4]); + addThis(); + + status = inSection(4); + actual = a[2][j][k]; + expect = 4; + addThis(); + + status = inSection(5); + actual = a[2][j][k][z]; + expect = 42; + addThis(); + + return a[2][j][k][z]; +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js new file mode 100644 index 0000000..83cf771 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js @@ -0,0 +1,113 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 07 February 2001 +* +* Functionality common to Array testing - +*/ +//------------------------------------------------------------------------------------------------- +var CHAR_LBRACKET = '['; +var CHAR_RBRACKET = ']'; +var CHAR_QT_DBL = '"'; +var CHAR_QT = "'"; +var CHAR_NL = '\n'; +var CHAR_COMMA = ','; +var CHAR_SPACE = ' '; +var TYPE_STRING = typeof 'abc'; + + +/* + * If available, arr.toSource() gives more detail than arr.toString() + * + * var arr = Array(1,2,'3'); + * + * arr.toSource() + * [1, 2, "3"] + * + * arr.toString() + * 1,2,3 + * + * But toSource() doesn't exist in Rhino, so use our own imitation, below - + * + */ +function formatArray(arr) +{ + try + { + return arr.toSource(); + } + catch(e) + { + return toSource(arr); + } +} + + + +/* + * Imitate SpiderMonkey's arr.toSource() method: + * + * a) Double-quote each array element that is of string type + * b) Represent |undefined| and |null| by empty strings + * c) Delimit elements by a comma + single space + * d) Do not add delimiter at the end UNLESS the last element is |undefined| + * e) Add square brackets to the beginning and end of the string + */ +function toSource(arr) +{ + var delim = CHAR_COMMA + CHAR_SPACE; + var elt = ''; + var ret = ''; + var len = arr.length; + + for (i=0; i<len; i++) + { + elt = arr[i]; + + switch(true) + { + case (typeof elt === TYPE_STRING) : + ret += doubleQuote(elt); + break; + + case (elt === undefined || elt === null) : + break; // add nothing but the delimiter, below - + + default: + ret += elt.toString(); + } + + if ((i < len-1) || (elt === undefined)) + ret += delim; + } + + return CHAR_LBRACKET + ret + CHAR_RBRACKET; +} + + +function doubleQuote(text) +{ + return CHAR_QT_DBL + text + CHAR_QT_DBL; +} + + +function singleQuote(text) +{ + return CHAR_QT + text + CHAR_QT; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js new file mode 100644 index 0000000..2331398 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +function TestObject () +{ + /* A warm, dry place for properties and methods to live */ +} + +TestObject.prototype._y = "<initial y>"; + +TestObject.prototype.y getter = +function get_y () +{ + var rv; + + if (typeof this._y == "string") + rv = "got " + this._y; + else + rv = this._y; + + return rv; +} + +TestObject.prototype.y setter = +function set_y (newVal) +{ + this._y = newVal; +} + +test(new TestObject()); + +function test(t) +{ + enterFunc ("test"); + + printStatus ("Basic Getter/ Setter test"); + reportCompare ("<initial y>", t._y, "y prototype check"); + + reportCompare ("got <initial y>", t.y, "y getter, before set"); + + t.y = "new y"; + reportCompare ("got new y", t.y, "y getter, after set"); + + t.y = 2; + reportCompare (2, t.y, "y getter, after numeric set"); + + var d = new Date(); + t.y = d; + reportCompare (d, t.y, "y getter, after date set"); + +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js new file mode 100644 index 0000000..07d32ed --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +var t = { + _y: "<initial y>", + + y getter: function get_y () + { + var rv; + if (typeof this._y == "string") + rv = "got " + this._y; + else + rv = this._y; + + return rv; + }, + + y setter: function set_y (newVal) + { + this._y = newVal; + } +} + + +test(t); + +function test(t) +{ + enterFunc ("test"); + + printStatus ("Basic Getter/ Setter test (object literal notation)"); + + reportCompare ("<initial y>", t._y, "y prototype check"); + + reportCompare ("got <initial y>", t.y, "y getter, before set"); + + t.y = "new y"; + reportCompare ("got new y", t.y, "y getter, after set"); + + t.y = 2; + reportCompare (2, t.y, "y getter, after numeric set"); + + var d = new Date(); + t.y = d; + reportCompare (d, t.y, "y getter, after date set"); + +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js new file mode 100644 index 0000000..952d3d7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js @@ -0,0 +1,190 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 April 2001 +* +* SUMMARY: Testing obj.prop getter/setter +* Note: this is a non-ECMA extension to the language. +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing obj.prop getter/setter'; +var statprefix = 'Status: '; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var cnDEFAULT = 'default name'; +var cnFRED = 'Fred'; +var obj = {}; +var obj2 = {}; +var s = ''; + + +// SECTION1: define getter/setter directly on an object (not its prototype) +obj = new Object(); +obj.nameSETS = 0; +obj.nameGETS = 0; +obj.name setter = function(newValue) {this._name=newValue; this.nameSETS++;} +obj.name getter = function() {this.nameGETS++; return this._name;} + +status = 'In SECTION1 of test after 0 sets, 0 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,0]; +addThis(); + +s = obj.name; +status = 'In SECTION1 of test after 0 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION1 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION1 of test after 2 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,2]; +addThis(); + + +// SECTION2: define getter/setter in Object.prototype +Object.prototype.nameSETS = 0; +Object.prototype.nameGETS = 0; +Object.prototype.name setter = function(newValue) {this._name=newValue; this.nameSETS++;} +Object.prototype.name getter = function() {this.nameGETS++; return this._name;} + +obj = new Object(); +status = 'In SECTION2 of test after 0 sets, 0 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,0]; +addThis(); + +s = obj.name; +status = 'In SECTION2 of test after 0 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION2 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION2 of test after 2 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,2]; +addThis(); + + +// SECTION 3: define getter/setter in prototype of user-defined constructor +function TestObject() +{ +} +TestObject.prototype.nameSETS = 0; +TestObject.prototype.nameGETS = 0; +TestObject.prototype.name setter = function(newValue) {this._name=newValue; this.nameSETS++;} +TestObject.prototype.name getter = function() {this.nameGETS++; return this._name;} +TestObject.prototype.name = cnDEFAULT; + +obj = new TestObject(); +status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype) +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,0]; +addThis(); + +s = obj.name; +status = 'In SECTION3 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION3 of test after 2 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION3 of test after 3 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [3,2]; +addThis(); + +obj2 = new TestObject(); +status = 'obj2 = new TestObject() after 1 set, 0 gets'; +actual = [obj2.nameSETS,obj2.nameGETS]; +expect = [1,0]; // we set a default value in the prototype - +addThis(); + +// Use both obj and obj2 - +obj2.name = obj.name + obj2.name; + status = 'obj2 = new TestObject() after 2 sets, 1 get'; + actual = [obj2.nameSETS,obj2.nameGETS]; + expect = [2,1]; + addThis(); + + status = 'In SECTION3 of test after 3 sets, 3 gets'; + actual = [obj.nameSETS,obj.nameGETS]; + expect = [3,3]; // we left off at [3,2] above - + addThis(); + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual.toString(); + expectedvalues[UBound] = expect.toString(); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js new file mode 100644 index 0000000..4445e80 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js @@ -0,0 +1,190 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 April 2001 +* +* SUMMARY: Testing obj.__defineSetter__(), obj.__defineGetter__() +* Note: this is a non-ECMA language extension +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing obj.__defineSetter__(), obj.__defineGetter__()'; +var statprefix = 'Status: '; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var cnDEFAULT = 'default name'; +var cnFRED = 'Fred'; +var obj = {}; +var obj2 = {}; +var s = ''; + + +// SECTION1: define getter/setter directly on an object (not its prototype) +obj = new Object(); +obj.nameSETS = 0; +obj.nameGETS = 0; +obj.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;}); +obj.__defineGetter__('name', function() {this.nameGETS++; return this._name;}); + +status = 'In SECTION1 of test after 0 sets, 0 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,0]; +addThis(); + +s = obj.name; +status = 'In SECTION1 of test after 0 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION1 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION1 of test after 2 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,2]; +addThis(); + + +// SECTION2: define getter/setter in Object.prototype +Object.prototype.nameSETS = 0; +Object.prototype.nameGETS = 0; +Object.prototype.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;}); +Object.prototype.__defineGetter__('name', function() {this.nameGETS++; return this._name;}); + +obj = new Object(); +status = 'In SECTION2 of test after 0 sets, 0 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,0]; +addThis(); + +s = obj.name; +status = 'In SECTION2 of test after 0 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION2 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION2 of test after 2 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,2]; +addThis(); + + +// SECTION 3: define getter/setter in prototype of user-defined constructor +function TestObject() +{ +} +TestObject.prototype.nameSETS = 0; +TestObject.prototype.nameGETS = 0; +TestObject.prototype.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;}); +TestObject.prototype.__defineGetter__('name', function() {this.nameGETS++; return this._name;}); +TestObject.prototype.name = cnDEFAULT; + +obj = new TestObject(); +status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype) +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,0]; +addThis(); + +s = obj.name; +status = 'In SECTION3 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION3 of test after 2 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION3 of test after 3 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [3,2]; +addThis(); + +obj2 = new TestObject(); +status = 'obj2 = new TestObject() after 1 set, 0 gets'; +actual = [obj2.nameSETS,obj2.nameGETS]; +expect = [1,0]; // we set a default value in the prototype - +addThis(); + +// Use both obj and obj2 - +obj2.name = obj.name + obj2.name; + status = 'obj2 = new TestObject() after 2 sets, 1 get'; + actual = [obj2.nameSETS,obj2.nameGETS]; + expect = [2,1]; + addThis(); + + status = 'In SECTION3 of test after 3 sets, 3 gets'; + actual = [obj.nameSETS,obj.nameGETS]; + expect = [3,3]; // we left off at [3,2] above - + addThis(); + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual.toString(); + expectedvalues[UBound] = expect.toString(); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js new file mode 100644 index 0000000..c0e61f9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js @@ -0,0 +1,199 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 April 2001 +* +* SUMMARY: Testing obj.__defineSetter__(), obj.__defineGetter__() +* Note: this is a non-ECMA language extension +* +* This test is the same as getset-004.js, except that here we +* store the getter/setter functions in global variables. +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing obj.__defineSetter__(), obj.__defineGetter__()'; +var statprefix = 'Status: '; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var cnName = 'name'; +var cnDEFAULT = 'default name'; +var cnFRED = 'Fred'; +var obj = {}; +var obj2 = {}; +var s = ''; + + +// The getter/setter functions we'll use in all three sections below - +var cnNameSetter = function(newValue) {this._name=newValue; this.nameSETS++;}; +var cnNameGetter = function() {this.nameGETS++; return this._name;}; + + +// SECTION1: define getter/setter directly on an object (not its prototype) +obj = new Object(); +obj.nameSETS = 0; +obj.nameGETS = 0; +obj.__defineSetter__(cnName, cnNameSetter); +obj.__defineGetter__(cnName, cnNameGetter); + +status = 'In SECTION1 of test after 0 sets, 0 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,0]; +addThis(); + +s = obj.name; +status = 'In SECTION1 of test after 0 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION1 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION1 of test after 2 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,2]; +addThis(); + + +// SECTION2: define getter/setter in Object.prototype +Object.prototype.nameSETS = 0; +Object.prototype.nameGETS = 0; +Object.prototype.__defineSetter__(cnName, cnNameSetter); +Object.prototype.__defineGetter__(cnName, cnNameGetter); + +obj = new Object(); +status = 'In SECTION2 of test after 0 sets, 0 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,0]; +addThis(); + +s = obj.name; +status = 'In SECTION2 of test after 0 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [0,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION2 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION2 of test after 2 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,2]; +addThis(); + + +// SECTION 3: define getter/setter in prototype of user-defined constructor +function TestObject() +{ +} +TestObject.prototype.nameSETS = 0; +TestObject.prototype.nameGETS = 0; +TestObject.prototype.__defineSetter__(cnName, cnNameSetter); +TestObject.prototype.__defineGetter__(cnName, cnNameGetter); +TestObject.prototype.name = cnDEFAULT; + +obj = new TestObject(); +status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype) +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,0]; +addThis(); + +s = obj.name; +status = 'In SECTION3 of test after 1 set, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [1,1]; +addThis(); + +obj.name = cnFRED; +status = 'In SECTION3 of test after 2 sets, 1 get'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [2,1]; +addThis(); + +obj.name = obj.name; +status = 'In SECTION3 of test after 3 sets, 2 gets'; +actual = [obj.nameSETS,obj.nameGETS]; +expect = [3,2]; +addThis(); + +obj2 = new TestObject(); +status = 'obj2 = new TestObject() after 1 set, 0 gets'; +actual = [obj2.nameSETS,obj2.nameGETS]; +expect = [1,0]; // we set a default value in the prototype - +addThis(); + +// Use both obj and obj2 - +obj2.name = obj.name + obj2.name; + status = 'obj2 = new TestObject() after 2 sets, 1 get'; + actual = [obj2.nameSETS,obj2.nameGETS]; + expect = [2,1]; + addThis(); + + status = 'In SECTION3 of test after 3 sets, 3 gets'; + actual = [obj.nameSETS,obj.nameGETS]; + expect = [3,3]; // we left off at [3,2] above - + addThis(); + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual.toString(); + expectedvalues[UBound] = expect.toString(); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js new file mode 100644 index 0000000..8d35bc9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js @@ -0,0 +1,173 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 14 April 2001 +* +* SUMMARY: Testing obj.__lookupGetter__(), obj.__lookupSetter__() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=71992 +* +* Brendan: "I see no need to provide more than the minimum: +* o.__lookupGetter__('p') returns the getter function for o.p, +* or undefined if o.p has no getter. Users can wrap and layer." +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 71992; +var summary = 'Testing obj.__lookupGetter__(), obj.__lookupSetter__()'; +var statprefix = 'Status: '; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var cnName = 'name'; +var cnColor = 'color'; +var cnNonExistingProp = 'ASDF_#_$%'; +var cnDEFAULT = 'default name'; +var cnFRED = 'Fred'; +var cnRED = 'red'; +var obj = {}; +var obj2 = {}; +var s; + + +// The only setter and getter functions we'll use in the three sections below - +var cnNameSetter = function(newValue) {this._name=newValue; this.nameSETS++;}; +var cnNameGetter = function() {this.nameGETS++; return this._name;}; + + + +// SECTION1: define getter/setter directly on an object (not its prototype) +obj = new Object(); +obj.nameSETS = 0; +obj.nameGETS = 0; +obj.__defineSetter__(cnName, cnNameSetter); +obj.__defineGetter__(cnName, cnNameGetter); +obj.name = cnFRED; +obj.color = cnRED; + +status ='In SECTION1 of test; looking up extant getter/setter'; +actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)]; +expect = [cnNameSetter, cnNameGetter]; +addThis(); + +status = 'In SECTION1 of test; looking up nonexistent getter/setter'; +actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)]; +expect = [undefined, undefined]; +addThis(); + +status = 'In SECTION1 of test; looking up getter/setter on nonexistent property'; +actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)]; +expect = [undefined, undefined]; +addThis(); + + + +// SECTION2: define getter/setter in Object.prototype +Object.prototype.nameSETS = 0; +Object.prototype.nameGETS = 0; +Object.prototype.__defineSetter__(cnName, cnNameSetter); +Object.prototype.__defineGetter__(cnName, cnNameGetter); + +obj = new Object(); +obj.name = cnFRED; +obj.color = cnRED; + +status = 'In SECTION2 of test looking up extant getter/setter'; +actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)]; +expect = [cnNameSetter, cnNameGetter]; +addThis(); + +status = 'In SECTION2 of test; looking up nonexistent getter/setter'; +actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)]; +expect = [undefined, undefined]; +addThis(); + +status = 'In SECTION2 of test; looking up getter/setter on nonexistent property'; +actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)]; +expect = [undefined, undefined]; +addThis(); + + + +// SECTION 3: define getter/setter in prototype of user-defined constructor +function TestObject() +{ +} +TestObject.prototype.nameSETS = 0; +TestObject.prototype.nameGETS = 0; +TestObject.prototype.__defineSetter__(cnName, cnNameSetter); +TestObject.prototype.__defineGetter__(cnName, cnNameGetter); +TestObject.prototype.name = cnDEFAULT; + +obj = new TestObject(); +obj.name = cnFRED; +obj.color = cnRED; + +status = 'In SECTION3 of test looking up extant getter/setter'; +actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)]; +expect = [cnNameSetter, cnNameGetter]; +addThis(); + +status = 'In SECTION3 of test; looking up non-existent getter/setter'; +actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)]; +expect = [undefined, undefined]; +addThis(); + +status = 'In SECTION3 of test; looking up getter/setter on nonexistent property'; +actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)]; +expect = [undefined, undefined]; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual.toString(); + expectedvalues[UBound] = expect.toString(); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js new file mode 100644 index 0000000..42e947d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js @@ -0,0 +1,161 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* 26 November 2000 +* +* +*SUMMARY: Testing numeric literals that begin with 0. +*This test arose from Bugzilla bug 49233. +*The best explanation is from jsscan.c: +* +* "We permit 08 and 09 as decimal numbers, which makes +* our behaviour a superset of the ECMA numeric grammar. +* We might not always be so permissive, so we warn about it." +* +*Thus an expression 010 will evaluate, as always, as an octal (to 8). +*However, 018 will evaluate as a decimal, to 18. Even though the +*user began the expression as an octal, he later used a non-octal +*digit. We forgive this and assume he intended a decimal. If the +*JavaScript "strict" option is set though, we will give a warning. +*/ +//------------------------------------------------------------------------------------------------- +var bug = '49233'; +var summary = 'Testing numeric literals that begin with 0'; +var statprefix = 'Testing '; +var quote = "'"; +var status = new Array(); +var actual = new Array(); +var expect = new Array(); + + +status[0]=showStatus('01') +actual[0]=01 +expect[0]=1 + +status[1]=showStatus('07') +actual[1]=07 +expect[1]=7 + +status[2]=showStatus('08') +actual[2]=08 +expect[2]=8 + +status[3]=showStatus('09') +actual[3]=09 +expect[3]=9 + +status[4]=showStatus('010') +actual[4]=010 +expect[4]=8 + +status[5]=showStatus('017') +actual[5]=017 +expect[5]=15 + +status[6]=showStatus('018') +actual[6]=018 +expect[6]=18 + +status[7]=showStatus('019') +actual[7]=019 +expect[7]=19 + +status[8]=showStatus('079') +actual[8]=079 +expect[8]=79 + +status[9]=showStatus('0079') +actual[9]=0079 +expect[9]=79 + +status[10]=showStatus('099') +actual[10]=099 +expect[10]=99 + +status[11]=showStatus('0099') +actual[11]=0099 +expect[11]=99 + +status[12]=showStatus('000000000077') +actual[12]=000000000077 +expect[12]=63 + +status[13]=showStatus('000000000078') +actual[13]=000000000078 +expect[13]=78 + +status[14]=showStatus('0000000000770000') +actual[14]=0000000000770000 +expect[14]=258048 + +status[15]=showStatus('0000000000780000') +actual[15]=0000000000780000 +expect[15]=780000 + +status[16]=showStatus('0765432198') +actual[16]=0765432198 +expect[16]=765432198 + +status[17]=showStatus('00076543219800') +actual[17]=00076543219800 +expect[17]=76543219800 + +status[18]=showStatus('0000001001007') +actual[18]=0000001001007 +expect[18]=262663 + +status[19]=showStatus('0000001001009') +actual[19]=0000001001009 +expect[19]=1001009 + +status[20]=showStatus('070') +actual[20]=070 +expect[20]=56 + +status[21]=showStatus('080') +actual[21]=080 +expect[21]=80 + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function showStatus(msg) +{ + return (statprefix + quote + msg + quote); +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + + for (i=0; i !=status.length; i++) + { + reportCompare (expect[i], actual[i], status[i]); + } + + exitFunc ('test'); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js new file mode 100644 index 0000000..b085dfb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js @@ -0,0 +1,105 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 30 Oct 2002 +* SUMMARY: '\400' should lex as a 2-digit octal escape + '0' +* See http://bugzilla.mozilla.org/show_bug.cgi?id=177314 +* +* Bug was that Rhino interpreted '\400' as a 3-digit octal escape. As such +* it is invalid, since octal escapes may only run from '\0' to '\377'. But +* the lexer should interpret this as '\40' + '0' instead, and throw no error. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 177314; +var summary = "'\\" + "400' should lex as a 2-digit octal escape + '0'"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// the last valid octal escape is '\377', which should equal hex escape '\xFF' +status = inSection(1); +actual = '\377'; +expect = '\xFF'; +addThis(); + +// now exercise the lexer by going one higher in the last digit +status = inSection(2); +actual = '\378'; +expect = '\37' + '8'; +addThis(); + +// trickier: 400 is a valid octal number, but '\400' isn't a valid octal escape +status = inSection(3); +actual = '\400'; +expect = '\40' + '0'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js new file mode 100644 index 0000000..20a8a8e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js @@ -0,0 +1,235 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 03 June 2002 +* SUMMARY: Function param or local var with same name as a function property +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=137000 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=138708 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=150032 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=150859 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 137000; +var summary = 'Function param or local var with same name as a function prop'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Note use of 'x' both for the parameter to f, + * and as a property name for |f| as an object + */ +function f(x) +{ +} + +status = inSection(1); +f.x = 12; +actual = f.x; +expect = 12; +addThis(); + + + +/* + * A more elaborate example, using the call() method + * to chain constructors from child to parent. + * + * The key point is the use of the same name 'p' for both + * the parameter to the constructor, and as a property name + */ +function parentObject(p) +{ + this.p = 1; +} + +function childObject() +{ + parentObject.call(this); +} +childObject.prototype = parentObject; + +status = inSection(2); +var objParent = new parentObject(); +actual = objParent.p; +expect = 1; +addThis(); + +status = inSection(3); +var objChild = new childObject(); +actual = objChild.p; +expect = 1; +addThis(); + + + +/* + * A similar set-up. Here the same name is being used for + * the parameter to both the Base and Child constructors, + */ +function Base(id) +{ +} + +function Child(id) +{ + this.prop = id; +} +Child.prototype=Base; + +status = inSection(4); +var c1 = new Child('child1'); +actual = c1.prop; +expect = 'child1'; +addThis(); + + + +/* + * Use same identifier as a property name, too - + */ +function BaseX(id) +{ +} + +function ChildX(id) +{ + this.id = id; +} +ChildX.prototype=BaseX; + +status = inSection(5); +c1 = new ChildX('child1'); +actual = c1.id; +expect = 'child1'; +addThis(); + + + +/* + * From http://bugzilla.mozilla.org/show_bug.cgi?id=150032 + * + * Here the same name is being used both for a local variable + * declared in g(), and as a property name for |g| as an object + */ +function g() +{ + var propA = g.propA; + var propB = g.propC; + + this.getVarA = function() {return propA;} + this.getVarB = function() {return propB;} +} +g.propA = 'A'; +g.propB = 'B'; +g.propC = 'C'; +var obj = new g(); + +status = inSection(6); +actual = obj.getVarA(); // this one was returning 'undefined' +expect = 'A'; +addThis(); + +status = inSection(7); +actual = obj.getVarB(); // this one is easy; it never failed +expect = 'C'; +addThis(); + + + +/* + * By martin.honnen@t-online.de + * From http://bugzilla.mozilla.org/show_bug.cgi?id=150859 + * + * Here the same name is being used for a local var in F + * and as a property name for |F| as an object + * + * Twist: the property is added via another function. + */ +function setFProperty(val) +{ + F.propA = val; +} + +function F() +{ + var propA = 'Local variable in F'; +} + +status = inSection(8); +setFProperty('Hello'); +actual = F.propA; // this was returning 'undefined' +expect = 'Hello'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js new file mode 100644 index 0000000..fa19d8c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js @@ -0,0 +1,178 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 06 February 2003 +* SUMMARY: Using |instanceof| to check if function is called as a constructor +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=192105 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 192105; +var summary = 'Using |instanceof| to check if f() is called as constructor'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * This function is the heart of the test. It sets the result + * variable |actual|, which we will compare against |expect|. + * + * Note |actual| will be set to |true| or |false| according + * to whether or not this function is called as a constructor; + * i.e. whether it is called via the |new| keyword or not - + */ +function f() +{ + actual = (this instanceof f); +} + + +/* + * Call f as a constructor from global scope + */ +status = inSection(1); +new f(); // sets |actual| +expect = true; +addThis(); + +/* + * Now, not as a constructor + */ +status = inSection(2); +f(); // sets |actual| +expect = false; +addThis(); + + +/* + * Call f as a constructor from function scope + */ +function F() +{ + new f(); +} +status = inSection(3); +F(); // sets |actual| +expect = true; +addThis(); + +/* + * Now, not as a constructor + */ +function G() +{ + f(); +} +status = inSection(4); +G(); // sets |actual| +expect = false; +addThis(); + + +/* + * Now make F() and G() methods of an object + */ +var obj = {F:F, G:G}; +status = inSection(5); +obj.F(); // sets |actual| +expect = true; +addThis(); + +status = inSection(6); +obj.G(); // sets |actual| +expect = false; +addThis(); + + +/* + * Now call F() and G() from yet other functions, and use eval() + */ +function A() +{ + eval('F();'); +} +status = inSection(7); +A(); // sets |actual| +expect = true; +addThis(); + + +function B() +{ + eval('G();'); +} +status = inSection(8); +B(); // sets |actual| +expect = false; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js new file mode 100644 index 0000000..3b0fad6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js @@ -0,0 +1,278 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 28 August 2001 +* +* SUMMARY: A [DontEnum] prop, if overridden, should appear in toSource(). +* See http://bugzilla.mozilla.org/show_bug.cgi?id=90596 +* +* NOTE: some inefficiencies in the test are made for the sake of readability. +* Sorting properties alphabetically is done for definiteness in comparisons. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 90596; +var summary = 'A [DontEnum] prop, if overridden, should appear in toSource()'; +var cnCOMMA = ','; +var cnLBRACE = '{'; +var cnRBRACE = '}'; +var cnLPAREN = '('; +var cnRPAREN = ')'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var obj = {}; + + +status = inSection(1); +obj = {toString:9}; +actual = obj.toSource(); +expect = '({toString:9})'; +addThis(); + +status = inSection(2); +obj = {hasOwnProperty:"Hi"}; +actual = obj.toSource(); +expect = '({hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(3); +obj = {toString:9, hasOwnProperty:"Hi"}; +actual = obj.toSource(); +expect = '({toString:9, hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(4); +obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}; +actual = obj.toSource(); +expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; +addThis(); + + +// TRY THE SAME THING IN EVAL CODE +var s = ''; + +status = inSection(5); +s = 'obj = {toString:9}'; +eval(s); +actual = obj.toSource(); +expect = '({toString:9})'; +addThis(); + +status = inSection(6); +s = 'obj = {hasOwnProperty:"Hi"}'; +eval(s); +actual = obj.toSource(); +expect = '({hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(7); +s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = obj.toSource(); +expect = '({toString:9, hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(8); +s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = obj.toSource(); +expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; +addThis(); + + +// TRY THE SAME THING IN FUNCTION CODE +function A() +{ + status = inSection(9); + var s = 'obj = {toString:9}'; + eval(s); + actual = obj.toSource(); + expect = '({toString:9})'; + addThis(); +} +A(); + +function B() +{ + status = inSection(10); + var s = 'obj = {hasOwnProperty:"Hi"}'; + eval(s); + actual = obj.toSource(); + expect = '({hasOwnProperty:"Hi"})'; + addThis(); +} +B(); + +function C() +{ + status = inSection(11); + var s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = obj.toSource(); + expect = '({toString:9, hasOwnProperty:"Hi"})'; + addThis(); +} +C(); + +function D() +{ + status = inSection(12); + var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = obj.toSource(); + expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; + addThis(); +} +D(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Sort properties alphabetically - + */ +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = sortThis(actual); + expectedvalues[UBound] = sortThis(expect); + UBound++; +} + + +/* + * Takes string of form '({"c", "b", "a", 2})' and returns '({"a","b","c",2})' + */ +function sortThis(sList) +{ + sList = compactThis(sList); + sList = stripParens(sList); + sList = stripBraces(sList); + var arr = sList.split(cnCOMMA); + arr = arr.sort(); + var ret = String(arr); + ret = addBraces(ret); + ret = addParens(ret); + return ret; +} + + +/* + * Strips out any whitespace from the text - + */ +function compactThis(text) +{ + var charCode = 0; + var ret = ''; + + for (var i=0; i<text.length; i++) + { + charCode = text.charCodeAt(i); + + if (!isWhiteSpace(charCode)) + ret += text.charAt(i); + } + + return ret; +} + + +function isWhiteSpace(charCode) +{ + switch (charCode) + { + case (0x0009): + case (0x000B): + case (0x000C): + case (0x0020): + case (0x000A): // '\n' + case (0x000D): // '\r' + return true; + break; + + default: + return false; + } +} + + +/* + * strips off parens at beginning and end of text - + */ +function stripParens(text) +{ + // remember to escape the parens... + var arr = text.match(/^\((.*)\)$/); + + // defend against a null match... + if (arr != null && arr[1] != null) + return arr[1]; + return text; +} + + +/* + * strips off braces at beginning and end of text - + */ +function stripBraces(text) +{ + // remember to escape the braces... + var arr = text.match(/^\{(.*)\}$/); + + // defend against a null match... + if (arr != null && arr[1] != null) + return arr[1]; + return text; +} + + +function addBraces(text) +{ + return cnLBRACE + text + cnRBRACE; +} + + +function addParens(text) +{ + return cnLPAREN + text + cnRPAREN; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js new file mode 100644 index 0000000..0d809a2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js @@ -0,0 +1,278 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 28 August 2001 +* +* SUMMARY: A [DontEnum] prop, if overridden, should appear in uneval(). +* See http://bugzilla.mozilla.org/show_bug.cgi?id=90596 +* +* NOTE: some inefficiencies in the test are made for the sake of readability. +* Sorting properties alphabetically is done for definiteness in comparisons. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 90596; +var summary = 'A [DontEnum] prop, if overridden, should appear in uneval()'; +var cnCOMMA = ','; +var cnLBRACE = '{'; +var cnRBRACE = '}'; +var cnLPAREN = '('; +var cnRPAREN = ')'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var obj = {}; + + +status = inSection(1); +obj = {toString:9}; +actual = uneval(obj); +expect = '({toString:9})'; +addThis(); + +status = inSection(2); +obj = {hasOwnProperty:"Hi"}; +actual = uneval(obj); +expect = '({hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(3); +obj = {toString:9, hasOwnProperty:"Hi"}; +actual = uneval(obj); +expect = '({toString:9, hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(4); +obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}; +actual = uneval(obj); +expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; +addThis(); + + +// TRY THE SAME THING IN EVAL CODE +var s = ''; + +status = inSection(5); +s = 'obj = {toString:9}'; +eval(s); +actual = uneval(obj); +expect = '({toString:9})'; +addThis(); + +status = inSection(6); +s = 'obj = {hasOwnProperty:"Hi"}'; +eval(s); +actual = uneval(obj); +expect = '({hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(7); +s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = uneval(obj); +expect = '({toString:9, hasOwnProperty:"Hi"})'; +addThis(); + +status = inSection(8); +s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = uneval(obj); +expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; +addThis(); + + +// TRY THE SAME THING IN FUNCTION CODE +function A() +{ + status = inSection(9); + var s = 'obj = {toString:9}'; + eval(s); + actual = uneval(obj); + expect = '({toString:9})'; + addThis(); +} +A(); + +function B() +{ + status = inSection(10); + var s = 'obj = {hasOwnProperty:"Hi"}'; + eval(s); + actual = uneval(obj); + expect = '({hasOwnProperty:"Hi"})'; + addThis(); +} +B(); + +function C() +{ + status = inSection(11); + var s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = uneval(obj); + expect = '({toString:9, hasOwnProperty:"Hi"})'; + addThis(); +} +C(); + +function D() +{ + status = inSection(12); + var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = uneval(obj); + expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; + addThis(); +} +D(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Sort properties alphabetically - + */ +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = sortThis(actual); + expectedvalues[UBound] = sortThis(expect); + UBound++; +} + + +/* + * Takes string of form '({"c", "b", "a", 2})' and returns '({"a","b","c",2})' + */ +function sortThis(sList) +{ + sList = compactThis(sList); + sList = stripParens(sList); + sList = stripBraces(sList); + var arr = sList.split(cnCOMMA); + arr = arr.sort(); + var ret = String(arr); + ret = addBraces(ret); + ret = addParens(ret); + return ret; +} + + +/* + * Strips out any whitespace from the text - + */ +function compactThis(text) +{ + var charCode = 0; + var ret = ''; + + for (var i=0; i<text.length; i++) + { + charCode = text.charCodeAt(i); + + if (!isWhiteSpace(charCode)) + ret += text.charAt(i); + } + + return ret; +} + + +function isWhiteSpace(charCode) +{ + switch (charCode) + { + case (0x0009): + case (0x000B): + case (0x000C): + case (0x0020): + case (0x000A): // '\n' + case (0x000D): // '\r' + return true; + break; + + default: + return false; + } +} + + +/* + * strips off parens at beginning and end of text - + */ +function stripParens(text) +{ + // remember to escape the parens... + var arr = text.match(/^\((.*)\)$/); + + // defend against a null match... + if (arr != null && arr[1] != null) + return arr[1]; + return text; +} + + +/* + * strips off braces at beginning and end of text - + */ +function stripBraces(text) +{ + // remember to escape the braces... + var arr = text.match(/^\{(.*)\}$/); + + // defend against a null match... + if (arr != null && arr[1] != null) + return arr[1]; + return text; +} + + +function addBraces(text) +{ + return cnLBRACE + text + cnRBRACE; +} + + +function addParens(text) +{ + return cnLPAREN + text + cnRPAREN; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js new file mode 100644 index 0000000..766fff5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js @@ -0,0 +1,290 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 28 August 2001 +* +* SUMMARY: A [DontEnum] prop, if overridden, should appear in for-in loops. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=90596 +* +* NOTE: some inefficiencies in the test are made for the sake of readability. +* For example, we quote string values like "Hi" in lines like this: +* +* actual = enumerateThis(obj); +* expect = '{prop:"Hi"}'; +* +* But enumerateThis(obj) gets literal value Hi for obj.prop, not literal "Hi". +* We take care of all these details in the compactThis(), sortThis() functions. +* Sorting properties alphabetically is necessary for the test to work in Rhino. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 90596; +var summary = '[DontEnum] props (if overridden) should appear in for-in loops'; +var cnCOMMA = ','; +var cnCOLON = ':'; +var cnLBRACE = '{'; +var cnRBRACE = '}'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var obj = {}; + + +status = inSection(1); +obj = {toString:9}; +actual = enumerateThis(obj); +expect = '{toString:9}'; +addThis(); + +status = inSection(2); +obj = {hasOwnProperty:"Hi"}; +actual = enumerateThis(obj); +expect = '{hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(3); +obj = {toString:9, hasOwnProperty:"Hi"}; +actual = enumerateThis(obj); +expect = '{toString:9, hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(4); +obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}; +actual = enumerateThis(obj); +expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}'; +addThis(); + + +// TRY THE SAME THING IN EVAL CODE +var s = ''; + +status = inSection(5); +s = 'obj = {toString:9}'; +eval(s); +actual = enumerateThis(obj); +expect = '{toString:9}'; +addThis(); + +status = inSection(6); +s = 'obj = {hasOwnProperty:"Hi"}'; +eval(s); +actual = enumerateThis(obj); +expect = '{hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(7); +s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = enumerateThis(obj); +expect = '{toString:9, hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(8); +s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = enumerateThis(obj); +expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}'; +addThis(); + + +// TRY THE SAME THING IN FUNCTION CODE +function A() +{ + status = inSection(9); + var s = 'obj = {toString:9}'; + eval(s); + actual = enumerateThis(obj); + expect = '{toString:9}'; + addThis(); +} +A(); + +function B() +{ + status = inSection(10); + var s = 'obj = {hasOwnProperty:"Hi"}'; + eval(s); + actual = enumerateThis(obj); + expect = '{hasOwnProperty:"Hi"}'; + addThis(); +} +B(); + +function C() +{ + status = inSection(11); + var s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = enumerateThis(obj); + expect = '{toString:9, hasOwnProperty:"Hi"}'; + addThis(); +} +C(); + +function D() +{ + status = inSection(12); + var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = enumerateThis(obj); + expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}'; + addThis(); +} +D(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function enumerateThis(obj) +{ + var arr = new Array(); + + for (var prop in obj) + { + arr.push(prop + cnCOLON + obj[prop]); + } + + var ret = addBraces(String(arr)); + return ret; +} + + +function addBraces(text) +{ + return cnLBRACE + text + cnRBRACE; +} + + +/* + * Sort properties alphabetically so the test will work in Rhino + */ +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = sortThis(actual); + expectedvalues[UBound] = sortThis(expect); + UBound++; +} + + +/* + * Takes a string of the form '{"c", "b", "a", 2}' and returns '{2,a,b,c}' + */ +function sortThis(sList) +{ + sList = compactThis(sList); + sList = stripBraces(sList); + var arr = sList.split(cnCOMMA); + arr = arr.sort(); + var ret = String(arr); + ret = addBraces(ret); + return ret; +} + + +/* + * Strips out any whitespace or quotes from the text - + */ +function compactThis(text) +{ + var charCode = 0; + var ret = ''; + + for (var i=0; i<text.length; i++) + { + charCode = text.charCodeAt(i); + + if (!isWhiteSpace(charCode) && !isQuote(charCode)) + ret += text.charAt(i); + } + + return ret; +} + + +function isWhiteSpace(charCode) +{ + switch (charCode) + { + case (0x0009): + case (0x000B): + case (0x000C): + case (0x0020): + case (0x000A): // '\n' + case (0x000D): // '\r' + return true; + break; + + default: + return false; + } +} + + +function isQuote(charCode) +{ + switch (charCode) + { + case (0x0027): // single quote + case (0x0022): // double quote + return true; + break; + + default: + return false; + } +} + + +/* + * strips off braces at beginning and end of text - + */ +function stripBraces(text) +{ + // remember to escape the braces... + var arr = text.match(/^\{(.*)\}$/); + + // defend against a null match... + if (arr != null && arr[1] != null) + return arr[1]; + return text; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js new file mode 100644 index 0000000..5130a03 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js @@ -0,0 +1,161 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 03 September 2001 +* +* SUMMARY: Double quotes should be escaped in Error.prototype.toSource() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96284 +* +* The real point here is this: we should be able to reconstruct an object +* from its toSource() property. We'll test this on various types of objects. +* +* Method: define obj2 = eval(obj1.toSource()) and verify that +* obj2.toSource() == obj1.toSource(). +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 96284; +var summary = 'Double quotes should be escaped in Error.prototype.toSource()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var obj1 = {}; +var obj2 = {}; +var cnTestString = '"This is a \" STUPID \" test string!!!"\\'; + + +// various NativeError objects - +status = inSection(1); +obj1 = Error(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(2); +obj1 = EvalError(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(3); +obj1 = RangeError(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(4); +obj1 = ReferenceError(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(5); +obj1 = SyntaxError(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(6); +obj1 = TypeError(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(7); +obj1 = URIError(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + + +// other types of objects - +status = inSection(8); +obj1 = new String(cnTestString); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(9); +obj1 = {color:'red', texture:cnTestString, hasOwnProperty:42}; +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(10); +obj1 = function(x) {function g(y){return y+1;} return g(x);}; +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(11); +obj1 = new Number(eval('6')); +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(12); +obj1 = /ad;(lf)kj(2309\/\/)\/\//; +obj2 = eval(obj1.toSource()); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js new file mode 100644 index 0000000..902ba06 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js @@ -0,0 +1,161 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 03 September 2001 +* +* SUMMARY: Double quotes should be escaped in uneval(new Error('""')) +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96284 +* +* The real point here is this: we should be able to reconstruct an object +* obj from uneval(obj). We'll test this on various types of objects. +* +* Method: define obj2 = eval(uneval(obj1)) and verify that +* obj2.toSource() == obj1.toSource(). +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 96284; +var summary = 'Double quotes should be escaped in Error.prototype.toSource()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var obj1 = {}; +var obj2 = {}; +var cnTestString = '"This is a \" STUPID \" test string!!!"\\'; + + +// various NativeError objects - +status = inSection(1); +obj1 = Error(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(2); +obj1 = EvalError(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(3); +obj1 = RangeError(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(4); +obj1 = ReferenceError(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(5); +obj1 = SyntaxError(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(6); +obj1 = TypeError(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(7); +obj1 = URIError(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + + +// other types of objects - +status = inSection(8); +obj1 = new String(cnTestString); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(9); +obj1 = {color:'red', texture:cnTestString, hasOwnProperty:42}; +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(10); +obj1 = function(x) {function g(y){return y+1;} return g(x);}; +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(11); +obj1 = new Number(eval('6')); +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + +status = inSection(12); +obj1 = /ad;(lf)kj(2309\/\/)\/\//; +obj2 = eval(uneval(obj1)); +actual = obj2.toSource(); +expect = obj1.toSource(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js new file mode 100644 index 0000000..1316672 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js @@ -0,0 +1,77 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): dbaron@fas.harvard.edu, pschwartau@netscape.com +* Date: 09 October 2001 +* +* SUMMARY: Regression test for Bugzilla bug 102725 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=102725 +* "gcc -O2 problems converting numbers to strings" +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 102725; +var summary = 'Testing converting numbers to strings'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Successive calls to foo.toString() were producing different answers! + */ +status = inSection(1); +foo = (new Date()).getTime(); +actual = foo.toString(); +expect = foo.toString(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js new file mode 100644 index 0000000..ab8113d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js @@ -0,0 +1,162 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 Jan 2002 +* SUMMARY: Reassignment to a const is NOT an error per ECMA +* See http://bugzilla.mozilla.org/show_bug.cgi?id=103602 +* +* ------- Additional Comment #4 From Brendan Eich 2002-01-10 15:30 ------- +* +* That's per ECMA (don't blame me, I fought for what Netscape always did: +* throw an error [could be a catchable exception since 1.3]). +* Readonly properties, when set by assignment, are not changed, but no error +* or exception is thrown. The value of the assignment expression is the value +* of the r.h.s. +* +* If you want a *strict* warning, pls change the summary of this bug to say so. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 103602; +var summary = 'Reassignment to a const is NOT an error per ECMA'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var cnFAIL_1 = 'Redeclaration of a const FAILED to cause an error'; +var cnFAIL_2 = 'Reassigning to a const caused an ERROR! It should not!!!'; +var sEval = ''; + +/* + * Not every implementation supports const (a non-ECMA extension) + * For example, Rhino does not; it would generate a complile-time error. + * So we have to hide this so it will be detected at run-time instead. + */ +try +{ + sEval = 'const one = 1'; + eval(sEval); +} +catch(e) +{ + quit(); // if const is not supported, this testcase is over - +} + + +status = inSection(1); +try +{ + /* + * Redeclaration of const should be a compile-time error. + * Hide so it will be detected at run-time. + */ + sEval = 'const one = 2;'; + eval(sEval); + + expect = ''; // we shouldn't reach this line + actual = cnFAIL_1; + addThis(); +} +catch(e) +{ + // good - we should be here. + actual = expect; + addThis(); +} + + +status = inSection(2); +try +{ + /* + * Reassignment to a const should be NOT be an error, per ECMA. + */ + one = 2; + actual = expect; // good: no error was generated + addThis(); + + // although no error, the assignment should have been ignored - + status = inSection(3); + actual = one; + expect = 1; + addThis(); + + // the value of the EXPRESSION, however, is the value of the r.h.s. - + status = inSection(4); + actual = (one = 2); + expect = 2; + addThis(); +} + +catch(e) +{ + // BAD - we shouldn't be here + expect = ''; + actual = cnFAIL_2; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js new file mode 100644 index 0000000..992028e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js @@ -0,0 +1,635 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): chwu@nortelnetworks.com, timeless@mac.com, +* brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 October 2001 +* SUMMARY: Regression test for Bugzilla bug 104077 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=104077 +* "JS crash: with/finally/return" +* +* Also http://bugzilla.mozilla.org/show_bug.cgi?id=120571 +* "JS crash: try/catch/continue." +* +* SpiderMonkey crashed on this code - it shouldn't. +* +* NOTE: the finally-blocks below should execute even if their try-blocks +* have return or throw statements in them: +* +* ------- Additional Comment #76 From Mike Shaver 2001-12-07 01:21 ------- +* finally trumps return, and all other control-flow constructs that cause +* program execution to jump out of the try block: throw, break, etc. Once you +* enter a try block, you will execute the finally block after leaving the try, +* regardless of what happens to make you leave the try. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 104077; +var summary = "Just testing that we don't crash on with/finally/return -"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function addValues(obj) +{ + var sum; + with (obj) + { + try + { + sum = arg1 + arg2; + } + finally + { + return sum; + } + } +} + +status = inSection(1); +var obj = new Object(); +obj.arg1 = 1; +obj.arg2 = 2; +actual = addValues(obj); +expect = 3; +captureThis(); + + + +function tryThis() +{ + var sum = 4 ; + var i = 0; + + while (sum < 10) + { + try + { + sum += 1; + i += 1; + } + finally + { + print("In finally case of tryThis() function"); + } + } + return i; +} + +status = inSection(2); +actual = tryThis(); +expect = 6; +captureThis(); + + + +function myTest(x) +{ + var obj = new Object(); + var msg; + + with (obj) + { + msg = (x != null) ? "NO" : "YES"; + print("Is the provided argument to myTest() null? : " + msg); + + try + { + throw "ZZZ"; + } + catch(e) + { + print("Caught thrown exception = " + e); + } + } + + return 1; +} + +status = inSection(3); +actual = myTest(null); +expect = 1; +captureThis(); + + + +function addValues_2(obj) +{ + var sum = 0; + with (obj) + { + try + { + sum = arg1 + arg2; + with (arg3) + { + while (sum < 10) + { + try + { + if (sum > 5) + return sum; + sum += 1; + } + catch(e) + { + print('Caught an exception in addValues_2() function: ' + e); + } + } + } + } + finally + { + return sum; + } + } +} + +status = inSection(4); +obj = new Object(); +obj.arg1 = 1; +obj.arg2 = 2; +obj.arg3 = new Object(); +obj.arg3.a = 10; +obj.arg3.b = 20; +actual = addValues_2(obj); +expect = 6; +captureThis(); + + + +status = inSection(5); +try +{ + throw new A(); +} +catch(e) +{ +} +finally +{ + try + { + throw new A(); + } + catch(e) + { + } + finally + { + actual = 'a'; + } + actual = 'b'; +} +expect = 'b'; +captureThis(); + + + + +function testfunc(mode) +{ + var obj = new Object(); + with (obj) + { + var num = 100; + var str = "abc" ; + + if (str == null) + { + try + { + throw "authentication.0"; + } + catch(e) + { + } + finally + { + } + + return num; + } + else + { + try + { + if (mode == 0) + throw "authentication.0"; + else + mytest(); + } + catch(e) + { + } + finally + { + } + + return num; + } + } +} + +status = inSection(6); +actual = testfunc(0); +expect = 100; +captureThis(); + +status = inSection(7); +actual = testfunc(); +expect = 100; +captureThis(); + + + + +function entry_menu() +{ + var document = new Object(); + var dialog = new Object(); + var num = 100; + + with (document) + { + with (dialog) + { + try + { + while (true) + { + return num; + } + } + finally + { + } + } + } +} + +status = inSection(8); +actual = entry_menu(); +expect = 100; +captureThis(); + + + + +function addValues_3(obj) +{ + var sum = 0; + + with (obj) + { + try + { + sum = arg1 + arg2; + with (arg3) + { + while (sum < 10) + { + try + { + if (sum > 5) + return sum; + sum += 1; + } + catch (e) + { + sum += 1; + print(e); + } + } + } + } + finally + { + try + { + sum +=1; + print("In finally block of addValues_3() function: sum = " + sum); + } + catch (e if e == 42) + { + sum +=1; + print('In finally catch block of addValues_3() function: sum = ' + sum + ', e = ' + e); + } + finally + { + sum +=1; + print("In finally finally block of addValues_3() function: sum = " + sum); + return sum; + } + } + } +} + +status = inSection(9); +obj = new Object(); +obj.arg1 = 1; +obj.arg2 = 2; +obj.arg3 = new Object(); +obj.arg3.a = 10; +obj.arg3.b = 20; +actual = addValues_3(obj); +expect = 8; +captureThis(); + + + + +function addValues_4(obj) +{ + var sum = 0; + + with (obj) + { + try + { + sum = arg1 + arg2; + with (arg3) + { + while (sum < 10) + { + try + { + if (sum > 5) + return sum; + sum += 1; + } + catch (e) + { + sum += 1; + print(e); + } + } + } + } + finally + { + try + { + sum += 1; + print("In finally block of addValues_4() function: sum = " + sum); + } + catch (e if e == 42) + { + sum += 1; + print("In 1st finally catch block of addValues_4() function: sum = " + sum + ", e = " + e); + } + catch (e if e == 43) + { + sum += 1; + print("In 2nd finally catch block of addValues_4() function: sum = " + sum + ", e = " + e); + } + finally + { + sum += 1; + print("In finally finally block of addValues_4() function: sum = " + sum); + return sum; + } + } + } +} + +status = inSection(10); +obj = new Object(); +obj.arg1 = 1; +obj.arg2 = 2; +obj.arg3 = new Object(); +obj.arg3.a = 10; +obj.arg3.b = 20; +actual = addValues_4(obj); +expect = 8; +captureThis(); + + + + +function addValues_5(obj) +{ + var sum = 0; + + with (obj) + { + try + { + sum = arg1 + arg2; + with (arg3) + { + while (sum < 10) + { + try + { + if (sum > 5) + return sum; + sum += 1; + } + catch (e) + { + sum += 1; + print(e); + } + } + } + } + finally + { + try + { + sum += 1; + print("In finally block of addValues_5() function: sum = " + sum); + } + catch (e) + { + sum += 1; + print("In finally catch block of addValues_5() function: sum = " + sum + ", e = " + e); + } + finally + { + sum += 1; + print("In finally finally block of addValues_5() function: sum = " + sum); + return sum; + } + } + } +} + +status = inSection(11); +obj = new Object(); +obj.arg1 = 1; +obj.arg2 = 2; +obj.arg3 = new Object(); +obj.arg3.a = 10; +obj.arg3.b = 20; +actual = addValues_5(obj); +expect = 8; +captureThis(); + + + + +function testObj(obj) +{ + var x = 42; + + try + { + with (obj) + { + if (obj.p) + throw obj.p; + x = obj.q; + } + } + finally + { + print("in finally block of testObj() function"); + return 999; + } +} + +status = inSection(12); +obj = {p:43}; +actual = testObj(obj); +expect = 999; +captureThis(); + + + +/* + * Next two cases are from http://bugzilla.mozilla.org/show_bug.cgi?id=120571 + */ +function a120571() +{ + while(0) + { + try + { + } + catch(e) + { + continue; + } + } +} + +// this caused a crash! Test to see that it doesn't now. +print(a120571); + +// Now test that we have a non-null value for a120571.toString() +status = inSection(13); +try +{ + actual = a120571.toString().match(/continue/)[0]; +} +catch(e) +{ + actual = 'FAILED! Did not find "continue" in function body'; +} +expect = 'continue'; +captureThis(); + + + + +function b() +{ + for(;;) + { + try + { + } + catch(e) + { + continue; + } + } +} + +// this caused a crash!!! Test to see that it doesn't now. +print(b); + +// Now test that we have a non-null value for b.toString() +status = inSection(14); +try +{ + actual = b.toString().match(/continue/)[0]; +} +catch(e) +{ + actual = 'FAILED! Did not find "continue" in function body'; +} +expect = 'continue'; +captureThis(); + + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js new file mode 100644 index 0000000..36959c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js @@ -0,0 +1,151 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 16 Nov 2001 +* SUMMARY: multiline comments containing "/*" should not be syntax errors +* See http://bugzilla.mozilla.org/show_bug.cgi?id=110286 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 110286; +var summary = 'Multiline comments containing "/*" should not be syntax errors'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = eval("/* /* */3"); +expect = 3; +addThis(); + +status = inSection(2); +actual = eval("3/* /* */"); +expect = 3; +addThis(); + +status = inSection(3); +actual = eval("/* 3/* */"); +expect = undefined; +addThis(); + +status = inSection(4); +actual = eval("/* /*3 */"); +expect = undefined; +addThis(); + +status = inSection(5); +var passed = true; +try +{ + eval("/* blah blah /* blah blah */"); +} +catch(e) +{ + passed = false; +} +actual = passed; +expect = true; +addThis(); + + +status = inSection(6); +try +{ + /* + /*A/* /* /*A/* + /* blah blah /* + /* blah blah /* + /* /*A/* /*A/* + */ + var result = 'PASSED'; +} +catch(e) +{ + var result = 'FAILED'; +} +actual = result; +expect = 'PASSED'; +addThis(); + + +status = inSection(7); +var str = 'ABC'; +/* + * /* + * /* + * /* + * /* + * + */ +str += 'DEF'; +actual = str; +expect = 'ABCDEF'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js new file mode 100644 index 0000000..375b906 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js @@ -0,0 +1,10960 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 Nov 2001 +* SUMMARY: JS should not crash on this code +* See http://bugzilla.mozilla.org/show_bug.cgi?id=111557 +* +*/ +//----------------------------------------------------------------------------- +var bug = 111557; +var summary = "Just seeing that we don't crash on this code -"; + +printBugNumber(bug); +printStatus(summary); + + +/* + * NOTE: have defined |top| as |this| to make this a standalone JS shell test. + * This came from the HTML of a frame, where |top| would have its DOM meaning. + */ +var top = this; + + top.authors = new Array(); + top.titles = new Array(); + var i = 0; + + + top.authors[i] = "zPROD xA.5375."; + top.titles[i] = "NDS Libraries for C"; + i++; + + top.authors[i] = "zFLDR xB.5375.0100."; + top.titles[i] = "NDS Backup Services"; + i++; + + top.authors[i] = "zFLDR xC.5375.0100.0001."; + top.titles[i] = "Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0001.0001."; + top.titles[i] = "NDSBackupServerData"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0001.0002."; + top.titles[i] = "NDSFreeNameList"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0001.0003."; + top.titles[i] = "NDSGetReplicaPartitionNames"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0001.0004."; + top.titles[i] = "NDSIsOnlyServerInTree"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0001.0005."; + top.titles[i] = "NDSSYSVolumeRecovery"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0001.0006."; + top.titles[i] = "NDSVerifyServerInfo"; + i++; + + top.authors[i] = "zFLDR xC.5375.0100.0002."; + top.titles[i] = "Structures"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0002.0001."; + top.titles[i] = "NAMEID_TYPE"; + i++; + + top.authors[i] = "zFLDR xC.5375.0100.0003."; + top.titles[i] = "Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0003.0001."; + top.titles[i] = "NDS Reason Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0100.0003.0002."; + top.titles[i] = "NDS Server Flags"; + i++; + + top.authors[i] = "zHTML xC.5375.0100.0004."; + top.titles[i] = "Revision History"; + i++; + + top.authors[i] = "zFLDR xB.5375.0300."; + top.titles[i] = "NDS Event Services"; + i++; + + top.authors[i] = "zFLDR xC.5375.0300.0001."; + top.titles[i] = "Concepts"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0001.0001."; + top.titles[i] = "NDS Event Introduction"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0001.0002."; + top.titles[i] = "NDS Event Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0001.0003."; + top.titles[i] = "NDS Event Priorities"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0001.0004."; + top.titles[i] = "NDS Event Data Filtering"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0001.0005."; + top.titles[i] = "NDS Event Types"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0001.0006."; + top.titles[i] = "Global Network Monitoring"; + i++; + + top.authors[i] = "zFLDR xC.5375.0300.0002."; + top.titles[i] = "Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0002.0001."; + top.titles[i] = "Monitoring NDS Events"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0002.0002."; + top.titles[i] = "Registering for NDS Events"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0002.0003."; + top.titles[i] = "Unregistering for NDS Events"; + i++; + + top.authors[i] = "zFLDR xC.5375.0300.0003."; + top.titles[i] = "Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0001."; + top.titles[i] = "NWDSEConvertEntryName"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0002."; + top.titles[i] = "NWDSEGetLocalAttrID"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0003."; + top.titles[i] = "NWDSEGetLocalAttrName"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0004."; + top.titles[i] = "NWDSEGetLocalClassID"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0005."; + top.titles[i] = "NWDSEGetLocalClassName"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0006."; + top.titles[i] = "NWDSEGetLocalEntryID"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0007."; + top.titles[i] = "NWDSEGetLocalEntryName"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0008."; + top.titles[i] = "NWDSERegisterForEvent"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0009."; + top.titles[i] = "NWDSERegisterForEventWithResult"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0003.0010."; + top.titles[i] = "NWDSEUnRegisterForEvent"; + i++; + + top.authors[i] = "zFLDR xC.5375.0300.0004."; + top.titles[i] = "Structures"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0001."; + top.titles[i] = "DSEACL"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0002."; + top.titles[i] = "DSEBackLink"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0003."; + top.titles[i] = "DSEBinderyObjectInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0004."; + top.titles[i] = "DSEBitString"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0005."; + top.titles[i] = "DSEChangeConnState"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0006."; + top.titles[i] = "DSECIList"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0007."; + top.titles[i] = "DSEDebugInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0008."; + top.titles[i] = "DSEEmailAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0009."; + top.titles[i] = "DSEEntryInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0010."; + top.titles[i] = "DSEEntryInfo2"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0011."; + top.titles[i] = "DSEEventData"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0012."; + top.titles[i] = "DSEFaxNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0013."; + top.titles[i] = "DSEHold"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0014."; + top.titles[i] = "DSEModuleState"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0015."; + top.titles[i] = "DSENetAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0016."; + top.titles[i] = "DSEOctetList"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0017."; + top.titles[i] = "DSEPath"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0018."; + top.titles[i] = "DSEReplicaPointer"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0019."; + top.titles[i] = "DSESEVInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0020."; + top.titles[i] = "DSETimeStamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0021."; + top.titles[i] = "DSETraceInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0022."; + top.titles[i] = "DSETypedName"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0023."; + top.titles[i] = "DSEVALData"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0004.0024."; + top.titles[i] = "DSEValueInfo"; + i++; + + top.authors[i] = "zFLDR xC.5375.0300.0005."; + top.titles[i] = "Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0005.0001."; + top.titles[i] = "Event Priorities"; + i++; + + top.authors[i] = "zHTML xD.5375.0300.0005.0002."; + top.titles[i] = "Event Types"; + i++; + + top.authors[i] = "zHTML xC.5375.0300.0006."; + top.titles[i] = "Revision History"; + i++; + + top.authors[i] = "zFLDR xB.5375.0600."; + top.titles[i] = "NDS Technical Overview"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0001."; + top.titles[i] = "NDS as the Internet Directory"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0001.0001."; + top.titles[i] = "Requirements for Networks and the Internet"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0001.0002."; + top.titles[i] = "NDS Compliance to X.500 Standard"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0001.0003."; + top.titles[i] = "NDS Compliance with LDAP v3"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0001.0004."; + top.titles[i] = "Directory Access Protocols"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0001.0005."; + top.titles[i] = "Programming Interfaces for NDS"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0001.0006."; + top.titles[i] = "NDS Architecture"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0002."; + top.titles[i] = "NDS Objects"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0002.0001."; + top.titles[i] = "NDS Names"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0002.0002."; + top.titles[i] = "Types of Information Stored in NDS"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0002.0003."; + top.titles[i] = "Retrieval of Information from NDS"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0002.0004."; + top.titles[i] = "Tree Walking"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0002.0005."; + top.titles[i] = "NDS Object Management"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0003."; + top.titles[i] = "NDS Security"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0003.0001."; + top.titles[i] = "Authentication"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0003.0002."; + top.titles[i] = "Access Control Lists"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0003.0003."; + top.titles[i] = "Inheritance"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0003.0004."; + top.titles[i] = "NetWare File System"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0004."; + top.titles[i] = "Partitions and Replicas"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0004.0001."; + top.titles[i] = "Partitioning"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0004.0002."; + top.titles[i] = "Replication"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0004.0003."; + top.titles[i] = "Distributed Reference Management"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0004.0004."; + top.titles[i] = "Partition Operations"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0004.0005."; + top.titles[i] = "Synchronization"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0004.0006."; + top.titles[i] = "Background Processes"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0005."; + top.titles[i] = "Bindery Services"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0005.0001."; + top.titles[i] = "NDS Bindery Context"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0005.0002."; + top.titles[i] = "Bindery Context Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0005.0003."; + top.titles[i] = "Bindery Context Eclipsing"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0005.0004."; + top.titles[i] = "NDS Bindery Objects"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0006."; + top.titles[i] = "NDS Return Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0006.0001."; + top.titles[i] = "NDS Return Values from the Operating System"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0006.0002."; + top.titles[i] = "NDS Client Return Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0006.0003."; + top.titles[i] = "NDS Agent Return Values"; + i++; + + top.authors[i] = "zFLDR xC.5375.0600.0007."; + top.titles[i] = "Directory Services Trace Utilities"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0007.0001."; + top.titles[i] = "Using the DSTrace NLM"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0007.0002."; + top.titles[i] = "Using Basic SET DSTrace Commands"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0007.0003."; + top.titles[i] = "Starting Background Processes with SET DSTrace"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0007.0004."; + top.titles[i] = "Tuning Background Processes"; + i++; + + top.authors[i] = "zHTML xD.5375.0600.0007.0005."; + top.titles[i] = "Enabling DSTrace Messages with SET DSTrace"; + i++; + + top.authors[i] = "zHTML xC.5375.0600.0008."; + top.titles[i] = "Revision History"; + i++; + + top.authors[i] = "zFLDR xB.5375.0200."; + top.titles[i] = "NDS Core Services"; + i++; + + top.authors[i] = "zFLDR xC.5375.0200.0001."; + top.titles[i] = "Programming Concepts"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0001."; + top.titles[i] = "Context Handles"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0002."; + top.titles[i] = "Buffer Management"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0003."; + top.titles[i] = "Read Requests for Object Information"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0004."; + top.titles[i] = "Search Requests"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0005."; + top.titles[i] = "Developing in a Loosely Consistent Environment"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0006."; + top.titles[i] = "Add Object Requests"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0007."; + top.titles[i] = "NDS Security and Applications"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0008."; + top.titles[i] = "Authentication of Client Applications"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0009."; + top.titles[i] = "Multiple Tree Support"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0010."; + top.titles[i] = "Effective Rights Function"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0011."; + top.titles[i] = "Partition Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0012."; + top.titles[i] = "Replica Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0013."; + top.titles[i] = "Read Requests for Schema Information"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0001.0014."; + top.titles[i] = "Schema Extension Requests"; + i++; + + top.authors[i] = "zFLDR xC.5375.0200.0002."; + top.titles[i] = "Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0002.0001."; + top.titles[i] = "Context Handle Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0002.0002."; + top.titles[i] = "Buffer Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0002.0003."; + top.titles[i] = "Authentication and Connection Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0002.0004."; + top.titles[i] = "Object Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0002.0005."; + top.titles[i] = "Partition and Replica Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0002.0006."; + top.titles[i] = "Schema Tasks"; + i++; + + top.authors[i] = "zFLDR xC.5375.0200.0003."; + top.titles[i] = "Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0001."; + top.titles[i] = "NWDSAbbreviateName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0002."; + top.titles[i] = "NWDSAbortPartitionOperation"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0003."; + top.titles[i] = "NWDSAddFilterToken"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0004."; + top.titles[i] = "NWDSAddObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0005."; + top.titles[i] = "NWDSAddPartition (obsolete---moved from .h file 11/99)"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0006."; + top.titles[i] = "NWDSAddReplica"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0007."; + top.titles[i] = "NWDSAddSecurityEquiv"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0008."; + top.titles[i] = "NWDSAllocBuf"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0009."; + top.titles[i] = "NWDSAllocFilter"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0010."; + top.titles[i] = "NWDSAuditGetObjectID"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0011."; + top.titles[i] = "NWDSAuthenticate"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0012."; + top.titles[i] = "NWDSAuthenticateConn"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0013."; + top.titles[i] = "NWDSAuthenticateConnEx"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0014."; + top.titles[i] = "NWDSBackupObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0015."; + top.titles[i] = "NWDSBeginClassItem"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0016."; + top.titles[i] = "NWDSCanDSAuthenticate"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0017."; + top.titles[i] = "NWDSCanonicalizeName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0018."; + top.titles[i] = "NWDSChangeObjectPassword"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0019."; + top.titles[i] = "NWDSChangeReplicaType"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0020."; + top.titles[i] = "NWDSCIStringsMatch"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0021."; + top.titles[i] = "NWDSCloseIteration"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0022."; + top.titles[i] = "NWDSCompare"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0023."; + top.titles[i] = "NWDSComputeAttrValSize"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0024."; + top.titles[i] = "NWDSCreateContext (obsolete---moved from .h file 6/99)"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0025."; + top.titles[i] = "NWDSCreateContextHandle"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0026."; + top.titles[i] = "NWDSDefineAttr"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0027."; + top.titles[i] = "NWDSDefineClass"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0028."; + top.titles[i] = "NWDSDelFilterToken"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0029."; + top.titles[i] = "NWDSDuplicateContext (obsolete 03/99)"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0030."; + top.titles[i] = "NWDSDuplicateContextHandle"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0031."; + top.titles[i] = "NWDSExtSyncList"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0032."; + top.titles[i] = "NWDSExtSyncRead"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0033."; + top.titles[i] = "NWDSExtSyncSearch"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0034."; + top.titles[i] = "NWDSFreeBuf"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0035."; + top.titles[i] = "NWDSFreeContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0036."; + top.titles[i] = "NWDSFreeFilter"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0037."; + top.titles[i] = "NWDSGenerateObjectKeyPair"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0038."; + top.titles[i] = "NWDSGetAttrCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0039."; + top.titles[i] = "NWDSGetAttrDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0040."; + top.titles[i] = "NWDSGetAttrName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0041."; + top.titles[i] = "NWDSGetAttrVal"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0042."; + top.titles[i] = "NWDSGetAttrValFlags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0043."; + top.titles[i] = "NWDSGetAttrValModTime"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0044."; + top.titles[i] = "NWDSGetBinderyContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0045."; + top.titles[i] = "NWDSGetClassDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0046."; + top.titles[i] = "NWDSGetClassDefCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0047."; + top.titles[i] = "NWDSGetClassItem"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0048."; + top.titles[i] = "NWDSGetClassItemCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0049."; + top.titles[i] = "NWDSGetContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0050."; + top.titles[i] = "NWDSGetCountByClassAndName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0051."; + top.titles[i] = "NWDSGetCurrentUser"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0052."; + top.titles[i] = "NWDSGetDefNameContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0053."; + top.titles[i] = "NWDSGetDSIInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0054."; + top.titles[i] = "NWDSGetDSVerInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0055."; + top.titles[i] = "NWDSGetEffectiveRights"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0056."; + top.titles[i] = "NWDSGetMonitoredConnRef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0057."; + top.titles[i] = "NWDSGetNDSInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0058."; + top.titles[i] = "NWDSGetObjectCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0059."; + top.titles[i] = "NWDSGetObjectHostServerAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0060."; + top.titles[i] = "NWDSGetObjectName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0061."; + top.titles[i] = "NWDSGetObjectNameAndInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0062."; + top.titles[i] = "NWDSGetPartitionExtInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0063."; + top.titles[i] = "NWDSGetPartitionExtInfoPtr"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0064."; + top.titles[i] = "NWDSGetPartitionInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0065."; + top.titles[i] = "NWDSGetPartitionRoot"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0066."; + top.titles[i] = "NWDSGetServerAddresses (obsolete 3/98)"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0067."; + top.titles[i] = "NWDSGetServerAddresses2"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0068."; + top.titles[i] = "NWDSGetServerDN"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0069."; + top.titles[i] = "NWDSGetServerName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0070."; + top.titles[i] = "NWDSGetSyntaxCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0071."; + top.titles[i] = "NWDSGetSyntaxDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0072."; + top.titles[i] = "NWDSGetSyntaxID"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0073."; + top.titles[i] = "NWDSInitBuf"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0074."; + top.titles[i] = "NWDSInspectEntry"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0075."; + top.titles[i] = "NWDSJoinPartitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0076."; + top.titles[i] = "NWDSList"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0077."; + top.titles[i] = "NWDSListAttrsEffectiveRights"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0078."; + top.titles[i] = "NWDSListByClassAndName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0079."; + top.titles[i] = "NWDSListContainableClasses"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0080."; + top.titles[i] = "NWDSListContainers"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0081."; + top.titles[i] = "NWDSListPartitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0082."; + top.titles[i] = "NWDSListPartitionsExtInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0083."; + top.titles[i] = "NWDSLogin"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0084."; + top.titles[i] = "NWDSLoginAsServer"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0085."; + top.titles[i] = "NWDSLogout"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0086."; + top.titles[i] = "NWDSMapIDToName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0087."; + top.titles[i] = "NWDSMapNameToID"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0088."; + top.titles[i] = "NWDSModifyClassDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0089."; + top.titles[i] = "NWDSModifyDN"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0090."; + top.titles[i] = "NWDSModifyObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0091."; + top.titles[i] = "NWDSModifyRDN"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0092."; + top.titles[i] = "NWDSMoveObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0093."; + top.titles[i] = "NWDSMutateObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0094."; + top.titles[i] = "NWDSOpenConnToNDSServer"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0095."; + top.titles[i] = "NWDSOpenMonitoredConn"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0096."; + top.titles[i] = "NWDSOpenStream"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0097."; + top.titles[i] = "NWDSPartitionReceiveAllUpdates"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0098."; + top.titles[i] = "NWDSPartitionSendAllUpdates"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0099."; + top.titles[i] = "NWDSPutAttrName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0100."; + top.titles[i] = "NWDSPutAttrNameAndVal"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0101."; + top.titles[i] = "NWDSPutAttrVal"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0102."; + top.titles[i] = "NWDSPutChange"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0103."; + top.titles[i] = "NWDSPutChangeAndVal"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0104."; + top.titles[i] = "NWDSPutClassItem"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0105."; + top.titles[i] = "NWDSPutClassName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0106."; + top.titles[i] = "NWDSPutFilter"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0107."; + top.titles[i] = "NWDSPutSyntaxName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0108."; + top.titles[i] = "NWDSRead"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0109."; + top.titles[i] = "NWDSReadAttrDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0110."; + top.titles[i] = "NWDSReadClassDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0111."; + top.titles[i] = "NWDSReadNDSInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0112."; + top.titles[i] = "NWDSReadObjectDSIInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0113."; + top.titles[i] = "NWDSReadObjectInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0114."; + top.titles[i] = "NWDSReadReferences"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0115."; + top.titles[i] = "NWDSReadSyntaxDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0116."; + top.titles[i] = "NWDSReadSyntaxes"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0117."; + top.titles[i] = "NWDSReloadDS"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0118."; + top.titles[i] = "NWDSRemoveAllTypes"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0119."; + top.titles[i] = "NWDSRemoveAttrDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0120."; + top.titles[i] = "NWDSRemoveClassDef"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0121."; + top.titles[i] = "NWDSRemoveObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0122."; + top.titles[i] = "NWDSRemovePartition"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0123."; + top.titles[i] = "NWDSRemoveReplica"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0124."; + top.titles[i] = "NWDSRemSecurityEquiv"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0125."; + top.titles[i] = "NWDSRepairTimeStamps"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0126."; + top.titles[i] = "NWDSReplaceAttrNameAbbrev"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0127."; + top.titles[i] = "NWDSResolveName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0128."; + top.titles[i] = "NWDSRestoreObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0129."; + top.titles[i] = "NWDSReturnBlockOfAvailableTrees"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0130."; + top.titles[i] = "NWDSScanConnsForTrees"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0131."; + top.titles[i] = "NWDSScanForAvailableTrees"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0132."; + top.titles[i] = "NWDSSearch"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0133."; + top.titles[i] = "NWDSSetContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0134."; + top.titles[i] = "NWDSSetCurrentUser"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0135."; + top.titles[i] = "NWDSSetDefNameContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0136."; + top.titles[i] = "NWDSSetMonitoredConnection"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0137."; + top.titles[i] = "NWDSSplitPartition"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0138."; + top.titles[i] = "NWDSSyncPartition"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0139."; + top.titles[i] = "NWDSSyncReplicaToServer"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0140."; + top.titles[i] = "NWDSSyncSchema"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0141."; + top.titles[i] = "NWDSUnlockConnection"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0142."; + top.titles[i] = "NWDSVerifyObjectPassword"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0143."; + top.titles[i] = "NWDSWhoAmI"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0144."; + top.titles[i] = "NWGetDefaultNameContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0145."; + top.titles[i] = "NWGetFileServerUTCTime"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0146."; + top.titles[i] = "NWGetNumConnections"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0147."; + top.titles[i] = "NWGetNWNetVersion"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0148."; + top.titles[i] = "NWGetPreferredConnName"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0149."; + top.titles[i] = "NWIsDSAuthenticated"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0150."; + top.titles[i] = "NWIsDSServer"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0151."; + top.titles[i] = "NWNetInit"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0152."; + top.titles[i] = "NWNetTerm"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0153."; + top.titles[i] = "NWSetDefaultNameContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0003.0154."; + top.titles[i] = "NWSetPreferredDSTree"; + i++; + + top.authors[i] = "zFLDR xC.5375.0200.0004."; + top.titles[i] = "Structures"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0001."; + top.titles[i] = "Asn1ID_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0002."; + top.titles[i] = "Attr_Info_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0003."; + top.titles[i] = "Back_Link_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0004."; + top.titles[i] = "Bit_String_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0005."; + top.titles[i] = "Buf_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0006."; + top.titles[i] = "CI_List_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0007."; + top.titles[i] = "Class_Info_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0008."; + top.titles[i] = "EMail_Address_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0009."; + top.titles[i] = "Fax_Number_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0010."; + top.titles[i] = "Filter_Cursor_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0011."; + top.titles[i] = "Filter_Node_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0012."; + top.titles[i] = "Hold_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0013."; + top.titles[i] = "NDSOSVersion_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0014."; + top.titles[i] = "NDSStatsInfo_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0015."; + top.titles[i] = "Net_Address_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0016."; + top.titles[i] = "NWDS_TimeStamp_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0017."; + top.titles[i] = "Object_ACL_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0018."; + top.titles[i] = "Object_Info_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0019."; + top.titles[i] = "Octet_List_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0020."; + top.titles[i] = "Octet_String_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0021."; + top.titles[i] = "Path_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0022."; + top.titles[i] = "Replica_Pointer_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0023."; + top.titles[i] = "Syntax_Info_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0024."; + top.titles[i] = "TimeStamp_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0025."; + top.titles[i] = "Typed_Name_T"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0004.0026."; + top.titles[i] = "Unknown_Attr_T"; + i++; + + top.authors[i] = "zFLDR xC.5375.0200.0005."; + top.titles[i] = "Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0001."; + top.titles[i] = "Attribute Constraint Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0002."; + top.titles[i] = "Attribute Value Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0003."; + top.titles[i] = "Buffer Operation Types and Related Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0004."; + top.titles[i] = "Class Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0005."; + top.titles[i] = "Change Types for Modifying Objects"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0006."; + top.titles[i] = "Context Keys and Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0007."; + top.titles[i] = "Default Context Key Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0008."; + top.titles[i] = "DCK_FLAGS Bit Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0009."; + top.titles[i] = "DCK_NAME_FORM Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0010."; + top.titles[i] = "DCK_CONFIDENCE Bit Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0011."; + top.titles[i] = "DCK_DSI_FLAGS Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0012."; + top.titles[i] = "DSI_ENTRY_FLAGS Values"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0013."; + top.titles[i] = "Filter Tokens"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0014."; + top.titles[i] = "Information Types for Attribute Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0015."; + top.titles[i] = "Information Types for Class Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0016."; + top.titles[i] = "Information Types for Search and Read"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0017."; + top.titles[i] = "Name Space Types"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0018."; + top.titles[i] = "NDS Access Control Rights"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0019."; + top.titles[i] = "NDS Ping Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0020."; + top.titles[i] = "DSP Replica Information Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0021."; + top.titles[i] = "Network Address Types"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0022."; + top.titles[i] = "Scope Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0023."; + top.titles[i] = "Replica Types"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0024."; + top.titles[i] = "Replica States"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0025."; + top.titles[i] = "Syntax Matching Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0005.0026."; + top.titles[i] = "Syntax IDs"; + i++; + + top.authors[i] = "zFLDR xC.5375.0200.0006."; + top.titles[i] = "NDS Example Code"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0006.0001."; + top.titles[i] = "Context Handle"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0006.0002."; + top.titles[i] = "Object and Attribute"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0006.0003."; + top.titles[i] = "Browsing and Searching"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0006.0004."; + top.titles[i] = "Batch Modification of Objects and Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0200.0006.0005."; + top.titles[i] = "Schema"; + i++; + + top.authors[i] = "zHTML xC.5375.0200.0007."; + top.titles[i] = "Revision History"; + i++; + + top.authors[i] = "zFLDR xB.5375.0500."; + top.titles[i] = "NDS Schema Reference"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0001."; + top.titles[i] = "Schema Concepts"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0001."; + top.titles[i] = "Schema Structure"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0002."; + top.titles[i] = "Schema Components"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0003."; + top.titles[i] = "Object Classes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0004."; + top.titles[i] = "Naming Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0005."; + top.titles[i] = "Containment Classes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0006."; + top.titles[i] = "Super Classes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0007."; + top.titles[i] = "Object Class Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0008."; + top.titles[i] = "Mandatory and Optional Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0009."; + top.titles[i] = "Default ACL Templates"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0010."; + top.titles[i] = "Auxiliary Classes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0011."; + top.titles[i] = "Attribute Type Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0012."; + top.titles[i] = "Attribute Syntax Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0001.0013."; + top.titles[i] = "Schema Extensions"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0002."; + top.titles[i] = "Base Object Class Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0001."; + top.titles[i] = "AFP Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0002."; + top.titles[i] = "Alias"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0003."; + top.titles[i] = "applicationEntity"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0004."; + top.titles[i] = "applicationProcess"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0005."; + top.titles[i] = "Audit:File Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0006."; + top.titles[i] = "Bindery Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0007."; + top.titles[i] = "Bindery Queue"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0008."; + top.titles[i] = "certificationAuthority"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0009."; + top.titles[i] = "CommExec"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0010."; + top.titles[i] = "Computer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0011."; + top.titles[i] = "Country"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0012."; + top.titles[i] = "cRLDistributionPoint"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0013."; + top.titles[i] = "dcObject"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0014."; + top.titles[i] = "Device"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0015."; + top.titles[i] = "Directory Map"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0016."; + top.titles[i] = "domain"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0017."; + top.titles[i] = "dSA"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0018."; + top.titles[i] = "External Entity"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0019."; + top.titles[i] = "Group"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0020."; + top.titles[i] = "LDAP Group"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0021."; + top.titles[i] = "LDAP Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0022."; + top.titles[i] = "List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0023."; + top.titles[i] = "Locality"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0024."; + top.titles[i] = "MASV:Security Policy"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0025."; + top.titles[i] = "Message Routing Group"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0026."; + top.titles[i] = "Messaging Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0027."; + top.titles[i] = "NCP Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0028."; + top.titles[i] = "ndsLoginProperties"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0029."; + top.titles[i] = "NDSPKI:Certificate Authority"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0030."; + top.titles[i] = "NDSPKI:Key Material"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0031."; + top.titles[i] = "NDSPKI:SD Key Access Partition"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0032."; + top.titles[i] = "NDSPKI:SD Key List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0033."; + top.titles[i] = "NDSPKI:Trusted Root"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0034."; + top.titles[i] = "NDSPKI:Trusted Root Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0035."; + top.titles[i] = "NSCP:groupOfCertificates"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0036."; + top.titles[i] = "NSCP:mailGroup1"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0037."; + top.titles[i] = "NSCP:mailRecipient"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0038."; + top.titles[i] = "NSCP:NetscapeMailServer5"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0039."; + top.titles[i] = "NSCP:NetscapeServer5"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0040."; + top.titles[i] = "NSCP:nginfo3"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0041."; + top.titles[i] = "NSCP:nsLicenseUser"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0042."; + top.titles[i] = "Organization"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0043."; + top.titles[i] = "Organizational Person"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0044."; + top.titles[i] = "Organizational Role"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0045."; + top.titles[i] = "Organizational Unit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0046."; + top.titles[i] = "Partition"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0047."; + top.titles[i] = "Person"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0048."; + top.titles[i] = "pkiCA"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0049."; + top.titles[i] = "pkiUser"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0050."; + top.titles[i] = "Print Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0051."; + top.titles[i] = "Printer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0052."; + top.titles[i] = "Profile"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0053."; + top.titles[i] = "Queue"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0054."; + top.titles[i] = "Resource"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0055."; + top.titles[i] = "SAS:Security"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0056."; + top.titles[i] = "SAS:Service"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0057."; + top.titles[i] = "Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0058."; + top.titles[i] = "strongAuthenticationUser"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0059."; + top.titles[i] = "Template"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0060."; + top.titles[i] = "Top"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0061."; + top.titles[i] = "Tree Root"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0062."; + top.titles[i] = "Unknown"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0063."; + top.titles[i] = "User"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0064."; + top.titles[i] = "userSecurityInformation"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0065."; + top.titles[i] = "Volume"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0002.0066."; + top.titles[i] = "WANMAN:LAN Area"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0003."; + top.titles[i] = "Novell Object Class Extensions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0001."; + top.titles[i] = "Entrust:CRLDistributionPoint"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0002."; + top.titles[i] = "inetOrgPerson"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0003."; + top.titles[i] = "NDPS Broker"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0004."; + top.titles[i] = "NDPS Manager"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0005."; + top.titles[i] = "NDPS Printer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0006."; + top.titles[i] = "NDSCat:Catalog"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0007."; + top.titles[i] = "NDSCat:Master Catalog"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0008."; + top.titles[i] = "NDSCat:Slave Catalog"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0009."; + top.titles[i] = "NetSvc"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0010."; + top.titles[i] = "NLS:License Certificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0011."; + top.titles[i] = "NLS:License Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0012."; + top.titles[i] = "NLS:Product Container"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0013."; + top.titles[i] = "NSCP:groupOfUniqueNames5"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0014."; + top.titles[i] = "NSCP:mailGroup5"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0015."; + top.titles[i] = "NSCP:Nginfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0016."; + top.titles[i] = "NSCP:Nginfo2"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0017."; + top.titles[i] = "residentialPerson"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0018."; + top.titles[i] = "SLP Scope Unit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0019."; + top.titles[i] = "SLP Directory Agent"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0020."; + top.titles[i] = "SLP Service"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0003.0021."; + top.titles[i] = "SMS SMDR Class"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0004."; + top.titles[i] = "Graphical View of Object Class Inheritance"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0001."; + top.titles[i] = "Alias and Bindery Object Classes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0002."; + top.titles[i] = "Tree Root, domain, and Unknown"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0003."; + top.titles[i] = "Computer, Country, Device, and Printer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0004."; + top.titles[i] = "List and Locality"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0005."; + top.titles[i] = "Organizational Role and Partition"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0006."; + top.titles[i] = "ndsLoginProperties, Organization, and Organizational Unit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0007."; + top.titles[i] = "ndsLoginProperties, Person, Organizational Person, and User"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0008."; + top.titles[i] = "Directory Map, Profile, Queues, Resource, and Volume"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0009."; + top.titles[i] = "Servers (AFP, Messaging, NCP, Print) and CommExec"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0004.0010."; + top.titles[i] = "External Entity, Group, and Message Routing Group"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0005."; + top.titles[i] = "Base Attribute Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0001."; + top.titles[i] = "Aliased Object Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0002."; + top.titles[i] = "Account Balance"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0003."; + top.titles[i] = "ACL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0004."; + top.titles[i] = "Allow Unlimited Credit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0005."; + top.titles[i] = "associatedName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0006."; + top.titles[i] = "attributeCertificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0007."; + top.titles[i] = "Audit:A Encryption Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0008."; + top.titles[i] = "Audit:B Encryption Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0009."; + top.titles[i] = "Audit:Contents"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0010."; + top.titles[i] = "Audit:Current Encryption Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0011."; + top.titles[i] = "Audit:File Link"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0012."; + top.titles[i] = "Audit:Link List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0013."; + top.titles[i] = "Audit:Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0014."; + top.titles[i] = "Audit:Policy"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0015."; + top.titles[i] = "Audit:Type"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0016."; + top.titles[i] = "authorityRevocationList"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0017."; + top.titles[i] = "Authority Revocation"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0018."; + top.titles[i] = "AuxClass Object Class Backup"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0019."; + top.titles[i] = "Auxiliary Class Flag"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0020."; + top.titles[i] = "Back Link"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0021."; + top.titles[i] = "Bindery Object Restriction"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0022."; + top.titles[i] = "Bindery Property"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0023."; + top.titles[i] = "Bindery Restriction Level"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0024."; + top.titles[i] = "Bindery Type"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0025."; + top.titles[i] = "businessCategory"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0026."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0027."; + top.titles[i] = "cACertificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0028."; + top.titles[i] = "CA Private Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0029."; + top.titles[i] = "CA Public Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0030."; + top.titles[i] = "Cartridge"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0031."; + top.titles[i] = "certificateRevocationList"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0032."; + top.titles[i] = "Certificate Revocation"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0033."; + top.titles[i] = "Certificate Validity Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0034."; + top.titles[i] = "crossCertificatePair"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0035."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0036."; + top.titles[i] = "Convergence"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0037."; + top.titles[i] = "Cross Certificate Pair"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0038."; + top.titles[i] = "dc"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0039."; + top.titles[i] = "Default Queue"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0040."; + top.titles[i] = "deltaRevocationList"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0041."; + top.titles[i] = "departmentNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0042."; + top.titles[i] = "Description"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0043."; + top.titles[i] = "destinationIndicator"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0044."; + top.titles[i] = "Detect Intruder"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0045."; + top.titles[i] = "Device"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0046."; + top.titles[i] = "dmdName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0047."; + top.titles[i] = "dn"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0048."; + top.titles[i] = "dnQualifier"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0049."; + top.titles[i] = "DS Revision"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0050."; + top.titles[i] = "EMail Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0051."; + top.titles[i] = "employeeType"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0052."; + top.titles[i] = "enhancedSearchGuide"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0053."; + top.titles[i] = "Equivalent To Me"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0054."; + top.titles[i] = "External Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0055."; + top.titles[i] = "External Synchronizer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0056."; + top.titles[i] = "Facsimile Telephone Number"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0057."; + top.titles[i] = "Full Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0058."; + top.titles[i] = "Generational Qualifier"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0059."; + top.titles[i] = "generationQualifier"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0060."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0061."; + top.titles[i] = "Given Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0062."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0063."; + top.titles[i] = "GUID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0064."; + top.titles[i] = "High Convergence Sync Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0065."; + top.titles[i] = "Higher Privileges"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0066."; + top.titles[i] = "Home Directory"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0067."; + top.titles[i] = "Home Directory Rights"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0068."; + top.titles[i] = "homePhone"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0069."; + top.titles[i] = "homePostalAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0070."; + top.titles[i] = "houseIdentifier"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0071."; + top.titles[i] = "Host Device"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0072."; + top.titles[i] = "Host Resource Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0073."; + top.titles[i] = "Host Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0074."; + top.titles[i] = "Inherited ACL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0075."; + top.titles[i] = "Initials"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0076."; + top.titles[i] = "internationaliSDNNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0077."; + top.titles[i] = "Internet EMail Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0078."; + top.titles[i] = "Intruder Attempt Reset Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0079."; + top.titles[i] = "Intruder Lockout Reset Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0080."; + top.titles[i] = "knowledgeInformation"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0081."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0082."; + top.titles[i] = "Language"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0083."; + top.titles[i] = "Last Login Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0084."; + top.titles[i] = "Last Referenced Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0085."; + top.titles[i] = "LDAP ACL v11"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0086."; + top.titles[i] = "LDAP Allow Clear Text Password"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0087."; + top.titles[i] = "LDAP Anonymous Identity"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0088."; + top.titles[i] = "LDAP Attribute Map v11"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0089."; + top.titles[i] = "LDAP Backup Log Filename"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0090."; + top.titles[i] = "LDAP Class Map v11"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0091."; + top.titles[i] = "LDAP Enable SSL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0092."; + top.titles[i] = "LDAP Enable TCP"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0093."; + top.titles[i] = "LDAP Enable UDP"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0094."; + top.titles[i] = "LDAP Group"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0095."; + top.titles[i] = "LDAP Host Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0096."; + top.titles[i] = "LDAP Log Filename"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0097."; + top.titles[i] = "LDAP Log Level"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0098."; + top.titles[i] = "LDAP Log Size Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0099."; + top.titles[i] = "LDAP Referral"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0100."; + top.titles[i] = "LDAP Screen Level"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0101."; + top.titles[i] = "LDAP Search Size Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0102."; + top.titles[i] = "LDAP Search Time Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0103."; + top.titles[i] = "LDAP Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0104."; + top.titles[i] = "LDAP Server Bind Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0105."; + top.titles[i] = "LDAP Server Idle Timeout"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0106."; + top.titles[i] = "LDAP Server List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0107."; + top.titles[i] = "LDAP SSL Port"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0108."; + top.titles[i] = "LDAP Suffix"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0109."; + top.titles[i] = "LDAP TCP Port"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0110."; + top.titles[i] = "LDAP UDP Port"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0111."; + top.titles[i] = "LDAP:bindCatalog"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0112."; + top.titles[i] = "LDAP:bindCatalogUsage"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0113."; + top.titles[i] = "LDAP:keyMaterialName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0114."; + top.titles[i] = "LDAP:otherReferralUsage"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0115."; + top.titles[i] = "LDAP:searchCatalog"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0116."; + top.titles[i] = "LDAP:searchCatalogUsage"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0117."; + top.titles[i] = "LDAP:searchReferralUsage"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0118."; + top.titles[i] = "Locked By Intruder"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0119."; + top.titles[i] = "Lockout After Detection"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0120."; + top.titles[i] = "Login Allowed Time Map"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0121."; + top.titles[i] = "Login Disabled"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0122."; + top.titles[i] = "Login Expiration Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0123."; + top.titles[i] = "Login Grace Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0124."; + top.titles[i] = "Login Grace Remaining"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0125."; + top.titles[i] = "Login Intruder Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0126."; + top.titles[i] = "Login Intruder Attempts"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0127."; + top.titles[i] = "Login Intruder Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0128."; + top.titles[i] = "Login Intruder Reset Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0129."; + top.titles[i] = "Login Maximum Simultaneous"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0130."; + top.titles[i] = "Login Script"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0131."; + top.titles[i] = "Login Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0132."; + top.titles[i] = "Low Convergence Reset Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0133."; + top.titles[i] = "Low Convergence Sync Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0134."; + top.titles[i] = "Mailbox ID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0135."; + top.titles[i] = "Mailbox Location"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0136."; + top.titles[i] = "manager"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0137."; + top.titles[i] = "masvAuthorizedRange"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0138."; + top.titles[i] = "masvDefaultRange"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0139."; + top.titles[i] = "masvDomainPolicy"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0140."; + top.titles[i] = "masvLabel"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0141."; + top.titles[i] = "masvProposedLabel"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0142."; + top.titles[i] = "Member"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0143."; + top.titles[i] = "Members Of Template"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0144."; + top.titles[i] = "Memory"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0145."; + top.titles[i] = "Message Routing Group"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0146."; + top.titles[i] = "Message Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0147."; + top.titles[i] = "Messaging Database Location"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0148."; + top.titles[i] = "Messaging Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0149."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0150."; + top.titles[i] = "Minimum Account Balance"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0151."; + top.titles[i] = "mobile"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0152."; + top.titles[i] = "NDSPKI:Certificate Chain"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0153."; + top.titles[i] = "NDSPKI:Given Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0154."; + top.titles[i] = "NDSPKI:Key File"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0155."; + top.titles[i] = "NDSPKI:Key Material DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0156."; + top.titles[i] = "NDSPKI:Keystore"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0157."; + top.titles[i] = "NDSPKI:Not After"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0158."; + top.titles[i] = "NDSPKI:Not Before"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0159."; + top.titles[i] = "NDSPKI:Parent CA"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0160."; + top.titles[i] = "NDSPKI:Parent CA DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0161."; + top.titles[i] = "NDSPKI:Private Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0162."; + top.titles[i] = "NDSPKI:Public Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0163."; + top.titles[i] = "NDSPKI:Public Key Certificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0164."; + top.titles[i] = "NDSPKI:SD Key Cert"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0165."; + top.titles[i] = "NDSPKI:SD Key ID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0166."; + top.titles[i] = "NDSPKI:SD Key Server DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0167."; + top.titles[i] = "NDSPKI:SD Key Struct"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0168."; + top.titles[i] = "NDSPKI:Subject Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0169."; + top.titles[i] = "NDSPKI:Tree CA DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0170."; + top.titles[i] = "NDSPKI:Trusted Root Certificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0171."; + top.titles[i] = "NDSPKI:userCertificateInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0172."; + top.titles[i] = "Network Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0173."; + top.titles[i] = "Network Address Restriction"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0174."; + top.titles[i] = "New Object's DS Rights"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0175."; + top.titles[i] = "New Object's FS Rights"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0176."; + top.titles[i] = "New Object's Self Rights"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0177."; + top.titles[i] = "NNS Domain"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0178."; + top.titles[i] = "Notify"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0179."; + top.titles[i] = "NSCP:administratorContactInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0180."; + top.titles[i] = "NSCP:adminURL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0181."; + top.titles[i] = "NSCP:AmailAccessDomain"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0182."; + top.titles[i] = "NSCP:AmailAlternateAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0183."; + top.titles[i] = "NSCP:AmailAutoReplyMode"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0184."; + top.titles[i] = "NSCP:AmailAutoReplyText"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0185."; + top.titles[i] = "NSCP:AmailDeliveryOption"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0186."; + top.titles[i] = "NSCP:AmailForwardingAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0187."; + top.titles[i] = "NSCP:AmailHost"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0188."; + top.titles[i] = "NSCP:AmailMessageStore"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0189."; + top.titles[i] = "NSCP:AmailProgramDeliveryInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0190."; + top.titles[i] = "NSCP:AmailQuota"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0191."; + top.titles[i] = "NSCP:AnsLicenseEndTime"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0192."; + top.titles[i] = "NSCP:AnsLicensedFor"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0193."; + top.titles[i] = "NSCP:AnsLicenseStartTime"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0194."; + top.titles[i] = "NSCP:employeeNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0195."; + top.titles[i] = "NSCP:installationTimeStamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0196."; + top.titles[i] = "NSCP:mailRoutingAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0197."; + top.titles[i] = "NSCP:memberCertificateDesc"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0198."; + top.titles[i] = "NSCP:mgrpRFC822mailmember"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0199."; + top.titles[i] = "NSCP:ngcomponentCIS"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0200."; + top.titles[i] = "NSCP:nsaclrole"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0201."; + top.titles[i] = "NSCP:nscreator"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0202."; + top.titles[i] = "NSCP:nsflags"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0203."; + top.titles[i] = "NSCP:nsnewsACL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0204."; + top.titles[i] = "NSCP:nsprettyname"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0205."; + top.titles[i] = "NSCP:serverHostName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0206."; + top.titles[i] = "NSCP:serverProductName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0207."; + top.titles[i] = "NSCP:serverRoot"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0208."; + top.titles[i] = "NSCP:serverVersionNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0209."; + top.titles[i] = "NSCP:subtreeACI"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0210."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0211."; + top.titles[i] = "Obituary"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0212."; + top.titles[i] = "Obituary Notify"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0213."; + top.titles[i] = "Object Class"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0214."; + top.titles[i] = "Operator"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0215."; + top.titles[i] = "Other GUID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0216."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0217."; + top.titles[i] = "Owner"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0218."; + top.titles[i] = "Page Description Language"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0219."; + top.titles[i] = "pager"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0220."; + top.titles[i] = "Partition Control"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0221."; + top.titles[i] = "Partition Creation Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0222."; + top.titles[i] = "Partition Status"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0223."; + top.titles[i] = "Password Allow Change"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0224."; + top.titles[i] = "Password Expiration Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0225."; + top.titles[i] = "Password Expiration Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0226."; + top.titles[i] = "Password Management"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0227."; + top.titles[i] = "Password Minimum Length"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0228."; + top.titles[i] = "Password Required"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0229."; + top.titles[i] = "Password Unique Required"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0230."; + top.titles[i] = "Passwords Used"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0231."; + top.titles[i] = "Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0232."; + top.titles[i] = "Permanent Config Parms"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0233."; + top.titles[i] = "Physical Delivery Office Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0234."; + top.titles[i] = "Postal Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0235."; + top.titles[i] = "Postal Code"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0236."; + top.titles[i] = "Postal Office Box"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0237."; + top.titles[i] = "Postmaster"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0238."; + top.titles[i] = "preferredDeliveryMethod"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0239."; + top.titles[i] = "presentationAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0240."; + top.titles[i] = "Print Job Configuration"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0241."; + top.titles[i] = "Print Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0242."; + top.titles[i] = "Printer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0243."; + top.titles[i] = "Printer Configuration"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0244."; + top.titles[i] = "Printer Control"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0245."; + top.titles[i] = "Private Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0246."; + top.titles[i] = "Profile"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0247."; + top.titles[i] = "Profile Membership"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0248."; + top.titles[i] = "protocolInformation"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0249."; + top.titles[i] = "Public Key"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0250."; + top.titles[i] = "Purge Vector"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0251."; + top.titles[i] = "Queue"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0252."; + top.titles[i] = "Queue Directory"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0253."; + top.titles[i] = "Received Up To"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0254."; + top.titles[i] = "Reference"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0255."; + top.titles[i] = "registeredAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0256."; + top.titles[i] = "Replica"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0257."; + top.titles[i] = "Replica Up To"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0258."; + top.titles[i] = "Resource"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0259."; + top.titles[i] = "Revision"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0260."; + top.titles[i] = "Role Occupant"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0261."; + top.titles[i] = "roomNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0262."; + top.titles[i] = "Run Setup Script"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0263."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0264."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0265."; + top.titles[i] = "SAP Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0266."; + top.titles[i] = "SAS:Security DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0267."; + top.titles[i] = "SAS:Service DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0268."; + top.titles[i] = "searchGuide"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0269."; + top.titles[i] = "searchSizeLimit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0270."; + top.titles[i] = "searchTimeLimit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0271."; + top.titles[i] = "Security Equals"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0272."; + top.titles[i] = "Security Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0273."; + top.titles[i] = "See Also"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0274."; + top.titles[i] = "Serial Number"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0275."; + top.titles[i] = "Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0276."; + top.titles[i] = "Server Holds"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0277."; + top.titles[i] = "Set Password After Create"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0278."; + top.titles[i] = "Setup Script"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0279."; + top.titles[i] = "Status"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0280."; + top.titles[i] = "supportedAlgorithms"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0281."; + top.titles[i] = "supportedApplicationContext"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0282."; + top.titles[i] = "Supported Connections"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0283."; + top.titles[i] = "Supported Gateway"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0284."; + top.titles[i] = "Supported Services"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0285."; + top.titles[i] = "Supported Typefaces"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0286."; + top.titles[i] = "Surname"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0287."; + top.titles[i] = "Synchronization Tolerance"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0288."; + top.titles[i] = "Synchronized Up To"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0289."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0290."; + top.titles[i] = "Telephone Number"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0291."; + top.titles[i] = "telexNumber"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0292."; + top.titles[i] = "telexTerminalIdentifier"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0293."; + top.titles[i] = "Timezone"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0294."; + top.titles[i] = "Title"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0295."; + top.titles[i] = "Transitive Vector"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0296."; + top.titles[i] = "Trustees Of New Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0297."; + top.titles[i] = "Type Creator Map"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0298."; + top.titles[i] = ""; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0299."; + top.titles[i] = "uniqueID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0300."; + top.titles[i] = "Unknown"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0301."; + top.titles[i] = "Unknown Auxiliary Class"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0302."; + top.titles[i] = "Unknown Base Class"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0303."; + top.titles[i] = "Used By"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0304."; + top.titles[i] = "User"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0305."; + top.titles[i] = "userCertificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0306."; + top.titles[i] = "userPassword"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0307."; + top.titles[i] = "Uses"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0308."; + top.titles[i] = "Version"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0309."; + top.titles[i] = "Volume"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0310."; + top.titles[i] = "Volume Space Restrictions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0311."; + top.titles[i] = "WANMAN:Cost"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0312."; + top.titles[i] = "WANMAN:Default Cost"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0313."; + top.titles[i] = "WANMAN:LAN Area Membership"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0314."; + top.titles[i] = "WANMAN:WAN Policy"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0315."; + top.titles[i] = "x121Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0005.0316."; + top.titles[i] = "x500UniqueIdentifier"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0006."; + top.titles[i] = "Novell Attribute Extensions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0001."; + top.titles[i] = "audio"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0002."; + top.titles[i] = "carLicense"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0003."; + top.titles[i] = "Client Install Candidate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0004."; + top.titles[i] = "Color Supported"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0005."; + top.titles[i] = "Database Dir Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0006."; + top.titles[i] = "Database Volume Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0007."; + top.titles[i] = "Datapool Location"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0008."; + top.titles[i] = "Datapool Locations"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0009."; + top.titles[i] = "Delivery Methods Installed"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0010."; + top.titles[i] = "displayName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0011."; + top.titles[i] = "Employee ID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0012."; + top.titles[i] = "Entrust:AttributeCertificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0013."; + top.titles[i] = "Entrust:User"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0014."; + top.titles[i] = "GW API Gateway Directory Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0015."; + top.titles[i] = "GW API Gateway Directory Volume"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0016."; + top.titles[i] = "IPP URI"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0017."; + top.titles[i] = "IPP URI Security Scheme"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0018."; + top.titles[i] = "jpegPhoto"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0019."; + top.titles[i] = "labeledUri"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0020."; + top.titles[i] = "LDAP Class Map"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0021."; + top.titles[i] = "ldapPhoto"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0022."; + top.titles[i] = "LDAPUserCertificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0023."; + top.titles[i] = "LDAP:ARL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0024."; + top.titles[i] = "LDAP:caCertificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0025."; + top.titles[i] = "LDAP:CRL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0026."; + top.titles[i] = "LDAP:crossCertificatePair"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0027."; + top.titles[i] = "MASV:Authorized Range"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0028."; + top.titles[i] = "MASV:Default Range"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0029."; + top.titles[i] = "MASV:Domain Policy"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0030."; + top.titles[i] = "MASV:Label"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0031."; + top.titles[i] = "MASV:Proposed Label"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0032."; + top.titles[i] = "Maximum Speed"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0033."; + top.titles[i] = "Maximum Speed Units"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0034."; + top.titles[i] = "MHS Send Directory Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0035."; + top.titles[i] = "MHS Send Directory Volume"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0036."; + top.titles[i] = "NDPS Accountant Role"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0037."; + top.titles[i] = "NDPS Control Flags"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0038."; + top.titles[i] = "NDPS Database Saved Timestamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0039."; + top.titles[i] = "NDPS Database Saved Data Image"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0040."; + top.titles[i] = "NDPS Database Saved Index Image"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0041."; + top.titles[i] = "NDPS Default Printer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0042."; + top.titles[i] = "NDPS Default Public Printer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0043."; + top.titles[i] = "NDPS Job Configuration"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0044."; + top.titles[i] = "NDPS Manager Status"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0045."; + top.titles[i] = "NDPS Operator Role"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0046."; + top.titles[i] = "NDPS Printer Install List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0047."; + top.titles[i] = "NDPS Printer Install Timestamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0048."; + top.titles[i] = "NDPS Printer Queue List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0049."; + top.titles[i] = "NDPS Printer Siblings"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0050."; + top.titles[i] = "NDPS Public Printer Install List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0051."; + top.titles[i] = "NDPS Replace All Client Printers"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0052."; + top.titles[i] = "NDPS SMTP Server"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0053."; + top.titles[i] = "NDPS User Role"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0054."; + top.titles[i] = "NDSCat:Actual All Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0055."; + top.titles[i] = "NDSCat:Actual Attribute Count"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0056."; + top.titles[i] = "NDSCat:Actual Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0057."; + top.titles[i] = "NDSCat:Actual Base Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0058."; + top.titles[i] = "NDSCat:Actual Catalog Size"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0059."; + top.titles[i] = "NDSCat:Actual End Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0060."; + top.titles[i] = "NDSCat:Actual Filter"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0061."; + top.titles[i] = "NDSCat:Actual Object Count"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0062."; + top.titles[i] = "NDSCat:Actual Return Code"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0063."; + top.titles[i] = "NDSCat:Actual Scope"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0064."; + top.titles[i] = "NDSCat:Actual Search Aliases"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0065."; + top.titles[i] = "NDSCat:Actual Start Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0066."; + top.titles[i] = "NDSCat:Actual Value Count"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0067."; + top.titles[i] = "NDSCat:All Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0068."; + top.titles[i] = "NDSCat:AttrDefTbl"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0069."; + top.titles[i] = "NDSCat:Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0070."; + top.titles[i] = "NDSCat:Auto Dredge"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0071."; + top.titles[i] = "NDSCat:Base Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0072."; + top.titles[i] = "NDSCat:CatalogDB"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0073."; + top.titles[i] = "NDSCat:Catalog List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0074."; + top.titles[i] = "NDSCat:Dredge Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0075."; + top.titles[i] = "NDSCat:Filter"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0076."; + top.titles[i] = "NDSCat:IndexDefTbl"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0077."; + top.titles[i] = "NDSCat:Indexes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0078."; + top.titles[i] = "NDSCat:Label"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0079."; + top.titles[i] = "NDSCat:Log"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0080."; + top.titles[i] = "NDSCat:Master Catalog"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0081."; + top.titles[i] = "NDSCat:Max Log Size"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0082."; + top.titles[i] = "NDSCat:Max Retries"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0083."; + top.titles[i] = "NDSCat:Max Threads"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0084."; + top.titles[i] = "NDSCat:Retry Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0085."; + top.titles[i] = "NDSCat:Scope"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0086."; + top.titles[i] = "NDSCat:Search Aliases"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0087."; + top.titles[i] = "NDSCat:Slave Catalog List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0088."; + top.titles[i] = "NDSCat:Start Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0089."; + top.titles[i] = "NDSCat:Synch Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0090."; + top.titles[i] = "NLS:Common Certificate"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0091."; + top.titles[i] = "NLS:Current Installed"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0092."; + top.titles[i] = "NLS:Current Peak Installed"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0093."; + top.titles[i] = "NLS:Current Peak Used"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0094."; + top.titles[i] = "NLS:Current Used"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0095."; + top.titles[i] = "NLS:Hourly Data Size"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0096."; + top.titles[i] = "NLS:License Database"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0097."; + top.titles[i] = "NLS:License ID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0098."; + top.titles[i] = "NLS:License Service Provider"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0099."; + top.titles[i] = "NLS:LSP Revision"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0100."; + top.titles[i] = "NLS:Owner"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0101."; + top.titles[i] = "NLS:Peak Installed Data"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0102."; + top.titles[i] = "NLS:Peak Used Data"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0103."; + top.titles[i] = "NLS:Product"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0104."; + top.titles[i] = "NLS:Publisher"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0105."; + top.titles[i] = "NLS:Revision"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0106."; + top.titles[i] = "NLS:Search Type"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0107."; + top.titles[i] = "NLS:Summary Update Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0108."; + top.titles[i] = "NLS:Summary Version"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0109."; + top.titles[i] = "NLS:Transaction Database"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0110."; + top.titles[i] = "NLS:Transaction Log Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0111."; + top.titles[i] = "NLS:Transaction Log Size"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0112."; + top.titles[i] = "NLS:Version"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0113."; + top.titles[i] = "Notification Consumers"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0114."; + top.titles[i] = "Notification Profile"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0115."; + top.titles[i] = "Notification Service Enabled"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0116."; + top.titles[i] = "Notification Srvc Net Addr"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0117."; + top.titles[i] = "Notification Srvc Net Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0118."; + top.titles[i] = "NRD:Registry Data"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0119."; + top.titles[i] = "NRD:Registry Index"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0120."; + top.titles[i] = "NSCP:mailAccessDomain"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0121."; + top.titles[i] = "NSCP:mailAlternateAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0122."; + top.titles[i] = "NSCP:mailAutoReplyMode"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0123."; + top.titles[i] = "NSCP:mailAutoReplyText"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0124."; + top.titles[i] = "NSCP:mailDeliveryOption"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0125."; + top.titles[i] = "NSCP:mailForwardingAddress"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0126."; + top.titles[i] = "NSCP:mailHost"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0127."; + top.titles[i] = "NSCP:mailMessageStore"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0128."; + top.titles[i] = "NSCP:mailProgramDeliveryInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0129."; + top.titles[i] = "NSCP:mailQuota"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0130."; + top.titles[i] = "NSCP:ngComponent"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0131."; + top.titles[i] = "NSCP:nsLicenseEndTime"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0132."; + top.titles[i] = "NSCP:nsLicensedFor"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0133."; + top.titles[i] = "NSCP:nsLicenseStartTime"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0134."; + top.titles[i] = "Page Description Languages"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0135."; + top.titles[i] = "preferredLanguage"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0136."; + top.titles[i] = "Primary Notification Service"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0137."; + top.titles[i] = "Primary Resource Service"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0138."; + top.titles[i] = "Printer Agent Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0139."; + top.titles[i] = "Printer Manufacturer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0140."; + top.titles[i] = "Printer Mechanism Types"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0141."; + top.titles[i] = "Printer Model"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0142."; + top.titles[i] = "Printer Status"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0143."; + top.titles[i] = "Printer to PA ID Mappings"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0144."; + top.titles[i] = "PSM Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0145."; + top.titles[i] = "Registry Advertising Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0146."; + top.titles[i] = "Registry Service Enabled"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0147."; + top.titles[i] = "Registry Srvc Net Addr"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0148."; + top.titles[i] = "Registry Srvc Net Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0149."; + top.titles[i] = "Resolution"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0150."; + top.titles[i] = "Resource Mgmt Srvc Net Addr"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0151."; + top.titles[i] = "Resource Mgmt Srvc Net Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0152."; + top.titles[i] = "Resource Mgmt Service Enabled"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0153."; + top.titles[i] = "Resource Mgr Database Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0154."; + top.titles[i] = "Resource Mgr Database Volume"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0155."; + top.titles[i] = "secretary"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0156."; + top.titles[i] = "Sides Supported"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0157."; + top.titles[i] = "SLP Attribute"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0158."; + top.titles[i] = "SLP Cache Limit"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0159."; + top.titles[i] = "SLP DA Back Link"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0160."; + top.titles[i] = "SLP Directory Agent DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0161."; + top.titles[i] = "SLP Language"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0162."; + top.titles[i] = "SLP Lifetime"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0163."; + top.titles[i] = "SLP Scope Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0164."; + top.titles[i] = "SLP Scope Unit DN"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0165."; + top.titles[i] = "SLP Start Purge Hour"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0166."; + top.titles[i] = "SLP Status"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0167."; + top.titles[i] = "SLP SU Back Link"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0168."; + top.titles[i] = "SLP SU Type"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0169."; + top.titles[i] = "SLP Type"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0170."; + top.titles[i] = "SLP URL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0171."; + top.titles[i] = "SMS Protocol Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0172."; + top.titles[i] = "SMS Registered Service"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0173."; + top.titles[i] = "SU"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0174."; + top.titles[i] = "SvcInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0175."; + top.titles[i] = "SvcType"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0176."; + top.titles[i] = "SvcTypeID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0006.0177."; + top.titles[i] = "userSMIMECertificate"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0007."; + top.titles[i] = "LDAP Operational Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0001."; + top.titles[i] = "createTimeStamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0002."; + top.titles[i] = "creatorsName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0003."; + top.titles[i] = "entryFlags"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0004."; + top.titles[i] = "federationBoundary"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0005."; + top.titles[i] = "localEntryID"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0006."; + top.titles[i] = "modifiersName"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0007."; + top.titles[i] = "modifyTimeStamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0008."; + top.titles[i] = "structuralObjectClass"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0009."; + top.titles[i] = "subordinateCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0007.0010."; + top.titles[i] = "subschemaSubentry"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0008."; + top.titles[i] = "Attribute Syntax Definitions"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0001."; + top.titles[i] = "Back Link"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0002."; + top.titles[i] = "Boolean"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0003."; + top.titles[i] = "Case Exact String"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0004."; + top.titles[i] = "Case Ignore List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0005."; + top.titles[i] = "Case Ignore String"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0006."; + top.titles[i] = "Class Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0007."; + top.titles[i] = "Counter"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0008."; + top.titles[i] = "Distinguished Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0009."; + top.titles[i] = "EMail Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0010."; + top.titles[i] = "Facsimile Telephone Number"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0011."; + top.titles[i] = "Hold"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0012."; + top.titles[i] = "Integer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0013."; + top.titles[i] = "Interval"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0014."; + top.titles[i] = "Net Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0015."; + top.titles[i] = "Numeric String"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0016."; + top.titles[i] = "Object ACL"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0017."; + top.titles[i] = "Octet List"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0018."; + top.titles[i] = "Octet String"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0019."; + top.titles[i] = "Path"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0020."; + top.titles[i] = "Postal Address"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0021."; + top.titles[i] = "Printable String"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0022."; + top.titles[i] = "Replica Pointer"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0023."; + top.titles[i] = "Stream"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0024."; + top.titles[i] = "Telephone Number"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0025."; + top.titles[i] = "Time"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0026."; + top.titles[i] = "Timestamp"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0027."; + top.titles[i] = "Typed Name"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0008.0028."; + top.titles[i] = "Unknown"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0009."; + top.titles[i] = "Index of Classes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0001."; + top.titles[i] = "A through B"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0002."; + top.titles[i] = "C through D"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0003."; + top.titles[i] = "E through K"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0004."; + top.titles[i] = "L through M"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0005."; + top.titles[i] = "N"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0006."; + top.titles[i] = "O"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0007."; + top.titles[i] = "P through R"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0008."; + top.titles[i] = "S"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0009.0009."; + top.titles[i] = "T through Z"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0010."; + top.titles[i] = "Index of Attributes"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0001."; + top.titles[i] = "A"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0002."; + top.titles[i] = "B"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0003."; + top.titles[i] = "C"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0004."; + top.titles[i] = "D"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0005."; + top.titles[i] = "E"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0006."; + top.titles[i] = "F through G"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0007."; + top.titles[i] = "H"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0008."; + top.titles[i] = "I through K"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0009."; + top.titles[i] = "L"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0010."; + top.titles[i] = "M"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0011."; + top.titles[i] = "N"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0012."; + top.titles[i] = "O"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0013."; + top.titles[i] = "P"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0014."; + top.titles[i] = "Q"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0015."; + top.titles[i] = "R"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0016."; + top.titles[i] = "S"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0017."; + top.titles[i] = "T"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0018."; + top.titles[i] = "U"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0010.0019."; + top.titles[i] = "V through Z"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0011."; + top.titles[i] = "Index of ASN.1 IDs"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0011.0001."; + top.titles[i] = "0"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0011.0002."; + top.titles[i] = "1"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0011.0003."; + top.titles[i] = "2 through 2.4"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0011.0004."; + top.titles[i] = "2.5 through 2.9"; + i++; + + top.authors[i] = "zFLDR xC.5375.0500.0012."; + top.titles[i] = "Index of LDAP Names"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0001."; + top.titles[i] = "A through B"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0002."; + top.titles[i] = "C"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0003."; + top.titles[i] = "D"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0004."; + top.titles[i] = "E through F"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0005."; + top.titles[i] = "G"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0006."; + top.titles[i] = "H"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0007."; + top.titles[i] = "I through K"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0008."; + top.titles[i] = "L"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0009."; + top.titles[i] = "M"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0010."; + top.titles[i] = "N"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0011."; + top.titles[i] = "O"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0012."; + top.titles[i] = "P"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0013."; + top.titles[i] = "Q through R"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0014."; + top.titles[i] = "S"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0015."; + top.titles[i] = "T"; + i++; + + top.authors[i] = "zHTML xD.5375.0500.0012.0016."; + top.titles[i] = "U through Z"; + i++; + + top.authors[i] = "zHTML xC.5375.0500.0013."; + top.titles[i] = "Revision History"; + i++; + + top.authors[i] = "zFLDR xB.5375.0400."; + top.titles[i] = "NDS Iterator Services"; + i++; + + top.authors[i] = "zFLDR xC.5375.0400.0001."; + top.titles[i] = "Concepts"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0001.0001."; + top.titles[i] = "Iterator Objects"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0001.0002."; + top.titles[i] = "Creation of an Iterator Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0001.0003."; + top.titles[i] = "Iterator Indexes"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0001.0004."; + top.titles[i] = "Positions of an Iterator Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0001.0005."; + top.titles[i] = "Current Position Movement with Retrieval Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0001.0006."; + top.titles[i] = "Retrieval of Data"; + i++; + + top.authors[i] = "zFLDR xC.5375.0400.0002."; + top.titles[i] = "Tasks"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0002.0001."; + top.titles[i] = "Creating a Search Iterator Object"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0002.0002."; + top.titles[i] = "Retrieving and Unpacking Object and Attribute Name Data"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0002.0003."; + top.titles[i] = "Retrieving and Unpacking Object, Attribute, and Value Data"; + i++; + + top.authors[i] = "zFLDR xC.5375.0400.0003."; + top.titles[i] = "Functions"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0001."; + top.titles[i] = "NWDSItrAtEOF"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0002."; + top.titles[i] = "NWDSItrAtFirst"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0003."; + top.titles[i] = "NWDSItrClone"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0004."; + top.titles[i] = "NWDSItrCount"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0005."; + top.titles[i] = "NWDSItrCreateList"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0006."; + top.titles[i] = "NWDSItrCreateSearch"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0007."; + top.titles[i] = "NWDSItrDestroy"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0008."; + top.titles[i] = "NWDSItrGetCurrent"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0009."; + top.titles[i] = "NWDSItrGetInfo"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0010."; + top.titles[i] = "NWDSItrGetNext"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0011."; + top.titles[i] = "NWDSItrGetPosition"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0012."; + top.titles[i] = "NWDSItrGetPrev"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0013."; + top.titles[i] = "NWDSItrSetPosition"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0014."; + top.titles[i] = "NWDSItrSetPositionFromIterator"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0015."; + top.titles[i] = "NWDSItrSkip"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0003.0016."; + top.titles[i] = "NWDSItrTypeDown"; + i++; + + top.authors[i] = "zFLDR xC.5375.0400.0004."; + top.titles[i] = "NDS Iterator Example Code"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0001."; + top.titles[i] = "Cloning an Iterator Object: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0002."; + top.titles[i] = "Counting with NDS Iterators: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0003."; + top.titles[i] = "Creating and Using a List Iterator: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0004."; + top.titles[i] = "Creating a Search Iterator and Displaying the Results: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0005."; + top.titles[i] = "Getting Iterator Information: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0006."; + top.titles[i] = "Getting and Setting the Iterator's Position: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0007."; + top.titles[i] = "Listing in Reverse Order: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0008."; + top.titles[i] = "Positioning the Iterator with Typedown: Example"; + i++; + + top.authors[i] = "zHTML xD.5375.0400.0004.0009."; + top.titles[i] = "Skipping Objects in the List: Example"; + i++; + + top.authors[i] = "zHTML xC.5375.0400.0005."; + top.titles[i] = "Revision History"; + i++; + + +// Morten's JavaScript Tree Menu +// written by Morten Wang <morten@treemenu.com> (c) 1998-2000 +// This is version 2.2.6, dated 2000-03-30 + +// The script is freely distributable +// It may be used (and modified) as you wish, but retain this message +// For more information about the menu visit its home page +// http://www.treemenu.com/ + +/****************************************************************************** +* Define the MenuItem object. * +******************************************************************************/ + +function MTMenuItem(text, url, target,nsearchID, icon) { + this.text = text; + this.url = url ? url : ""; + this.target = target ? target : ""; + this.icon = icon ? icon : ""; + this.nsearchID = nsearchID; + + this.number = MTMSubNumber++; + this.parent = null; + this.submenu = null; + this.expanded = false; + this.selected = false; + this.childSelected = false; + + this.MTMakeSubmenu = MTMakeSubmenu; + +} + +function MTMakeSubmenu(menu) { + this.submenu = menu; + for (var i = 0; i < menu.items.length; i++) + { + menu.items[i].parent = this; + } +} + + + +function getChildrenChecked(item, selected) +{ + if (item.submenu != null) + { + for (var x = 0; x < item.submenu.items.length; x++) + { + item.submenu.items[x].selected = selected; + item.submenu.items[x].childSelected = false; + MarkChildren(item.submenu.items[x],selected); + } + } +} + +/****************************************************************************** +* Define the Menu object. * +******************************************************************************/ + +function MTMenu() { + this.items = new Array(); + this.MTMAddItem = MTMAddItem; +} + +function MTMAddItem(item) { + this.items[this.items.length] = item; +} + +/****************************************************************************** +* Define the icon list, addIcon function and MTMIcon item. * +******************************************************************************/ + +function IconList() { + this.items = new Array(); + this.addIcon = addIcon; +} + +function addIcon(item) { + this.items[this.items.length] = item; +} + +function MTMIcon(iconfile, match, type) { + this.file = iconfile; + this.match = match; + this.type = type; +} + +/****************************************************************************** +* Global variables. Not to be altered unless you know what you're doing. * +* User-configurable options are at the end of this document. * +******************************************************************************/ + +var MTMLoaded = false; +var MTMLevel; +var MTMBar = new Array(); +var MTMIndices = new Array(); +var MTMBrowser = null; +var MTMNN3 = false; +var MTMNN4 = false; +var MTMIE4 = false; +var MTMUseStyle = true; + +/* + * (For a standalone JS shell test, we will simply set these as follows:) + */ +MTMBrowser = true; +MTMNN4 = true; + + +var MTMClickedItem = false; +var MTMExpansion = false; + +var MTMSubNumber = 1; +var MTMTrackedItem = false; +var MTMTrack = false; + +var MTMPreHREF = ""; +if(MTMIE4 || MTMNN3) { + MTMPreHREF += ""; // document.location.href.substring(0, document.location.href.lastIndexOf("/") +1); +} + +var MTMFirstRun = true; +var MTMCurrentTime = 0; // for checking timeout. +var MTMUpdating = false; +var MTMWinSize, MTMyval; +var MTMOutputString = ""; + +/****************************************************************************** +* Code that picks up frame names of frames in the parent frameset. * +******************************************************************************/ + + +/****************************************************************************** +* Dummy function for sub-menus without URLs * +* Thanks to Michel Plungjan for the advice. :) * +******************************************************************************/ + +function myVoid() { ; } + +/****************************************************************************** +* Functions to draw the menu. * +******************************************************************************/ + +function MTMSubAction(SubItem, ReturnValue) { + + SubItem.expanded = (SubItem.expanded) ? false : true; + if(SubItem.expanded) { + MTMExpansion = true; + } + + MTMClickedItem = SubItem.number; + + if(MTMTrackedItem && MTMTrackedItem != SubItem.number) { + MTMTrackedItem = false; + } + + if(!ReturnValue) { + setTimeout("MTMDisplayMenu()", 10); + } + + return ReturnValue; +} + + +function MarkChildren(item, selected) +{ + if (item.submenu != null) + { + for (var x = 0; x < item.submenu.items.length; x++) + { + item.submenu.items[x].selected = selected; + item.submenu.items[x].childSelected = false; + MarkChildren(item.submenu.items[x],selected); + } + } + +} + +function isAllChildrenSelected(item) +{ + if (item.submenu != null) + { + for (var x = 0; x < item.submenu.items.length; x++) + { + if (!item.submenu.items[x].selected) + { + return false; + } + } + } + return true; +} + +function isSomeChildrenSelected(item) +{ + var retValue = false; + + if (item.submenu != null) + { + for (var x = 0; x < item.submenu.items.length; x++) + { + if (item.submenu.items[x].selected || item.submenu.items[x].childSelected) + { + retValue = true; + } + } + } + + return retValue; +} + +function ToggleSelected(item, ReturnValue) { + + item.selected = (item.selected) ? false : true; + item.childSelected = false; + + var currentNode = item; + + while (currentNode.parent) + { + currentNode.parent.selected = isAllChildrenSelected(currentNode.parent); + currentNode.parent.childSelected = isSomeChildrenSelected(currentNode.parent); + currentNode = currentNode.parent; + } + + MarkChildren(item,item.selected); + + if(!ReturnValue) { + setTimeout("MTMDisplayMenu()", 10); + } + + return ReturnValue; +} + + +function MTMStartMenu() { + MTMLoaded = true; + if(MTMFirstRun) { + MTMCurrentTime++; + if(MTMCurrentTime == MTMTimeOut) { // call MTMDisplayMenu + setTimeout("MTMDisplayMenu()",10); + } else { + setTimeout("MTMStartMenu()",100); + } + } +} + +function MTMDisplayMenu() { + if(MTMBrowser && !MTMUpdating) { + MTMUpdating = true; + MTMFirstRun = false; + + if(MTMTrack) { MTMTrackedItem = MTMTrackExpand(menu); } + + if(MTMExpansion && MTMSubsAutoClose) { MTMCloseSubs(menu); } + + MTMLevel = 0; + MTMDoc = parent.frames[MTMenuFrame].document + MTMDoc.open("text/html", "replace"); + MTMOutputString = '<html><head>'; + if(MTMLinkedSS) { + MTMOutputString += '<link rel="stylesheet" type="text/css" href="' + MTMPreHREF + MTMSSHREF + '">'; + } else if(MTMUseStyle) { + MTMOutputString += '<style type="text/css">body {color:' + MTMTextColor + ';background:'; + MTMOutputString += (MTMBackground == "") ? MTMBGColor : MTMakeBackImage(MTMBackground); + MTMOutputString += ';} #root {color:' + MTMRootColor + ';background:' + ((MTMBackground == "") ? MTMBGColor : 'transparent') + ';font-family:' + MTMRootFont + ';font-size:' + MTMRootCSSize + ';} '; + MTMOutputString += 'a {font-family:' + MTMenuFont + ';letter-spacing:-0.05em;font-weight:bold;font-size:' + MTMenuCSSize + ';text-decoration:none;color:' + MTMLinkColor + ';background:' + MTMakeBackground() + ';} '; + MTMOutputString += MTMakeA('pseudo', 'hover', MTMAhoverColor); + MTMOutputString += MTMakeA('class', 'tracked', MTMTrackColor); + MTMOutputString += MTMakeA('class', 'subexpanded', MTMSubExpandColor); + MTMOutputString += MTMakeA('class', 'subclosed', MTMSubClosedColor) + '</style>'; + } + + MTMOutputString += '</head><body '; + if(MTMBackground != "") { + MTMOutputString += 'background="' + MTMPreHREF + MTMenuImageDirectory + MTMBackground + '" '; + } + MTMOutputString += 'bgcolor="' + MTMBGColor + '" text="' + MTMTextColor + '" link="' + MTMLinkColor + '" vlink="' + MTMLinkColor + '" alink="' + MTMLinkColor + '">'; + + MTMOutputString += '<table border="0" cellpadding="0" cellspacing="0" width="' + MTMTableWidth + '">'; + MTMOutputString += '<tr valign="top"><td nowrap>'; //REMOVED ROOT ICON <img src="' + MTMPreHREF + MTMenuImageDirectory + MTMRootIcon + '" align="left" border="0" vspace="0" hspace="0">'; + if(MTMUseStyle) { + MTMOutputString += ''; //REMOVED ROOT CAPTION <span id="root"> ' + MTMenuText + '</span>'; + } else { + MTMOutputString += ''; //REMOVED ROOT CAPTION <font size="' + MTMRootFontSize + '" face="' + MTMRootFont + '" color="' + MTMRootColor + '">' + MTMenuText + '</font>'; + } + MTMDoc.writeln(MTMOutputString + '</td></tr>'); + + MTMListItems(menu); + MTMDoc.writeln('</table>'); + + MTMDoc.writeln('</body></html>'); + MTMDoc.close(); + + if((MTMClickedItem || MTMTrackedItem) && (MTMNN4 || MTMIE4) && !MTMFirstRun) { + MTMItemName = "sub" + (MTMClickedItem ? MTMClickedItem : MTMTrackedItem); + if(document.layers && parent.frames[MTMenuFrame].scrollbars) { + MTMyval = parent.frames[MTMenuFrame].document.anchors[MTMItemName].y; + MTMWinSize = parent.frames[MTMenuFrame].innerHeight; + } else { + MTMyval = MTMGetPos(parent.frames[MTMenuFrame].document.all[MTMItemName]); + MTMWinSize = parent.frames[MTMenuFrame].document.body.offsetHeight; + } + if(MTMyval > (MTMWinSize - 60)) { + parent.frames[MTMenuFrame].scrollBy(0, parseInt(MTMyval - (MTMWinSize * 1/3))); + } + } + + MTMClickedItem = false; + MTMExpansion = false; + MTMTrack = false; + } +MTMUpdating = false; +} + +function MTMListItems(menu) { + var i, isLast; + for (i = 0; i < menu.items.length; i++) { + MTMIndices[MTMLevel] = i; + isLast = (i == menu.items.length -1); + MTMDisplayItem(menu.items[i], isLast); + + if (menu.items[i].submenu && menu.items[i].expanded) { + MTMBar[MTMLevel] = (isLast) ? false : true; + MTMLevel++; + MTMListItems(menu.items[i].submenu); + MTMLevel--; + } else { + MTMBar[MTMLevel] = false; + } + } + +} + +function MTMDisplayItem(item, last) { + var i, img, more; + + var MTMfrm = "parent.frames['code']"; + var MTMref = '.menu.items[' + MTMIndices[0] + ']'; + + if(item.submenu) { + var MTMouseOverText; + + var MTMClickCmd; + var MTMDblClickCmd = false; + + + if(MTMLevel > 0) { + for(i = 1; i <= MTMLevel; i++) { + MTMref += ".submenu.items[" + MTMIndices[i] + "]"; + } + } + + if(!MTMEmulateWE && !item.expanded && (item.url != "")) { + MTMClickCmd = "return " + MTMfrm + ".MTMSubAction(" + MTMfrm + MTMref + ",true);"; + } else { + MTMClickCmd = "return " + MTMfrm + ".MTMSubAction(" + MTMfrm + MTMref + ",false);"; + } + + if(item.url == "") { + MTMouseOverText = (item.text.indexOf("'") != -1) ? MTMEscapeQuotes(item.text) : item.text; + } else { + MTMouseOverText = "Expand/Collapse"; + } + } + + MTMOutputString = '<tr valign="top"><td nowrap>'; + if(MTMLevel > 0) { + for (i = 0; i < MTMLevel; i++) { + MTMOutputString += (MTMBar[i]) ? MTMakeImage("menu_bar.gif") : MTMakeImage("menu_pixel.gif"); + } + } + + more = false; + if(item.submenu) { + if(MTMSubsGetPlus || MTMEmulateWE) { + more = true; + } else { + for (i = 0; i < item.submenu.items.length; i++) { + if (item.submenu.items[i].submenu) { + more = true; + } + } + } + } + if(!more) { + img = (last) ? "menu_corner.gif" : "menu_tee.gif"; + } else { + if(item.expanded) { + img = (last) ? "menu_corner_minus.gif" : "menu_tee_minus.gif"; + } else { + img = (last) ? "menu_corner_plus.gif" : "menu_tee_plus.gif"; + } + if(item.url == "" || item.expanded || MTMEmulateWE) { + MTMOutputString += MTMakeVoid(item, MTMClickCmd, MTMouseOverText); + } else { + MTMOutputString += MTMakeLink(item, true) + ' onclick="' + MTMClickCmd + '">'; + } + } + MTMOutputString += MTMakeImage(img); +///////////////////////////////////////// + +var MTMCheckRef = '.menu.items[' + MTMIndices[0] + ']'; +if(MTMLevel > 0) { + for(i = 1; i <= MTMLevel; i++) { + MTMCheckRef += ".submenu.items[" + MTMIndices[i] + "]"; + } + } + +MTMOutputString += MTMakeVoid(item, "return " + MTMfrm + ".ToggleSelected(" + MTMfrm + MTMCheckRef + ",false);", "Checked Status") ; +var checkedImage = item.selected ? "checked.gif" : "uchecked.gif"; +if (!item.selected) +{ + checkedImage = item.childSelected ? "gchecked.gif" : "uchecked.gif"; +} +MTMOutputString += MTMakeImage(checkedImage); +MTMOutputString += '</a>'; +///////////////////////////////////////////////// + + + if(item.submenu) { + if(MTMEmulateWE && item.url != "") + { + MTMOutputString += '</a>' + MTMakeLink(item, false) + '>'; + } + + img = (item.expanded) ? "menu_folder_open.gif" : "menu_folder_closed.gif"; + + if(!more) { + if(item.url == "" || item.expanded) { + MTMOutputString += MTMakeVoid(item, MTMClickCmd, MTMouseOverText); + } else { + MTMOutputString += MTMakeLink(item, true) + ' onclick="' + MTMClickCmd + '">'; + } + } + MTMOutputString += MTMakeImage(img); + + } else { + MTMOutputString += MTMakeLink(item, true) + '>'; + img = (item.icon != "") ? item.icon : MTMFetchIcon(item.url); + MTMOutputString += MTMakeImage(img); + } + + if(item.submenu && (item.url != "") && (item.expanded && !MTMEmulateWE)) { + MTMOutputString += '</a>' + MTMakeLink(item, false) + '>'; + } + + if(MTMNN3 && !MTMLinkedSS) { + var stringColor; + if(item.submenu && (item.url == "") && (item.number == MTMClickedItem)) { + stringColor = (item.expanded) ? MTMSubExpandColor : MTMSubClosedColor; + } else if(MTMTrackedItem && MTMTrackedItem == item.number) { + stringColor = MTMTrackColor; + } else { + stringColor = MTMLinkColor; + } + MTMOutputString += '<font color="' + stringColor + '" size="' + MTMenuFontSize + '" face="' + MTMenuFont + '">'; + } + MTMOutputString += ' ' + item.text + ((MTMNN3 && !MTMLinkedSS) ? '</font>' : '') + '</a>' ; + MTMDoc.writeln(MTMOutputString + '</td></tr>'); +} + +function MTMEscapeQuotes(myString) { + var newString = ""; + var cur_pos = myString.indexOf("'"); + var prev_pos = 0; + while (cur_pos != -1) { + if(cur_pos == 0) { + newString += "\\"; + } else if(myString.charAt(cur_pos-1) != "\\") { + newString += myString.substring(prev_pos, cur_pos) + "\\"; + } else if(myString.charAt(cur_pos-1) == "\\") { + newString += myString.substring(prev_pos, cur_pos); + } + prev_pos = cur_pos++; + cur_pos = myString.indexOf("'", cur_pos); + } + return(newString + myString.substring(prev_pos, myString.length)); +} + +function MTMTrackExpand(thisMenu) { + var i, targetPath; + var foundNumber = false; + for(i = 0; i < thisMenu.items.length; i++) { + if(thisMenu.items[i].url != "" && MTMTrackTarget(thisMenu.items[i].target)) { + targetPath = parent.frames[thisMenu.items[i].target].location.protocol + '//' + parent.frames[thisMenu.items[i].target].location.host + parent.frames[thisMenu.items[i].target].location.pathname; + + if(targetPath.lastIndexOf(thisMenu.items[i].url) != -1 && (targetPath.lastIndexOf(thisMenu.items[i].url) + thisMenu.items[i].url.length) == targetPath.length) { + return(thisMenu.items[i].number); + } + } + if(thisMenu.items[i].submenu) { + foundNumber = MTMTrackExpand(thisMenu.items[i].submenu); + if(foundNumber) { + if(!thisMenu.items[i].expanded) { + thisMenu.items[i].expanded = true; + if(!MTMClickedItem) { MTMClickedItem = thisMenu.items[i].number; } + MTMExpansion = true; + } + return(foundNumber); + } + } + } +return(foundNumber); +} + +function MTMCloseSubs(thisMenu) { + var i, j; + var foundMatch = false; + for(i = 0; i < thisMenu.items.length; i++) { + if(thisMenu.items[i].submenu && thisMenu.items[i].expanded) { + if(thisMenu.items[i].number == MTMClickedItem) { + foundMatch = true; + for(j = 0; j < thisMenu.items[i].submenu.items.length; j++) { + if(thisMenu.items[i].submenu.items[j].expanded) { + thisMenu.items[i].submenu.items[j].expanded = false; + } + } + } else { + if(foundMatch) { + thisMenu.items[i].expanded = false; + } else { + foundMatch = MTMCloseSubs(thisMenu.items[i].submenu); + if(!foundMatch) { + thisMenu.items[i].expanded = false; + } + } + } + } + } +return(foundMatch); +} + +function MTMFetchIcon(testString) { + var i; + for(i = 0; i < MTMIconList.items.length; i++) { + if((MTMIconList.items[i].type == 'any') && (testString.indexOf(MTMIconList.items[i].match) != -1)) { + return(MTMIconList.items[i].file); + } else if((MTMIconList.items[i].type == 'pre') && (testString.indexOf(MTMIconList.items[i].match) == 0)) { + return(MTMIconList.items[i].file); + } else if((MTMIconList.items[i].type == 'post') && (testString.indexOf(MTMIconList.items[i].match) != -1)) { + if((testString.lastIndexOf(MTMIconList.items[i].match) + MTMIconList.items[i].match.length) == testString.length) { + return(MTMIconList.items[i].file); + } + } + } +return("menu_link_default.gif"); +} + +function MTMGetPos(myObj) { + return(myObj.offsetTop + ((myObj.offsetParent) ? MTMGetPos(myObj.offsetParent) : 0)); +} + +function MTMCheckURL(myURL) { + var tempString = ""; + if((myURL.indexOf("http://") == 0) || (myURL.indexOf("https://") == 0) || (myURL.indexOf("mailto:") == 0) || (myURL.indexOf("ftp://") == 0) || (myURL.indexOf("telnet:") == 0) || (myURL.indexOf("news:") == 0) || (myURL.indexOf("gopher:") == 0) || (myURL.indexOf("nntp:") == 0) || (myURL.indexOf("javascript:") == 0)) { + tempString += myURL; + } else { + tempString += MTMPreHREF + myURL; + } +return(tempString); +} + +function MTMakeVoid(thisItem, thisCmd, thisText) { + var tempString = ""; + tempString += '<a name="sub' + thisItem.number + '" href="javascript:parent.frames[\'code\'].myVoid();" onclick="' + thisCmd + '" onmouseover="window.status=\'' + thisText + '\';return true;" onmouseout="window.status=\'' + window.defaultStatus.replace(/'/g,"") + '\';return true;"'; + if(thisItem.number == MTMClickedItem) { + var tempClass; + tempClass = thisItem.expanded ? "subexpanded" : "subclosed"; + tempString += ' class="' + tempClass + '"'; + } + return(tempString + '>'); +} + +function MTMakeLink(thisItem, addName) { + var tempString = '<a'; + + if(MTMTrackedItem && MTMTrackedItem == thisItem.number) { + tempString += ' class="tracked"' + } + if(addName) { + tempString += ' name="sub' + thisItem.number + '"'; + } + tempString += ' href="' + MTMCheckURL(thisItem.url) + '"'; + if(thisItem.target != "") { + tempString += ' target="' + thisItem.target + '"'; + } +return tempString; +} + +function MTMakeImage(thisImage) { + return('<img src="' + MTMPreHREF + MTMenuImageDirectory + thisImage + '" align="left" border="0" vspace="0" hspace="0" width="18" height="18">'); +} + +function MTMakeBackImage(thisImage) { + var tempString = 'transparent url("' + ((MTMPreHREF == "") ? "" : MTMPreHREF); + tempString += MTMenuImageDirectory + thisImage + '")' + return(tempString); +} + +function MTMakeA(thisType, thisText, thisColor) { + var tempString = ""; + tempString += 'a' + ((thisType == "pseudo") ? ':' : '.'); + return(tempString + thisText + '{color:' + thisColor + ';background:' + MTMakeBackground() + ';}'); +} + +function MTMakeBackground() { + return((MTMBackground == "") ? MTMBGColor : 'transparent'); +} + +function MTMTrackTarget(thisTarget) { + if(thisTarget.charAt(0) == "_") { + return false; + } else { + for(i = 0; i < MTMFrameNames.length; i++) { + if(thisTarget == MTMFrameNames[i]) { + return true; + } + } + } + return false; +} + + + + +/****************************************************************************** +* User-configurable options. * +******************************************************************************/ + +// Menu table width, either a pixel-value (number) or a percentage value. +var MTMTableWidth = "100%"; + +// Name of the frame where the menu is to appear. +var MTMenuFrame = "tocmain"; + +// variable for determining whether a sub-menu always gets a plus-sign +// regardless of whether it holds another sub-menu or not +var MTMSubsGetPlus = true; + + +// variable that defines whether the menu emulates the behaviour of +// Windows Explorer +var MTMEmulateWE = true; + +// Directory of menu images/icons +var MTMenuImageDirectory = "/ndk/doc/docui2k/menu-images/"; + +// Variables for controlling colors in the menu document. +// Regular BODY atttributes as in HTML documents. +var MTMBGColor = "#cc0000"; +var MTMBackground = ""; +var MTMTextColor = "white"; + +// color for all menu items +var MTMLinkColor = "#ffffcc"; + +// Hover color, when the mouse is over a menu link +var MTMAhoverColor = "#FF9933"; + +// Foreground color for the tracking & clicked submenu item +var MTMTrackColor ="#FF9933"; +var MTMSubExpandColor = "#ffffcc"; +var MTMSubClosedColor = "#ffffcc"; + +// All options regarding the root text and it's icon +var MTMRootIcon = "menu_new_root.gif"; +var MTMenuText = "Site contents:"; +var MTMRootColor = "white"; +var MTMRootFont = "Verdana"; +var MTMRootCSSize = "84%"; +var MTMRootFontSize = "-1"; + +// Font for menu items. +var MTMenuFont = "Verdana"; +var MTMenuCSSize = "74%"; +var MTMenuFontSize = "-1"; + +// Variables for style sheet usage +// 'true' means use a linked style sheet. +var MTMLinkedSS = false; +var MTMSSHREF = "style/menu.css"; + +// Whether you want an open sub-menu to close automagically +// when another sub-menu is opened. 'true' means auto-close +var MTMSubsAutoClose = false; + +// This variable controls how long it will take for the menu +// to appear if the tracking code in the content frame has +// failed to display the menu. Number if in tenths of a second +// (1/10) so 10 means "wait 1 second". +var MTMTimeOut = 25; + +/****************************************************************************** +* User-configurable list of icons. * +******************************************************************************/ + +var MTMIconList = null; +MTMIconList = new IconList(); +// examples: +//MTMIconList.addIcon(new MTMIcon("menu_link_external.gif", "http://", "pre")); +//MTMIconList.addIcon(new MTMIcon("menu_link_pdf.gif", ".pdf", "post")); + +/****************************************************************************** +* User-configurable menu. * +******************************************************************************/ + + +// navigation link is an object used to store the extracted information from +// the search request. The stored information will be used to build the +// navigation tree. + function navigationLink(title,URL,level,elementIndex,levelIndex,parentIndex,author) + { + var returnArray = new Array(); + returnArray.title = title; + returnArray.URL = URL; + returnArray.level = level; + returnArray.hasChild = false; + returnArray.elementIndex = elementIndex; + returnArray.parentIndex = parentIndex; + returnArray.levelIndex = levelIndex; + returnArray.author = author; + + return returnArray; + } + +// Variables used for tracking state as the search iterates through the list +// of documents returned. +var index = 0; +var currentLevel = 0; +var levelParents = new Array(); +var levelIndexes = new Array(); +var navigationTree = new Array(); +var treeNodes = new Array(); +var levelIndex = 0; +top.printList = ""; +top.printCount = 0; + +// asign the menu handle to the created tree +var menu = null; + + +function getNextChecked(item) +{ + // case that root of tree is selected + if ( item.parent == null && item.selected) + { + for (var i = 0 ; i < top.authors.length; i++) + { + var re = /\s$/; + + if (top.titles[i].replace(re,"") == item.text.replace(re,"")) + { + top.printList += (top.authors[i].length + 3) + "_" + top.authors[i].replace(/\s/g,"+") + "+en"; + top.printCount ++; + } + } + } + else if (item.submenu != null) + { + for (var x = 0; x < item.submenu.items.length; x++) + { + if (item.submenu.items[x].selected) + { + var name = item.submenu.items[x].text; + for (var i = 0 ; i < top.authors.length; i++) + { + var re = /\s$/; + if (top.titles[i].replace(re,"") == name.replace(re,"")) + { + top.printList += (top.authors[i].length + 3) + "_" + top.authors[i].replace(/\s/g,"+") + "+en"; + top.printCount ++; + } + } + + } + else + { + getNextChecked(item.submenu.items[x]); + } + } + } + +} + +// Get a URL to pass checked topics to the Print Servlet + + + +function getPrintUrl(menu) +{ + top.printList = ""; + top.printCount = 0; + + getNextChecked(menu.items[0]); + top.printList = top.printCount + "_" + top.printList; + + return top.printList; +} + +function setLevels() +{ + + // Tracking the parent of the next node. + levelParents[currentLevel + 1] = index; + + // levelIndex is the child index under a branch + if (levelIndexes[currentLevel] == null) + { + levelIndexes[currentLevel] = 0; + } + else + { + levelIndexes[currentLevel] = levelIndexes[currentLevel] + 1; + levelIndexes[currentLevel + 1] = -1; + } +} + +function buildTree() +{ + +// Determine which nodes have children and assign the correct property +for (var i = 0; i < navigationTree.length-1; i++) +{ + // see if the current node has chilren + var thisLevel = navigationTree[i]["level"]; + var nextLevel = navigationTree[i+1]["level"]; + + if (nextLevel > thisLevel) + { + navigationTree[i]["hasChild"] = true; + } + else + { + navigationTree[i]["hasChild"] = false; + } +} + + +// create tree object nodes. +for( var j = 0; j < navigationTree.length; j++) +{ + treeNodes[j] = null; + treeNodes[j] = new MTMenu(); +} + + +// add all items to nodes - +// NOTE, index to add to is the parent index + 1 for node tree offset of root=0 +for( var j3 = 0; j3 < navigationTree.length; j3++) +{ + if (navigationTree[j3]["parentIndex"] == null) + { + var nsearchID = navigationTree[j3]["author"]; + treeNodes[0].MTMAddItem(new MTMenuItem(navigationTree[j3]["title"], navigationTree[j3]["URL"].replace(/http...developer.novell.com.ndk/gi,"/ndk") , "content_frame", nsearchID)); + } + else + { + var nsearchID = navigationTree[j3]["author"]; + treeNodes[navigationTree[j3]["parentIndex"] + 1 ].MTMAddItem(new MTMenuItem(navigationTree[j3]["title"], navigationTree[j3]["URL"].replace(/http...developer.novell.com.ndk/gi,"/ndk"), "content_frame",nsearchID)); + } +} + +// create submenu structure +// NOTE: add 1 to parent nodes for root = 0 offset. +for( var j4 = 0; j4 < navigationTree.length; j4++) +{ + if (navigationTree[j4]["hasChild"]) + { + var pindex = null; + if (navigationTree[j4]["parentIndex"] == null) + { + + pindex = 0; + } + else + { + pindex = navigationTree[j4]["parentIndex"]+1; + } + + var lindex = navigationTree[j4]["levelIndex"]; + // document.write('treeNodes[' + pindex +'].items['+ lindex +'].MTMakeSubmenu(treeNodes['+(j4+1)+']);<br>'); + + treeNodes[pindex].items[lindex].MTMakeSubmenu(treeNodes[j4+1]); + } +} + + menu = treeNodes[0]; + +//expand the second item to display the sub contents on first display +if (menu.items[0] != null ) +{ + menu.items[0].expanded = true; + +} + + + +} + + + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Libraries for C ","http://developer.novell.com/ndk/doc/ndslib/treetitl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Backup Services ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hevgtl7k.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDSBackupServerData ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSFreeNameList ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk12.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSGetReplicaPartitionNames ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk19.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSIsOnlyServerInTree ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk26.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSSYSVolumeRecovery ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk33.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSVerifyServerInfo ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk40.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Structures ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hqp7vveq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NAMEID_TYPE ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk48.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Values ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hmmmal7s.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Reason Flags ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/h3r99io5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Server Flags ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hnlckbki.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Event Services ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hmwiqbwd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Concepts ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hj3udfo7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Event Introduction ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hmgeu8a1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Event Functions ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hxwcemsz.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Event Priorities ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hux0tdup.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Event Data Filtering ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/ha7nqbpy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Event Types ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h741eryw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Global Network Monitoring ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h9alatk4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Tasks ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/huypg52u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Monitoring NDS Events ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hhkihe7f.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Registering for NDS Events ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h0xmzt1h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unregistering for NDS Events ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hk3fvwed.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NWDSEConvertEntryName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk28.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEGetLocalAttrID ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk33.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEGetLocalAttrName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk39.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEGetLocalClassID ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk45.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEGetLocalClassName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk51.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEGetLocalEntryID ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk57.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEGetLocalEntryName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk63.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSERegisterForEvent ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk69.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSERegisterForEventWithResult ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk75.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSEUnRegisterForEvent ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk81.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Structures ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hqp7vveq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("DSEACL ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk88.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEBackLink ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk92.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEBinderyObjectInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk96.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEBitString ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk100.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEChangeConnState ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk104.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSECIList ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk108.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEDebugInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk112.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEEmailAddress ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk116.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEEntryInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk120.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEEntryInfo2 ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk124.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEEventData ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk128.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEFaxNumber ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk132.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEHold ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk135.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEModuleState ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk139.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSENetAddress ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk143.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEOctetList ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk147.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEPath ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk151.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEReplicaPointer ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk155.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSESEVInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk159.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSETimeStamp ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk163.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSETraceInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk167.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSETypedName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk172.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEVALData ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk176.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSEValueInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk179.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Values ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hmmmal7s.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Event Priorities ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hlerfllh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Event Types ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hiz5y84y.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/a6hw6zr.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Technical Overview ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h6tvg4z7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS as the Internet Directory ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h273w870.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Requirements for Networks and the Internet ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a2lh37b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Compliance to X.500 Standard ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h0jj42d7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Compliance with LDAP v3 ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a2b6k5w.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Directory Access Protocols ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a2b6k5x.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Programming Interfaces for NDS ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h2qzzkq8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Architecture ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h6mny7fl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Objects ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hp4dslw5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Names ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h0yh1byj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Types of Information Stored in NDS ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hci52ynf.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Retrieval of Information from NDS ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hwwz5mda.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Tree Walking ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h2xhaphc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Object Management ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h3mq2rf0.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Security ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hl8x1zxc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Authentication ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hp901s8a.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Access Control Lists ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hr8sqtoi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Inheritance ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hh9881ul.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NetWare File System ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h64btfhk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Partitions and Replicas ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hmq60r6h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Partitioning ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hqx5hvrp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replication ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hj5l8npv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Distributed Reference Management ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hzap47de.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition Operations ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hgbpk7x9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Synchronization ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hsiplgn4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Background Processes ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hz2kcp2e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Bindery Services ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hwug6ytv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Bindery Context ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h8dwby8o.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Context Path ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h6y3yva6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Context Eclipsing ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hwcqk80m.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Bindery Objects ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hq4w9le6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Return Values ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hbjry4gt.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NDS Return Values from the Operating System ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h5h16q77.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Client Return Values ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/he2lvhfy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Agent Return Values ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hcvwzt90.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Directory Services Trace Utilities ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hujirj2n.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Using the DSTrace NLM ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hmg1e5gn.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Using Basic SET DSTrace Commands ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hdn0smja.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Starting Background Processes with SET DSTrace ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h5pjd8fv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Tuning Background Processes ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hhv9cqpk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Enabling DSTrace Messages with SET DSTrace ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hcah5j8v.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Core Services ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h2y7hdit.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Programming Concepts ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h2x9gqr9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Context Handles ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huynzi7a.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Buffer Management ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h9xiygoj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Read Requests for Object Information ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h7d6try4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Search Requests ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h11es6ae.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Developing in a Loosely Consistent Environment ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hsaqomj7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Add Object Requests ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hqjws9hi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Security and Applications ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h3xwyggn.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Authentication of Client Applications ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h0m1k6ck.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Multiple Tree Support ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hu5a8flo.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Effective Rights Function ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/he06edkq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/ha7fzu9h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hpmsr4w7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Read Requests for Schema Information ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h0a2o4v9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Schema Extension Requests ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hrgy5k6e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huypg52u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Context Handle Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hw34ixeu.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Buffer Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hb1nkqk4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Authentication and Connection Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huzx6sda.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hddp9m9i.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition and Replica Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hpx2o69b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Schema Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hp85l75p.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NWDSAbbreviateName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk135.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAbortPartitionOperation ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk144.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAddFilterToken ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk153.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAddObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk162.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAddPartition (obsolete---moved from .h file 11/99) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk171.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAddReplica ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk180.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAddSecurityEquiv ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk189.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAllocBuf ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk198.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAllocFilter ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk207.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAuditGetObjectID ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk216.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAuthenticate ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk225.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAuthenticateConn ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk234.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSAuthenticateConnEx ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a3fvxoz.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSBackupObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk243.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSBeginClassItem ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk252.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCanDSAuthenticate ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk261.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCanonicalizeName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk270.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSChangeObjectPassword ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk279.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSChangeReplicaType ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk288.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCIStringsMatch ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk297.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCloseIteration ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk305.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCompare ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk314.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSComputeAttrValSize ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk360.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCreateContext (obsolete---moved from .h file 6/99) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk369.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSCreateContextHandle ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk371.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSDefineAttr ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk382.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSDefineClass ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk391.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSDelFilterToken ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk402.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSDuplicateContext (obsolete 03/99) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk412.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSDuplicateContextHandle ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk423.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSExtSyncList ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk434.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSExtSyncRead ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk443.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSExtSyncSearch ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk455.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSFreeBuf ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk465.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSFreeContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk474.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSFreeFilter ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk491.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGenerateObjectKeyPair ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk501.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetAttrCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk511.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetAttrDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk521.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetAttrName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk530.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetAttrVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk540.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetAttrValFlags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk550.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetAttrValModTime ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk558.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetBinderyContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk566.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk603.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetClassDefCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk691.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetClassItem ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk769.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetClassItemCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk838.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk919.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetCountByClassAndName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk972.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetCurrentUser ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1031.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetDefNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1041.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetDSIInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1117.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetDSVerInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1209.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetEffectiveRights ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1274.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetMonitoredConnRef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1346.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetNDSInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1425.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetObjectCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1528.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetObjectHostServerAddress ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1604.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetObjectName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1640.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetObjectNameAndInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1700.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetPartitionExtInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1781.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetPartitionExtInfoPtr ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1830.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetPartitionInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1938.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetPartitionRoot ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2001.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetServerAddresses (obsolete 3/98) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2021.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetServerAddresses2 ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2030.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetServerDN ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2039.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetServerName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2047.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetSyntaxCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2056.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetSyntaxDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2065.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSGetSyntaxID ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2074.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSInitBuf ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2082.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSInspectEntry ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2091.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSJoinPartitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2099.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSList ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2108.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSListAttrsEffectiveRights ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2117.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSListByClassAndName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2126.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSListContainableClasses ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2135.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSListContainers ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2144.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSListPartitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2153.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSListPartitionsExtInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2162.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSLogin ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2171.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSLoginAsServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2180.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSLogout ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2187.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSMapIDToName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2196.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSMapNameToID ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2205.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSModifyClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2214.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSModifyDN ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2223.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSModifyObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2232.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSModifyRDN ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2241.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSMoveObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2250.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSMutateObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a37nkf6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSOpenConnToNDSServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2259.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSOpenMonitoredConn ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2268.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSOpenStream ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2277.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPartitionReceiveAllUpdates ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2285.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPartitionSendAllUpdates ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2294.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutAttrName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2303.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutAttrNameAndVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2312.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutAttrVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2321.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutChange ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2330.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutChangeAndVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2339.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutClassItem ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2348.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutClassName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2357.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutFilter ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2364.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSPutSyntaxName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2373.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRead ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2380.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadAttrDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2389.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2398.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadNDSInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2407.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadObjectDSIInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2416.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadObjectInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2425.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadReferences ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2434.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadSyntaxDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2443.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReadSyntaxes ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2451.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReloadDS ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2459.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemoveAllTypes ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2467.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemoveAttrDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2475.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemoveClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2484.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemoveObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2493.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemovePartition ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2501.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemoveReplica ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2510.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRemSecurityEquiv ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2519.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRepairTimeStamps ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2528.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReplaceAttrNameAbbrev ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2536.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSResolveName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2544.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSRestoreObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2553.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSReturnBlockOfAvailableTrees ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2562.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSScanConnsForTrees ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2573.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSScanForAvailableTrees ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2582.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSearch ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2591.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSetContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2600.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSetCurrentUser ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2609.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSetDefNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2615.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSetMonitoredConnection ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2624.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSplitPartition ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2633.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSyncPartition ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2642.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSyncReplicaToServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2651.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSSyncSchema ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2660.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSUnlockConnection ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2669.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSVerifyObjectPassword ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2678.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSWhoAmI ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2687.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWGetDefaultNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2695.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWGetFileServerUTCTime ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2704.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWGetNumConnections ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2712.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWGetNWNetVersion ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2720.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWGetPreferredConnName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2727.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWIsDSAuthenticated ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2736.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWIsDSServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2743.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWNetInit ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2750.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWNetTerm ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2759.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWSetDefaultNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2767.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWSetPreferredDSTree ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2776.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Structures ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hqp7vveq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Asn1ID_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2785.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Attr_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2790.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Back_Link_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2795.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bit_String_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2800.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Buf_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2805.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("CI_List_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2810.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Class_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2815.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("EMail_Address_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2820.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Fax_Number_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2826.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Filter_Cursor_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2831.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Filter_Node_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2836.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Hold_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2841.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSOSVersion_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2846.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSStatsInfo_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2850.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Net_Address_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2855.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDS_TimeStamp_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2860.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object_ACL_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2865.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2870.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Octet_List_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2875.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Octet_String_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2880.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Path_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2885.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica_Pointer_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2890.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Syntax_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2895.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("TimeStamp_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2900.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Typed_Name_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2906.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unknown_Attr_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2911.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hmmmal7s.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Attribute Constraint Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hudjk3k4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Attribute Value Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h6anqw6h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Buffer Operation Types and Related Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h8bn0lfm.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Class Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hpj620k3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Change Types for Modifying Objects ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hc4p686b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Context Keys and Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h1btx3en.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Default Context Key Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hlkcqs3t.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DCK_FLAGS Bit Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/he1wcp92.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DCK_NAME_FORM Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hmd7uuiw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DCK_CONFIDENCE Bit Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h7hy5yg3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DCK_DSI_FLAGS Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huh0ri39.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSI_ENTRY_FLAGS Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hqwiyl1u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Filter Tokens ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h487zxy3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Information Types for Attribute Definitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hdqx1cns.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Information Types for Class Definitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hcq403ms.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Information Types for Search and Read ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/ha682lf8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Name Space Types ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hs6qj0yl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Access Control Rights ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h12s89uj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDS Ping Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hf0fdqhd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DSP Replica Information Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hw42a7qg.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Network Address Types ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hniuyp90.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Scope Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h6wfyyfk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica Types ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/he290q86.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica States ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h9br9yt1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Syntax Matching Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hd8fn0rm.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Syntax IDs ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hn1dsa7y.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Example Code ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hb05g04v.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Context Handle ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2sofgc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object and Attribute ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snp6e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Browsing and Searching ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snu78.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Batch Modification of Objects and Attributes ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snzot.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Schema ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snqyd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Schema Reference ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h4q1mn1i.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Schema Concepts ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h282spjh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Schema Structure ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hpmkggmh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Schema Components ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hvt5bdoi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hbna398k.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Naming Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h9vf1k0r.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Containment Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hh1izaro.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Super Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hmdjysrx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object Class Flags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h6rvyaky.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Mandatory and Optional Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h2vnta8j.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Default ACL Templates ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hr9sm1l0.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Auxiliary Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hlh5m1af.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Attribute Type Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hotadinr.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Attribute Syntax Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h2m59phc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Schema Extensions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/he5mef3b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Base Object Class Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hmv2qd15.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("AFP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk75.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Alias ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk83.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("applicationEntity ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk91.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("applicationProcess ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk99.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:File Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk107.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk115.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk123.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("certificationAuthority ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk131.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("CommExec ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk139.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Computer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk147.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Country ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk155.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("cRLDistributionPoint ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk163.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("dcObject ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk171.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Device ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk179.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Directory Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk187.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("domain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk195.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("dSA ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk203.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("External Entity ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk219.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk227.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a38rj6z.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk243.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk251.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Locality ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk259.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MASV:Security Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk267.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Message Routing Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk275.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Messaging Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk283.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NCP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk291.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("ndsLoginProperties ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk347.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Certificate Authority ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk355.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Key Material ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk363.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:SD Key Access Partition ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvd6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:SD Key List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvdx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Trusted Root ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvbk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Trusted Root Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvcf.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:groupOfCertificates ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk421.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailGroup1 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk445.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailRecipient ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk466.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:NetscapeMailServer5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk474.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:NetscapeServer5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk482.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nginfo3 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk510.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsLicenseUser ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk518.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Organization ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk530.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Organizational Person ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk541.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Organizational Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk550.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Organizational Unit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk561.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk570.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Person ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk578.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("pkiCA ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk586.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("pkiUser ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk594.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Print Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk602.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk610.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Profile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk618.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk626.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk634.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SAS:Security ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk642.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SAS:Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk650.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk658.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("strongAuthenticationUser ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk698.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Template ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk706.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Top ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk714.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Tree Root ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk722.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk730.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk738.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("userSecurityInformation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk746.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk754.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("WANMAN:LAN Area ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk762.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Novell Object Class Extensions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3fh4x1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Entrust:CRLDistributionPoint ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk211.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("inetOrgPerson ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk235.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Broker ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk299.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Manager ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk307.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk315.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk323.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Master Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk331.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Slave Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk339.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NetSvc ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk379.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:License Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk386.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:License Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk394.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Product Container ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk412.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:groupOfUniqueNames5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk432.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailGroup5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk454.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:Nginfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk491.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:Nginfo2 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk502.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("residentialPerson ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3omhcl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Scope Unit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk666.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Directory Agent ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk674.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk682.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SMS SMDR Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk690.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Graphical View of Object Class Inheritance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hzah4ydk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Alias and Bindery Object Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hw8hr9jx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Tree Root, domain, and Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hu1mitlx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Computer, Country, Device, and Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hnf7uif9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("List and Locality ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h48ynbap.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Organizational Role and Partition ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hrfg9w4e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("ndsLoginProperties, Organization, and Organizational Unit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hzvb48kg.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("ndsLoginProperties, Person, Organizational Person, and User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hknzjmiv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Directory Map, Profile, Queues, Resource, and Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h8jovuwl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Servers (AFP, Messaging, NCP, Print) and CommExec ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/ha47y85g.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("External Entity, Group, and Message Routing Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hds3w6ie.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Base Attribute Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hf9qbbni.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Aliased Object Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk782.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Account Balance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk788.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("ACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk794.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Allow Unlimited Credit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk800.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("associatedName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a7bbra4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("attributeCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk806.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:A Encryption Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk812.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:B Encryption Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk818.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:Contents ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk824.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:Current Encryption Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk830.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:File Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk836.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:Link List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk842.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk848.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk854.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Audit:Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk860.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("authorityRevocationList ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk866.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Authority Revocation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk872.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("AuxClass Object Class Backup ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk878.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Auxiliary Class Flag ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk884.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk890.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Object Restriction ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk896.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Property ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk902.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Restriction Level ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk908.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Bindery Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk914.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("businessCategory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk920.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk932.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("cACertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk938.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("CA Private Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk944.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("CA Public Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk950.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Cartridge ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk956.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("certificateRevocationList ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk962.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Certificate Revocation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk968.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Certificate Validity Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk974.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("crossCertificatePair ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk926.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk986.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Convergence ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk998.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Cross Certificate Pair ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1004.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("dc ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1034.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Default Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1040.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("deltaRevocationList ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1052.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("departmentNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3on5am.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Description ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1058.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("destinationIndicator ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1064.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Detect Intruder ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1070.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Device ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1076.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("dmdName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1082.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("dn ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1088.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("dnQualifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1094.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("DS Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1100.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("EMail Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1106.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("employeeType ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3on9iy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("enhancedSearchGuide ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1120.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Equivalent To Me ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1138.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("External Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1144.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("External Synchronizer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1150.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Facsimile Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1156.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Full Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1162.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Generational Qualifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1168.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("generationQualifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1174.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1180.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Given Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1186.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1192.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("GUID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1198.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("High Convergence Sync Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1216.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Higher Privileges ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1222.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Home Directory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1228.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Home Directory Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1234.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("homePhone ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onbgn.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("homePostalAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3ondem.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("houseIdentifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1258.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Host Device ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1240.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Host Resource Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1246.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Host Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1252.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Inherited ACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1264.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Initials ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1270.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("internationaliSDNNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1276.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Internet EMail Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1282.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Intruder Attempt Reset Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1288.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Intruder Lockout Reset Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1294.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("knowledgeInformation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1312.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1318.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Language ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1324.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Last Login Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1330.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Last Referenced Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1336.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP ACL v11 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1342.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Allow Clear Text Password ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1348.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Anonymous Identity ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1354.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Attribute Map v11 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1360.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Backup Log Filename ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1366.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Class Map v11 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1378.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Enable SSL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1384.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Enable TCP ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1390.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Enable UDP ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1396.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1402.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Host Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1408.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Log Filename ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1414.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Log Level ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1420.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Log Size Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1426.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Referral ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1432.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Screen Level ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1438.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Search Size Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1444.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Search Time Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1450.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1456.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Server Bind Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1462.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Server Idle Timeout ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1468.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Server List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1474.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP SSL Port ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1480.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Suffix ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1486.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP TCP Port ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1492.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP UDP Port ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1498.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:bindCatalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1516.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:bindCatalogUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1522.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:keyMaterialName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1546.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:otherReferralUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1552.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:searchCatalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1558.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:searchCatalogUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1564.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:searchReferralUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1570.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Locked By Intruder ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1576.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Lockout After Detection ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1582.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Allowed Time Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1588.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Disabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1594.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Expiration Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1600.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Grace Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1606.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Grace Remaining ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1612.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Intruder Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1618.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Intruder Attempts ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1624.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Intruder Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1630.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Intruder Reset Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1636.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Maximum Simultaneous ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1642.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Script ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1648.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Login Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1654.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Low Convergence Reset Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1660.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Low Convergence Sync Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1666.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Mailbox ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1672.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Mailbox Location ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1678.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("manager ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onljj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("masvAuthorizedRange ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1684.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("masvDefaultRange ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1690.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("masvDomainPolicy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1696.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("masvLabel ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1702.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("masvProposedLabel ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1708.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Member ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1726.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Members Of Template ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1732.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Memory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1738.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Message Routing Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1744.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Message Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1750.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Messaging Database Location ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1756.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Messaging Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1762.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1768.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Minimum Account Balance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1786.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("mobile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oojmc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Certificate Chain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4104.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Given Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4110.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Key File ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4116.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Key Material DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4122.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Keystore ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknqe.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Not After ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Not Before ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpe.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Parent CA ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4128.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Parent CA DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4134.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Private Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4140.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Public Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4146.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Public Key Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4152.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:SD Key Cert ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknq2.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:SD Key ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknq8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:SD Key Server DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:SD Key Struct ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Subject Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4158.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Tree CA DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4164.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:Trusted Root Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknp8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSPKI:userCertificateInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknp2.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Network Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4170.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Network Address Restriction ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4176.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("New Object's DS Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4182.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("New Object's FS Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4188.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("New Object's Self Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4194.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NNS Domain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4338.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Notify ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4374.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:administratorContactInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4392.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:adminURL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4398.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailAccessDomain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4404.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailAlternateAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4410.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailAutoReplyMode ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4416.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailAutoReplyText ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4422.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailDeliveryOption ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4428.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailForwardingAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4434.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailHost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4440.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailMessageStore ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4446.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailProgramDeliveryInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4452.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AmailQuota ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4458.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AnsLicenseEndTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4464.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AnsLicensedFor ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4470.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:AnsLicenseStartTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4476.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:employeeNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4482.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:installationTimeStamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4488.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailRoutingAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2ixy4e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:memberCertificateDesc ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4554.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mgrpRFC822mailmember ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4560.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:ngcomponentCIS ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4572.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsaclrole ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4578.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nscreator ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4584.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsflags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4590.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsnewsACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4614.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsprettyname ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4620.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:serverHostName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4626.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:serverProductName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4632.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:serverRoot ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4638.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:serverVersionNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4644.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:subtreeACI ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4650.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4656.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Obituary ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4662.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Obituary Notify ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4668.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4674.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Operator ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4680.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Other GUID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4686.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4692.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Owner ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4698.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Page Description Language ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4704.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("pager ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oojmj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition Control ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4716.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition Creation Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4722.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Partition Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4728.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Allow Change ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4734.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Expiration Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4740.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Expiration Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4746.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Management ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4752.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Minimum Length ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4758.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Required ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4764.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Password Unique Required ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4770.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Passwords Used ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4776.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4782.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Permanent Config Parms ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4788.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Physical Delivery Office Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4794.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Postal Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4800.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Postal Code ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4806.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Postal Office Box ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4812.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Postmaster ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4818.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("preferredDeliveryMethod ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4824.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("presentationAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4830.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Print Job Configuration ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4848.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Print Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4854.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4860.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Configuration ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4872.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Control ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4878.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Private Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4914.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Profile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4920.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Profile Membership ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4926.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("protocolInformation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4932.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Public Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4944.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Purge Vector ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4950.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4956.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Queue Directory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4962.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Received Up To ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4968.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Reference ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4974.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("registeredAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4980.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5010.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica Up To ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5016.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5028.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5064.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Role Occupant ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5070.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("roomNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5076.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Run Setup Script ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5082.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5088.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5094.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SAP Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5100.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SAS:Security DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5106.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SAS:Service DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5112.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("searchGuide ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5118.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("searchSizeLimit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5124.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("searchTimeLimit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5130.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Security Equals ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5136.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Security Flags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5142.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("See Also ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5148.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Serial Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5154.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5160.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Server Holds ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5166.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Set Password After Create ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5172.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Setup Script ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5178.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5286.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("supportedAlgorithms ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5298.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("supportedApplicationContext ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5304.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Supported Connections ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5310.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Supported Gateway ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5316.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Supported Services ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5322.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Supported Typefaces ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5328.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Surname ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5334.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Synchronization Tolerance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5358.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Synchronized Up To ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5364.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5370.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5376.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("telexNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5382.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("telexTerminalIdentifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5388.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Timezone ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5394.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Title ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5400.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Transitive Vector ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5406.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Trustees Of New Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5412.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Type Creator Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5418.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5424.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("uniqueID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5430.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5436.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unknown Auxiliary Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5442.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unknown Base Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5448.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Used By ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5454.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5460.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("userCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5466.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("userPassword ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6m1fnz.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Uses ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5472.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Version ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5478.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5484.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Volume Space Restrictions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5490.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("WANMAN:Cost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5496.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("WANMAN:Default Cost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5502.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("WANMAN:LAN Area Membership ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5508.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("WANMAN:WAN Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5514.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("x121Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5520.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("x500UniqueIdentifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5526.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Novell Attribute Extensions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3fh5xp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("audio ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3omwno.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("carLicense ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3on4e7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Client Install Candidate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk980.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Color Supported ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk992.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Database Dir Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1010.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Database Volume Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1016.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Datapool Location ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1022.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Datapool Locations ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1028.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Delivery Methods Installed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1046.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("displayName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oorbo.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Employee ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1114.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Entrust:AttributeCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1126.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Entrust:User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1132.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("GW API Gateway Directory Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1204.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("GW API Gateway Directory Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1210.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("IPP URI ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1300.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("IPP URI Security Scheme ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1306.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("jpegPhoto ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onfdu.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("labeledUri ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onkke.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP Class Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1372.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("ldapPhoto ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3op8zp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAPUserCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1504.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:ARL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1510.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:caCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1528.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:CRL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1534.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("LDAP:crossCertificatePair ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1540.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MASV:Authorized Range ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2co5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MASV:Default Range ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2cob.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MASV:Domain Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2coh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MASV:Label ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2con.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MASV:Proposed Label ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2cot.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Maximum Speed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1714.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Maximum Speed Units ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1720.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MHS Send Directory Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1774.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("MHS Send Directory Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1780.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Accountant Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1792.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Control Flags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1798.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Database Saved Timestamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1804.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Database Saved Data Image ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1810.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Database Saved Index Image ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1816.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Default Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1822.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Default Public Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1828.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Job Configuration ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1834.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Manager Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1840.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Operator Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1846.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Printer Install List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1852.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Printer Install Timestamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1858.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Printer Queue List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1864.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Printer Siblings ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1870.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Public Printer Install List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1876.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS Replace All Client Printers ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1882.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS SMTP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1888.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDPS User Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1894.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual All Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1900.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Attribute Count ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1906.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1912.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Base Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1918.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Catalog Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1924.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual End Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1930.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Filter ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1936.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Object Count ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1942.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Return Code ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1948.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Scope ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1954.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Search Aliases ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1960.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Start Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1966.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Actual Value Count ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1972.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:All Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1978.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:AttrDefTbl ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1984.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1990.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Auto Dredge ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1996.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Base Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk2002.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:CatalogDB ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk2008.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Catalog List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk2014.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Dredge Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4008.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Filter ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4014.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:IndexDefTbl ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4020.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Indexes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4026.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Label ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4032.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Log ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4038.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Master Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4044.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Max Log Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4050.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Max Retries ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4056.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Max Threads ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4062.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Retry Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4068.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Scope ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4074.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Search Aliases ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4080.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Slave Catalog List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4086.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Start Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4092.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NDSCat:Synch Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4098.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Common Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4200.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Current Installed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4206.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Current Peak Installed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4212.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Current Peak Used ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4218.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Current Used ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4224.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Hourly Data Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4230.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:License Database ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4236.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:License ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4242.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:License Service Provider ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4248.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:LSP Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4254.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Owner ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4260.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Peak Installed Data ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4266.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Peak Used Data ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4272.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Product ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4278.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Publisher ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4284.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4290.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Search Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4296.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Summary Update Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4302.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Summary Version ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4308.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Transaction Database ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4314.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Transaction Log Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4320.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Transaction Log Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4326.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NLS:Version ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4332.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Notification Consumers ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4344.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Notification Profile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4350.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Notification Service Enabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4356.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Notification Srvc Net Addr ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4362.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Notification Srvc Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4368.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NRD:Registry Data ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4380.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NRD:Registry Index ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4386.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailAccessDomain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4494.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailAlternateAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4500.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailAutoReplyMode ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4506.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailAutoReplyText ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4512.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailDeliveryOption ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4518.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailForwardingAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4524.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailHost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4530.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailMessageStore ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4536.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailProgramDeliveryInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4542.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:mailQuota ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4548.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:ngComponent ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4566.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsLicenseEndTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4596.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsLicensedFor ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4602.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NSCP:nsLicenseStartTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4608.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Page Description Languages ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4710.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("preferredLanguage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oon3t.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Primary Notification Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4836.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Primary Resource Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4842.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Agent Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4866.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Manufacturer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4884.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Mechanism Types ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4890.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Model ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4896.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4902.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printer to PA ID Mappings ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4908.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("PSM Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4938.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Registry Advertising Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4986.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Registry Service Enabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4992.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Registry Srvc Net Addr ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4998.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Registry Srvc Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5004.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resolution ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5022.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource Mgmt Srvc Net Addr ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5034.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource Mgmt Srvc Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5040.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource Mgmt Service Enabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5046.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource Mgr Database Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5052.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Resource Mgr Database Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5058.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("secretary ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oon40.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Sides Supported ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5184.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Attribute ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5190.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Cache Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5196.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP DA Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5202.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Directory Agent DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5208.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Language ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5214.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Lifetime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5220.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Scope Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5226.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Scope Unit DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5232.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Start Purge Hour ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5238.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5244.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP SU Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5250.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP SU Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5256.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5262.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SLP URL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5268.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SMS Protocol Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5274.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SMS Registered Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5280.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SU ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5292.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SvcInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5340.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SvcType ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5346.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("SvcTypeID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5352.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("userSMIMECertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oorbh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("LDAP Operational Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a7lnqjy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("createTimeStamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3q.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("creatorsName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3f.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("entryFlags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxcp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("federationBoundary ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fzxsm.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("localEntryID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fzcam.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("modifiersName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3j.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("modifyTimeStamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3x.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("structuralObjectClass ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxcb.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("subordinateCount ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxci.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("subschemaSubentry ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxc4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Attribute Syntax Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h55cqjqs.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5533.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Boolean ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5540.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Case Exact String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5547.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Case Ignore List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5554.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Case Ignore String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5561.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Class Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5568.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Counter ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5575.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Distinguished Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5582.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("EMail Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5589.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Facsimile Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5596.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Hold ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5603.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Integer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5610.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5617.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5624.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Numeric String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5631.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Object ACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5638.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Octet List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5645.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Octet String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5652.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5659.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Postal Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5666.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Printable String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5673.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Replica Pointer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5680.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Stream ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5687.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5694.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5701.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Timestamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5708.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Typed Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5715.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5722.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Index of Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("A through B ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx2.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("C through D ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("E through K ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("L through M ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("N ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("O ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("P through R ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("S ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("T through Z ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx10.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Index of Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx11.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("A ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx12.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("B ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx13.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("C ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx14.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("D ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx15.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("E ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx16.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("F through G ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx17.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("H ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx18.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("I through K ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx19.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("L ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx20.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("M ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx21.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("N ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx22.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("O ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx23.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("P ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx24.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Q ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx25.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("R ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx26.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("S ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx27.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("T ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx28.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("U ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx29.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("V through Z ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx30.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Index of ASN.1 IDs ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx31.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("0 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx32.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("1 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx33.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("2 through 2.4 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx34.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("2.5 through 2.9 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx35.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Index of LDAP Names ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx36.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("A through B ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx37.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("C ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx38.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("D ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx39.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("E through F ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx40.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("G ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx41.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("H ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx42.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("I through K ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx43.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("L ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx44.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("M ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx45.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("N ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx46.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("O ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx47.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("P ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx48.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Q through R ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx49.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("S ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx50.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("T ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx51.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("U through Z ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx52.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Iterator Services ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hnv8aaj7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Concepts ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hj3udfo7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Iterator Objects ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hwiuqovp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Creation of an Iterator Object ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hrb7xece.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Iterator Indexes ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hqngpqag.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Positions of an Iterator Object ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/h25zhm0d.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Current Position Movement with Retrieval Functions ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hn9jdbnd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Retrieval of Data ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hy7j1t07.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Tasks ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/huypg52u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Creating a Search Iterator Object ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hcyx2utx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Retrieving and Unpacking Object and Attribute Name Data ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/h9evr0ru.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Retrieving and Unpacking Object, Attribute, and Value Data ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/htq89y7t.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("NWDSItrAtEOF ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk29.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrAtFirst ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk36.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrClone ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk43.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrCount ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk50.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrCreateList ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk57.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrCreateSearch ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk64.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrDestroy ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk71.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrGetCurrent ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk77.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrGetInfo ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk84.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrGetNext ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk91.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrGetPosition ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk98.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrGetPrev ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk105.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrSetPosition ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk112.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrSetPositionFromIterator ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk119.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrSkip ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk126.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("NWDSItrTypeDown ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk133.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("NDS Iterator Example Code ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hw9m9u6o.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +currentLevel++; + +setLevels(); +var navElement = navigationLink("Cloning an Iterator Object: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hur66hmi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Counting with NDS Iterators: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hgllfzfg.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Creating and Using a List Iterator: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hfnbz1tw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Creating a Search Iterator and Displaying the Results: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hhe6xegc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Getting Iterator Information: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hfg59w8k.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Getting and Setting the Iterator's Position: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hh03dp06.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Listing in Reverse Order: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hsj5zfs1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Positioning the Iterator with Typedown: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hqvieqdk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +setLevels(); +var navElement = navigationLink("Skipping Objects in the List: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/ho81tg5d.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +setLevels(); +var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],""); +navigationTree[index] = navElement; +index++; + +if (currentLevel > 1) currentLevel-- + +if (currentLevel > 1) currentLevel-- + + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js new file mode 100644 index 0000000..b4470ee --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js @@ -0,0 +1,101 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rokicki@instantis.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 December 2001 +* SUMMARY: Regression test for bug 114491 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=114491 +* +* Rhino crashed on this code. It should produce a syntax error, not a crash. +* Using the () operator after a function STATEMENT is incorrect syntax. +* Rhino correctly caught the error when there was no |if (true)|. +* With the |if (true)|, however, Rhino crashed - +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 114491; +var summary = 'Regression test for bug 114491'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = 'Program execution did NOT fall into catch-block'; +expect = 'Program execution fell into into catch-block'; +try +{ + var sEval = 'if (true) function f(){}()'; + eval(sEval); +} +catch(e) +{ + actual = expect; +} +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js new file mode 100644 index 0000000..41e94b4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js @@ -0,0 +1,109 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rokicki@instantis.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 December 2001 +* SUMMARY: Regression test for bug 114493 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=114493 +* +* Rhino crashed on this code. It should produce a syntax error, not a crash. +* Note that "3"[5] === undefined, and Rhino correctly gave an error if you +* tried to use the call operator on |undefined|: +* +* js> undefined(); +* js: TypeError: undefined is not a function. +* +* However, Rhino CRASHED if you tried to do "3"[5](). +* +* Rhino would NOT crash if you tried "3"[0]() or "3"[5]. Only array indices +* that were out of bounds, followed by the call operator, would crash. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 114493; +var summary = 'Regression test for bug 114493'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var sEval = ''; + + +status = inSection(1); +actual = 'Program execution did NOT fall into catch-block'; +expect = 'Program execution fell into into catch-block'; +try +{ + sEval = '"3"[5]()'; + eval(sEval); +} +catch(e) +{ + actual = expect; +} +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js new file mode 100644 index 0000000..3d7b89a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js @@ -0,0 +1,181 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 08 Jan 2002 +* SUMMARY: Just testing that we don't crash on this code +* See http://bugzilla.mozilla.org/show_bug.cgi?id=118849 +* +* http://developer.netscape.com:80/docs/manuals/js/core/jsref/function.htm +* The Function constructor: +* Function ([arg1[, arg2[, ... argN]],] functionBody) +* +* Parameters +* arg1, arg2, ... argN +* (Optional) Names to be used by the function as formal argument names. +* Each must be a string that corresponds to a valid JavaScript identifier. +* +* functionBody +* A string containing JS statements comprising the function definition. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 118849; +var summary = 'Should not crash if we provide Function() with bad arguments' +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var cnFAIL_1 = 'LEGAL call to Function() caused an ERROR!!!'; +var cnFAIL_2 = 'ILLEGAL call to Function() FAILED to cause an error'; +var cnSTRING = 'ASDF'; +var cnNUMBER = 123; + + +/***********************************************************/ +/**** THESE ARE LEGITMATE CALLS AND SHOULD ALL SUCCEED ***/ +/***********************************************************/ +status = inSection(1); +actual = cnFAIL_1; // initialize to failure +try +{ + Function(cnSTRING); + Function(cnNUMBER); // cnNUMBER is a valid functionBody + Function(cnSTRING,cnSTRING); + Function(cnSTRING,cnNUMBER); + Function(cnSTRING,cnSTRING,cnNUMBER); + + new Function(cnSTRING); + new Function(cnNUMBER); + new Function(cnSTRING,cnSTRING); + new Function(cnSTRING,cnNUMBER); + new Function(cnSTRING,cnSTRING,cnNUMBER); + + actual = expect; +} +catch(e) +{ +} +addThis(); + + + +/**********************************************************/ +/*** EACH CASE THAT FOLLOWS SHOULD TRIGGER AN ERROR ***/ +/*** (BUT NOT A CRASH) ***/ +/*** NOTE WE NOW USE cnFAIL_2 INSTEAD OF cnFAIL_1 ***/ +/**********************************************************/ +status = inSection(2); +actual = cnFAIL_2; +try +{ + Function(cnNUMBER,cnNUMBER); // cnNUMBER is an invalid JS identifier name +} +catch(e) +{ + actual = expect; +} +addThis(); + + +status = inSection(3); +actual = cnFAIL_2; +try +{ + Function(cnNUMBER,cnSTRING,cnSTRING); +} +catch(e) +{ + actual = expect; +} +addThis(); + + +status = inSection(4); +actual = cnFAIL_2; +try +{ + new Function(cnNUMBER,cnNUMBER); +} +catch(e) +{ + actual = expect; +} +addThis(); + + +status = inSection(5); +actual = cnFAIL_2; +try +{ + new Function(cnNUMBER,cnSTRING,cnSTRING); +} +catch(e) +{ + actual = expect; +} +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js new file mode 100644 index 0000000..80b4e29 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js @@ -0,0 +1,113 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 06 Mar 2002 +* SUMMARY: Testing cloned function objects +* See http://bugzilla.mozilla.org/show_bug.cgi?id=127557 +* +* Before this bug was fixed, this testcase would error when run: +* +* ReferenceError: h_peer is not defined +* +* The line |g.prototype = new Object| below is essential: this is +* what was confusing the engine in its attempt to look up h_peer +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 127557; +var summary = 'Testing cloned function objects'; +var cnCOMMA = ','; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f(x,y) +{ + function h() + { + return h_peer(); + } + function h_peer() + { + return (x + cnCOMMA + y); + } + return h; +} + +status = inSection(1); +var g = clone(f); +g.prototype = new Object; +var h = g(5,6); +actual = h(); +expect = '5,6'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js new file mode 100644 index 0000000..aae857f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js @@ -0,0 +1,68 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 16 Mar 2002 +* SUMMARY: Shouldn't crash if define |var arguments| inside a function +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131510 +* +*/ +//----------------------------------------------------------------------------- +var bug = 131510; +var summary = "Shouldn't crash if define |var arguments| inside a function"; +printBugNumber(bug); +printStatus(summary); + + +function f() {var arguments;} +f(); + + +/* + * Put same example in function scope instead of global scope + */ +function g() { function f() {var arguments;}; f();}; +g(); + + +/* + * Put these examples in eval scope + */ +var s = 'function f() {var arguments;}; f();'; +eval(s); + +s = 'function g() { function f() {var arguments;}; f();}; g();'; +eval(s); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js new file mode 100644 index 0000000..a02408a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js @@ -0,0 +1,135 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): Martin.Honnen@t-online.de, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 04 May 2002 +* SUMMARY: |if (false) {var x;} should create the variable x +* See http://bugzilla.mozilla.org/show_bug.cgi?id=140974 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 140974; +var TEST_PASSED = 'variable was created'; +var TEST_FAILED = 'variable was NOT created'; +var summary = '|if (false) {var x;}| should create the variable x'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// -------------- THESE TWO SECTIONS TEST THE VARIABLE X -------------- +status = inSection(1); +actual = TEST_PASSED; +try{ X;} catch(e) {actual = TEST_FAILED} +expect = TEST_PASSED; +addThis(); + +var X; + +status = inSection(2); +actual = TEST_PASSED; +try{ X;} catch(e) {actual = TEST_FAILED} +expect = TEST_PASSED; +addThis(); + + + +// -------------- THESE TWO SECTIONS TEST THE VARIABLE Y -------------- +status = inSection(3); +actual = TEST_PASSED; +try{ Y;} catch(e) {actual = TEST_FAILED} +expect = TEST_PASSED; +addThis(); + +if (false) {var Y;}; + +status = inSection(4); +actual = TEST_PASSED; +try{ Y;} catch(e) {actual = TEST_FAILED} +expect = TEST_PASSED; +addThis(); + + + +// -------------- THESE TWO SECTIONS TEST THE VARIABLE Z -------------- +status = inSection(5); +actual = TEST_PASSED; +try{ Z;} catch(e) {actual = TEST_FAILED} +expect = TEST_PASSED; +addThis(); + +if (false) { for (var Z; false;){} } + +status = inSection(6); +actual = TEST_PASSED; +try{ Z;} catch(e) {actual = TEST_FAILED} +expect = TEST_PASSED; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js new file mode 100644 index 0000000..dee3700 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js @@ -0,0 +1,154 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): jim-patterson@ncf.ca, brendan@mozilla.org, +* pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 Jun 2002 +* SUMMARY: Shouldn't crash when catch parameter is "hidden" by varX +* See http://bugzilla.mozilla.org/show_bug.cgi?id=146596 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 146596; +var summary = "Shouldn't crash when catch parameter is 'hidden' by varX"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Just seeing we don't crash when executing this function - + * This example provided by jim-patterson@ncf.ca + * + * Brendan: "Jim, thanks for the testcase. But note that |var| + * in a JS function makes a function-scoped variable -- JS lacks + * block scope apart from for catch variables within catch blocks. + * + * Therefore the catch variable hides the function-local variable." + */ +function F() +{ + try + { + return "A simple exception"; + } + catch(e) + { + var e = "Another exception"; + } + + return 'XYZ'; +} + +status = inSection(1); +actual = F(); +expect = "A simple exception"; +addThis(); + + + +/* + * Sanity check by Brendan: "This should output + * + * 24 + * 42 + * undefined + * + * and throw no uncaught exception." + * + */ +function f(obj) +{ + var res = []; + + try + { + throw 42; + } + catch(e) + { + with(obj) + { + var e; + res[0] = e; // |with| binds tighter than |catch|; s/b |obj.e| + } + + res[1] = e; // |catch| binds tighter than function scope; s/b 42 + } + + res[2] = e; // |var e| has function scope; s/b visible but contain |undefined| + return res; +} + +status = inSection(2); +actual = f({e:24}); +expect = [24, 42, undefined]; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual.toString(); + expectedvalues[UBound] = expect.toString(); + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js new file mode 100644 index 0000000..adb4374 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js @@ -0,0 +1,121 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, mstoltz@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 08 July 2002 +* SUMMARY: Testing expressions with large numbers of parentheses +* See http://bugzilla.mozilla.org/show_bug.cgi?id=152646 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 152646; +var summary = 'Testing expressions with large numbers of parentheses'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Just seeing that we don't crash when compiling this assignment - + * + * We will form an eval string to set the result-variable |actual|. + * To get a feel for this, suppose N were 3. Then the eval string is + * 'actual = (((0)));' The expected value for this after eval() is 0. + */ +status = inSection(1); + +var sLeft = '(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('; +sLeft += sLeft; +sLeft += sLeft; +sLeft += sLeft; +sLeft += sLeft; +sLeft += sLeft; + +var sRight = '))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'; +sRight += sRight; +sRight += sRight; +sRight += sRight; +sRight += sRight; + +var sEval = 'actual = ' + sLeft + '0' + sRight; +try +{ + eval(sEval); +} +catch(e) +{ + /* + * An exception during this eval is OK, as the runtime can throw one + * in response to too deep recursion. We haven't crashed; good! + */ + actual = 0; +} +expect = 0; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js new file mode 100644 index 0000000..9dbd75f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js @@ -0,0 +1,126 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 16 September 2002 +* SUMMARY: Testing propertyIsEnumerable() on non-existent property +* See http://bugzilla.mozilla.org/show_bug.cgi?id=156354 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 156354; +var summary = 'Testing propertyIsEnumerable() on non-existent property'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = this.propertyIsEnumerable('XYZ'); +expect = false; +addThis(); + +status = inSection(2); +actual = this.propertyIsEnumerable(''); +expect = false; +addThis(); + +status = inSection(3); +actual = this.propertyIsEnumerable(undefined); +expect = false; +addThis(); + +status = inSection(4); +actual = this.propertyIsEnumerable(null); +expect = false; +addThis(); + +status = inSection(5); +actual = this.propertyIsEnumerable('\u02b1'); +expect = false; +addThis(); + + +var obj = {prop1:null}; + +status = inSection(6); +actual = obj.propertyIsEnumerable('prop1'); +expect = true; +addThis(); + +status = inSection(7); +actual = obj.propertyIsEnumerable('prop2'); +expect = false; +addThis(); + +// let's try one via eval(), too - +status = inSection(8); +eval("actual = obj.propertyIsEnumerable('prop2')"); +expect = false; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js new file mode 100644 index 0000000..c804d88 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js @@ -0,0 +1,124 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 Oct 2002 +* SUMMARY: Testing script with at least 64K of different string literals +* See http://bugzilla.mozilla.org/show_bug.cgi?id=159334 +* +* Testing that script engine can handle scripts with at least 128K of different +* string literals. The following will evaluate, via eval(), a script like this: +* +* f('0') +* f('1') +* ... +* f('N - 1') +* +* where N is 0x20000 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 159334; +var summary = 'Testing script with at least 128K of different string literals'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var N = 0x20000; + +// Create big string for eval recursively to avoid N*N behavior +// on string concatenation +var long_eval = buildEval_r(0, N); + +// Run it +var test_sum = 0; +function f(str) { test_sum += Number(str); } +eval(long_eval); + +status = inSection(1); +actual = (test_sum == N * (N - 1) / 2); +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function buildEval_r(beginLine, endLine) +{ + var count = endLine - beginLine; + + if (count == 0) + return ""; + + if (count == 1) + return "f('" + beginLine + "')\n"; + + var middle = beginLine + (count >>> 1); + return buildEval_r(beginLine, middle) + buildEval_r(middle, endLine); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js new file mode 100644 index 0000000..12fa16e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js @@ -0,0 +1,215 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): desale@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 13 Sep 2002 +* SUMMARY: Testing F.toString() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=168347 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 168347; +var summary = "Testing F.toString()"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var FtoString = ''; +var sFunc = ''; + +sFunc += 'function F()'; +sFunc += '{'; +sFunc += ' var f = arguments.callee;'; +sFunc += ' f.i = 0;'; +sFunc += ''; +sFunc += ' try'; +sFunc += ' {'; +sFunc += ' f.i = f.i + 1;'; +sFunc += ' print("i = i+1 succeeded \ti = " + f.i);'; +sFunc += ' }'; +sFunc += ' catch(e)'; +sFunc += ' {'; +sFunc += ' print("i = i+1 failed with " + e + "\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ''; +sFunc += ' try'; +sFunc += ' {'; +sFunc += ' ++f.i;'; +sFunc += ' print("++i succeeded \t\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ' catch(e)'; +sFunc += ' {'; +sFunc += ' print("++i failed with " + e + "\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ''; +sFunc += ' try'; +sFunc += ' {'; +sFunc += ' f.i++;'; +sFunc += ' print("i++ succeeded \t\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ' catch(e)'; +sFunc += ' {'; +sFunc += ' print("i++ failed with " + e + "\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ''; +sFunc += ' try'; +sFunc += ' {'; +sFunc += ' --f.i;'; +sFunc += ' print("--i succeeded \t\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ' catch(e)'; +sFunc += ' {'; +sFunc += ' print("--i failed with " + e + "\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ''; +sFunc += ' try'; +sFunc += ' {'; +sFunc += ' f.i--;'; +sFunc += ' print("i-- succeeded \t\ti = " + f.i);'; +sFunc += ' }'; +sFunc += ' catch(e)'; +sFunc += ' {'; +sFunc += ' print("i-- failed with " + e + "\ti = " + f.i);'; +sFunc += ' }'; +sFunc += '}'; + + +/* + * Use sFunc to define the function F. The test + * then rests on comparing F.toString() to sFunc. + */ +eval(sFunc); + + +/* + * There are trivial whitespace differences between F.toString() + * and sFunc. So strip out whitespace before comparing them - + */ +sFunc = stripWhite(sFunc); +FtoString = stripWhite(F.toString()); + + +/* + * Break comparison into sections to make any failures + * easier for the developer to track down - + */ +status = inSection(1); +actual = FtoString.substring(0,100); +expect = sFunc.substring(0,100); +addThis(); + +status = inSection(2); +actual = FtoString.substring(100,200); +expect = sFunc.substring(100,200); +addThis(); + +status = inSection(3); +actual = FtoString.substring(200,300); +expect = sFunc.substring(200,300); +addThis(); + +status = inSection(4); +actual = FtoString.substring(300,400); +expect = sFunc.substring(300,400); +addThis(); + +status = inSection(5); +actual = FtoString.substring(400,500); +expect = sFunc.substring(400,500); +addThis(); + +status = inSection(6); +actual = FtoString.substring(500,600); +expect = sFunc.substring(500,600); +addThis(); + +status = inSection(7); +actual = FtoString.substring(600,700); +expect = sFunc.substring(600,700); +addThis(); + +status = inSection(8); +actual = FtoString.substring(700,800); +expect = sFunc.substring(700,800); +addThis(); + +status = inSection(9); +actual = FtoString.substring(800,900); +expect = sFunc.substring(800,900); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + +/* + * Remove any whitespace characters; also + * any escaped tabs or escaped newlines. + */ +function stripWhite(str) +{ + var re = /\s|\\t|\\n/g; + return str.replace(re, ''); +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js new file mode 100644 index 0000000..d5841bb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js @@ -0,0 +1,106 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 22 Sep 2002 +* SUMMARY: adding prop after middle-delete of function w duplicate formal args +* See http://bugzilla.mozilla.org/show_bug.cgi?id=170193 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 170193; +var summary = 'adding property after middle-delete of function w duplicate formal args'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +/* + * This sequence of steps used to cause the SpiderMonkey shell to hang - + */ +function f(a,a,b){} +f.c=42; +f.d=43; +delete f.c; // "middle delete" +f.e=44; + +status = inSection(1); +actual = f.c; +expect = undefined; +addThis(); + +status = inSection(2); +actual = f.d; +expect = 43; +addThis(); + +status = inSection(3); +actual = f.e; +expect = 44; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js new file mode 100644 index 0000000..3a6be9f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js @@ -0,0 +1,94 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 07 Oct 2002 +* SUMMARY: UTF-8 decoder should not accept overlong sequences +* See http://bugzilla.mozilla.org/show_bug.cgi?id=172699 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 172699; +var summary = 'UTF-8 decoder should not accept overlong sequences'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +/* + * The patch for http://bugzilla.mozilla.org/show_bug.cgi?id=172699 + * defined this value to be the result of an overlong UTF-8 sequence - + */ +var INVALID_CHAR = 0xFFFD; + + +status = inSection(1); +actual = decodeURI("%C0%AF").charCodeAt(0); +expect = INVALID_CHAR; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js new file mode 100644 index 0000000..31a7f30 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js @@ -0,0 +1,363 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 11 Nov 2002 +* SUMMARY: JS shouldn't crash on extraneous args to str.match(), etc. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=179524 +* +* Note that when testing str.replace(), we have to be careful if the first +* argument provided to str.replace() is not a regexp object. ECMA-262 says +* it is NOT converted to one, unlike the case for str.match(), str.search(). +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83293#c21. This means +* we have to be careful how we test meta-characters in the first argument +* to str.replace(), if that argument is a string - +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 179524; +var summary = "Don't crash on extraneous arguments to str.match(), etc."; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +str = 'ABC abc'; +var re = /z/ig; + +status = inSection(1); +actual = str.match(re); +expect = null; +addThis(); + +status = inSection(2); +actual = str.match(re, 'i'); +expect = null; +addThis(); + +status = inSection(3); +actual = str.match(re, 'g', ''); +expect = null; +addThis(); + +status = inSection(4); +actual = str.match(re, 'z', new Object(), new Date()); +expect = null; +addThis(); + + +/* + * Now try the same thing with str.search() + */ +status = inSection(5); +actual = str.search(re); +expect = -1; +addThis(); + +status = inSection(6); +actual = str.search(re, 'i'); +expect = -1; +addThis(); + +status = inSection(7); +actual = str.search(re, 'g', ''); +expect = -1; +addThis(); + +status = inSection(8); +actual = str.search(re, 'z', new Object(), new Date()); +expect = -1; +addThis(); + + +/* + * Now try the same thing with str.replace() + */ +status = inSection(9); +actual = str.replace(re, 'Z'); +expect = str; +addThis(); + +status = inSection(10); +actual = str.replace(re, 'Z', 'i'); +expect = str; +addThis(); + +status = inSection(11); +actual = str.replace(re, 'Z', 'g', ''); +expect = str; +addThis(); + +status = inSection(12); +actual = str.replace(re, 'Z', 'z', new Object(), new Date()); +expect = str; +addThis(); + + + +/* + * Now test the case where str.match()'s first argument is not a regexp object. + * In that case, JS follows ECMA-262 Ed.3 by converting the 1st argument to a + * regexp object using the argument as a regexp pattern, but then extends ECMA + * by taking any optional 2nd argument to be a regexp flag string (e.g.'ig'). + * + * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=179524#c10 + */ +status = inSection(13); +actual = str.match('a').toString(); +expect = str.match(/a/).toString(); +addThis(); + +status = inSection(14); +actual = str.match('a', 'i').toString(); +expect = str.match(/a/i).toString(); +addThis(); + +status = inSection(15); +actual = str.match('a', 'ig').toString(); +expect = str.match(/a/ig).toString(); +addThis(); + +status = inSection(16); +actual = str.match('\\s', 'm').toString(); +expect = str.match(/\s/m).toString(); +addThis(); + + +/* + * Now try the previous three cases with extraneous parameters + */ +status = inSection(17); +actual = str.match('a', 'i', 'g').toString(); +expect = str.match(/a/i).toString(); +addThis(); + +status = inSection(18); +actual = str.match('a', 'ig', new Object()).toString(); +expect = str.match(/a/ig).toString(); +addThis(); + +status = inSection(19); +actual = str.match('\\s', 'm', 999).toString(); +expect = str.match(/\s/m).toString(); +addThis(); + + +/* + * Try an invalid second parameter (i.e. an invalid regexp flag) + */ +status = inSection(20); +try +{ + actual = str.match('a', 'z').toString(); + expect = 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!'; + addThis(); +} +catch (e) +{ + actual = e instanceof SyntaxError; + expect = true; + addThis(); +} + + + +/* + * Now test str.search() where the first argument is not a regexp object. + * The same considerations as above apply - + * + * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=179524#c16 + */ +status = inSection(21); +actual = str.search('a'); +expect = str.search(/a/); +addThis(); + +status = inSection(22); +actual = str.search('a', 'i'); +expect = str.search(/a/i); +addThis(); + +status = inSection(23); +actual = str.search('a', 'ig'); +expect = str.search(/a/ig); +addThis(); + +status = inSection(24); +actual = str.search('\\s', 'm'); +expect = str.search(/\s/m); +addThis(); + + +/* + * Now try the previous three cases with extraneous parameters + */ +status = inSection(25); +actual = str.search('a', 'i', 'g'); +expect = str.search(/a/i); +addThis(); + +status = inSection(26); +actual = str.search('a', 'ig', new Object()); +expect = str.search(/a/ig); +addThis(); + +status = inSection(27); +actual = str.search('\\s', 'm', 999); +expect = str.search(/\s/m); +addThis(); + + +/* + * Try an invalid second parameter (i.e. an invalid regexp flag) + */ +status = inSection(28); +try +{ + actual = str.search('a', 'z'); + expect = 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!'; + addThis(); +} +catch (e) +{ + actual = e instanceof SyntaxError; + expect = true; + addThis(); +} + + + +/* + * Now test str.replace() where the first argument is not a regexp object. + * The same considerations as above apply, EXCEPT for meta-characters. + * See introduction to testcase above. References: + * + * http://bugzilla.mozilla.org/show_bug.cgi?id=179524#c16 + * http://bugzilla.mozilla.org/show_bug.cgi?id=83293#c21 + */ +status = inSection(29); +actual = str.replace('a', 'Z'); +expect = str.replace(/a/, 'Z'); +addThis(); + +status = inSection(30); +actual = str.replace('a', 'Z', 'i'); +expect = str.replace(/a/i, 'Z'); +addThis(); + +status = inSection(31); +actual = str.replace('a', 'Z', 'ig'); +expect = str.replace(/a/ig, 'Z'); +addThis(); + +status = inSection(32); +actual = str.replace('\\s', 'Z', 'm'); //<--- NO!!! No meta-characters 1st arg! +actual = str.replace(' ', 'Z', 'm'); //<--- Have to do this instead +expect = str.replace(/\s/m, 'Z'); +addThis(); + + +/* + * Now try the previous three cases with extraneous parameters + */ +status = inSection(33); +actual = str.replace('a', 'Z', 'i', 'g'); +expect = str.replace(/a/i, 'Z'); +addThis(); + +status = inSection(34); +actual = str.replace('a', 'Z', 'ig', new Object()); +expect = str.replace(/a/ig, 'Z'); +addThis(); + +status = inSection(35); +actual = str.replace('\\s', 'Z', 'm', 999); //<--- NO meta-characters 1st arg! +actual = str.replace(' ', 'Z', 'm', 999); //<--- Have to do this instead +expect = str.replace(/\s/m, 'Z'); +addThis(); + + +/* + * Try an invalid third parameter (i.e. an invalid regexp flag) + */ +status = inSection(36); +try +{ + actual = str.replace('a', 'Z', 'z'); + expect = 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!'; + addThis(); +} +catch (e) +{ + actual = e instanceof SyntaxError; + expect = true; + addThis(); +} + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js new file mode 100644 index 0000000..69e0e8d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js @@ -0,0 +1,96 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 13 Dec 2002 +* SUMMARY: Decompilation of "\\" should give "\\" +* See http://bugzilla.mozilla.org/show_bug.cgi?id=185165 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 185165; +var summary = 'Decompilation of "\\\\" should give "\\\\"'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// Check that second decompilation of script gives the same string as first one +var f1 = function() { return "\\"; } +var s1 = f1.toString(); + +var f2; +eval("f2=" + s1); +var s2 = f2.toString(); + +status = inSection(1); +actual = s2; +expect = s1; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js new file mode 100644 index 0000000..19f7906 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js @@ -0,0 +1,102 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 03 February 2003 +* SUMMARY: Testing script with huge number of comments +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=191633 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 191633; +var summary = 'Testing script with huge number of comments'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = false; // initialize to failure +var s = repeat_str("//\n", 40000); // Build a string of 40000 lines of comments +eval(s + "actual = true;"); +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function repeat_str(str, repeat_count) +{ + var arr = new Array(repeat_count); + + while (repeat_count != 0) + arr[--repeat_count] = str; + + return str.concat.apply(str, arr); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js new file mode 100644 index 0000000..ff1498c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js @@ -0,0 +1,99 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 03 February 2003 +* SUMMARY: Testing script containing <!- at internal buffer boundary. +* JS parser must look for HTML comment-opener <!--, but mustn't disallow <!- +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=191668 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 191668; +var summary = 'Testing script containing <!- at internal buffer boundary'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var N = 512; +var j = 0; +var str = 'if (0<!-0) ++j;'; + +for (var i=0; i!=N; ++i) +{ + eval(str); + str = ' ' + str; +} + +status = inSection(1); +actual = j; +expect = N; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js new file mode 100644 index 0000000..0b9e1ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js @@ -0,0 +1,117 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 08 February 2003 +* SUMMARY: Parser recursion should check stack overflow +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=192414 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 192414; +var summary = 'Parser recursion should check stack overflow'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +/* + * We will form an eval string to set the result-variable |actual|. + * To get a feel for this, suppose N were 3. Then the eval string is + * 'actual = (1&(1&(1&1)));' The expected value after eval() is 1. + */ +status = inSection(1); +var N = 10000; +var left = repeat_str('(1&', N); +var right = repeat_str(')', N); +var str = 'actual = '.concat(left, '1', right, ';'); +try +{ + eval(str); +} +catch (e) +{ + /* + * An exception during this eval is OK, as the runtime can throw one + * in response to too deep recursion. We haven't crashed; good! + */ + actual = 1; +} +expect = 1; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function repeat_str(str, repeat_count) +{ + var arr = new Array(--repeat_count); + while (repeat_count != 0) + arr[--repeat_count] = str; + return str.concat.apply(str, arr); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js new file mode 100644 index 0000000..188d225 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js @@ -0,0 +1,152 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 February 2003 +* SUMMARY: Object.toSource() recursion should check stack overflow +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=192465 +* +* MODIFIED: 27 February 2003 +* +* We are adding an early return to this testcase, since it is causing +* big problems on Linux RedHat8! For a discussion of this issue, see +* http://bugzilla.mozilla.org/show_bug.cgi?id=174341#c24 and following. +* +* +* MODIFIED: 20 March 2003 +* +* Removed the early return and changed |N| below from 1000 to 90. +* Note |make_deep_nest(N)| returns an object graph of length N(N+1). +* So the graph has now been reduced from 1,001,000 to 8190. +* +* With this reduction, the bug still manifests on my WinNT and Linux +* boxes (crash due to stack overflow). So the testcase is again of use +* on those boxes. At the same time, Linux RedHat8 boxes can now run +* the test in a reasonable amount of time. +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 192465; +var summary = 'Object.toSource() recursion should check stack overflow'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * We're just testing that this script will compile and run. + * Set both |actual| and |expect| to a dummy value. + */ +status = inSection(1); +var N = 90; +try +{ + make_deep_nest(N); +} +catch (e) +{ + // An exception is OK, as the runtime can throw one in response to too deep + // recursion. We haven't crashed; good! Continue on to set the dummy values - +} +actual = 1; +expect = 1; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +/* + * EXAMPLE: + * + * If the global variable |N| is 2, then for |level| == 0, 1, 2, the return + * value of this function will be toSource() of these objects, respectively: + * + * {next:{next:END}} + * {next:{next:{next:{next:END}}}} + * {next:{next:{next:{next:{next:{next:END}}}}}} + * + */ +function make_deep_nest(level) +{ + var head = {}; + var cursor = head; + + for (var i=0; i!=N; ++i) + { + cursor.next = {}; + cursor = cursor.next; + } + + cursor.toSource = function() + { + if (level != 0) + return make_deep_nest(level - 1); + return "END"; + } + + return head.toSource(); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js new file mode 100644 index 0000000..47110bb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js @@ -0,0 +1,99 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 17 February 2003 +* SUMMARY: Testing empty blocks +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=193418 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 193418; +var summary = 'Testing empty blocks'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f() +{ + while (0) + { + { } + } + actual = true; +} + + +status = inSection(1); +f(); // sets |actual| +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js new file mode 100644 index 0000000..d668201 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js @@ -0,0 +1,90 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 28 April 2003 +* SUMMARY: Testing the ternary query operator +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=203402 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 203402; +var summary = 'Testing the ternary query operator'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// This used to crash the Rhino optimized shell - +status = inSection(1); +actual = "" + (1==0) ? "" : ""; +expect = ""; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js new file mode 100644 index 0000000..af35bdb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js @@ -0,0 +1,159 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): briang@tonic.com, igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 29 April 2003 +* SUMMARY: Testing merged if-clauses +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=203841 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 203841; +var summary = 'Testing merged if-clauses'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +var a = 0; +var b = 0; +var c = 0; +if (a == 5, b == 6) { c = 1; } +actual = c; +expect = 0; +addThis(); + +status = inSection(2); +a = 5; +b = 0; +c = 0; +if (a == 5, b == 6) { c = 1; } +actual = c; +expect = 0; +addThis(); + +status = inSection(3); +a = 5; +b = 6; +c = 0; +if (a == 5, b == 6) { c = 1; } +actual = c; +expect = 1; +addThis(); + +/* + * Now get tricky and use the = operator inside the if-clause + */ +status = inSection(4); +a = 0; +b = 6; +c = 0; +if (a = 5, b == 6) { c = 1; } +actual = c; +expect = 1; +addThis(); + +status = inSection(5); +c = 0; +if (1, 1 == 6) { c = 1; } +actual = c; +expect = 0; +addThis(); + + +/* + * Now some tests involving arrays + */ +var x=[]; + +status = inSection(6); // get element case +c = 0; +if (x[1==2]) { c = 1; } +actual = c; +expect = 0; +addThis(); + +status = inSection(7); // set element case +c = 0; +if (x[1==2]=1) { c = 1; } +actual = c; +expect = 1; +addThis(); + +status = inSection(8); // delete element case +c = 0; +if (delete x[1==2]) { c = 1; } +actual = c; +expect = 1; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js new file mode 100644 index 0000000..fae19b3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js @@ -0,0 +1,143 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): briang@tonic.com, igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 29 April 2003 +* SUMMARY: eval() is not a constructor, but don't crash on |new eval();| +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=204210 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 204210; +var summary = "eval() is not a constructor, but don't crash on |new eval();|"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +printBugNumber(bug); +printStatus(summary); + +/* + * Just testing that we don't crash on any of these constructs - + */ + + +/* + * global scope - + */ +try +{ + var x = new eval(); + new eval(); +} +catch(e) +{ +} + + +/* + * function scope - + */ +f(); +function f() +{ + try + { + var x = new eval(); + new eval(); + } + catch(e) + { + } +} + + +/* + * eval scope - + */ +var s = ''; +s += 'try'; +s += '{'; +s += ' var x = new eval();'; +s += ' new eval();'; +s += '}'; +s += 'catch(e)'; +s += '{'; +s += '}'; +eval(s); + + +/* + * some combinations of scope - + */ +s = ''; +s += 'function g()'; +s += '{'; +s += ' try'; +s += ' {'; +s += ' var x = new eval();'; +s += ' new eval();'; +s += ' }'; +s += ' catch(e)'; +s += ' {'; +s += ' }'; +s += '}'; +s += 'g();'; +eval(s); + + +function h() +{ + var s = ''; + s += 'function f()'; + s += '{'; + s += ' try'; + s += ' {'; + s += ' var x = new eval();'; + s += ' new eval();'; + s += ' }'; + s += ' catch(e)'; + s += ' {'; + s += ' }'; + s += '}'; + s += 'f();'; + eval(s); +} +h(); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js new file mode 100644 index 0000000..8b915e2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js @@ -0,0 +1,96 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): briang@tonic.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 02 July 2003 +* SUMMARY: testing line ending with |continue| and only terminated by a CR +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=210682 +* +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 210682; +var summary = 'testing line ending with |continue| and only terminated by CR'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +for (i=0; i<100; i++) +{ + if (i%2 == 0) continue + this.lasti = i; +} + +status = inSection(1); +actual = lasti; +expect = 99; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js new file mode 100644 index 0000000..e555754 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js @@ -0,0 +1,1033 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 September 2003 +* SUMMARY: Just seeing we don't crash on this code +* See http://bugzilla.mozilla.org/show_bug.cgi?id=216320 +* +*/ +//----------------------------------------------------------------------------- +var bug = 216320; +var summary = "Just seeing we don't crash on this code"; + +printBugNumber(bug); +printStatus(summary); + + +/* TESTCASE BEGINS HERE */ +status=0; +ism='NO'; +scf='N'; + +function vol(){ +if(navigator.appName!="Netscape"){ if(!window.navigator.onLine){ alert(pbc0430); return false; } } +return true; } + +function vnid(formfield){ +nid=formfield.value; +if(!nid.match(/^\s*$/)){ +nl=nid.split('/').length; +if(nl!=2&&nl!=3){ +alert(pbc0420); +formfield.focus(); +return false; +}}} + +function vnull(formfield){ +text=formfield.value; +if(text.match(/^\s*$/)){ +alert(pbc0425); +formfield.focus(); +return false; +} +return true; +} + +function vdt(formfield){ +date=formfield.value; +//MM/DD/YYYY +//YYYY/MM/DD +year=date.substring(0,4); +hy1=date.charAt(4); +month=date.substring(5,7); +hy2=date.charAt(7); +day=date.substring(8,10); +today=new Date(); +tdy=today.getDate(); +tmn=today.getMonth()+1; +if(today.getYear()<2000)tyr=today.getYear()+1900; +else tyr=today.getYear(); +if(date.match(/^\s*$/)) {return true; } + +if(hy1!="/"||hy2!="/"){ +alert(pbc0409); +formfield.focus(); +return false; +} +if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){ +alert(pbc0409); +formfield.focus(); +return false; +} + +if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day>31)||(year%4==0&&month==2&&day>29)||(year%4!=0&&month==2&&day>28)||((month==4||month==6||month==9||month==11)&&day>30)){ +alert(pbc0409); +formfield.focus(); +return false; +} +return true; +} + +function vkdt(formfield){ +date=formfield.value; +year=date.substring(0,4); +hy1=date.charAt(4); +month=date.substring(5,7); +hy2=date.charAt(7); +day=date.substring(8,10); +today=new Date(); +tdy=today.getDate(); +tmn=today.getMonth()+1; +if(today.getYear()<2000)tyr=today.getYear()+1900; +else tyr=today.getYear(); +if(date.match(/^\s*$/)){ +alert(pbc0425); +formfield.focus(); +return false; +} +if(hy1!="/"||hy2!="/"){ +alert(pbc0409); +formfield.focus(); +return false; +} + +if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){ +alert(pbc0409); +formfield.focus(); +return false; +} + +if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day>31)||(year%4==0&&month==2&&day>29)||(year%4!=0&&month==2&&day>28)||((month==4||month==6||month==9||month==11)&&day>30)){ +alert(pbc0409); +formfield.focus(); +return false; +} +return true; +} + +function ddif(month1,day1,year1,month2,day2,year2){ +start = new Date(); +start.setYear(year1); +start.setMonth(month1-1); +start.setDate(day1); +start.setMinutes(0); +start.setHours(0); +start.setSeconds(0); +end = new Date(); +end.setYear(year2); +end.setMonth(month2-1); +end.setDate(day2); +end.setMinutes(0); +end.setHours(0); +end.setSeconds(0); +current =(end.getTime() - start.getTime()); +days = Math.floor(current /(1000 * 60 * 60 * 24)); +return(days); +} + +function vsub(form,status,ism,action){ +if(!vol()){ return false; } +if(status<9||status==12){ +band=form.BAND.options[form.BAND.selectedIndex].value; +if(band=="00"){ +alert(pbc0425); +form.BAND.focus(); +return false; +} +} + +if((status>=0&&status<5)||(status==7)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){ +if(!vnull(form.PT)) { return false; } +adt1=form.STD; +adt2=form.END; +stdt=adt1.value; +etdt=adt2.value; +syr=stdt.substring(0,4); +start_hy1=stdt.charAt(4); +smon=stdt.substring(5,7); +start_hy2=stdt.charAt(7); +sdy=stdt.substring(8,10); +eyr=etdt.substring(0,4); +end_hy1=etdt.charAt(4); +emon=etdt.substring(5,7); +end_hy2=etdt.charAt(7); +edy=etdt.substring(8,10); +today=new Date(); +date=today.getDate(); +month=today.getMonth()+1; +if(today.getYear()<2000)year=today.getYear()+1900; else year=today.getYear(); +nextYear=year+1; +if(!vnull(form.STD)){ return false; } +if(!vnull(form.END)){ return false; } +if(start_hy1!="/"||start_hy2!="/"){ +alert(pbc0409); +form.STD.focus(); +return false; +} +if(end_hy1!="/"||end_hy2!="/"){ +alert(pbc0409); +form.END.focus(); +return false; +} +if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){ +alert(pbc0409); +form.STD.focus(); +return false; +} +if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){ +alert(pbc0409); +form.END.focus(); +return false; +} +if(((smon==1||smon==3||smon==5||smon==7||smon==8||smon==10||smon==12)&&sdy>31)||(syr%4==0&&smon==2&&sdy>29)||(syr%4!=0&&smon==2&&sdy>28)||((smon==4||smon==6||smon==9||smon==11)&&sdy>30)){ +alert(pbc0409); +form.STD.focus(); +return false; +} +if(((emon==1||emon==3||emon==5||emon==7||emon==8||emon==10||emon==12)&&edy>31)||(eyr%4==0&&emon==2&&edy>29)||(eyr%4!=0&&emon==2&&edy>28)||((emon==4||emon==6||emon==9||emon==11)&&edy>30)){ +alert(pbc0409); +form.END.focus(); +return false; +} +if ((eyr==nextYear)&&(syr==year)) { +if ((emon>1)||(edy >31)) { +alert(pbc0401); +form.END.focus(); +return false; +} +} else { + +if ((syr!=eyr)){ +alert(pbc0406); +form.STD.focus(); +return false; +} +if(smon>emon||(smon==emon&&sdy>=edy)){ +alert(pbc0402); +form.STD.focus(); +return false; +} +if((eyr!=year)&&(eyr!=year-1)){ +alert(pbc0405); +form.END.focus(); +return false; +} +} +if(ism=='YES'&&(status==5||status==6||status==12)){ +if(ddif(month,date,year,emon,edy,eyr)>31){ +alert(pbc0421); +form.END.focus(); +return false; +} +} +if((status>2&&status<5)||(status==7)||((status>=5&&status<9||status==12)&&ism=="YES")){ +if(status!=5){ +if(!vdt(form.IRD1)){ +return false; +} +if(!vdt(form.IRD2)){ +return false; +} +if(!vdt(form.IRD3)){ +return false; +} +ird1=form.IRD1.value; +ird2=form.IRD2.value; +ird3=form.IRD3.value; +if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){ +alert(pbc0417); +form.IRD1.focus(); +return false; +} +else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){ +alert(pbc0417); +form.IRD2.focus(); +return false; +} +if(!vdt(form.FRD1)){ return false;} +} +if(status==5){ +if(!vdt(form.IRD1)){return false;} +if(!vdt(form.IRD2)){return false;} +if(!vdt(form.IRD3)){return false;} +ird1=form.IRD1.value; +ird2=form.IRD2.value; +ird3=form.IRD3.value; +if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){ +alert(pbc0417); +form.IRD1.focus(); +return false; +} +else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){ +alert(pbc0417); +form.IRD2.focus(); +return false; +} +if(!vkdt(form.FRD1)){ +return false; +} +} +} +} +if((status>=0&&status<2)||(status==3)||(status==7)||(status>=2&&status<9&&ism=="YES")||(status==12&&ism=="YES")){ +if(!vnull(form.WO)){ +return false; +} +if(!vnull(form.EO)){ +return false; +} +if(!vnull(form.TO)){ +return false; +} +} +if((status==2||status==4)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){ +if(!vnull(form.WR)){return false;} +if(!vnull(form.ER)){return false;} +if(!vnull(form.TR)){return false;} +} +if((status==5||status==6||status==12)&&ism=="YES"){ +if(!vkdt(form.FRD1)){return false;} +frdt=form.FRD1.value; +fryr=frdt.substring(0,4); +frmn=frdt.substring(5,7); +frdy=frdt.substring(8,10); +if(fryr<syr||(fryr==syr&&frmn<smon)||(fryr==syr&&frmn==smon&&frdy<=sdy)){ +alert(pbc0410); +form.FRD1.focus(); +return false; +} +if((status==5||status==6||status==12)&&ism=="YES"){ +isnh=""; +for(i=0; i<form.INH.length; i++){ +if(form.INH[i].checked==true){ isnh=form.INH[i].value; } +} +if(isnh==""){ +alert(pbc0424); +form.INH[1].focus(); +return false; +} +if(isnh=="Y"){ +beh=""; +for(i=0; i<form.NHB.length; i++){ +if(form.NHB[i].checked==true){ beh=form.NHB[i].value; } +} +skl=""; +for(i=0; i<form.NHS.length; i++){ +if(form.NHS[i].checked==true){ skl=form.NHS[i].value; } +} +if(beh==""){ +alert(pbc0408); +form.NHB[0].focus(); +return false; +} +if(skl==""){ +alert(pbc0426); +form.NHS[0].focus(); +return false; +} +if((beh=="N"||skl=="N")&&status!=12){ +if(form.RCD[3].checked==false){ +if(confirm(pbc0455))srdb(form.RCD,"4"); +else { +form.NHB[0].focus(); +return false; +}}}}} +rating=""; +if(status!=12){ for(i=0; i<form.RCD.length; i++){ if(form.RCD[i].checked==true)rating=form.RCD[i].value; } } +else if(status==12){ rating="4"; } +if(rating==""){ +alert(pbc0428); +form.RCD[0].focus(); +return false; +} +if(rating=="4"){ +if(!vkdt(form.SID)){ return false; } +idt=form.SID.value; +iyr=idt.substring(0,4); +imon=idt.substring(5,7); +idy=idt.substring(8,10); +frdt=form.FRD1.value; +fryr=frdt.substring(0,4); +frmn=frdt.substring(5,7); +frdy=frdt.substring(8,10); +if(iyr<eyr||(iyr==eyr&&imon<emon)||(iyr==eyr&&imon==emon&&idy<=edy)){ +alert(pbc0415); +form.SID.focus(); +return false; +} +if(iyr<fryr||(iyr==fryr&&imon<frmn)||(iyr==fryr&&imon==frmn&&idy<=frdy)){ +alert(pbc0427); +form.SID.focus(); +return false; +} +if(ddif(emon,edy,eyr,imon,idy,iyr)<30){ +alert(pbc0416); +form.SID.focus(); +return false; +} +if(ddif(emon,edy,eyr,imon,idy,iyr)>90){ +if(!confirm(pbc0439+" "+pbc0442)){ +form.SID.focus(); +return false; +}}} else { +// MK/06-20-01 = If Rating Not equals to 4 blank out the sustained improve Date +form.SID.value=""; +} +if(!vnull(form.OAT)){ return false; } +if(form.MSRQ.checked==true){ +if(form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){ +alert(pbc0418); +form.NEW_SIGN_MGR_ID.focus(); +return false; +} +if(vnid(form.NEW_SIGN_MGR_ID)==false){ return false; } +} else { +if(!form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){ +alert(pbc0422); +form.NEW_SIGN_MGR_ID.focus(); +return false; +} +if ( (form.TOC.value=="YES") && (form.RSRQ.checked==true) ) { +alert(pbc0429); +form.NEW_SEC_LINE_REV_ID.focus(); +return false; +} +} +if(form.RSRQ.checked==true){ +if(form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)){ +alert(pbc0418); +form.NEW_SEC_LINE_REV_ID.focus(); +return false; +} +if(vnid(form.NEW_SEC_LINE_REV_ID)==false){ return false; } +} else { +if(!form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)) { +alert(pbc0423); +form.NEW_SEC_LINE_REV_ID.focus(); +return false; +} +if ( (form.TOC.value=="YES") && (form.MSRQ.checked==true) ) { +alert(pbc0431); +form.NEW_SEC_LINE_REV_ID.focus(); +return false; +}}} +if(status!=9){ +/**for returned objectives **/ +if(status==3){ +if(conf(pbc0466) == false) return false; +} + +if(ism=='NO'){ +if(status==0||status==1||status==3||status==7){ +if(conf(pbc0456) == false) return false; +} + +if(status==2||status==4||status==8){ +if(conf(pbc0457) == false) return false; +} +} else if(ism=='YES'){ +if(status==0||status==1||status==3||status==7){ +if(conf(pbc0458) == false)return false; +} +if(status==2||status==4||status==8){ +if(conf(pbc0459) == false)return false; +} +if(status==5||status==6){ +if(form.ESRQ.checked==false){ +if(conf(pbc0460) == false)return false; +} else { +if(conf(pbc0461) == false)return false; +}}}} +if(status==9){ +if(ism=='NO'){ +if(conf(pbc0462) == false)return false; +} else if(ism=='YES'){ +if(conf(pbc0463) == false)return false; +} else if(ism=='REVIEWER'){ +if(conf(pbc0464) == false)return false; +}} +sact(action); +if(status>=9&&status<=11){ snul(); } +form.submit(); +return true; +} + +function vsav(form,status,ism,action) { +if(!vol()){ return false; } +adt1=form.STD; +adt2=form.END; +stdt=adt1.value; +etdt=adt2.value; +syr=stdt.substring(0,4); +start_hy1=stdt.charAt(4); +smon=stdt.substring(5,7); +start_hy2=stdt.charAt(7); +sdy=stdt.substring(8,10); +eyr=etdt.substring(0,4); +end_hy1=etdt.charAt(4); +emon=etdt.substring(5,7); +end_hy2=etdt.charAt(7); +edy=etdt.substring(8,10); +today=new Date(); +date=today.getDate(); +month=today.getMonth()+1; +if(today.getYear()<2000) year=today.getYear()+1900; else year=today.getYear(); +nextYear=year+1; +if(!vnull(form.STD)) return false; +if(!vnull(form.END)) return false; +if(start_hy1!="/"||start_hy2!="/"){ +alert(pbc0409); +form.STD.focus(); +return false; +} +if(end_hy1!="/"||end_hy2!="/"){ +alert(pbc0409); +form.END.focus(); +return false; +} +if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){ +alert(pbc0409); +form.STD.focus(); +return false; +} +if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){ +alert(pbc0409); +form.END.focus(); +return false; +} +if(((smon==1||smon==3||smon==5||smon==7||smon==8||smon==10||smon==12)&&sdy>31)||(syr%4==0&&smon==2&&sdy>29)||(syr%4!=0&&smon==2&&sdy>28)||((smon==4||smon==6||smon==9||smon==11)&&sdy>30)){ +alert(pbc0409); +form.STD.focus(); +return false; +} +if(((emon==1||emon==3||emon==5||emon==7||emon==8||emon==10||emon==12)&&edy>31)||(eyr%4==0&&emon==2&&edy>29)||(eyr%4!=0&&emon==2&&edy>28)||((emon==4||emon==6||emon==9||emon==11)&&edy>30)){ +alert(pbc0409); +form.END.focus(); +return false; +} +if ((eyr==nextYear)&&(syr==year)) { +if ((emon>1)||(edy >31)) { +alert(pbc0401); +form.END.focus(); +return false; +} +} else { +if ((syr<year-1) || (syr>year)) { +alert(pbc0407); +form.STD.focus(); +return false; +} +if((eyr!=year)&&(eyr!=year-1)){ +alert(pbc0405); +form.END.focus(); +return false; +} +if(smon>emon||(smon==emon&&sdy>=edy)){ +alert(pbc0403); +form.STD.focus(); +return false; +} +} +if((status>2&&status<5)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){ +if(!vdt(form.IRD1)){return false;} +if(!vdt(form.IRD2)){return false;} +if(!vdt(form.IRD3)){ return false; } +ird1=form.IRD1.value; +ird2=form.IRD2.value; +ird3=form.IRD3.value; +if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){ +alert(pbc0417); +form.IRD1.focus(); +return false; +} +else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){ +alert(pbc0417); +form.IRD2.focus(); +return false; +} +if(!vdt(form.FRD1)){return false;} +if(ism=="YES"){ +if(!vdt(form.FRD1)){return false;} +} +} +if((status==5||status==6)&&ism=="YES"){ +rating=""; +for(i=0;i<form.RCD.length;i++){ +if(form.RCD[i].checked==true)rating=form.RCD[i].value; +} +isnh=""; +for(i=0; i<form.INH.length; i++){ +if(form.INH[i].checked==true){ +isnh=form.INH[i].value; +} +} +if(isnh=="Y"){ +beh=""; +for(i=0; i<form.NHB.length;i++){ +if(form.NHB[i].checked==true){ +beh=form.NHB[i].value; +} +} +skl=""; +for(i=0; i<form.NHS.length;i++){ +if(form.NHS[i].checked==true){ +skl=form.NHS[i].value; +} +} +if((beh=="N"||skl=="N")&&rating!=""){ +if(form.RCD[3].checked==false){ +if(confirm(pbc0455))srdb(form.RCD,"4"); +else { +form.NHB[0].focus(); +return false; +} +} +} +if(!vdt(form.SID)){ return false;} +} +} +if((status==2||status==4 || status==8 || status==5 || status==6 || status==10)&&ism=='YES') +{ +if(!confirm(pbc0436)){ return false;} +if(form.OBJECTIVE_CHANGED.value=='Y') { + if(confirm(pbc0452+" "+pbc0453+" "+pbc0454)){form.MRQ.value=4; } else { form.MRQ.value=0; } +}else if (( status==5 || status==6 || status==10) && (form.RESULTS_CHANGED.value=='Y')) { + if(confirm(pbc0470+" "+pbc0453+" "+pbc0454)){form.MRQ.value=8; } else { form.MRQ.value=0; } +} +} +sact(action); +if(status>=9&&status<=11){ +snul(); +} +form.submit(); +return true; +} +function cft(formfield){ +nid=formfield.value; +if(nid.match(/^\s*$/)){ +alert(pbc0419); +formfield.focus(); +return false; +} +nl=nid.split('/').length; +if(nl!=2&&nl!=3){ +alert(pbc0420); +formfield.focus(); +return false; +} +return true; +} +function dcf(form,pbcId,cnum,sequence,status,atyp,ver){ +if(!vol()){} +dflg=confirm("\n\n<====================== " + pbc0468 + " ======================>\n\n" + pbc0469 + "\n\n<==================================================================>"); +if(dflg==true) { +form.ATYP.value=atyp; +form.PID.value=pbcId; +form.CNUM.value=cnum; +form.SEQ.value=sequence; +form.ST.value=status; +form.VER.value=ver; +form.submit(); +} + +} + + + +function lop(){ +//if(confirm(pbc0447+" "+pbc0451)){ +sck("timer",""); +sck("PBC_AUTH4",""); +sck("IBM004",""); +this.close(); +//} + +} + +function csrlop(){ + top.location="logoff.jsp"; +} +function lof(){ +csr=gck("IBM004"); +if(csr==null){ top.location="logoff.jsp"; } +else if(csr.charAt(0)==3){ window.location="csrlogoff.jsp"; } +else{ top.location="logoff.jsp"; } +} + +function goToHome(){ + top.location="pbcmain.jsp"; + } + +function docsr(){ +sck("IBM004","1^NONE^1"); +window.location="pbcmain.jsp" +} + +function ccd(){ +if(confirm(pbc0434)){ +if(navigator.appName!="Netscape"){ +if(!window.navigator.onLine){ +window.close(); +} +else { +window.location='pbcmain.jsp'; +} +} +else { +window.location='pbcmain.jsp'; +} +} +} + +function crt(form,action){ +if(!vol()){return false;} +band=form.BAND.options[form.BAND.selectedIndex].value; +if(band=="00"){ +alert(pbc0425); +form.BAND.focus(); +return false; +} +if(!confirm(pbc0450)){return false;} +sact(action); +form.submit(); +return true; +} +function cusat(form,action){ +if(!vol()){return false;} +sact(action); +form.action="unsatreq.jsp"; +form.submit(); +return true; +} +function cfrt(form,ism,action){ +if(!vol()){return false;} +sact(action); +if(ism=="NO"){ +if(confirm(pbc0449+" "+pbc0432)){ +snul(); +form.submit(); +return true; +} +} +if(ism=="REVIEWER"){ +if(confirm(pbc0449+" "+pbc0448)){ +snul(); +form.submit(); +return true; +} +} +if(ism=="YES"){ +if(confirm(pbc0440)){ +snul(); +form.submit(); +return true; +} +} +} + +function cces(form){ +if(form.ESRQ.checked==true){ +if(!confirm(pbc0435+" "+pbc0443))form.ESRQ.checked=false; +else {form.ESRQ.checked=true;} +} +} + +function ccms(form){ +if(form.MSRQ.checked==true){ +if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0445))form.MSRQ.checked=false; +else { +form.MSRQ.checked=true; +} +} +} + +function ccrs(form){ +if(form.RSRQ.checked==true){ +if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0446))form.RSRQ.checked=false; +else { +form.RSRQ.checked=true; +} +} +} + +function seo(){ +alert(pbc0412+" "+pbc0413+" "+pbc0414); +} +function cows(form,action){ +if(!vol()){ +return false; +} +if(confirm(pbc0437)){ +sact(action); +form.submit(); +return true; +} +} + +function srdb(rdb,value) { +for(i=0; i<rdb.length;i++) { +if(rdb[i].value == value) { +rdb[i].checked = true; +return true; +} +} +return true; +} + +function slop(lbx,value) { +if(lbx.options.length > 0) { +for(i=0;i < lbx.options.length;i++) { +if(lbx.options[i].value == value) { +lbx.options[i].selected = true; +return true; +} +} +} +return true; +} + +function ourl(URL,WIN_NAME){ +if(!vol()){ return; } +var emp_win; +if(document.layers) { +child_screenX=window.screenX+50; +child_width=window.innerWidth-75; +child_height=window.innerHeight-75; +emp_win=window.open(URL,WIN_NAME,"screenX="+ child_screenX +",screenY=75,height="+ child_height +",width="+ child_width +",resizable,status,scrollbars"); +} else{ +child_width = screen.width-160; +child_height = screen.height-200; +emp_win=window.open(URL,WIN_NAME,"height="+ child_height +",width="+ child_width +",resizable=yes,status=no,scrollbars=yes"); +//emp_win.moveTo(110,0); +} +//if (URL.indexOf("pbcsitehelp")==-1) { alert("Opened new window."); } +emp_win.focus(); +} + +function dnh(form){ +form.NHS[0].checked=false; +form.NHS[1].checked=false; +form.NHB[0].checked=false; +form.NHB[1].checked=false; +} + +function cnh(form){ +isnh=""; +for(i=0; i<form.INH.length;i++) +{ +if(form.INH[i].checked==true){isnh=form.INH[i].value; } +} +if(isnh != 'Y'){ +form.NHS[0].checked=false; +form.NHS[1].checked=false; +form.NHB[0].checked=false; +form.NHB[1].checked=false; +return false; +} +else +{ + //if ((form.NHS[0].checked || form.NHS[1].checked) && (form.NHB[0].checked || form.NHB[1].checked)) + if (form.NHS[1].checked || form.NHB[1].checked ) + { + form.RCD[3].checked=true; + return true; + } + return false; +} +} + +function err(errMsg) { +alert(getEncodedText(errMsg)); +} + +function getEncodedText(txtValue) { +if (txtValue.match(/^\s*$/)) return txtValue; +var txtValue1 = txtValue.replace((/"/g),'"'); +var txtValue2 = txtValue1.replace((/>/g),">"); +var txtValue3 = txtValue2.replace((/</g),"<"); +return txtValue3; +} + +function encodeText(txtValue) { +if (txtValue.match(/^\s*$/)) return txtValue; +var txtValue0 = txtValue.replace((/\r\n/g),'&lf;'); +var txtValue1 = txtValue0.replace((/"/g),'"'); +var txtValue2 = txtValue1.replace((/>/g),'>'); +var txtValue3 = txtValue2.replace((/</g),'<'); +return txtValue3; +} + + +function gck(name){ +result = null; +mck = " " + document.cookie + ";"; +srcnm = " " + name + "="; +scok = mck.indexOf(srcnm); +if(scok != -1){ +scok += srcnm.length; +eofck = mck.indexOf(";",scok); +result = unescape(mck.substring(scok,eofck)); +} +return(result); +} + +function sck(name,value){ +ckpth="path=/;domain=.ibm.com"; +document.cookie = name + "=" + value + ";" + ckpth; +} + + +function testForCookie(){ + sck("PBCTest","test"); + if(gck("PBCTest") == "test") { + // alert("Cookie test is good"); + return true; + } + else { + // alert("Cookie test is bad"); + return false; + } + } + + +function prn(form,l_status,l_ism,l_scf,l_locale){ +status = l_status; +ism = l_ism; +scf = l_scf; +pwin=window.open("printvw.jsp?nls="+l_locale + "ISNEWWIN=TRUE","pwin","resizable=yes,width=560,height=400,scrollbars=yes,toolbar,screenX=5,screenY=5"); +} + +function gsno(form){ +unum=form.UNUM.value; +eofsn=unum.length-3; +cnum=unum.substring(0,eofsn); +return(cnum); +} + +function conf(msg){ +return top.confirm(msg); +} + +function sact(action){ +document.PBC_FORM.ATYP.value=action; +} + +function snul(){ +document.PBC_FORM.WO.value=""; +document.PBC_FORM.WR.value=""; +document.PBC_FORM.EO.value=""; +document.PBC_FORM.ER.value=""; +document.PBC_FORM.TO.value=""; +document.PBC_FORM.TR.value=""; +document.PBC_FORM.OAT.value=""; +} + +function gcnum(){ +unum=document.PBC_FORM.UNUM.value; +eofsn=unum.length-3; +cnum=unum.substring(0,eofsn); +return(cnum); +} +function checkForEditPage() { + if(true==checkForm()){ + if(!confirm(pbc0465)) return false; + } + return true; +} + +function checkForm() { + var frms=document.forms["PBC_FORM"]; + if (navigator.appName=="Netscape") { + if (frms==undefined) return false; + if (frms.IS_EDIT==undefined) return false; + } else { + if(frms==null) return false; + if (frms.IS_EDIT==null) return false; + } + return true; +} + + + +function removeAnchor(link){ +link2 = link; +indx = link.indexOf('#'); +while (indx!=-1) +{ +link2 = link.substring(0,indx); +indx=link2.indexOf("#"); + + +} +return link2; +} + +function gotoHREF(link){ +if(document.layers){ +var documentURL = removeAnchor(document.URL); +location.href=documentURL+link; +return true; + +}else{ +var documentURL = removeAnchor(document.URL); +document.URL=documentURL+link; + + +} + + +} + +function init_resize_event(){ +} + +function putVal2ck() +{ +} + +function setValuesFromCookie() +{ +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js new file mode 100644 index 0000000..e978553 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 November 2002 +* SUMMARY: JS should treat --> as a single-line comment indicator. +* Whitespace may occur before the --> on the same line. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=31255 +* and http://bugzilla.mozilla.org/show_bug.cgi?id=179366 (Rhino version) +* +* Note: <!--, --> are the HTML multi-line comment opener, closer. +* JS already accepted <!-- as a single-line comment indicator. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 31255; +var summary = 'JS should treat --> as a single-line comment indicator'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +<!-- HTML comment start is already a single-line JS comment indicator +var x = 1; <!-- until end-of-line + +status = inSection(1); +actual = (x == 1); +expect = true; +addThis(); + +--> HTML comment end is JS comments until end-of-line + --> but only if it follows a possible whitespace after line start + --> so in the following --> should not be treated as comments +if (x-->0) + x = 2; + +status = inSection(2); +actual = (x == 2); +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js new file mode 100644 index 0000000..9c51ce8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js @@ -0,0 +1,105 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 30 Sep 2003 +* SUMMARY: Testing concatenation of string + number +* See http://bugzilla.mozilla.org/show_bug.cgi?id=39309 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 39309; +var summary = 'Testing concatenation of string + number'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f(textProp, len) +{ + var i = 0; + while (++i <= len) + { + var name = textProp + i; + actual = name; + } +} + + +status = inSection(1); +f('text', 1); // sets |actual| +expect = 'text1'; +addThis(); + +status = inSection(2); +f('text', 100); // sets |actual| +expect = 'text100'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js new file mode 100644 index 0000000..51dde84 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js @@ -0,0 +1,63 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 26 Feb 2001 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=44009 +* +* SUMMARY: Testing that we don't crash on obj.toSource() +*/ +//------------------------------------------------------------------------------------------------- +var bug = 44009; +var summary = "Testing that we don't crash on obj.toSource()"; +var obj1 = {}; +var sToSource = ''; +var self = this; //capture a reference to the global JS object - + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + var obj2 = {}; + + // test various objects and scopes - + testThis(self); + testThis(this); + testThis(obj1); + testThis(obj2); + + exitFunc ('test'); +} + + +// We're just testing that we don't crash by doing this - +function testThis(obj) +{ + sToSource = obj.toSource(); + obj.prop = obj; + sToSource = obj.toSource(); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js new file mode 100644 index 0000000..39136a9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js @@ -0,0 +1,88 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 03 December 2000 +* +* +* SUMMARY: This test arose from Bugzilla bug 57043: +* "Negative integers as object properties: strange behavior!" +* +* We check that object properties may be indexed by signed +* numeric literals, as in assignments like obj[-1] = 'Hello' +* +* NOTE: it should not matter whether we provide the literal with +* quotes around it or not; e.g. these should be equivalent: +* +* obj[-1] = 'Hello' +* obj['-1'] = 'Hello' +*/ +//------------------------------------------------------------------------------------------------- +var bug = 57043; +var summary = 'Indexing object properties by signed numerical literals -' +var statprefix = 'Adding a property to test object with an index of '; +var statsuffix = ', testing it now -'; +var propprefix = 'This is property '; +var obj = new Object(); +var status = ''; var actual = ''; var expect = ''; var value = ''; + + +// various indices to try - +var index = Array(-5000, -507, -3, -2, -1, 0, 1, 2, 3); + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (j in index) {testProperty(index[j]);} + + exitFunc ('test'); +} + + +function testProperty(i) +{ + status = getStatus(i); + + // try to assign a property using the given index - + obj[i] = value = (propprefix + i); + + // try to read the property back via the index (as number) - + expect = value; + actual = obj[i]; + reportCompare(expect, actual, status); + + // try to read the property back via the index as string - + expect = value; + actual = obj[String(i)]; + reportCompare(expect, actual, status); +} + + +function getStatus(i) +{ + return (statprefix + i + statsuffix); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js new file mode 100644 index 0000000..3fb1764 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js @@ -0,0 +1,56 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 15 Feb 2001 +* +* SUMMARY: var self = global JS object, outside any eval, is DontDelete +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498 +* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251 +* +* Brendan: +* +* "Demonstrate that variable statement outside any eval creates a +* DontDelete property of the global object" +*/ +//------------------------------------------------------------------------------------------------- +var bug = 68498; +var summary ='Testing that variable statement outside any eval creates' + + ' a DontDelete property of the global object'; + + +// To be pedantic, use a variable named 'self' to capture the global object - +var self = this; +var actual = (delete self); +var expect =false; + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + reportCompare(expect, actual, summary); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js new file mode 100644 index 0000000..5f30b0b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js @@ -0,0 +1,80 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 15 Feb 2001 +* +* SUMMARY: create a Deletable local variable using eval +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498 +* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251 +* +* Brendan: +* +* "Demonstrate the creation of a Deletable local variable using eval" +*/ +//------------------------------------------------------------------------------------------------- +var bug = 68498; +var summary = 'Creating a Deletable local variable using eval'; +var statprefix = '; currently at expect['; +var statsuffix = '] within test -'; +var actual = [ ]; +var expect = [ ]; + + +// Capture a reference to the global object - +var self = this; + +// This function is the heart of the test - +function f(s) {eval(s); actual[0]=y; return delete y;} + + +// Set the actual-results array. The next line will set actual[0] and actual[1] in one shot +actual[1] = f('var y = 42'); +actual[2] = 'y' in self && y; + +// Set the expected-results array - +expect[0] = 42; +expect[1] = true; +expect[2] = false; + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i in expect) + { + reportCompare(expect[i], actual[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return (summary + statprefix + i + statsuffix); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js new file mode 100644 index 0000000..712207b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js @@ -0,0 +1,84 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 15 Feb 2001 +* +* SUMMARY: calling obj.eval(str) +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498 +* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251 +* +* Brendan: +* +* "Backward compatibility: support calling obj.eval(str), which evaluates +* str using obj as the scope chain and variable object." +*/ +//------------------------------------------------------------------------------------------------- +var bug = 68498; +var summary = 'Testing calling obj.eval(str)'; +var statprefix = '; currently at expect['; +var statsuffix = '] within test -'; +var actual = [ ]; +var expect = [ ]; + + +// Capture a reference to the global object - +var self = this; + +// This function is the heart of the test - +function f(s) {self.eval(s); return y;} + + +// Set the actual-results array - +actual[0] = f('var y = 43'); +actual[1] = 'y' in self && y; +actual[2] = delete y; +actual[3] = 'y' in self; + +// Set the expected-results array - +expect[0] = 43; +expect[1] = 43; +expect[2] = true; +expect[3] = false; + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i in expect) + { + reportCompare(expect[i], actual[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return (summary + statprefix + i + statsuffix); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js new file mode 100644 index 0000000..6e60d4d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js @@ -0,0 +1,112 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* Date: 15 Feb 2001 +* +* SUMMARY: self.eval(str) inside a function +* NOTE: 'self' is just a variable used to capture the global JS object. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498 +* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=69441 (!!!) +* +* Brendan: +* +* "ECMA-262 Edition 3, 10.1.3 requires a FunctionDeclaration parsed as part +* of a Program by eval to create a property of eval's caller's variable object. +* This test evals in the body of a with statement, whose scope chain *is* +* relevant to the effect of parsing the FunctionDeclaration." +*/ +//------------------------------------------------------------------------------------------------- +var bug = 68498; +var summary = 'Testing self.eval(str) inside a function'; +var statprefix = '; currently at expect['; +var statsuffix = '] within test -'; +var sToEval=''; +var actual=[ ]; +var expect=[ ]; + + +// Capture a reference to the global object - +var self = this; + +// You shouldn't see this global variable's value in any printout - +var x = 'outer'; + +// This function is the heart of the test - +function f(o,s,x) {with(o) eval(s); return z;}; + +// Run-time statements to pass to the eval inside f +sToEval += 'actual[0] = typeof g;' +sToEval += 'function g(){actual[1]=(typeof w == "undefined" || w); return x};' +sToEval += 'actual[2] = w;' +sToEval += 'actual[3] = typeof g;' +sToEval += 'var z=g();' + +// Set the actual-results array. The next line will set actual[0] - actual[4] in one shot +actual[4] = f({w:44}, sToEval, 'inner'); +actual[5] = 'z' in self && z; + + +/* Set the expected-results array. +* +* Sample issue: why do we set expect[4] = 'inner'? Look at actual[4]... +* 1. The return value of f equals z, which is not defined at compile-time +* 2. At run-time (via with(o) eval(s) inside f), z is defined as the return value of g +* 3. At run-time (via with(o) eval(s) inside f), g is defined to return x +* 4. In the scope of with(o), x is undefined +* 5. Farther up the scope chain, x can be located as an argument of f +* 6. The value of this argument at run-time is 'inner' +* 7. Even farther up the scope chain, the name x can be found as a global variable +* 8. The value of this global variable is 'outer', but we should NOT have gone +* this far up the scope chain to find x...therefore we expect 'inner' +*/ +expect[0] = 'function'; +expect[1] = 44; +expect[2] = 44; +expect[3] = 'function'; +expect[4] = 'inner'; +expect[5] = false; + + + +//------------------------------------------------------------------------------------------------ +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i in expect) + { + reportCompare(expect[i], actual[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return (summary + statprefix + i + statsuffix); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js new file mode 100644 index 0000000..be0ace1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js @@ -0,0 +1,53 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 21 Feb 2001 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=69607 +* +* SUMMARY: testing that we don't crash on trivial JavaScript +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = 69607; +var summary = "Testing that we don't crash on trivial JavaScript"; +var var1; +var var2; +var var3; + +printBugNumber (bug); +printStatus (summary); + +/* + * The crash this bug reported was caused by precisely these lines + * placed in top-level code (i.e. not wrapped inside a function) - +*/ +if(false) +{ + var1 = 0; +} +else +{ + var2 = 0; +} + +if(false) +{ + var3 = 0; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js new file mode 100644 index 0000000..b6427bf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js @@ -0,0 +1,60 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): shaver@mozilla.org +* Date: 06 Mar 2001 +* +* SUMMARY: Propagate heavyweightness back up the function-nesting +* chain. See http://bugzilla.mozilla.org/show_bug.cgi?id=71107 +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = 71107; +var summary = 'Propagate heavyweightness back up the function-nesting chain...'; + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + var actual = outer()()(); //call the return of calling the return of outer() + var expect = 5; + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} + + +function outer () { + var outer_var = 5; + + function inner() { + function way_inner() { + return outer_var; + } + return way_inner; + } + return inner; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js new file mode 100644 index 0000000..3d0533d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js @@ -0,0 +1,139 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 16 May 2001 +* +* SUMMARY: Regression test for bug 76054 +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76054 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=78706 +* All String HTML methods should be LOWER case - +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 76054; +var summary = 'Testing that String HTML methods produce all lower-case'; +var statprefix = 'Currently testing String.'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var s = 'xyz'; + +status = 'anchor()'; +actual = s.anchor(); +expect = actual.toLowerCase(); +addThis(); + +status = 'big()'; +actual = s.big(); +expect = actual.toLowerCase(); +addThis(); + +status = 'blink()'; +actual = s.blink(); +expect = actual.toLowerCase(); +addThis(); + +status = 'bold()'; +actual = s.bold(); +expect = actual.toLowerCase(); +addThis(); + +status = 'italics()'; +actual = s.italics(); +expect = actual.toLowerCase(); +addThis(); + +status = 'fixed()'; +actual = s.fixed(); +expect = actual.toLowerCase(); +addThis(); + +status = 'fontcolor()'; +actual = s.fontcolor(); +expect = actual.toLowerCase(); +addThis(); + +status = 'fontsize()'; +actual = s.fontsize(); +expect = actual.toLowerCase(); +addThis(); + +status = 'link()'; +actual = s.link(); +expect = actual.toLowerCase(); +addThis(); + +status = 'small()'; +actual = s.small(); +expect = actual.toLowerCase(); +addThis(); + +status = 'strike()'; +actual = s.strike(); +expect = actual.toLowerCase(); +addThis(); + +status = 'sub()'; +actual = s.sub(); +expect = actual.toLowerCase(); +addThis(); + +status = 'sup()'; +actual = s.sup(); +expect = actual.toLowerCase(); +addThis(); + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js new file mode 100644 index 0000000..75dc052 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js @@ -0,0 +1,3137 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): khanson@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 Nov 2001 +* SUMMARY: Regression test for bug 80981. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=80981 +* "Need extended jump bytecode to avoid "script too large" errors, etc." +* +* Before this bug was fixed, the script below caused a run-time error because +* its switch statement was too big. After the fix, SpiderMonkey should compile +* this script just fine. The same fix has not been made in Rhino, however, +* so it will continue to error there... +* +* If you ever run this test against an old SpiderMonkey shell to see the bug, +* you should run it interactively: i.e. launch the JS shell manually, and load +* the test manually. Do not run it via the test driver jsDriverl.pl. Why? - +* before the fix for bug 97646, the JS shell would error on this script, but +* would NOT give non-0 exit code. As a result, the test driver couldn't detect +* the error (it looks for non-0 exit codes). +* +*/ +//----------------------------------------------------------------------------- +var i2 = 3011; +var n = new Array (i2); +var err_num = 0; +var i = 0; +var j = 0; +var k = 0; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + b (); + b4 (); + print('Number of errors = ' + err_num); +} + + +function b() +{ + b4 (); + b_after (); + + for (i=0; i<i2; i++) {n[i] = 0;} + i = 0; + + while (k++ <= i2) + { + switch (j = (k*73)%i2) + { + case 0: if (n[0]++ > 0) check ('a string 0'); break; + case 1: if (n[1]++ > 0) check ('a string 1'); break; + case 2: if (n[2]++ > 0) check ('a string 2'); break; + case 3: if (n[3]++ > 0) check ('a string 3'); break; + case 4: if (n[4]++ > 0) check ('a string 4'); break; + case 5: if (n[5]++ > 0) check ('a string 5'); break; + case 6: if (n[6]++ > 0) check ('a string 6'); break; + case 7: if (n[7]++ > 0) check ('a string 7'); break; + case 8: if (n[8]++ > 0) check ('a string 8'); break; + case 9: if (n[9]++ > 0) check ('a string 9'); break; + case 10: if (n[10]++ > 0) check ('a string 10'); break; + case 11: if (n[11]++ > 0) check ('a string 11'); break; + case 12: if (n[12]++ > 0) check ('a string 12'); break; + case 13: if (n[13]++ > 0) check ('a string 13'); break; + case 14: if (n[14]++ > 0) check ('a string 14'); break; + case 15: if (n[15]++ > 0) check ('a string 15'); break; + case 16: if (n[16]++ > 0) check ('a string 16'); break; + case 17: if (n[17]++ > 0) check ('a string 17'); break; + case 18: if (n[18]++ > 0) check ('a string 18'); break; + case 19: if (n[19]++ > 0) check ('a string 19'); break; + case 20: if (n[20]++ > 0) check ('a string 20'); break; + case 21: if (n[21]++ > 0) check ('a string 21'); break; + case 22: if (n[22]++ > 0) check ('a string 22'); break; + case 23: if (n[23]++ > 0) check ('a string 23'); break; + case 24: if (n[24]++ > 0) check ('a string 24'); break; + case 25: if (n[25]++ > 0) check ('a string 25'); break; + case 26: if (n[26]++ > 0) check ('a string 26'); break; + case 27: if (n[27]++ > 0) check ('a string 27'); break; + case 28: if (n[28]++ > 0) check ('a string 28'); break; + case 29: if (n[29]++ > 0) check ('a string 29'); break; + case 30: if (n[30]++ > 0) check ('a string 30'); break; + case 31: if (n[31]++ > 0) check ('a string 31'); break; + case 32: if (n[32]++ > 0) check ('a string 32'); break; + case 33: if (n[33]++ > 0) check ('a string 33'); break; + case 34: if (n[34]++ > 0) check ('a string 34'); break; + case 35: if (n[35]++ > 0) check ('a string 35'); break; + case 36: if (n[36]++ > 0) check ('a string 36'); break; + case 37: if (n[37]++ > 0) check ('a string 37'); break; + case 38: if (n[38]++ > 0) check ('a string 38'); break; + case 39: if (n[39]++ > 0) check ('a string 39'); break; + case 40: if (n[40]++ > 0) check ('a string 40'); break; + case 41: if (n[41]++ > 0) check ('a string 41'); break; + case 42: if (n[42]++ > 0) check ('a string 42'); break; + case 43: if (n[43]++ > 0) check ('a string 43'); break; + case 44: if (n[44]++ > 0) check ('a string 44'); break; + case 45: if (n[45]++ > 0) check ('a string 45'); break; + case 46: if (n[46]++ > 0) check ('a string 46'); break; + case 47: if (n[47]++ > 0) check ('a string 47'); break; + case 48: if (n[48]++ > 0) check ('a string 48'); break; + case 49: if (n[49]++ > 0) check ('a string 49'); break; + case 50: if (n[50]++ > 0) check ('a string 50'); break; + case 51: if (n[51]++ > 0) check ('a string 51'); break; + case 52: if (n[52]++ > 0) check ('a string 52'); break; + case 53: if (n[53]++ > 0) check ('a string 53'); break; + case 54: if (n[54]++ > 0) check ('a string 54'); break; + case 55: if (n[55]++ > 0) check ('a string 55'); break; + case 56: if (n[56]++ > 0) check ('a string 56'); break; + case 57: if (n[57]++ > 0) check ('a string 57'); break; + case 58: if (n[58]++ > 0) check ('a string 58'); break; + case 59: if (n[59]++ > 0) check ('a string 59'); break; + case 60: if (n[60]++ > 0) check ('a string 60'); break; + case 61: if (n[61]++ > 0) check ('a string 61'); break; + case 62: if (n[62]++ > 0) check ('a string 62'); break; + case 63: if (n[63]++ > 0) check ('a string 63'); break; + case 64: if (n[64]++ > 0) check ('a string 64'); break; + case 65: if (n[65]++ > 0) check ('a string 65'); break; + case 66: if (n[66]++ > 0) check ('a string 66'); break; + case 67: if (n[67]++ > 0) check ('a string 67'); break; + case 68: if (n[68]++ > 0) check ('a string 68'); break; + case 69: if (n[69]++ > 0) check ('a string 69'); break; + case 70: if (n[70]++ > 0) check ('a string 70'); break; + case 71: if (n[71]++ > 0) check ('a string 71'); break; + case 72: if (n[72]++ > 0) check ('a string 72'); break; + case 73: if (n[73]++ > 0) check ('a string 73'); break; + case 74: if (n[74]++ > 0) check ('a string 74'); break; + case 75: if (n[75]++ > 0) check ('a string 75'); break; + case 76: if (n[76]++ > 0) check ('a string 76'); break; + case 77: if (n[77]++ > 0) check ('a string 77'); break; + case 78: if (n[78]++ > 0) check ('a string 78'); break; + case 79: if (n[79]++ > 0) check ('a string 79'); break; + case 80: if (n[80]++ > 0) check ('a string 80'); break; + case 81: if (n[81]++ > 0) check ('a string 81'); break; + case 82: if (n[82]++ > 0) check ('a string 82'); break; + case 83: if (n[83]++ > 0) check ('a string 83'); break; + case 84: if (n[84]++ > 0) check ('a string 84'); break; + case 85: if (n[85]++ > 0) check ('a string 85'); break; + case 86: if (n[86]++ > 0) check ('a string 86'); break; + case 87: if (n[87]++ > 0) check ('a string 87'); break; + case 88: if (n[88]++ > 0) check ('a string 88'); break; + case 89: if (n[89]++ > 0) check ('a string 89'); break; + case 90: if (n[90]++ > 0) check ('a string 90'); break; + case 91: if (n[91]++ > 0) check ('a string 91'); break; + case 92: if (n[92]++ > 0) check ('a string 92'); break; + case 93: if (n[93]++ > 0) check ('a string 93'); break; + case 94: if (n[94]++ > 0) check ('a string 94'); break; + case 95: if (n[95]++ > 0) check ('a string 95'); break; + case 96: if (n[96]++ > 0) check ('a string 96'); break; + case 97: if (n[97]++ > 0) check ('a string 97'); break; + case 98: if (n[98]++ > 0) check ('a string 98'); break; + case 99: if (n[99]++ > 0) check ('a string 99'); break; + case 100: if (n[100]++ > 0) check ('a string 100'); break; + case 101: if (n[101]++ > 0) check ('a string 101'); break; + case 102: if (n[102]++ > 0) check ('a string 102'); break; + case 103: if (n[103]++ > 0) check ('a string 103'); break; + case 104: if (n[104]++ > 0) check ('a string 104'); break; + case 105: if (n[105]++ > 0) check ('a string 105'); break; + case 106: if (n[106]++ > 0) check ('a string 106'); break; + case 107: if (n[107]++ > 0) check ('a string 107'); break; + case 108: if (n[108]++ > 0) check ('a string 108'); break; + case 109: if (n[109]++ > 0) check ('a string 109'); break; + case 110: if (n[110]++ > 0) check ('a string 110'); break; + case 111: if (n[111]++ > 0) check ('a string 111'); break; + case 112: if (n[112]++ > 0) check ('a string 112'); break; + case 113: if (n[113]++ > 0) check ('a string 113'); break; + case 114: if (n[114]++ > 0) check ('a string 114'); break; + case 115: if (n[115]++ > 0) check ('a string 115'); break; + case 116: if (n[116]++ > 0) check ('a string 116'); break; + case 117: if (n[117]++ > 0) check ('a string 117'); break; + case 118: if (n[118]++ > 0) check ('a string 118'); break; + case 119: if (n[119]++ > 0) check ('a string 119'); break; + case 120: if (n[120]++ > 0) check ('a string 120'); break; + case 121: if (n[121]++ > 0) check ('a string 121'); break; + case 122: if (n[122]++ > 0) check ('a string 122'); break; + case 123: if (n[123]++ > 0) check ('a string 123'); break; + case 124: if (n[124]++ > 0) check ('a string 124'); break; + case 125: if (n[125]++ > 0) check ('a string 125'); break; + case 126: if (n[126]++ > 0) check ('a string 126'); break; + case 127: if (n[127]++ > 0) check ('a string 127'); break; + case 128: if (n[128]++ > 0) check ('a string 128'); break; + case 129: if (n[129]++ > 0) check ('a string 129'); break; + case 130: if (n[130]++ > 0) check ('a string 130'); break; + case 131: if (n[131]++ > 0) check ('a string 131'); break; + case 132: if (n[132]++ > 0) check ('a string 132'); break; + case 133: if (n[133]++ > 0) check ('a string 133'); break; + case 134: if (n[134]++ > 0) check ('a string 134'); break; + case 135: if (n[135]++ > 0) check ('a string 135'); break; + case 136: if (n[136]++ > 0) check ('a string 136'); break; + case 137: if (n[137]++ > 0) check ('a string 137'); break; + case 138: if (n[138]++ > 0) check ('a string 138'); break; + case 139: if (n[139]++ > 0) check ('a string 139'); break; + case 140: if (n[140]++ > 0) check ('a string 140'); break; + case 141: if (n[141]++ > 0) check ('a string 141'); break; + case 142: if (n[142]++ > 0) check ('a string 142'); break; + case 143: if (n[143]++ > 0) check ('a string 143'); break; + case 144: if (n[144]++ > 0) check ('a string 144'); break; + case 145: if (n[145]++ > 0) check ('a string 145'); break; + case 146: if (n[146]++ > 0) check ('a string 146'); break; + case 147: if (n[147]++ > 0) check ('a string 147'); break; + case 148: if (n[148]++ > 0) check ('a string 148'); break; + case 149: if (n[149]++ > 0) check ('a string 149'); break; + case 150: if (n[150]++ > 0) check ('a string 150'); break; + case 151: if (n[151]++ > 0) check ('a string 151'); break; + case 152: if (n[152]++ > 0) check ('a string 152'); break; + case 153: if (n[153]++ > 0) check ('a string 153'); break; + case 154: if (n[154]++ > 0) check ('a string 154'); break; + case 155: if (n[155]++ > 0) check ('a string 155'); break; + case 156: if (n[156]++ > 0) check ('a string 156'); break; + case 157: if (n[157]++ > 0) check ('a string 157'); break; + case 158: if (n[158]++ > 0) check ('a string 158'); break; + case 159: if (n[159]++ > 0) check ('a string 159'); break; + case 160: if (n[160]++ > 0) check ('a string 160'); break; + case 161: if (n[161]++ > 0) check ('a string 161'); break; + case 162: if (n[162]++ > 0) check ('a string 162'); break; + case 163: if (n[163]++ > 0) check ('a string 163'); break; + case 164: if (n[164]++ > 0) check ('a string 164'); break; + case 165: if (n[165]++ > 0) check ('a string 165'); break; + case 166: if (n[166]++ > 0) check ('a string 166'); break; + case 167: if (n[167]++ > 0) check ('a string 167'); break; + case 168: if (n[168]++ > 0) check ('a string 168'); break; + case 169: if (n[169]++ > 0) check ('a string 169'); break; + case 170: if (n[170]++ > 0) check ('a string 170'); break; + case 171: if (n[171]++ > 0) check ('a string 171'); break; + case 172: if (n[172]++ > 0) check ('a string 172'); break; + case 173: if (n[173]++ > 0) check ('a string 173'); break; + case 174: if (n[174]++ > 0) check ('a string 174'); break; + case 175: if (n[175]++ > 0) check ('a string 175'); break; + case 176: if (n[176]++ > 0) check ('a string 176'); break; + case 177: if (n[177]++ > 0) check ('a string 177'); break; + case 178: if (n[178]++ > 0) check ('a string 178'); break; + case 179: if (n[179]++ > 0) check ('a string 179'); break; + case 180: if (n[180]++ > 0) check ('a string 180'); break; + case 181: if (n[181]++ > 0) check ('a string 181'); break; + case 182: if (n[182]++ > 0) check ('a string 182'); break; + case 183: if (n[183]++ > 0) check ('a string 183'); break; + case 184: if (n[184]++ > 0) check ('a string 184'); break; + case 185: if (n[185]++ > 0) check ('a string 185'); break; + case 186: if (n[186]++ > 0) check ('a string 186'); break; + case 187: if (n[187]++ > 0) check ('a string 187'); break; + case 188: if (n[188]++ > 0) check ('a string 188'); break; + case 189: if (n[189]++ > 0) check ('a string 189'); break; + case 190: if (n[190]++ > 0) check ('a string 190'); break; + case 191: if (n[191]++ > 0) check ('a string 191'); break; + case 192: if (n[192]++ > 0) check ('a string 192'); break; + case 193: if (n[193]++ > 0) check ('a string 193'); break; + case 194: if (n[194]++ > 0) check ('a string 194'); break; + case 195: if (n[195]++ > 0) check ('a string 195'); break; + case 196: if (n[196]++ > 0) check ('a string 196'); break; + case 197: if (n[197]++ > 0) check ('a string 197'); break; + case 198: if (n[198]++ > 0) check ('a string 198'); break; + case 199: if (n[199]++ > 0) check ('a string 199'); break; + case 200: if (n[200]++ > 0) check ('a string 200'); break; + case 201: if (n[201]++ > 0) check ('a string 201'); break; + case 202: if (n[202]++ > 0) check ('a string 202'); break; + case 203: if (n[203]++ > 0) check ('a string 203'); break; + case 204: if (n[204]++ > 0) check ('a string 204'); break; + case 205: if (n[205]++ > 0) check ('a string 205'); break; + case 206: if (n[206]++ > 0) check ('a string 206'); break; + case 207: if (n[207]++ > 0) check ('a string 207'); break; + case 208: if (n[208]++ > 0) check ('a string 208'); break; + case 209: if (n[209]++ > 0) check ('a string 209'); break; + case 210: if (n[210]++ > 0) check ('a string 210'); break; + case 211: if (n[211]++ > 0) check ('a string 211'); break; + case 212: if (n[212]++ > 0) check ('a string 212'); break; + case 213: if (n[213]++ > 0) check ('a string 213'); break; + case 214: if (n[214]++ > 0) check ('a string 214'); break; + case 215: if (n[215]++ > 0) check ('a string 215'); break; + case 216: if (n[216]++ > 0) check ('a string 216'); break; + case 217: if (n[217]++ > 0) check ('a string 217'); break; + case 218: if (n[218]++ > 0) check ('a string 218'); break; + case 219: if (n[219]++ > 0) check ('a string 219'); break; + case 220: if (n[220]++ > 0) check ('a string 220'); break; + case 221: if (n[221]++ > 0) check ('a string 221'); break; + case 222: if (n[222]++ > 0) check ('a string 222'); break; + case 223: if (n[223]++ > 0) check ('a string 223'); break; + case 224: if (n[224]++ > 0) check ('a string 224'); break; + case 225: if (n[225]++ > 0) check ('a string 225'); break; + case 226: if (n[226]++ > 0) check ('a string 226'); break; + case 227: if (n[227]++ > 0) check ('a string 227'); break; + case 228: if (n[228]++ > 0) check ('a string 228'); break; + case 229: if (n[229]++ > 0) check ('a string 229'); break; + case 230: if (n[230]++ > 0) check ('a string 230'); break; + case 231: if (n[231]++ > 0) check ('a string 231'); break; + case 232: if (n[232]++ > 0) check ('a string 232'); break; + case 233: if (n[233]++ > 0) check ('a string 233'); break; + case 234: if (n[234]++ > 0) check ('a string 234'); break; + case 235: if (n[235]++ > 0) check ('a string 235'); break; + case 236: if (n[236]++ > 0) check ('a string 236'); break; + case 237: if (n[237]++ > 0) check ('a string 237'); break; + case 238: if (n[238]++ > 0) check ('a string 238'); break; + case 239: if (n[239]++ > 0) check ('a string 239'); break; + case 240: if (n[240]++ > 0) check ('a string 240'); break; + case 241: if (n[241]++ > 0) check ('a string 241'); break; + case 242: if (n[242]++ > 0) check ('a string 242'); break; + case 243: if (n[243]++ > 0) check ('a string 243'); break; + case 244: if (n[244]++ > 0) check ('a string 244'); break; + case 245: if (n[245]++ > 0) check ('a string 245'); break; + case 246: if (n[246]++ > 0) check ('a string 246'); break; + case 247: if (n[247]++ > 0) check ('a string 247'); break; + case 248: if (n[248]++ > 0) check ('a string 248'); break; + case 249: if (n[249]++ > 0) check ('a string 249'); break; + case 250: if (n[250]++ > 0) check ('a string 250'); break; + case 251: if (n[251]++ > 0) check ('a string 251'); break; + case 252: if (n[252]++ > 0) check ('a string 252'); break; + case 253: if (n[253]++ > 0) check ('a string 253'); break; + case 254: if (n[254]++ > 0) check ('a string 254'); break; + case 255: if (n[255]++ > 0) check ('a string 255'); break; + case 256: if (n[256]++ > 0) check ('a string 256'); break; + case 257: if (n[257]++ > 0) check ('a string 257'); break; + case 258: if (n[258]++ > 0) check ('a string 258'); break; + case 259: if (n[259]++ > 0) check ('a string 259'); break; + case 260: if (n[260]++ > 0) check ('a string 260'); break; + case 261: if (n[261]++ > 0) check ('a string 261'); break; + case 262: if (n[262]++ > 0) check ('a string 262'); break; + case 263: if (n[263]++ > 0) check ('a string 263'); break; + case 264: if (n[264]++ > 0) check ('a string 264'); break; + case 265: if (n[265]++ > 0) check ('a string 265'); break; + case 266: if (n[266]++ > 0) check ('a string 266'); break; + case 267: if (n[267]++ > 0) check ('a string 267'); break; + case 268: if (n[268]++ > 0) check ('a string 268'); break; + case 269: if (n[269]++ > 0) check ('a string 269'); break; + case 270: if (n[270]++ > 0) check ('a string 270'); break; + case 271: if (n[271]++ > 0) check ('a string 271'); break; + case 272: if (n[272]++ > 0) check ('a string 272'); break; + case 273: if (n[273]++ > 0) check ('a string 273'); break; + case 274: if (n[274]++ > 0) check ('a string 274'); break; + case 275: if (n[275]++ > 0) check ('a string 275'); break; + case 276: if (n[276]++ > 0) check ('a string 276'); break; + case 277: if (n[277]++ > 0) check ('a string 277'); break; + case 278: if (n[278]++ > 0) check ('a string 278'); break; + case 279: if (n[279]++ > 0) check ('a string 279'); break; + case 280: if (n[280]++ > 0) check ('a string 280'); break; + case 281: if (n[281]++ > 0) check ('a string 281'); break; + case 282: if (n[282]++ > 0) check ('a string 282'); break; + case 283: if (n[283]++ > 0) check ('a string 283'); break; + case 284: if (n[284]++ > 0) check ('a string 284'); break; + case 285: if (n[285]++ > 0) check ('a string 285'); break; + case 286: if (n[286]++ > 0) check ('a string 286'); break; + case 287: if (n[287]++ > 0) check ('a string 287'); break; + case 288: if (n[288]++ > 0) check ('a string 288'); break; + case 289: if (n[289]++ > 0) check ('a string 289'); break; + case 290: if (n[290]++ > 0) check ('a string 290'); break; + case 291: if (n[291]++ > 0) check ('a string 291'); break; + case 292: if (n[292]++ > 0) check ('a string 292'); break; + case 293: if (n[293]++ > 0) check ('a string 293'); break; + case 294: if (n[294]++ > 0) check ('a string 294'); break; + case 295: if (n[295]++ > 0) check ('a string 295'); break; + case 296: if (n[296]++ > 0) check ('a string 296'); break; + case 297: if (n[297]++ > 0) check ('a string 297'); break; + case 298: if (n[298]++ > 0) check ('a string 298'); break; + case 299: if (n[299]++ > 0) check ('a string 299'); break; + case 300: if (n[300]++ > 0) check ('a string 300'); break; + case 301: if (n[301]++ > 0) check ('a string 301'); break; + case 302: if (n[302]++ > 0) check ('a string 302'); break; + case 303: if (n[303]++ > 0) check ('a string 303'); break; + case 304: if (n[304]++ > 0) check ('a string 304'); break; + case 305: if (n[305]++ > 0) check ('a string 305'); break; + case 306: if (n[306]++ > 0) check ('a string 306'); break; + case 307: if (n[307]++ > 0) check ('a string 307'); break; + case 308: if (n[308]++ > 0) check ('a string 308'); break; + case 309: if (n[309]++ > 0) check ('a string 309'); break; + case 310: if (n[310]++ > 0) check ('a string 310'); break; + case 311: if (n[311]++ > 0) check ('a string 311'); break; + case 312: if (n[312]++ > 0) check ('a string 312'); break; + case 313: if (n[313]++ > 0) check ('a string 313'); break; + case 314: if (n[314]++ > 0) check ('a string 314'); break; + case 315: if (n[315]++ > 0) check ('a string 315'); break; + case 316: if (n[316]++ > 0) check ('a string 316'); break; + case 317: if (n[317]++ > 0) check ('a string 317'); break; + case 318: if (n[318]++ > 0) check ('a string 318'); break; + case 319: if (n[319]++ > 0) check ('a string 319'); break; + case 320: if (n[320]++ > 0) check ('a string 320'); break; + case 321: if (n[321]++ > 0) check ('a string 321'); break; + case 322: if (n[322]++ > 0) check ('a string 322'); break; + case 323: if (n[323]++ > 0) check ('a string 323'); break; + case 324: if (n[324]++ > 0) check ('a string 324'); break; + case 325: if (n[325]++ > 0) check ('a string 325'); break; + case 326: if (n[326]++ > 0) check ('a string 326'); break; + case 327: if (n[327]++ > 0) check ('a string 327'); break; + case 328: if (n[328]++ > 0) check ('a string 328'); break; + case 329: if (n[329]++ > 0) check ('a string 329'); break; + case 330: if (n[330]++ > 0) check ('a string 330'); break; + case 331: if (n[331]++ > 0) check ('a string 331'); break; + case 332: if (n[332]++ > 0) check ('a string 332'); break; + case 333: if (n[333]++ > 0) check ('a string 333'); break; + case 334: if (n[334]++ > 0) check ('a string 334'); break; + case 335: if (n[335]++ > 0) check ('a string 335'); break; + case 336: if (n[336]++ > 0) check ('a string 336'); break; + case 337: if (n[337]++ > 0) check ('a string 337'); break; + case 338: if (n[338]++ > 0) check ('a string 338'); break; + case 339: if (n[339]++ > 0) check ('a string 339'); break; + case 340: if (n[340]++ > 0) check ('a string 340'); break; + case 341: if (n[341]++ > 0) check ('a string 341'); break; + case 342: if (n[342]++ > 0) check ('a string 342'); break; + case 343: if (n[343]++ > 0) check ('a string 343'); break; + case 344: if (n[344]++ > 0) check ('a string 344'); break; + case 345: if (n[345]++ > 0) check ('a string 345'); break; + case 346: if (n[346]++ > 0) check ('a string 346'); break; + case 347: if (n[347]++ > 0) check ('a string 347'); break; + case 348: if (n[348]++ > 0) check ('a string 348'); break; + case 349: if (n[349]++ > 0) check ('a string 349'); break; + case 350: if (n[350]++ > 0) check ('a string 350'); break; + case 351: if (n[351]++ > 0) check ('a string 351'); break; + case 352: if (n[352]++ > 0) check ('a string 352'); break; + case 353: if (n[353]++ > 0) check ('a string 353'); break; + case 354: if (n[354]++ > 0) check ('a string 354'); break; + case 355: if (n[355]++ > 0) check ('a string 355'); break; + case 356: if (n[356]++ > 0) check ('a string 356'); break; + case 357: if (n[357]++ > 0) check ('a string 357'); break; + case 358: if (n[358]++ > 0) check ('a string 358'); break; + case 359: if (n[359]++ > 0) check ('a string 359'); break; + case 360: if (n[360]++ > 0) check ('a string 360'); break; + case 361: if (n[361]++ > 0) check ('a string 361'); break; + case 362: if (n[362]++ > 0) check ('a string 362'); break; + case 363: if (n[363]++ > 0) check ('a string 363'); break; + case 364: if (n[364]++ > 0) check ('a string 364'); break; + case 365: if (n[365]++ > 0) check ('a string 365'); break; + case 366: if (n[366]++ > 0) check ('a string 366'); break; + case 367: if (n[367]++ > 0) check ('a string 367'); break; + case 368: if (n[368]++ > 0) check ('a string 368'); break; + case 369: if (n[369]++ > 0) check ('a string 369'); break; + case 370: if (n[370]++ > 0) check ('a string 370'); break; + case 371: if (n[371]++ > 0) check ('a string 371'); break; + case 372: if (n[372]++ > 0) check ('a string 372'); break; + case 373: if (n[373]++ > 0) check ('a string 373'); break; + case 374: if (n[374]++ > 0) check ('a string 374'); break; + case 375: if (n[375]++ > 0) check ('a string 375'); break; + case 376: if (n[376]++ > 0) check ('a string 376'); break; + case 377: if (n[377]++ > 0) check ('a string 377'); break; + case 378: if (n[378]++ > 0) check ('a string 378'); break; + case 379: if (n[379]++ > 0) check ('a string 379'); break; + case 380: if (n[380]++ > 0) check ('a string 380'); break; + case 381: if (n[381]++ > 0) check ('a string 381'); break; + case 382: if (n[382]++ > 0) check ('a string 382'); break; + case 383: if (n[383]++ > 0) check ('a string 383'); break; + case 384: if (n[384]++ > 0) check ('a string 384'); break; + case 385: if (n[385]++ > 0) check ('a string 385'); break; + case 386: if (n[386]++ > 0) check ('a string 386'); break; + case 387: if (n[387]++ > 0) check ('a string 387'); break; + case 388: if (n[388]++ > 0) check ('a string 388'); break; + case 389: if (n[389]++ > 0) check ('a string 389'); break; + case 390: if (n[390]++ > 0) check ('a string 390'); break; + case 391: if (n[391]++ > 0) check ('a string 391'); break; + case 392: if (n[392]++ > 0) check ('a string 392'); break; + case 393: if (n[393]++ > 0) check ('a string 393'); break; + case 394: if (n[394]++ > 0) check ('a string 394'); break; + case 395: if (n[395]++ > 0) check ('a string 395'); break; + case 396: if (n[396]++ > 0) check ('a string 396'); break; + case 397: if (n[397]++ > 0) check ('a string 397'); break; + case 398: if (n[398]++ > 0) check ('a string 398'); break; + case 399: if (n[399]++ > 0) check ('a string 399'); break; + case 400: if (n[400]++ > 0) check ('a string 400'); break; + case 401: if (n[401]++ > 0) check ('a string 401'); break; + case 402: if (n[402]++ > 0) check ('a string 402'); break; + case 403: if (n[403]++ > 0) check ('a string 403'); break; + case 404: if (n[404]++ > 0) check ('a string 404'); break; + case 405: if (n[405]++ > 0) check ('a string 405'); break; + case 406: if (n[406]++ > 0) check ('a string 406'); break; + case 407: if (n[407]++ > 0) check ('a string 407'); break; + case 408: if (n[408]++ > 0) check ('a string 408'); break; + case 409: if (n[409]++ > 0) check ('a string 409'); break; + case 410: if (n[410]++ > 0) check ('a string 410'); break; + case 411: if (n[411]++ > 0) check ('a string 411'); break; + case 412: if (n[412]++ > 0) check ('a string 412'); break; + case 413: if (n[413]++ > 0) check ('a string 413'); break; + case 414: if (n[414]++ > 0) check ('a string 414'); break; + case 415: if (n[415]++ > 0) check ('a string 415'); break; + case 416: if (n[416]++ > 0) check ('a string 416'); break; + case 417: if (n[417]++ > 0) check ('a string 417'); break; + case 418: if (n[418]++ > 0) check ('a string 418'); break; + case 419: if (n[419]++ > 0) check ('a string 419'); break; + case 420: if (n[420]++ > 0) check ('a string 420'); break; + case 421: if (n[421]++ > 0) check ('a string 421'); break; + case 422: if (n[422]++ > 0) check ('a string 422'); break; + case 423: if (n[423]++ > 0) check ('a string 423'); break; + case 424: if (n[424]++ > 0) check ('a string 424'); break; + case 425: if (n[425]++ > 0) check ('a string 425'); break; + case 426: if (n[426]++ > 0) check ('a string 426'); break; + case 427: if (n[427]++ > 0) check ('a string 427'); break; + case 428: if (n[428]++ > 0) check ('a string 428'); break; + case 429: if (n[429]++ > 0) check ('a string 429'); break; + case 430: if (n[430]++ > 0) check ('a string 430'); break; + case 431: if (n[431]++ > 0) check ('a string 431'); break; + case 432: if (n[432]++ > 0) check ('a string 432'); break; + case 433: if (n[433]++ > 0) check ('a string 433'); break; + case 434: if (n[434]++ > 0) check ('a string 434'); break; + case 435: if (n[435]++ > 0) check ('a string 435'); break; + case 436: if (n[436]++ > 0) check ('a string 436'); break; + case 437: if (n[437]++ > 0) check ('a string 437'); break; + case 438: if (n[438]++ > 0) check ('a string 438'); break; + case 439: if (n[439]++ > 0) check ('a string 439'); break; + case 440: if (n[440]++ > 0) check ('a string 440'); break; + case 441: if (n[441]++ > 0) check ('a string 441'); break; + case 442: if (n[442]++ > 0) check ('a string 442'); break; + case 443: if (n[443]++ > 0) check ('a string 443'); break; + case 444: if (n[444]++ > 0) check ('a string 444'); break; + case 445: if (n[445]++ > 0) check ('a string 445'); break; + case 446: if (n[446]++ > 0) check ('a string 446'); break; + case 447: if (n[447]++ > 0) check ('a string 447'); break; + case 448: if (n[448]++ > 0) check ('a string 448'); break; + case 449: if (n[449]++ > 0) check ('a string 449'); break; + case 450: if (n[450]++ > 0) check ('a string 450'); break; + case 451: if (n[451]++ > 0) check ('a string 451'); break; + case 452: if (n[452]++ > 0) check ('a string 452'); break; + case 453: if (n[453]++ > 0) check ('a string 453'); break; + case 454: if (n[454]++ > 0) check ('a string 454'); break; + case 455: if (n[455]++ > 0) check ('a string 455'); break; + case 456: if (n[456]++ > 0) check ('a string 456'); break; + case 457: if (n[457]++ > 0) check ('a string 457'); break; + case 458: if (n[458]++ > 0) check ('a string 458'); break; + case 459: if (n[459]++ > 0) check ('a string 459'); break; + case 460: if (n[460]++ > 0) check ('a string 460'); break; + case 461: if (n[461]++ > 0) check ('a string 461'); break; + case 462: if (n[462]++ > 0) check ('a string 462'); break; + case 463: if (n[463]++ > 0) check ('a string 463'); break; + case 464: if (n[464]++ > 0) check ('a string 464'); break; + case 465: if (n[465]++ > 0) check ('a string 465'); break; + case 466: if (n[466]++ > 0) check ('a string 466'); break; + case 467: if (n[467]++ > 0) check ('a string 467'); break; + case 468: if (n[468]++ > 0) check ('a string 468'); break; + case 469: if (n[469]++ > 0) check ('a string 469'); break; + case 470: if (n[470]++ > 0) check ('a string 470'); break; + case 471: if (n[471]++ > 0) check ('a string 471'); break; + case 472: if (n[472]++ > 0) check ('a string 472'); break; + case 473: if (n[473]++ > 0) check ('a string 473'); break; + case 474: if (n[474]++ > 0) check ('a string 474'); break; + case 475: if (n[475]++ > 0) check ('a string 475'); break; + case 476: if (n[476]++ > 0) check ('a string 476'); break; + case 477: if (n[477]++ > 0) check ('a string 477'); break; + case 478: if (n[478]++ > 0) check ('a string 478'); break; + case 479: if (n[479]++ > 0) check ('a string 479'); break; + case 480: if (n[480]++ > 0) check ('a string 480'); break; + case 481: if (n[481]++ > 0) check ('a string 481'); break; + case 482: if (n[482]++ > 0) check ('a string 482'); break; + case 483: if (n[483]++ > 0) check ('a string 483'); break; + case 484: if (n[484]++ > 0) check ('a string 484'); break; + case 485: if (n[485]++ > 0) check ('a string 485'); break; + case 486: if (n[486]++ > 0) check ('a string 486'); break; + case 487: if (n[487]++ > 0) check ('a string 487'); break; + case 488: if (n[488]++ > 0) check ('a string 488'); break; + case 489: if (n[489]++ > 0) check ('a string 489'); break; + case 490: if (n[490]++ > 0) check ('a string 490'); break; + case 491: if (n[491]++ > 0) check ('a string 491'); break; + case 492: if (n[492]++ > 0) check ('a string 492'); break; + case 493: if (n[493]++ > 0) check ('a string 493'); break; + case 494: if (n[494]++ > 0) check ('a string 494'); break; + case 495: if (n[495]++ > 0) check ('a string 495'); break; + case 496: if (n[496]++ > 0) check ('a string 496'); break; + case 497: if (n[497]++ > 0) check ('a string 497'); break; + case 498: if (n[498]++ > 0) check ('a string 498'); break; + case 499: if (n[499]++ > 0) check ('a string 499'); break; + case 500: if (n[500]++ > 0) check ('a string 500'); break; + case 501: if (n[501]++ > 0) check ('a string 501'); break; + case 502: if (n[502]++ > 0) check ('a string 502'); break; + case 503: if (n[503]++ > 0) check ('a string 503'); break; + case 504: if (n[504]++ > 0) check ('a string 504'); break; + case 505: if (n[505]++ > 0) check ('a string 505'); break; + case 506: if (n[506]++ > 0) check ('a string 506'); break; + case 507: if (n[507]++ > 0) check ('a string 507'); break; + case 508: if (n[508]++ > 0) check ('a string 508'); break; + case 509: if (n[509]++ > 0) check ('a string 509'); break; + case 510: if (n[510]++ > 0) check ('a string 510'); break; + case 511: if (n[511]++ > 0) check ('a string 511'); break; + case 512: if (n[512]++ > 0) check ('a string 512'); break; + case 513: if (n[513]++ > 0) check ('a string 513'); break; + case 514: if (n[514]++ > 0) check ('a string 514'); break; + case 515: if (n[515]++ > 0) check ('a string 515'); break; + case 516: if (n[516]++ > 0) check ('a string 516'); break; + case 517: if (n[517]++ > 0) check ('a string 517'); break; + case 518: if (n[518]++ > 0) check ('a string 518'); break; + case 519: if (n[519]++ > 0) check ('a string 519'); break; + case 520: if (n[520]++ > 0) check ('a string 520'); break; + case 521: if (n[521]++ > 0) check ('a string 521'); break; + case 522: if (n[522]++ > 0) check ('a string 522'); break; + case 523: if (n[523]++ > 0) check ('a string 523'); break; + case 524: if (n[524]++ > 0) check ('a string 524'); break; + case 525: if (n[525]++ > 0) check ('a string 525'); break; + case 526: if (n[526]++ > 0) check ('a string 526'); break; + case 527: if (n[527]++ > 0) check ('a string 527'); break; + case 528: if (n[528]++ > 0) check ('a string 528'); break; + case 529: if (n[529]++ > 0) check ('a string 529'); break; + case 530: if (n[530]++ > 0) check ('a string 530'); break; + case 531: if (n[531]++ > 0) check ('a string 531'); break; + case 532: if (n[532]++ > 0) check ('a string 532'); break; + case 533: if (n[533]++ > 0) check ('a string 533'); break; + case 534: if (n[534]++ > 0) check ('a string 534'); break; + case 535: if (n[535]++ > 0) check ('a string 535'); break; + case 536: if (n[536]++ > 0) check ('a string 536'); break; + case 537: if (n[537]++ > 0) check ('a string 537'); break; + case 538: if (n[538]++ > 0) check ('a string 538'); break; + case 539: if (n[539]++ > 0) check ('a string 539'); break; + case 540: if (n[540]++ > 0) check ('a string 540'); break; + case 541: if (n[541]++ > 0) check ('a string 541'); break; + case 542: if (n[542]++ > 0) check ('a string 542'); break; + case 543: if (n[543]++ > 0) check ('a string 543'); break; + case 544: if (n[544]++ > 0) check ('a string 544'); break; + case 545: if (n[545]++ > 0) check ('a string 545'); break; + case 546: if (n[546]++ > 0) check ('a string 546'); break; + case 547: if (n[547]++ > 0) check ('a string 547'); break; + case 548: if (n[548]++ > 0) check ('a string 548'); break; + case 549: if (n[549]++ > 0) check ('a string 549'); break; + case 550: if (n[550]++ > 0) check ('a string 550'); break; + case 551: if (n[551]++ > 0) check ('a string 551'); break; + case 552: if (n[552]++ > 0) check ('a string 552'); break; + case 553: if (n[553]++ > 0) check ('a string 553'); break; + case 554: if (n[554]++ > 0) check ('a string 554'); break; + case 555: if (n[555]++ > 0) check ('a string 555'); break; + case 556: if (n[556]++ > 0) check ('a string 556'); break; + case 557: if (n[557]++ > 0) check ('a string 557'); break; + case 558: if (n[558]++ > 0) check ('a string 558'); break; + case 559: if (n[559]++ > 0) check ('a string 559'); break; + case 560: if (n[560]++ > 0) check ('a string 560'); break; + case 561: if (n[561]++ > 0) check ('a string 561'); break; + case 562: if (n[562]++ > 0) check ('a string 562'); break; + case 563: if (n[563]++ > 0) check ('a string 563'); break; + case 564: if (n[564]++ > 0) check ('a string 564'); break; + case 565: if (n[565]++ > 0) check ('a string 565'); break; + case 566: if (n[566]++ > 0) check ('a string 566'); break; + case 567: if (n[567]++ > 0) check ('a string 567'); break; + case 568: if (n[568]++ > 0) check ('a string 568'); break; + case 569: if (n[569]++ > 0) check ('a string 569'); break; + case 570: if (n[570]++ > 0) check ('a string 570'); break; + case 571: if (n[571]++ > 0) check ('a string 571'); break; + case 572: if (n[572]++ > 0) check ('a string 572'); break; + case 573: if (n[573]++ > 0) check ('a string 573'); break; + case 574: if (n[574]++ > 0) check ('a string 574'); break; + case 575: if (n[575]++ > 0) check ('a string 575'); break; + case 576: if (n[576]++ > 0) check ('a string 576'); break; + case 577: if (n[577]++ > 0) check ('a string 577'); break; + case 578: if (n[578]++ > 0) check ('a string 578'); break; + case 579: if (n[579]++ > 0) check ('a string 579'); break; + case 580: if (n[580]++ > 0) check ('a string 580'); break; + case 581: if (n[581]++ > 0) check ('a string 581'); break; + case 582: if (n[582]++ > 0) check ('a string 582'); break; + case 583: if (n[583]++ > 0) check ('a string 583'); break; + case 584: if (n[584]++ > 0) check ('a string 584'); break; + case 585: if (n[585]++ > 0) check ('a string 585'); break; + case 586: if (n[586]++ > 0) check ('a string 586'); break; + case 587: if (n[587]++ > 0) check ('a string 587'); break; + case 588: if (n[588]++ > 0) check ('a string 588'); break; + case 589: if (n[589]++ > 0) check ('a string 589'); break; + case 590: if (n[590]++ > 0) check ('a string 590'); break; + case 591: if (n[591]++ > 0) check ('a string 591'); break; + case 592: if (n[592]++ > 0) check ('a string 592'); break; + case 593: if (n[593]++ > 0) check ('a string 593'); break; + case 594: if (n[594]++ > 0) check ('a string 594'); break; + case 595: if (n[595]++ > 0) check ('a string 595'); break; + case 596: if (n[596]++ > 0) check ('a string 596'); break; + case 597: if (n[597]++ > 0) check ('a string 597'); break; + case 598: if (n[598]++ > 0) check ('a string 598'); break; + case 599: if (n[599]++ > 0) check ('a string 599'); break; + case 600: if (n[600]++ > 0) check ('a string 600'); break; + case 601: if (n[601]++ > 0) check ('a string 601'); break; + case 602: if (n[602]++ > 0) check ('a string 602'); break; + case 603: if (n[603]++ > 0) check ('a string 603'); break; + case 604: if (n[604]++ > 0) check ('a string 604'); break; + case 605: if (n[605]++ > 0) check ('a string 605'); break; + case 606: if (n[606]++ > 0) check ('a string 606'); break; + case 607: if (n[607]++ > 0) check ('a string 607'); break; + case 608: if (n[608]++ > 0) check ('a string 608'); break; + case 609: if (n[609]++ > 0) check ('a string 609'); break; + case 610: if (n[610]++ > 0) check ('a string 610'); break; + case 611: if (n[611]++ > 0) check ('a string 611'); break; + case 612: if (n[612]++ > 0) check ('a string 612'); break; + case 613: if (n[613]++ > 0) check ('a string 613'); break; + case 614: if (n[614]++ > 0) check ('a string 614'); break; + case 615: if (n[615]++ > 0) check ('a string 615'); break; + case 616: if (n[616]++ > 0) check ('a string 616'); break; + case 617: if (n[617]++ > 0) check ('a string 617'); break; + case 618: if (n[618]++ > 0) check ('a string 618'); break; + case 619: if (n[619]++ > 0) check ('a string 619'); break; + case 620: if (n[620]++ > 0) check ('a string 620'); break; + case 621: if (n[621]++ > 0) check ('a string 621'); break; + case 622: if (n[622]++ > 0) check ('a string 622'); break; + case 623: if (n[623]++ > 0) check ('a string 623'); break; + case 624: if (n[624]++ > 0) check ('a string 624'); break; + case 625: if (n[625]++ > 0) check ('a string 625'); break; + case 626: if (n[626]++ > 0) check ('a string 626'); break; + case 627: if (n[627]++ > 0) check ('a string 627'); break; + case 628: if (n[628]++ > 0) check ('a string 628'); break; + case 629: if (n[629]++ > 0) check ('a string 629'); break; + case 630: if (n[630]++ > 0) check ('a string 630'); break; + case 631: if (n[631]++ > 0) check ('a string 631'); break; + case 632: if (n[632]++ > 0) check ('a string 632'); break; + case 633: if (n[633]++ > 0) check ('a string 633'); break; + case 634: if (n[634]++ > 0) check ('a string 634'); break; + case 635: if (n[635]++ > 0) check ('a string 635'); break; + case 636: if (n[636]++ > 0) check ('a string 636'); break; + case 637: if (n[637]++ > 0) check ('a string 637'); break; + case 638: if (n[638]++ > 0) check ('a string 638'); break; + case 639: if (n[639]++ > 0) check ('a string 639'); break; + case 640: if (n[640]++ > 0) check ('a string 640'); break; + case 641: if (n[641]++ > 0) check ('a string 641'); break; + case 642: if (n[642]++ > 0) check ('a string 642'); break; + case 643: if (n[643]++ > 0) check ('a string 643'); break; + case 644: if (n[644]++ > 0) check ('a string 644'); break; + case 645: if (n[645]++ > 0) check ('a string 645'); break; + case 646: if (n[646]++ > 0) check ('a string 646'); break; + case 647: if (n[647]++ > 0) check ('a string 647'); break; + case 648: if (n[648]++ > 0) check ('a string 648'); break; + case 649: if (n[649]++ > 0) check ('a string 649'); break; + case 650: if (n[650]++ > 0) check ('a string 650'); break; + case 651: if (n[651]++ > 0) check ('a string 651'); break; + case 652: if (n[652]++ > 0) check ('a string 652'); break; + case 653: if (n[653]++ > 0) check ('a string 653'); break; + case 654: if (n[654]++ > 0) check ('a string 654'); break; + case 655: if (n[655]++ > 0) check ('a string 655'); break; + case 656: if (n[656]++ > 0) check ('a string 656'); break; + case 657: if (n[657]++ > 0) check ('a string 657'); break; + case 658: if (n[658]++ > 0) check ('a string 658'); break; + case 659: if (n[659]++ > 0) check ('a string 659'); break; + case 660: if (n[660]++ > 0) check ('a string 660'); break; + case 661: if (n[661]++ > 0) check ('a string 661'); break; + case 662: if (n[662]++ > 0) check ('a string 662'); break; + case 663: if (n[663]++ > 0) check ('a string 663'); break; + case 664: if (n[664]++ > 0) check ('a string 664'); break; + case 665: if (n[665]++ > 0) check ('a string 665'); break; + case 666: if (n[666]++ > 0) check ('a string 666'); break; + case 667: if (n[667]++ > 0) check ('a string 667'); break; + case 668: if (n[668]++ > 0) check ('a string 668'); break; + case 669: if (n[669]++ > 0) check ('a string 669'); break; + case 670: if (n[670]++ > 0) check ('a string 670'); break; + case 671: if (n[671]++ > 0) check ('a string 671'); break; + case 672: if (n[672]++ > 0) check ('a string 672'); break; + case 673: if (n[673]++ > 0) check ('a string 673'); break; + case 674: if (n[674]++ > 0) check ('a string 674'); break; + case 675: if (n[675]++ > 0) check ('a string 675'); break; + case 676: if (n[676]++ > 0) check ('a string 676'); break; + case 677: if (n[677]++ > 0) check ('a string 677'); break; + case 678: if (n[678]++ > 0) check ('a string 678'); break; + case 679: if (n[679]++ > 0) check ('a string 679'); break; + case 680: if (n[680]++ > 0) check ('a string 680'); break; + case 681: if (n[681]++ > 0) check ('a string 681'); break; + case 682: if (n[682]++ > 0) check ('a string 682'); break; + case 683: if (n[683]++ > 0) check ('a string 683'); break; + case 684: if (n[684]++ > 0) check ('a string 684'); break; + case 685: if (n[685]++ > 0) check ('a string 685'); break; + case 686: if (n[686]++ > 0) check ('a string 686'); break; + case 687: if (n[687]++ > 0) check ('a string 687'); break; + case 688: if (n[688]++ > 0) check ('a string 688'); break; + case 689: if (n[689]++ > 0) check ('a string 689'); break; + case 690: if (n[690]++ > 0) check ('a string 690'); break; + case 691: if (n[691]++ > 0) check ('a string 691'); break; + case 692: if (n[692]++ > 0) check ('a string 692'); break; + case 693: if (n[693]++ > 0) check ('a string 693'); break; + case 694: if (n[694]++ > 0) check ('a string 694'); break; + case 695: if (n[695]++ > 0) check ('a string 695'); break; + case 696: if (n[696]++ > 0) check ('a string 696'); break; + case 697: if (n[697]++ > 0) check ('a string 697'); break; + case 698: if (n[698]++ > 0) check ('a string 698'); break; + case 699: if (n[699]++ > 0) check ('a string 699'); break; + case 700: if (n[700]++ > 0) check ('a string 700'); break; + case 701: if (n[701]++ > 0) check ('a string 701'); break; + case 702: if (n[702]++ > 0) check ('a string 702'); break; + case 703: if (n[703]++ > 0) check ('a string 703'); break; + case 704: if (n[704]++ > 0) check ('a string 704'); break; + case 705: if (n[705]++ > 0) check ('a string 705'); break; + case 706: if (n[706]++ > 0) check ('a string 706'); break; + case 707: if (n[707]++ > 0) check ('a string 707'); break; + case 708: if (n[708]++ > 0) check ('a string 708'); break; + case 709: if (n[709]++ > 0) check ('a string 709'); break; + case 710: if (n[710]++ > 0) check ('a string 710'); break; + case 711: if (n[711]++ > 0) check ('a string 711'); break; + case 712: if (n[712]++ > 0) check ('a string 712'); break; + case 713: if (n[713]++ > 0) check ('a string 713'); break; + case 714: if (n[714]++ > 0) check ('a string 714'); break; + case 715: if (n[715]++ > 0) check ('a string 715'); break; + case 716: if (n[716]++ > 0) check ('a string 716'); break; + case 717: if (n[717]++ > 0) check ('a string 717'); break; + case 718: if (n[718]++ > 0) check ('a string 718'); break; + case 719: if (n[719]++ > 0) check ('a string 719'); break; + case 720: if (n[720]++ > 0) check ('a string 720'); break; + case 721: if (n[721]++ > 0) check ('a string 721'); break; + case 722: if (n[722]++ > 0) check ('a string 722'); break; + case 723: if (n[723]++ > 0) check ('a string 723'); break; + case 724: if (n[724]++ > 0) check ('a string 724'); break; + case 725: if (n[725]++ > 0) check ('a string 725'); break; + case 726: if (n[726]++ > 0) check ('a string 726'); break; + case 727: if (n[727]++ > 0) check ('a string 727'); break; + case 728: if (n[728]++ > 0) check ('a string 728'); break; + case 729: if (n[729]++ > 0) check ('a string 729'); break; + case 730: if (n[730]++ > 0) check ('a string 730'); break; + case 731: if (n[731]++ > 0) check ('a string 731'); break; + case 732: if (n[732]++ > 0) check ('a string 732'); break; + case 733: if (n[733]++ > 0) check ('a string 733'); break; + case 734: if (n[734]++ > 0) check ('a string 734'); break; + case 735: if (n[735]++ > 0) check ('a string 735'); break; + case 736: if (n[736]++ > 0) check ('a string 736'); break; + case 737: if (n[737]++ > 0) check ('a string 737'); break; + case 738: if (n[738]++ > 0) check ('a string 738'); break; + case 739: if (n[739]++ > 0) check ('a string 739'); break; + case 740: if (n[740]++ > 0) check ('a string 740'); break; + case 741: if (n[741]++ > 0) check ('a string 741'); break; + case 742: if (n[742]++ > 0) check ('a string 742'); break; + case 743: if (n[743]++ > 0) check ('a string 743'); break; + case 744: if (n[744]++ > 0) check ('a string 744'); break; + case 745: if (n[745]++ > 0) check ('a string 745'); break; + case 746: if (n[746]++ > 0) check ('a string 746'); break; + case 747: if (n[747]++ > 0) check ('a string 747'); break; + case 748: if (n[748]++ > 0) check ('a string 748'); break; + case 749: if (n[749]++ > 0) check ('a string 749'); break; + case 750: if (n[750]++ > 0) check ('a string 750'); break; + case 751: if (n[751]++ > 0) check ('a string 751'); break; + case 752: if (n[752]++ > 0) check ('a string 752'); break; + case 753: if (n[753]++ > 0) check ('a string 753'); break; + case 754: if (n[754]++ > 0) check ('a string 754'); break; + case 755: if (n[755]++ > 0) check ('a string 755'); break; + case 756: if (n[756]++ > 0) check ('a string 756'); break; + case 757: if (n[757]++ > 0) check ('a string 757'); break; + case 758: if (n[758]++ > 0) check ('a string 758'); break; + case 759: if (n[759]++ > 0) check ('a string 759'); break; + case 760: if (n[760]++ > 0) check ('a string 760'); break; + case 761: if (n[761]++ > 0) check ('a string 761'); break; + case 762: if (n[762]++ > 0) check ('a string 762'); break; + case 763: if (n[763]++ > 0) check ('a string 763'); break; + case 764: if (n[764]++ > 0) check ('a string 764'); break; + case 765: if (n[765]++ > 0) check ('a string 765'); break; + case 766: if (n[766]++ > 0) check ('a string 766'); break; + case 767: if (n[767]++ > 0) check ('a string 767'); break; + case 768: if (n[768]++ > 0) check ('a string 768'); break; + case 769: if (n[769]++ > 0) check ('a string 769'); break; + case 770: if (n[770]++ > 0) check ('a string 770'); break; + case 771: if (n[771]++ > 0) check ('a string 771'); break; + case 772: if (n[772]++ > 0) check ('a string 772'); break; + case 773: if (n[773]++ > 0) check ('a string 773'); break; + case 774: if (n[774]++ > 0) check ('a string 774'); break; + case 775: if (n[775]++ > 0) check ('a string 775'); break; + case 776: if (n[776]++ > 0) check ('a string 776'); break; + case 777: if (n[777]++ > 0) check ('a string 777'); break; + case 778: if (n[778]++ > 0) check ('a string 778'); break; + case 779: if (n[779]++ > 0) check ('a string 779'); break; + case 780: if (n[780]++ > 0) check ('a string 780'); break; + case 781: if (n[781]++ > 0) check ('a string 781'); break; + case 782: if (n[782]++ > 0) check ('a string 782'); break; + case 783: if (n[783]++ > 0) check ('a string 783'); break; + case 784: if (n[784]++ > 0) check ('a string 784'); break; + case 785: if (n[785]++ > 0) check ('a string 785'); break; + case 786: if (n[786]++ > 0) check ('a string 786'); break; + case 787: if (n[787]++ > 0) check ('a string 787'); break; + case 788: if (n[788]++ > 0) check ('a string 788'); break; + case 789: if (n[789]++ > 0) check ('a string 789'); break; + case 790: if (n[790]++ > 0) check ('a string 790'); break; + case 791: if (n[791]++ > 0) check ('a string 791'); break; + case 792: if (n[792]++ > 0) check ('a string 792'); break; + case 793: if (n[793]++ > 0) check ('a string 793'); break; + case 794: if (n[794]++ > 0) check ('a string 794'); break; + case 795: if (n[795]++ > 0) check ('a string 795'); break; + case 796: if (n[796]++ > 0) check ('a string 796'); break; + case 797: if (n[797]++ > 0) check ('a string 797'); break; + case 798: if (n[798]++ > 0) check ('a string 798'); break; + case 799: if (n[799]++ > 0) check ('a string 799'); break; + case 800: if (n[800]++ > 0) check ('a string 800'); break; + case 801: if (n[801]++ > 0) check ('a string 801'); break; + case 802: if (n[802]++ > 0) check ('a string 802'); break; + case 803: if (n[803]++ > 0) check ('a string 803'); break; + case 804: if (n[804]++ > 0) check ('a string 804'); break; + case 805: if (n[805]++ > 0) check ('a string 805'); break; + case 806: if (n[806]++ > 0) check ('a string 806'); break; + case 807: if (n[807]++ > 0) check ('a string 807'); break; + case 808: if (n[808]++ > 0) check ('a string 808'); break; + case 809: if (n[809]++ > 0) check ('a string 809'); break; + case 810: if (n[810]++ > 0) check ('a string 810'); break; + case 811: if (n[811]++ > 0) check ('a string 811'); break; + case 812: if (n[812]++ > 0) check ('a string 812'); break; + case 813: if (n[813]++ > 0) check ('a string 813'); break; + case 814: if (n[814]++ > 0) check ('a string 814'); break; + case 815: if (n[815]++ > 0) check ('a string 815'); break; + case 816: if (n[816]++ > 0) check ('a string 816'); break; + case 817: if (n[817]++ > 0) check ('a string 817'); break; + case 818: if (n[818]++ > 0) check ('a string 818'); break; + case 819: if (n[819]++ > 0) check ('a string 819'); break; + case 820: if (n[820]++ > 0) check ('a string 820'); break; + case 821: if (n[821]++ > 0) check ('a string 821'); break; + case 822: if (n[822]++ > 0) check ('a string 822'); break; + case 823: if (n[823]++ > 0) check ('a string 823'); break; + case 824: if (n[824]++ > 0) check ('a string 824'); break; + case 825: if (n[825]++ > 0) check ('a string 825'); break; + case 826: if (n[826]++ > 0) check ('a string 826'); break; + case 827: if (n[827]++ > 0) check ('a string 827'); break; + case 828: if (n[828]++ > 0) check ('a string 828'); break; + case 829: if (n[829]++ > 0) check ('a string 829'); break; + case 830: if (n[830]++ > 0) check ('a string 830'); break; + case 831: if (n[831]++ > 0) check ('a string 831'); break; + case 832: if (n[832]++ > 0) check ('a string 832'); break; + case 833: if (n[833]++ > 0) check ('a string 833'); break; + case 834: if (n[834]++ > 0) check ('a string 834'); break; + case 835: if (n[835]++ > 0) check ('a string 835'); break; + case 836: if (n[836]++ > 0) check ('a string 836'); break; + case 837: if (n[837]++ > 0) check ('a string 837'); break; + case 838: if (n[838]++ > 0) check ('a string 838'); break; + case 839: if (n[839]++ > 0) check ('a string 839'); break; + case 840: if (n[840]++ > 0) check ('a string 840'); break; + case 841: if (n[841]++ > 0) check ('a string 841'); break; + case 842: if (n[842]++ > 0) check ('a string 842'); break; + case 843: if (n[843]++ > 0) check ('a string 843'); break; + case 844: if (n[844]++ > 0) check ('a string 844'); break; + case 845: if (n[845]++ > 0) check ('a string 845'); break; + case 846: if (n[846]++ > 0) check ('a string 846'); break; + case 847: if (n[847]++ > 0) check ('a string 847'); break; + case 848: if (n[848]++ > 0) check ('a string 848'); break; + case 849: if (n[849]++ > 0) check ('a string 849'); break; + case 850: if (n[850]++ > 0) check ('a string 850'); break; + case 851: if (n[851]++ > 0) check ('a string 851'); break; + case 852: if (n[852]++ > 0) check ('a string 852'); break; + case 853: if (n[853]++ > 0) check ('a string 853'); break; + case 854: if (n[854]++ > 0) check ('a string 854'); break; + case 855: if (n[855]++ > 0) check ('a string 855'); break; + case 856: if (n[856]++ > 0) check ('a string 856'); break; + case 857: if (n[857]++ > 0) check ('a string 857'); break; + case 858: if (n[858]++ > 0) check ('a string 858'); break; + case 859: if (n[859]++ > 0) check ('a string 859'); break; + case 860: if (n[860]++ > 0) check ('a string 860'); break; + case 861: if (n[861]++ > 0) check ('a string 861'); break; + case 862: if (n[862]++ > 0) check ('a string 862'); break; + case 863: if (n[863]++ > 0) check ('a string 863'); break; + case 864: if (n[864]++ > 0) check ('a string 864'); break; + case 865: if (n[865]++ > 0) check ('a string 865'); break; + case 866: if (n[866]++ > 0) check ('a string 866'); break; + case 867: if (n[867]++ > 0) check ('a string 867'); break; + case 868: if (n[868]++ > 0) check ('a string 868'); break; + case 869: if (n[869]++ > 0) check ('a string 869'); break; + case 870: if (n[870]++ > 0) check ('a string 870'); break; + case 871: if (n[871]++ > 0) check ('a string 871'); break; + case 872: if (n[872]++ > 0) check ('a string 872'); break; + case 873: if (n[873]++ > 0) check ('a string 873'); break; + case 874: if (n[874]++ > 0) check ('a string 874'); break; + case 875: if (n[875]++ > 0) check ('a string 875'); break; + case 876: if (n[876]++ > 0) check ('a string 876'); break; + case 877: if (n[877]++ > 0) check ('a string 877'); break; + case 878: if (n[878]++ > 0) check ('a string 878'); break; + case 879: if (n[879]++ > 0) check ('a string 879'); break; + case 880: if (n[880]++ > 0) check ('a string 880'); break; + case 881: if (n[881]++ > 0) check ('a string 881'); break; + case 882: if (n[882]++ > 0) check ('a string 882'); break; + case 883: if (n[883]++ > 0) check ('a string 883'); break; + case 884: if (n[884]++ > 0) check ('a string 884'); break; + case 885: if (n[885]++ > 0) check ('a string 885'); break; + case 886: if (n[886]++ > 0) check ('a string 886'); break; + case 887: if (n[887]++ > 0) check ('a string 887'); break; + case 888: if (n[888]++ > 0) check ('a string 888'); break; + case 889: if (n[889]++ > 0) check ('a string 889'); break; + case 890: if (n[890]++ > 0) check ('a string 890'); break; + case 891: if (n[891]++ > 0) check ('a string 891'); break; + case 892: if (n[892]++ > 0) check ('a string 892'); break; + case 893: if (n[893]++ > 0) check ('a string 893'); break; + case 894: if (n[894]++ > 0) check ('a string 894'); break; + case 895: if (n[895]++ > 0) check ('a string 895'); break; + case 896: if (n[896]++ > 0) check ('a string 896'); break; + case 897: if (n[897]++ > 0) check ('a string 897'); break; + case 898: if (n[898]++ > 0) check ('a string 898'); break; + case 899: if (n[899]++ > 0) check ('a string 899'); break; + case 900: if (n[900]++ > 0) check ('a string 900'); break; + case 901: if (n[901]++ > 0) check ('a string 901'); break; + case 902: if (n[902]++ > 0) check ('a string 902'); break; + case 903: if (n[903]++ > 0) check ('a string 903'); break; + case 904: if (n[904]++ > 0) check ('a string 904'); break; + case 905: if (n[905]++ > 0) check ('a string 905'); break; + case 906: if (n[906]++ > 0) check ('a string 906'); break; + case 907: if (n[907]++ > 0) check ('a string 907'); break; + case 908: if (n[908]++ > 0) check ('a string 908'); break; + case 909: if (n[909]++ > 0) check ('a string 909'); break; + case 910: if (n[910]++ > 0) check ('a string 910'); break; + case 911: if (n[911]++ > 0) check ('a string 911'); break; + case 912: if (n[912]++ > 0) check ('a string 912'); break; + case 913: if (n[913]++ > 0) check ('a string 913'); break; + case 914: if (n[914]++ > 0) check ('a string 914'); break; + case 915: if (n[915]++ > 0) check ('a string 915'); break; + case 916: if (n[916]++ > 0) check ('a string 916'); break; + case 917: if (n[917]++ > 0) check ('a string 917'); break; + case 918: if (n[918]++ > 0) check ('a string 918'); break; + case 919: if (n[919]++ > 0) check ('a string 919'); break; + case 920: if (n[920]++ > 0) check ('a string 920'); break; + case 921: if (n[921]++ > 0) check ('a string 921'); break; + case 922: if (n[922]++ > 0) check ('a string 922'); break; + case 923: if (n[923]++ > 0) check ('a string 923'); break; + case 924: if (n[924]++ > 0) check ('a string 924'); break; + case 925: if (n[925]++ > 0) check ('a string 925'); break; + case 926: if (n[926]++ > 0) check ('a string 926'); break; + case 927: if (n[927]++ > 0) check ('a string 927'); break; + case 928: if (n[928]++ > 0) check ('a string 928'); break; + case 929: if (n[929]++ > 0) check ('a string 929'); break; + case 930: if (n[930]++ > 0) check ('a string 930'); break; + case 931: if (n[931]++ > 0) check ('a string 931'); break; + case 932: if (n[932]++ > 0) check ('a string 932'); break; + case 933: if (n[933]++ > 0) check ('a string 933'); break; + case 934: if (n[934]++ > 0) check ('a string 934'); break; + case 935: if (n[935]++ > 0) check ('a string 935'); break; + case 936: if (n[936]++ > 0) check ('a string 936'); break; + case 937: if (n[937]++ > 0) check ('a string 937'); break; + case 938: if (n[938]++ > 0) check ('a string 938'); break; + case 939: if (n[939]++ > 0) check ('a string 939'); break; + case 940: if (n[940]++ > 0) check ('a string 940'); break; + case 941: if (n[941]++ > 0) check ('a string 941'); break; + case 942: if (n[942]++ > 0) check ('a string 942'); break; + case 943: if (n[943]++ > 0) check ('a string 943'); break; + case 944: if (n[944]++ > 0) check ('a string 944'); break; + case 945: if (n[945]++ > 0) check ('a string 945'); break; + case 946: if (n[946]++ > 0) check ('a string 946'); break; + case 947: if (n[947]++ > 0) check ('a string 947'); break; + case 948: if (n[948]++ > 0) check ('a string 948'); break; + case 949: if (n[949]++ > 0) check ('a string 949'); break; + case 950: if (n[950]++ > 0) check ('a string 950'); break; + case 951: if (n[951]++ > 0) check ('a string 951'); break; + case 952: if (n[952]++ > 0) check ('a string 952'); break; + case 953: if (n[953]++ > 0) check ('a string 953'); break; + case 954: if (n[954]++ > 0) check ('a string 954'); break; + case 955: if (n[955]++ > 0) check ('a string 955'); break; + case 956: if (n[956]++ > 0) check ('a string 956'); break; + case 957: if (n[957]++ > 0) check ('a string 957'); break; + case 958: if (n[958]++ > 0) check ('a string 958'); break; + case 959: if (n[959]++ > 0) check ('a string 959'); break; + case 960: if (n[960]++ > 0) check ('a string 960'); break; + case 961: if (n[961]++ > 0) check ('a string 961'); break; + case 962: if (n[962]++ > 0) check ('a string 962'); break; + case 963: if (n[963]++ > 0) check ('a string 963'); break; + case 964: if (n[964]++ > 0) check ('a string 964'); break; + case 965: if (n[965]++ > 0) check ('a string 965'); break; + case 966: if (n[966]++ > 0) check ('a string 966'); break; + case 967: if (n[967]++ > 0) check ('a string 967'); break; + case 968: if (n[968]++ > 0) check ('a string 968'); break; + case 969: if (n[969]++ > 0) check ('a string 969'); break; + case 970: if (n[970]++ > 0) check ('a string 970'); break; + case 971: if (n[971]++ > 0) check ('a string 971'); break; + case 972: if (n[972]++ > 0) check ('a string 972'); break; + case 973: if (n[973]++ > 0) check ('a string 973'); break; + case 974: if (n[974]++ > 0) check ('a string 974'); break; + case 975: if (n[975]++ > 0) check ('a string 975'); break; + case 976: if (n[976]++ > 0) check ('a string 976'); break; + case 977: if (n[977]++ > 0) check ('a string 977'); break; + case 978: if (n[978]++ > 0) check ('a string 978'); break; + case 979: if (n[979]++ > 0) check ('a string 979'); break; + case 980: if (n[980]++ > 0) check ('a string 980'); break; + case 981: if (n[981]++ > 0) check ('a string 981'); break; + case 982: if (n[982]++ > 0) check ('a string 982'); break; + case 983: if (n[983]++ > 0) check ('a string 983'); break; + case 984: if (n[984]++ > 0) check ('a string 984'); break; + case 985: if (n[985]++ > 0) check ('a string 985'); break; + case 986: if (n[986]++ > 0) check ('a string 986'); break; + case 987: if (n[987]++ > 0) check ('a string 987'); break; + case 988: if (n[988]++ > 0) check ('a string 988'); break; + case 989: if (n[989]++ > 0) check ('a string 989'); break; + case 990: if (n[990]++ > 0) check ('a string 990'); break; + case 991: if (n[991]++ > 0) check ('a string 991'); break; + case 992: if (n[992]++ > 0) check ('a string 992'); break; + case 993: if (n[993]++ > 0) check ('a string 993'); break; + case 994: if (n[994]++ > 0) check ('a string 994'); break; + case 995: if (n[995]++ > 0) check ('a string 995'); break; + case 996: if (n[996]++ > 0) check ('a string 996'); break; + case 997: if (n[997]++ > 0) check ('a string 997'); break; + case 998: if (n[998]++ > 0) check ('a string 998'); break; + case 999: if (n[999]++ > 0) check ('a string 999'); break; + case 1000: if (n[1000]++ > 0) check ('a string 1000'); break; + case 1001: if (n[1001]++ > 0) check ('a string 1001'); break; + case 1002: if (n[1002]++ > 0) check ('a string 1002'); break; + case 1003: if (n[1003]++ > 0) check ('a string 1003'); break; + case 1004: if (n[1004]++ > 0) check ('a string 1004'); break; + case 1005: if (n[1005]++ > 0) check ('a string 1005'); break; + case 1006: if (n[1006]++ > 0) check ('a string 1006'); break; + case 1007: if (n[1007]++ > 0) check ('a string 1007'); break; + case 1008: if (n[1008]++ > 0) check ('a string 1008'); break; + case 1009: if (n[1009]++ > 0) check ('a string 1009'); break; + case 1010: if (n[1010]++ > 0) check ('a string 1010'); break; + case 1011: if (n[1011]++ > 0) check ('a string 1011'); break; + case 1012: if (n[1012]++ > 0) check ('a string 1012'); break; + case 1013: if (n[1013]++ > 0) check ('a string 1013'); break; + case 1014: if (n[1014]++ > 0) check ('a string 1014'); break; + case 1015: if (n[1015]++ > 0) check ('a string 1015'); break; + case 1016: if (n[1016]++ > 0) check ('a string 1016'); break; + case 1017: if (n[1017]++ > 0) check ('a string 1017'); break; + case 1018: if (n[1018]++ > 0) check ('a string 1018'); break; + case 1019: if (n[1019]++ > 0) check ('a string 1019'); break; + case 1020: if (n[1020]++ > 0) check ('a string 1020'); break; + case 1021: if (n[1021]++ > 0) check ('a string 1021'); break; + case 1022: if (n[1022]++ > 0) check ('a string 1022'); break; + case 1023: if (n[1023]++ > 0) check ('a string 1023'); break; + case 1024: if (n[1024]++ > 0) check ('a string 1024'); break; + case 1025: if (n[1025]++ > 0) check ('a string 1025'); break; + case 1026: if (n[1026]++ > 0) check ('a string 1026'); break; + case 1027: if (n[1027]++ > 0) check ('a string 1027'); break; + case 1028: if (n[1028]++ > 0) check ('a string 1028'); break; + case 1029: if (n[1029]++ > 0) check ('a string 1029'); break; + case 1030: if (n[1030]++ > 0) check ('a string 1030'); break; + case 1031: if (n[1031]++ > 0) check ('a string 1031'); break; + case 1032: if (n[1032]++ > 0) check ('a string 1032'); break; + case 1033: if (n[1033]++ > 0) check ('a string 1033'); break; + case 1034: if (n[1034]++ > 0) check ('a string 1034'); break; + case 1035: if (n[1035]++ > 0) check ('a string 1035'); break; + case 1036: if (n[1036]++ > 0) check ('a string 1036'); break; + case 1037: if (n[1037]++ > 0) check ('a string 1037'); break; + case 1038: if (n[1038]++ > 0) check ('a string 1038'); break; + case 1039: if (n[1039]++ > 0) check ('a string 1039'); break; + case 1040: if (n[1040]++ > 0) check ('a string 1040'); break; + case 1041: if (n[1041]++ > 0) check ('a string 1041'); break; + case 1042: if (n[1042]++ > 0) check ('a string 1042'); break; + case 1043: if (n[1043]++ > 0) check ('a string 1043'); break; + case 1044: if (n[1044]++ > 0) check ('a string 1044'); break; + case 1045: if (n[1045]++ > 0) check ('a string 1045'); break; + case 1046: if (n[1046]++ > 0) check ('a string 1046'); break; + case 1047: if (n[1047]++ > 0) check ('a string 1047'); break; + case 1048: if (n[1048]++ > 0) check ('a string 1048'); break; + case 1049: if (n[1049]++ > 0) check ('a string 1049'); break; + case 1050: if (n[1050]++ > 0) check ('a string 1050'); break; + case 1051: if (n[1051]++ > 0) check ('a string 1051'); break; + case 1052: if (n[1052]++ > 0) check ('a string 1052'); break; + case 1053: if (n[1053]++ > 0) check ('a string 1053'); break; + case 1054: if (n[1054]++ > 0) check ('a string 1054'); break; + case 1055: if (n[1055]++ > 0) check ('a string 1055'); break; + case 1056: if (n[1056]++ > 0) check ('a string 1056'); break; + case 1057: if (n[1057]++ > 0) check ('a string 1057'); break; + case 1058: if (n[1058]++ > 0) check ('a string 1058'); break; + case 1059: if (n[1059]++ > 0) check ('a string 1059'); break; + case 1060: if (n[1060]++ > 0) check ('a string 1060'); break; + case 1061: if (n[1061]++ > 0) check ('a string 1061'); break; + case 1062: if (n[1062]++ > 0) check ('a string 1062'); break; + case 1063: if (n[1063]++ > 0) check ('a string 1063'); break; + case 1064: if (n[1064]++ > 0) check ('a string 1064'); break; + case 1065: if (n[1065]++ > 0) check ('a string 1065'); break; + case 1066: if (n[1066]++ > 0) check ('a string 1066'); break; + case 1067: if (n[1067]++ > 0) check ('a string 1067'); break; + case 1068: if (n[1068]++ > 0) check ('a string 1068'); break; + case 1069: if (n[1069]++ > 0) check ('a string 1069'); break; + case 1070: if (n[1070]++ > 0) check ('a string 1070'); break; + case 1071: if (n[1071]++ > 0) check ('a string 1071'); break; + case 1072: if (n[1072]++ > 0) check ('a string 1072'); break; + case 1073: if (n[1073]++ > 0) check ('a string 1073'); break; + case 1074: if (n[1074]++ > 0) check ('a string 1074'); break; + case 1075: if (n[1075]++ > 0) check ('a string 1075'); break; + case 1076: if (n[1076]++ > 0) check ('a string 1076'); break; + case 1077: if (n[1077]++ > 0) check ('a string 1077'); break; + case 1078: if (n[1078]++ > 0) check ('a string 1078'); break; + case 1079: if (n[1079]++ > 0) check ('a string 1079'); break; + case 1080: if (n[1080]++ > 0) check ('a string 1080'); break; + case 1081: if (n[1081]++ > 0) check ('a string 1081'); break; + case 1082: if (n[1082]++ > 0) check ('a string 1082'); break; + case 1083: if (n[1083]++ > 0) check ('a string 1083'); break; + case 1084: if (n[1084]++ > 0) check ('a string 1084'); break; + case 1085: if (n[1085]++ > 0) check ('a string 1085'); break; + case 1086: if (n[1086]++ > 0) check ('a string 1086'); break; + case 1087: if (n[1087]++ > 0) check ('a string 1087'); break; + case 1088: if (n[1088]++ > 0) check ('a string 1088'); break; + case 1089: if (n[1089]++ > 0) check ('a string 1089'); break; + case 1090: if (n[1090]++ > 0) check ('a string 1090'); break; + case 1091: if (n[1091]++ > 0) check ('a string 1091'); break; + case 1092: if (n[1092]++ > 0) check ('a string 1092'); break; + case 1093: if (n[1093]++ > 0) check ('a string 1093'); break; + case 1094: if (n[1094]++ > 0) check ('a string 1094'); break; + case 1095: if (n[1095]++ > 0) check ('a string 1095'); break; + case 1096: if (n[1096]++ > 0) check ('a string 1096'); break; + case 1097: if (n[1097]++ > 0) check ('a string 1097'); break; + case 1098: if (n[1098]++ > 0) check ('a string 1098'); break; + case 1099: if (n[1099]++ > 0) check ('a string 1099'); break; + case 1100: if (n[1100]++ > 0) check ('a string 1100'); break; + case 1101: if (n[1101]++ > 0) check ('a string 1101'); break; + case 1102: if (n[1102]++ > 0) check ('a string 1102'); break; + case 1103: if (n[1103]++ > 0) check ('a string 1103'); break; + case 1104: if (n[1104]++ > 0) check ('a string 1104'); break; + case 1105: if (n[1105]++ > 0) check ('a string 1105'); break; + case 1106: if (n[1106]++ > 0) check ('a string 1106'); break; + case 1107: if (n[1107]++ > 0) check ('a string 1107'); break; + case 1108: if (n[1108]++ > 0) check ('a string 1108'); break; + case 1109: if (n[1109]++ > 0) check ('a string 1109'); break; + case 1110: if (n[1110]++ > 0) check ('a string 1110'); break; + case 1111: if (n[1111]++ > 0) check ('a string 1111'); break; + case 1112: if (n[1112]++ > 0) check ('a string 1112'); break; + case 1113: if (n[1113]++ > 0) check ('a string 1113'); break; + case 1114: if (n[1114]++ > 0) check ('a string 1114'); break; + case 1115: if (n[1115]++ > 0) check ('a string 1115'); break; + case 1116: if (n[1116]++ > 0) check ('a string 1116'); break; + case 1117: if (n[1117]++ > 0) check ('a string 1117'); break; + case 1118: if (n[1118]++ > 0) check ('a string 1118'); break; + case 1119: if (n[1119]++ > 0) check ('a string 1119'); break; + case 1120: if (n[1120]++ > 0) check ('a string 1120'); break; + case 1121: if (n[1121]++ > 0) check ('a string 1121'); break; + case 1122: if (n[1122]++ > 0) check ('a string 1122'); break; + case 1123: if (n[1123]++ > 0) check ('a string 1123'); break; + case 1124: if (n[1124]++ > 0) check ('a string 1124'); break; + case 1125: if (n[1125]++ > 0) check ('a string 1125'); break; + case 1126: if (n[1126]++ > 0) check ('a string 1126'); break; + case 1127: if (n[1127]++ > 0) check ('a string 1127'); break; + case 1128: if (n[1128]++ > 0) check ('a string 1128'); break; + case 1129: if (n[1129]++ > 0) check ('a string 1129'); break; + case 1130: if (n[1130]++ > 0) check ('a string 1130'); break; + case 1131: if (n[1131]++ > 0) check ('a string 1131'); break; + case 1132: if (n[1132]++ > 0) check ('a string 1132'); break; + case 1133: if (n[1133]++ > 0) check ('a string 1133'); break; + case 1134: if (n[1134]++ > 0) check ('a string 1134'); break; + case 1135: if (n[1135]++ > 0) check ('a string 1135'); break; + case 1136: if (n[1136]++ > 0) check ('a string 1136'); break; + case 1137: if (n[1137]++ > 0) check ('a string 1137'); break; + case 1138: if (n[1138]++ > 0) check ('a string 1138'); break; + case 1139: if (n[1139]++ > 0) check ('a string 1139'); break; + case 1140: if (n[1140]++ > 0) check ('a string 1140'); break; + case 1141: if (n[1141]++ > 0) check ('a string 1141'); break; + case 1142: if (n[1142]++ > 0) check ('a string 1142'); break; + case 1143: if (n[1143]++ > 0) check ('a string 1143'); break; + case 1144: if (n[1144]++ > 0) check ('a string 1144'); break; + case 1145: if (n[1145]++ > 0) check ('a string 1145'); break; + case 1146: if (n[1146]++ > 0) check ('a string 1146'); break; + case 1147: if (n[1147]++ > 0) check ('a string 1147'); break; + case 1148: if (n[1148]++ > 0) check ('a string 1148'); break; + case 1149: if (n[1149]++ > 0) check ('a string 1149'); break; + case 1150: if (n[1150]++ > 0) check ('a string 1150'); break; + case 1151: if (n[1151]++ > 0) check ('a string 1151'); break; + case 1152: if (n[1152]++ > 0) check ('a string 1152'); break; + case 1153: if (n[1153]++ > 0) check ('a string 1153'); break; + case 1154: if (n[1154]++ > 0) check ('a string 1154'); break; + case 1155: if (n[1155]++ > 0) check ('a string 1155'); break; + case 1156: if (n[1156]++ > 0) check ('a string 1156'); break; + case 1157: if (n[1157]++ > 0) check ('a string 1157'); break; + case 1158: if (n[1158]++ > 0) check ('a string 1158'); break; + case 1159: if (n[1159]++ > 0) check ('a string 1159'); break; + case 1160: if (n[1160]++ > 0) check ('a string 1160'); break; + case 1161: if (n[1161]++ > 0) check ('a string 1161'); break; + case 1162: if (n[1162]++ > 0) check ('a string 1162'); break; + case 1163: if (n[1163]++ > 0) check ('a string 1163'); break; + case 1164: if (n[1164]++ > 0) check ('a string 1164'); break; + case 1165: if (n[1165]++ > 0) check ('a string 1165'); break; + case 1166: if (n[1166]++ > 0) check ('a string 1166'); break; + case 1167: if (n[1167]++ > 0) check ('a string 1167'); break; + case 1168: if (n[1168]++ > 0) check ('a string 1168'); break; + case 1169: if (n[1169]++ > 0) check ('a string 1169'); break; + case 1170: if (n[1170]++ > 0) check ('a string 1170'); break; + case 1171: if (n[1171]++ > 0) check ('a string 1171'); break; + case 1172: if (n[1172]++ > 0) check ('a string 1172'); break; + case 1173: if (n[1173]++ > 0) check ('a string 1173'); break; + case 1174: if (n[1174]++ > 0) check ('a string 1174'); break; + case 1175: if (n[1175]++ > 0) check ('a string 1175'); break; + case 1176: if (n[1176]++ > 0) check ('a string 1176'); break; + case 1177: if (n[1177]++ > 0) check ('a string 1177'); break; + case 1178: if (n[1178]++ > 0) check ('a string 1178'); break; + case 1179: if (n[1179]++ > 0) check ('a string 1179'); break; + case 1180: if (n[1180]++ > 0) check ('a string 1180'); break; + case 1181: if (n[1181]++ > 0) check ('a string 1181'); break; + case 1182: if (n[1182]++ > 0) check ('a string 1182'); break; + case 1183: if (n[1183]++ > 0) check ('a string 1183'); break; + case 1184: if (n[1184]++ > 0) check ('a string 1184'); break; + case 1185: if (n[1185]++ > 0) check ('a string 1185'); break; + case 1186: if (n[1186]++ > 0) check ('a string 1186'); break; + case 1187: if (n[1187]++ > 0) check ('a string 1187'); break; + case 1188: if (n[1188]++ > 0) check ('a string 1188'); break; + case 1189: if (n[1189]++ > 0) check ('a string 1189'); break; + case 1190: if (n[1190]++ > 0) check ('a string 1190'); break; + case 1191: if (n[1191]++ > 0) check ('a string 1191'); break; + case 1192: if (n[1192]++ > 0) check ('a string 1192'); break; + case 1193: if (n[1193]++ > 0) check ('a string 1193'); break; + case 1194: if (n[1194]++ > 0) check ('a string 1194'); break; + case 1195: if (n[1195]++ > 0) check ('a string 1195'); break; + case 1196: if (n[1196]++ > 0) check ('a string 1196'); break; + case 1197: if (n[1197]++ > 0) check ('a string 1197'); break; + case 1198: if (n[1198]++ > 0) check ('a string 1198'); break; + case 1199: if (n[1199]++ > 0) check ('a string 1199'); break; + case 1200: if (n[1200]++ > 0) check ('a string 1200'); break; + case 1201: if (n[1201]++ > 0) check ('a string 1201'); break; + case 1202: if (n[1202]++ > 0) check ('a string 1202'); break; + case 1203: if (n[1203]++ > 0) check ('a string 1203'); break; + case 1204: if (n[1204]++ > 0) check ('a string 1204'); break; + case 1205: if (n[1205]++ > 0) check ('a string 1205'); break; + case 1206: if (n[1206]++ > 0) check ('a string 1206'); break; + case 1207: if (n[1207]++ > 0) check ('a string 1207'); break; + case 1208: if (n[1208]++ > 0) check ('a string 1208'); break; + case 1209: if (n[1209]++ > 0) check ('a string 1209'); break; + case 1210: if (n[1210]++ > 0) check ('a string 1210'); break; + case 1211: if (n[1211]++ > 0) check ('a string 1211'); break; + case 1212: if (n[1212]++ > 0) check ('a string 1212'); break; + case 1213: if (n[1213]++ > 0) check ('a string 1213'); break; + case 1214: if (n[1214]++ > 0) check ('a string 1214'); break; + case 1215: if (n[1215]++ > 0) check ('a string 1215'); break; + case 1216: if (n[1216]++ > 0) check ('a string 1216'); break; + case 1217: if (n[1217]++ > 0) check ('a string 1217'); break; + case 1218: if (n[1218]++ > 0) check ('a string 1218'); break; + case 1219: if (n[1219]++ > 0) check ('a string 1219'); break; + case 1220: if (n[1220]++ > 0) check ('a string 1220'); break; + case 1221: if (n[1221]++ > 0) check ('a string 1221'); break; + case 1222: if (n[1222]++ > 0) check ('a string 1222'); break; + case 1223: if (n[1223]++ > 0) check ('a string 1223'); break; + case 1224: if (n[1224]++ > 0) check ('a string 1224'); break; + case 1225: if (n[1225]++ > 0) check ('a string 1225'); break; + case 1226: if (n[1226]++ > 0) check ('a string 1226'); break; + case 1227: if (n[1227]++ > 0) check ('a string 1227'); break; + case 1228: if (n[1228]++ > 0) check ('a string 1228'); break; + case 1229: if (n[1229]++ > 0) check ('a string 1229'); break; + case 1230: if (n[1230]++ > 0) check ('a string 1230'); break; + case 1231: if (n[1231]++ > 0) check ('a string 1231'); break; + case 1232: if (n[1232]++ > 0) check ('a string 1232'); break; + case 1233: if (n[1233]++ > 0) check ('a string 1233'); break; + case 1234: if (n[1234]++ > 0) check ('a string 1234'); break; + case 1235: if (n[1235]++ > 0) check ('a string 1235'); break; + case 1236: if (n[1236]++ > 0) check ('a string 1236'); break; + case 1237: if (n[1237]++ > 0) check ('a string 1237'); break; + case 1238: if (n[1238]++ > 0) check ('a string 1238'); break; + case 1239: if (n[1239]++ > 0) check ('a string 1239'); break; + case 1240: if (n[1240]++ > 0) check ('a string 1240'); break; + case 1241: if (n[1241]++ > 0) check ('a string 1241'); break; + case 1242: if (n[1242]++ > 0) check ('a string 1242'); break; + case 1243: if (n[1243]++ > 0) check ('a string 1243'); break; + case 1244: if (n[1244]++ > 0) check ('a string 1244'); break; + case 1245: if (n[1245]++ > 0) check ('a string 1245'); break; + case 1246: if (n[1246]++ > 0) check ('a string 1246'); break; + case 1247: if (n[1247]++ > 0) check ('a string 1247'); break; + case 1248: if (n[1248]++ > 0) check ('a string 1248'); break; + case 1249: if (n[1249]++ > 0) check ('a string 1249'); break; + case 1250: if (n[1250]++ > 0) check ('a string 1250'); break; + case 1251: if (n[1251]++ > 0) check ('a string 1251'); break; + case 1252: if (n[1252]++ > 0) check ('a string 1252'); break; + case 1253: if (n[1253]++ > 0) check ('a string 1253'); break; + case 1254: if (n[1254]++ > 0) check ('a string 1254'); break; + case 1255: if (n[1255]++ > 0) check ('a string 1255'); break; + case 1256: if (n[1256]++ > 0) check ('a string 1256'); break; + case 1257: if (n[1257]++ > 0) check ('a string 1257'); break; + case 1258: if (n[1258]++ > 0) check ('a string 1258'); break; + case 1259: if (n[1259]++ > 0) check ('a string 1259'); break; + case 1260: if (n[1260]++ > 0) check ('a string 1260'); break; + case 1261: if (n[1261]++ > 0) check ('a string 1261'); break; + case 1262: if (n[1262]++ > 0) check ('a string 1262'); break; + case 1263: if (n[1263]++ > 0) check ('a string 1263'); break; + case 1264: if (n[1264]++ > 0) check ('a string 1264'); break; + case 1265: if (n[1265]++ > 0) check ('a string 1265'); break; + case 1266: if (n[1266]++ > 0) check ('a string 1266'); break; + case 1267: if (n[1267]++ > 0) check ('a string 1267'); break; + case 1268: if (n[1268]++ > 0) check ('a string 1268'); break; + case 1269: if (n[1269]++ > 0) check ('a string 1269'); break; + case 1270: if (n[1270]++ > 0) check ('a string 1270'); break; + case 1271: if (n[1271]++ > 0) check ('a string 1271'); break; + case 1272: if (n[1272]++ > 0) check ('a string 1272'); break; + case 1273: if (n[1273]++ > 0) check ('a string 1273'); break; + case 1274: if (n[1274]++ > 0) check ('a string 1274'); break; + case 1275: if (n[1275]++ > 0) check ('a string 1275'); break; + case 1276: if (n[1276]++ > 0) check ('a string 1276'); break; + case 1277: if (n[1277]++ > 0) check ('a string 1277'); break; + case 1278: if (n[1278]++ > 0) check ('a string 1278'); break; + case 1279: if (n[1279]++ > 0) check ('a string 1279'); break; + case 1280: if (n[1280]++ > 0) check ('a string 1280'); break; + case 1281: if (n[1281]++ > 0) check ('a string 1281'); break; + case 1282: if (n[1282]++ > 0) check ('a string 1282'); break; + case 1283: if (n[1283]++ > 0) check ('a string 1283'); break; + case 1284: if (n[1284]++ > 0) check ('a string 1284'); break; + case 1285: if (n[1285]++ > 0) check ('a string 1285'); break; + case 1286: if (n[1286]++ > 0) check ('a string 1286'); break; + case 1287: if (n[1287]++ > 0) check ('a string 1287'); break; + case 1288: if (n[1288]++ > 0) check ('a string 1288'); break; + case 1289: if (n[1289]++ > 0) check ('a string 1289'); break; + case 1290: if (n[1290]++ > 0) check ('a string 1290'); break; + case 1291: if (n[1291]++ > 0) check ('a string 1291'); break; + case 1292: if (n[1292]++ > 0) check ('a string 1292'); break; + case 1293: if (n[1293]++ > 0) check ('a string 1293'); break; + case 1294: if (n[1294]++ > 0) check ('a string 1294'); break; + case 1295: if (n[1295]++ > 0) check ('a string 1295'); break; + case 1296: if (n[1296]++ > 0) check ('a string 1296'); break; + case 1297: if (n[1297]++ > 0) check ('a string 1297'); break; + case 1298: if (n[1298]++ > 0) check ('a string 1298'); break; + case 1299: if (n[1299]++ > 0) check ('a string 1299'); break; + case 1300: if (n[1300]++ > 0) check ('a string 1300'); break; + case 1301: if (n[1301]++ > 0) check ('a string 1301'); break; + case 1302: if (n[1302]++ > 0) check ('a string 1302'); break; + case 1303: if (n[1303]++ > 0) check ('a string 1303'); break; + case 1304: if (n[1304]++ > 0) check ('a string 1304'); break; + case 1305: if (n[1305]++ > 0) check ('a string 1305'); break; + case 1306: if (n[1306]++ > 0) check ('a string 1306'); break; + case 1307: if (n[1307]++ > 0) check ('a string 1307'); break; + case 1308: if (n[1308]++ > 0) check ('a string 1308'); break; + case 1309: if (n[1309]++ > 0) check ('a string 1309'); break; + case 1310: if (n[1310]++ > 0) check ('a string 1310'); break; + case 1311: if (n[1311]++ > 0) check ('a string 1311'); break; + case 1312: if (n[1312]++ > 0) check ('a string 1312'); break; + case 1313: if (n[1313]++ > 0) check ('a string 1313'); break; + case 1314: if (n[1314]++ > 0) check ('a string 1314'); break; + case 1315: if (n[1315]++ > 0) check ('a string 1315'); break; + case 1316: if (n[1316]++ > 0) check ('a string 1316'); break; + case 1317: if (n[1317]++ > 0) check ('a string 1317'); break; + case 1318: if (n[1318]++ > 0) check ('a string 1318'); break; + case 1319: if (n[1319]++ > 0) check ('a string 1319'); break; + case 1320: if (n[1320]++ > 0) check ('a string 1320'); break; + case 1321: if (n[1321]++ > 0) check ('a string 1321'); break; + case 1322: if (n[1322]++ > 0) check ('a string 1322'); break; + case 1323: if (n[1323]++ > 0) check ('a string 1323'); break; + case 1324: if (n[1324]++ > 0) check ('a string 1324'); break; + case 1325: if (n[1325]++ > 0) check ('a string 1325'); break; + case 1326: if (n[1326]++ > 0) check ('a string 1326'); break; + case 1327: if (n[1327]++ > 0) check ('a string 1327'); break; + case 1328: if (n[1328]++ > 0) check ('a string 1328'); break; + case 1329: if (n[1329]++ > 0) check ('a string 1329'); break; + case 1330: if (n[1330]++ > 0) check ('a string 1330'); break; + case 1331: if (n[1331]++ > 0) check ('a string 1331'); break; + case 1332: if (n[1332]++ > 0) check ('a string 1332'); break; + case 1333: if (n[1333]++ > 0) check ('a string 1333'); break; + case 1334: if (n[1334]++ > 0) check ('a string 1334'); break; + case 1335: if (n[1335]++ > 0) check ('a string 1335'); break; + case 1336: if (n[1336]++ > 0) check ('a string 1336'); break; + case 1337: if (n[1337]++ > 0) check ('a string 1337'); break; + case 1338: if (n[1338]++ > 0) check ('a string 1338'); break; + case 1339: if (n[1339]++ > 0) check ('a string 1339'); break; + case 1340: if (n[1340]++ > 0) check ('a string 1340'); break; + case 1341: if (n[1341]++ > 0) check ('a string 1341'); break; + case 1342: if (n[1342]++ > 0) check ('a string 1342'); break; + case 1343: if (n[1343]++ > 0) check ('a string 1343'); break; + case 1344: if (n[1344]++ > 0) check ('a string 1344'); break; + case 1345: if (n[1345]++ > 0) check ('a string 1345'); break; + case 1346: if (n[1346]++ > 0) check ('a string 1346'); break; + case 1347: if (n[1347]++ > 0) check ('a string 1347'); break; + case 1348: if (n[1348]++ > 0) check ('a string 1348'); break; + case 1349: if (n[1349]++ > 0) check ('a string 1349'); break; + case 1350: if (n[1350]++ > 0) check ('a string 1350'); break; + case 1351: if (n[1351]++ > 0) check ('a string 1351'); break; + case 1352: if (n[1352]++ > 0) check ('a string 1352'); break; + case 1353: if (n[1353]++ > 0) check ('a string 1353'); break; + case 1354: if (n[1354]++ > 0) check ('a string 1354'); break; + case 1355: if (n[1355]++ > 0) check ('a string 1355'); break; + case 1356: if (n[1356]++ > 0) check ('a string 1356'); break; + case 1357: if (n[1357]++ > 0) check ('a string 1357'); break; + case 1358: if (n[1358]++ > 0) check ('a string 1358'); break; + case 1359: if (n[1359]++ > 0) check ('a string 1359'); break; + case 1360: if (n[1360]++ > 0) check ('a string 1360'); break; + case 1361: if (n[1361]++ > 0) check ('a string 1361'); break; + case 1362: if (n[1362]++ > 0) check ('a string 1362'); break; + case 1363: if (n[1363]++ > 0) check ('a string 1363'); break; + case 1364: if (n[1364]++ > 0) check ('a string 1364'); break; + case 1365: if (n[1365]++ > 0) check ('a string 1365'); break; + case 1366: if (n[1366]++ > 0) check ('a string 1366'); break; + case 1367: if (n[1367]++ > 0) check ('a string 1367'); break; + case 1368: if (n[1368]++ > 0) check ('a string 1368'); break; + case 1369: if (n[1369]++ > 0) check ('a string 1369'); break; + case 1370: if (n[1370]++ > 0) check ('a string 1370'); break; + case 1371: if (n[1371]++ > 0) check ('a string 1371'); break; + case 1372: if (n[1372]++ > 0) check ('a string 1372'); break; + case 1373: if (n[1373]++ > 0) check ('a string 1373'); break; + case 1374: if (n[1374]++ > 0) check ('a string 1374'); break; + case 1375: if (n[1375]++ > 0) check ('a string 1375'); break; + case 1376: if (n[1376]++ > 0) check ('a string 1376'); break; + case 1377: if (n[1377]++ > 0) check ('a string 1377'); break; + case 1378: if (n[1378]++ > 0) check ('a string 1378'); break; + case 1379: if (n[1379]++ > 0) check ('a string 1379'); break; + case 1380: if (n[1380]++ > 0) check ('a string 1380'); break; + case 1381: if (n[1381]++ > 0) check ('a string 1381'); break; + case 1382: if (n[1382]++ > 0) check ('a string 1382'); break; + case 1383: if (n[1383]++ > 0) check ('a string 1383'); break; + case 1384: if (n[1384]++ > 0) check ('a string 1384'); break; + case 1385: if (n[1385]++ > 0) check ('a string 1385'); break; + case 1386: if (n[1386]++ > 0) check ('a string 1386'); break; + case 1387: if (n[1387]++ > 0) check ('a string 1387'); break; + case 1388: if (n[1388]++ > 0) check ('a string 1388'); break; + case 1389: if (n[1389]++ > 0) check ('a string 1389'); break; + case 1390: if (n[1390]++ > 0) check ('a string 1390'); break; + case 1391: if (n[1391]++ > 0) check ('a string 1391'); break; + case 1392: if (n[1392]++ > 0) check ('a string 1392'); break; + case 1393: if (n[1393]++ > 0) check ('a string 1393'); break; + case 1394: if (n[1394]++ > 0) check ('a string 1394'); break; + case 1395: if (n[1395]++ > 0) check ('a string 1395'); break; + case 1396: if (n[1396]++ > 0) check ('a string 1396'); break; + case 1397: if (n[1397]++ > 0) check ('a string 1397'); break; + case 1398: if (n[1398]++ > 0) check ('a string 1398'); break; + case 1399: if (n[1399]++ > 0) check ('a string 1399'); break; + case 1400: if (n[1400]++ > 0) check ('a string 1400'); break; + case 1401: if (n[1401]++ > 0) check ('a string 1401'); break; + case 1402: if (n[1402]++ > 0) check ('a string 1402'); break; + case 1403: if (n[1403]++ > 0) check ('a string 1403'); break; + case 1404: if (n[1404]++ > 0) check ('a string 1404'); break; + case 1405: if (n[1405]++ > 0) check ('a string 1405'); break; + case 1406: if (n[1406]++ > 0) check ('a string 1406'); break; + case 1407: if (n[1407]++ > 0) check ('a string 1407'); break; + case 1408: if (n[1408]++ > 0) check ('a string 1408'); break; + case 1409: if (n[1409]++ > 0) check ('a string 1409'); break; + case 1410: if (n[1410]++ > 0) check ('a string 1410'); break; + case 1411: if (n[1411]++ > 0) check ('a string 1411'); break; + case 1412: if (n[1412]++ > 0) check ('a string 1412'); break; + case 1413: if (n[1413]++ > 0) check ('a string 1413'); break; + case 1414: if (n[1414]++ > 0) check ('a string 1414'); break; + case 1415: if (n[1415]++ > 0) check ('a string 1415'); break; + case 1416: if (n[1416]++ > 0) check ('a string 1416'); break; + case 1417: if (n[1417]++ > 0) check ('a string 1417'); break; + case 1418: if (n[1418]++ > 0) check ('a string 1418'); break; + case 1419: if (n[1419]++ > 0) check ('a string 1419'); break; + case 1420: if (n[1420]++ > 0) check ('a string 1420'); break; + case 1421: if (n[1421]++ > 0) check ('a string 1421'); break; + case 1422: if (n[1422]++ > 0) check ('a string 1422'); break; + case 1423: if (n[1423]++ > 0) check ('a string 1423'); break; + case 1424: if (n[1424]++ > 0) check ('a string 1424'); break; + case 1425: if (n[1425]++ > 0) check ('a string 1425'); break; + case 1426: if (n[1426]++ > 0) check ('a string 1426'); break; + case 1427: if (n[1427]++ > 0) check ('a string 1427'); break; + case 1428: if (n[1428]++ > 0) check ('a string 1428'); break; + case 1429: if (n[1429]++ > 0) check ('a string 1429'); break; + case 1430: if (n[1430]++ > 0) check ('a string 1430'); break; + case 1431: if (n[1431]++ > 0) check ('a string 1431'); break; + case 1432: if (n[1432]++ > 0) check ('a string 1432'); break; + case 1433: if (n[1433]++ > 0) check ('a string 1433'); break; + case 1434: if (n[1434]++ > 0) check ('a string 1434'); break; + case 1435: if (n[1435]++ > 0) check ('a string 1435'); break; + case 1436: if (n[1436]++ > 0) check ('a string 1436'); break; + case 1437: if (n[1437]++ > 0) check ('a string 1437'); break; + case 1438: if (n[1438]++ > 0) check ('a string 1438'); break; + case 1439: if (n[1439]++ > 0) check ('a string 1439'); break; + case 1440: if (n[1440]++ > 0) check ('a string 1440'); break; + case 1441: if (n[1441]++ > 0) check ('a string 1441'); break; + case 1442: if (n[1442]++ > 0) check ('a string 1442'); break; + case 1443: if (n[1443]++ > 0) check ('a string 1443'); break; + case 1444: if (n[1444]++ > 0) check ('a string 1444'); break; + case 1445: if (n[1445]++ > 0) check ('a string 1445'); break; + case 1446: if (n[1446]++ > 0) check ('a string 1446'); break; + case 1447: if (n[1447]++ > 0) check ('a string 1447'); break; + case 1448: if (n[1448]++ > 0) check ('a string 1448'); break; + case 1449: if (n[1449]++ > 0) check ('a string 1449'); break; + case 1450: if (n[1450]++ > 0) check ('a string 1450'); break; + case 1451: if (n[1451]++ > 0) check ('a string 1451'); break; + case 1452: if (n[1452]++ > 0) check ('a string 1452'); break; + case 1453: if (n[1453]++ > 0) check ('a string 1453'); break; + case 1454: if (n[1454]++ > 0) check ('a string 1454'); break; + case 1455: if (n[1455]++ > 0) check ('a string 1455'); break; + case 1456: if (n[1456]++ > 0) check ('a string 1456'); break; + case 1457: if (n[1457]++ > 0) check ('a string 1457'); break; + case 1458: if (n[1458]++ > 0) check ('a string 1458'); break; + case 1459: if (n[1459]++ > 0) check ('a string 1459'); break; + case 1460: if (n[1460]++ > 0) check ('a string 1460'); break; + case 1461: if (n[1461]++ > 0) check ('a string 1461'); break; + case 1462: if (n[1462]++ > 0) check ('a string 1462'); break; + case 1463: if (n[1463]++ > 0) check ('a string 1463'); break; + case 1464: if (n[1464]++ > 0) check ('a string 1464'); break; + case 1465: if (n[1465]++ > 0) check ('a string 1465'); break; + case 1466: if (n[1466]++ > 0) check ('a string 1466'); break; + case 1467: if (n[1467]++ > 0) check ('a string 1467'); break; + case 1468: if (n[1468]++ > 0) check ('a string 1468'); break; + case 1469: if (n[1469]++ > 0) check ('a string 1469'); break; + case 1470: if (n[1470]++ > 0) check ('a string 1470'); break; + case 1471: if (n[1471]++ > 0) check ('a string 1471'); break; + case 1472: if (n[1472]++ > 0) check ('a string 1472'); break; + case 1473: if (n[1473]++ > 0) check ('a string 1473'); break; + case 1474: if (n[1474]++ > 0) check ('a string 1474'); break; + case 1475: if (n[1475]++ > 0) check ('a string 1475'); break; + case 1476: if (n[1476]++ > 0) check ('a string 1476'); break; + case 1477: if (n[1477]++ > 0) check ('a string 1477'); break; + case 1478: if (n[1478]++ > 0) check ('a string 1478'); break; + case 1479: if (n[1479]++ > 0) check ('a string 1479'); break; + case 1480: if (n[1480]++ > 0) check ('a string 1480'); break; + case 1481: if (n[1481]++ > 0) check ('a string 1481'); break; + case 1482: if (n[1482]++ > 0) check ('a string 1482'); break; + case 1483: if (n[1483]++ > 0) check ('a string 1483'); break; + case 1484: if (n[1484]++ > 0) check ('a string 1484'); break; + case 1485: if (n[1485]++ > 0) check ('a string 1485'); break; + case 1486: if (n[1486]++ > 0) check ('a string 1486'); break; + case 1487: if (n[1487]++ > 0) check ('a string 1487'); break; + case 1488: if (n[1488]++ > 0) check ('a string 1488'); break; + case 1489: if (n[1489]++ > 0) check ('a string 1489'); break; + case 1490: if (n[1490]++ > 0) check ('a string 1490'); break; + case 1491: if (n[1491]++ > 0) check ('a string 1491'); break; + case 1492: if (n[1492]++ > 0) check ('a string 1492'); break; + case 1493: if (n[1493]++ > 0) check ('a string 1493'); break; + case 1494: if (n[1494]++ > 0) check ('a string 1494'); break; + case 1495: if (n[1495]++ > 0) check ('a string 1495'); break; + case 1496: if (n[1496]++ > 0) check ('a string 1496'); break; + case 1497: if (n[1497]++ > 0) check ('a string 1497'); break; + case 1498: if (n[1498]++ > 0) check ('a string 1498'); break; + case 1499: if (n[1499]++ > 0) check ('a string 1499'); break; + case 1500: if (n[1500]++ > 0) check ('a string 1500'); break; + case 1501: if (n[1501]++ > 0) check ('a string 1501'); break; + case 1502: if (n[1502]++ > 0) check ('a string 1502'); break; + case 1503: if (n[1503]++ > 0) check ('a string 1503'); break; + case 1504: if (n[1504]++ > 0) check ('a string 1504'); break; + case 1505: if (n[1505]++ > 0) check ('a string 1505'); break; + case 1506: if (n[1506]++ > 0) check ('a string 1506'); break; + case 1507: if (n[1507]++ > 0) check ('a string 1507'); break; + case 1508: if (n[1508]++ > 0) check ('a string 1508'); break; + case 1509: if (n[1509]++ > 0) check ('a string 1509'); break; + case 1510: if (n[1510]++ > 0) check ('a string 1510'); break; + case 1511: if (n[1511]++ > 0) check ('a string 1511'); break; + case 1512: if (n[1512]++ > 0) check ('a string 1512'); break; + case 1513: if (n[1513]++ > 0) check ('a string 1513'); break; + case 1514: if (n[1514]++ > 0) check ('a string 1514'); break; + case 1515: if (n[1515]++ > 0) check ('a string 1515'); break; + case 1516: if (n[1516]++ > 0) check ('a string 1516'); break; + case 1517: if (n[1517]++ > 0) check ('a string 1517'); break; + case 1518: if (n[1518]++ > 0) check ('a string 1518'); break; + case 1519: if (n[1519]++ > 0) check ('a string 1519'); break; + case 1520: if (n[1520]++ > 0) check ('a string 1520'); break; + case 1521: if (n[1521]++ > 0) check ('a string 1521'); break; + case 1522: if (n[1522]++ > 0) check ('a string 1522'); break; + case 1523: if (n[1523]++ > 0) check ('a string 1523'); break; + case 1524: if (n[1524]++ > 0) check ('a string 1524'); break; + case 1525: if (n[1525]++ > 0) check ('a string 1525'); break; + case 1526: if (n[1526]++ > 0) check ('a string 1526'); break; + case 1527: if (n[1527]++ > 0) check ('a string 1527'); break; + case 1528: if (n[1528]++ > 0) check ('a string 1528'); break; + case 1529: if (n[1529]++ > 0) check ('a string 1529'); break; + case 1530: if (n[1530]++ > 0) check ('a string 1530'); break; + case 1531: if (n[1531]++ > 0) check ('a string 1531'); break; + case 1532: if (n[1532]++ > 0) check ('a string 1532'); break; + case 1533: if (n[1533]++ > 0) check ('a string 1533'); break; + case 1534: if (n[1534]++ > 0) check ('a string 1534'); break; + case 1535: if (n[1535]++ > 0) check ('a string 1535'); break; + case 1536: if (n[1536]++ > 0) check ('a string 1536'); break; + case 1537: if (n[1537]++ > 0) check ('a string 1537'); break; + case 1538: if (n[1538]++ > 0) check ('a string 1538'); break; + case 1539: if (n[1539]++ > 0) check ('a string 1539'); break; + case 1540: if (n[1540]++ > 0) check ('a string 1540'); break; + case 1541: if (n[1541]++ > 0) check ('a string 1541'); break; + case 1542: if (n[1542]++ > 0) check ('a string 1542'); break; + case 1543: if (n[1543]++ > 0) check ('a string 1543'); break; + case 1544: if (n[1544]++ > 0) check ('a string 1544'); break; + case 1545: if (n[1545]++ > 0) check ('a string 1545'); break; + case 1546: if (n[1546]++ > 0) check ('a string 1546'); break; + case 1547: if (n[1547]++ > 0) check ('a string 1547'); break; + case 1548: if (n[1548]++ > 0) check ('a string 1548'); break; + case 1549: if (n[1549]++ > 0) check ('a string 1549'); break; + case 1550: if (n[1550]++ > 0) check ('a string 1550'); break; + case 1551: if (n[1551]++ > 0) check ('a string 1551'); break; + case 1552: if (n[1552]++ > 0) check ('a string 1552'); break; + case 1553: if (n[1553]++ > 0) check ('a string 1553'); break; + case 1554: if (n[1554]++ > 0) check ('a string 1554'); break; + case 1555: if (n[1555]++ > 0) check ('a string 1555'); break; + case 1556: if (n[1556]++ > 0) check ('a string 1556'); break; + case 1557: if (n[1557]++ > 0) check ('a string 1557'); break; + case 1558: if (n[1558]++ > 0) check ('a string 1558'); break; + case 1559: if (n[1559]++ > 0) check ('a string 1559'); break; + case 1560: if (n[1560]++ > 0) check ('a string 1560'); break; + case 1561: if (n[1561]++ > 0) check ('a string 1561'); break; + case 1562: if (n[1562]++ > 0) check ('a string 1562'); break; + case 1563: if (n[1563]++ > 0) check ('a string 1563'); break; + case 1564: if (n[1564]++ > 0) check ('a string 1564'); break; + case 1565: if (n[1565]++ > 0) check ('a string 1565'); break; + case 1566: if (n[1566]++ > 0) check ('a string 1566'); break; + case 1567: if (n[1567]++ > 0) check ('a string 1567'); break; + case 1568: if (n[1568]++ > 0) check ('a string 1568'); break; + case 1569: if (n[1569]++ > 0) check ('a string 1569'); break; + case 1570: if (n[1570]++ > 0) check ('a string 1570'); break; + case 1571: if (n[1571]++ > 0) check ('a string 1571'); break; + case 1572: if (n[1572]++ > 0) check ('a string 1572'); break; + case 1573: if (n[1573]++ > 0) check ('a string 1573'); break; + case 1574: if (n[1574]++ > 0) check ('a string 1574'); break; + case 1575: if (n[1575]++ > 0) check ('a string 1575'); break; + case 1576: if (n[1576]++ > 0) check ('a string 1576'); break; + case 1577: if (n[1577]++ > 0) check ('a string 1577'); break; + case 1578: if (n[1578]++ > 0) check ('a string 1578'); break; + case 1579: if (n[1579]++ > 0) check ('a string 1579'); break; + case 1580: if (n[1580]++ > 0) check ('a string 1580'); break; + case 1581: if (n[1581]++ > 0) check ('a string 1581'); break; + case 1582: if (n[1582]++ > 0) check ('a string 1582'); break; + case 1583: if (n[1583]++ > 0) check ('a string 1583'); break; + case 1584: if (n[1584]++ > 0) check ('a string 1584'); break; + case 1585: if (n[1585]++ > 0) check ('a string 1585'); break; + case 1586: if (n[1586]++ > 0) check ('a string 1586'); break; + case 1587: if (n[1587]++ > 0) check ('a string 1587'); break; + case 1588: if (n[1588]++ > 0) check ('a string 1588'); break; + case 1589: if (n[1589]++ > 0) check ('a string 1589'); break; + case 1590: if (n[1590]++ > 0) check ('a string 1590'); break; + case 1591: if (n[1591]++ > 0) check ('a string 1591'); break; + case 1592: if (n[1592]++ > 0) check ('a string 1592'); break; + case 1593: if (n[1593]++ > 0) check ('a string 1593'); break; + case 1594: if (n[1594]++ > 0) check ('a string 1594'); break; + case 1595: if (n[1595]++ > 0) check ('a string 1595'); break; + case 1596: if (n[1596]++ > 0) check ('a string 1596'); break; + case 1597: if (n[1597]++ > 0) check ('a string 1597'); break; + case 1598: if (n[1598]++ > 0) check ('a string 1598'); break; + case 1599: if (n[1599]++ > 0) check ('a string 1599'); break; + case 1600: if (n[1600]++ > 0) check ('a string 1600'); break; + case 1601: if (n[1601]++ > 0) check ('a string 1601'); break; + case 1602: if (n[1602]++ > 0) check ('a string 1602'); break; + case 1603: if (n[1603]++ > 0) check ('a string 1603'); break; + case 1604: if (n[1604]++ > 0) check ('a string 1604'); break; + case 1605: if (n[1605]++ > 0) check ('a string 1605'); break; + case 1606: if (n[1606]++ > 0) check ('a string 1606'); break; + case 1607: if (n[1607]++ > 0) check ('a string 1607'); break; + case 1608: if (n[1608]++ > 0) check ('a string 1608'); break; + case 1609: if (n[1609]++ > 0) check ('a string 1609'); break; + case 1610: if (n[1610]++ > 0) check ('a string 1610'); break; + case 1611: if (n[1611]++ > 0) check ('a string 1611'); break; + case 1612: if (n[1612]++ > 0) check ('a string 1612'); break; + case 1613: if (n[1613]++ > 0) check ('a string 1613'); break; + case 1614: if (n[1614]++ > 0) check ('a string 1614'); break; + case 1615: if (n[1615]++ > 0) check ('a string 1615'); break; + case 1616: if (n[1616]++ > 0) check ('a string 1616'); break; + case 1617: if (n[1617]++ > 0) check ('a string 1617'); break; + case 1618: if (n[1618]++ > 0) check ('a string 1618'); break; + case 1619: if (n[1619]++ > 0) check ('a string 1619'); break; + case 1620: if (n[1620]++ > 0) check ('a string 1620'); break; + case 1621: if (n[1621]++ > 0) check ('a string 1621'); break; + case 1622: if (n[1622]++ > 0) check ('a string 1622'); break; + case 1623: if (n[1623]++ > 0) check ('a string 1623'); break; + case 1624: if (n[1624]++ > 0) check ('a string 1624'); break; + case 1625: if (n[1625]++ > 0) check ('a string 1625'); break; + case 1626: if (n[1626]++ > 0) check ('a string 1626'); break; + case 1627: if (n[1627]++ > 0) check ('a string 1627'); break; + case 1628: if (n[1628]++ > 0) check ('a string 1628'); break; + case 1629: if (n[1629]++ > 0) check ('a string 1629'); break; + case 1630: if (n[1630]++ > 0) check ('a string 1630'); break; + case 1631: if (n[1631]++ > 0) check ('a string 1631'); break; + case 1632: if (n[1632]++ > 0) check ('a string 1632'); break; + case 1633: if (n[1633]++ > 0) check ('a string 1633'); break; + case 1634: if (n[1634]++ > 0) check ('a string 1634'); break; + case 1635: if (n[1635]++ > 0) check ('a string 1635'); break; + case 1636: if (n[1636]++ > 0) check ('a string 1636'); break; + case 1637: if (n[1637]++ > 0) check ('a string 1637'); break; + case 1638: if (n[1638]++ > 0) check ('a string 1638'); break; + case 1639: if (n[1639]++ > 0) check ('a string 1639'); break; + case 1640: if (n[1640]++ > 0) check ('a string 1640'); break; + case 1641: if (n[1641]++ > 0) check ('a string 1641'); break; + case 1642: if (n[1642]++ > 0) check ('a string 1642'); break; + case 1643: if (n[1643]++ > 0) check ('a string 1643'); break; + case 1644: if (n[1644]++ > 0) check ('a string 1644'); break; + case 1645: if (n[1645]++ > 0) check ('a string 1645'); break; + case 1646: if (n[1646]++ > 0) check ('a string 1646'); break; + case 1647: if (n[1647]++ > 0) check ('a string 1647'); break; + case 1648: if (n[1648]++ > 0) check ('a string 1648'); break; + case 1649: if (n[1649]++ > 0) check ('a string 1649'); break; + case 1650: if (n[1650]++ > 0) check ('a string 1650'); break; + case 1651: if (n[1651]++ > 0) check ('a string 1651'); break; + case 1652: if (n[1652]++ > 0) check ('a string 1652'); break; + case 1653: if (n[1653]++ > 0) check ('a string 1653'); break; + case 1654: if (n[1654]++ > 0) check ('a string 1654'); break; + case 1655: if (n[1655]++ > 0) check ('a string 1655'); break; + case 1656: if (n[1656]++ > 0) check ('a string 1656'); break; + case 1657: if (n[1657]++ > 0) check ('a string 1657'); break; + case 1658: if (n[1658]++ > 0) check ('a string 1658'); break; + case 1659: if (n[1659]++ > 0) check ('a string 1659'); break; + case 1660: if (n[1660]++ > 0) check ('a string 1660'); break; + case 1661: if (n[1661]++ > 0) check ('a string 1661'); break; + case 1662: if (n[1662]++ > 0) check ('a string 1662'); break; + case 1663: if (n[1663]++ > 0) check ('a string 1663'); break; + case 1664: if (n[1664]++ > 0) check ('a string 1664'); break; + case 1665: if (n[1665]++ > 0) check ('a string 1665'); break; + case 1666: if (n[1666]++ > 0) check ('a string 1666'); break; + case 1667: if (n[1667]++ > 0) check ('a string 1667'); break; + case 1668: if (n[1668]++ > 0) check ('a string 1668'); break; + case 1669: if (n[1669]++ > 0) check ('a string 1669'); break; + case 1670: if (n[1670]++ > 0) check ('a string 1670'); break; + case 1671: if (n[1671]++ > 0) check ('a string 1671'); break; + case 1672: if (n[1672]++ > 0) check ('a string 1672'); break; + case 1673: if (n[1673]++ > 0) check ('a string 1673'); break; + case 1674: if (n[1674]++ > 0) check ('a string 1674'); break; + case 1675: if (n[1675]++ > 0) check ('a string 1675'); break; + case 1676: if (n[1676]++ > 0) check ('a string 1676'); break; + case 1677: if (n[1677]++ > 0) check ('a string 1677'); break; + case 1678: if (n[1678]++ > 0) check ('a string 1678'); break; + case 1679: if (n[1679]++ > 0) check ('a string 1679'); break; + case 1680: if (n[1680]++ > 0) check ('a string 1680'); break; + case 1681: if (n[1681]++ > 0) check ('a string 1681'); break; + case 1682: if (n[1682]++ > 0) check ('a string 1682'); break; + case 1683: if (n[1683]++ > 0) check ('a string 1683'); break; + case 1684: if (n[1684]++ > 0) check ('a string 1684'); break; + case 1685: if (n[1685]++ > 0) check ('a string 1685'); break; + case 1686: if (n[1686]++ > 0) check ('a string 1686'); break; + case 1687: if (n[1687]++ > 0) check ('a string 1687'); break; + case 1688: if (n[1688]++ > 0) check ('a string 1688'); break; + case 1689: if (n[1689]++ > 0) check ('a string 1689'); break; + case 1690: if (n[1690]++ > 0) check ('a string 1690'); break; + case 1691: if (n[1691]++ > 0) check ('a string 1691'); break; + case 1692: if (n[1692]++ > 0) check ('a string 1692'); break; + case 1693: if (n[1693]++ > 0) check ('a string 1693'); break; + case 1694: if (n[1694]++ > 0) check ('a string 1694'); break; + case 1695: if (n[1695]++ > 0) check ('a string 1695'); break; + case 1696: if (n[1696]++ > 0) check ('a string 1696'); break; + case 1697: if (n[1697]++ > 0) check ('a string 1697'); break; + case 1698: if (n[1698]++ > 0) check ('a string 1698'); break; + case 1699: if (n[1699]++ > 0) check ('a string 1699'); break; + case 1700: if (n[1700]++ > 0) check ('a string 1700'); break; + case 1701: if (n[1701]++ > 0) check ('a string 1701'); break; + case 1702: if (n[1702]++ > 0) check ('a string 1702'); break; + case 1703: if (n[1703]++ > 0) check ('a string 1703'); break; + case 1704: if (n[1704]++ > 0) check ('a string 1704'); break; + case 1705: if (n[1705]++ > 0) check ('a string 1705'); break; + case 1706: if (n[1706]++ > 0) check ('a string 1706'); break; + case 1707: if (n[1707]++ > 0) check ('a string 1707'); break; + case 1708: if (n[1708]++ > 0) check ('a string 1708'); break; + case 1709: if (n[1709]++ > 0) check ('a string 1709'); break; + case 1710: if (n[1710]++ > 0) check ('a string 1710'); break; + case 1711: if (n[1711]++ > 0) check ('a string 1711'); break; + case 1712: if (n[1712]++ > 0) check ('a string 1712'); break; + case 1713: if (n[1713]++ > 0) check ('a string 1713'); break; + case 1714: if (n[1714]++ > 0) check ('a string 1714'); break; + case 1715: if (n[1715]++ > 0) check ('a string 1715'); break; + case 1716: if (n[1716]++ > 0) check ('a string 1716'); break; + case 1717: if (n[1717]++ > 0) check ('a string 1717'); break; + case 1718: if (n[1718]++ > 0) check ('a string 1718'); break; + case 1719: if (n[1719]++ > 0) check ('a string 1719'); break; + case 1720: if (n[1720]++ > 0) check ('a string 1720'); break; + case 1721: if (n[1721]++ > 0) check ('a string 1721'); break; + case 1722: if (n[1722]++ > 0) check ('a string 1722'); break; + case 1723: if (n[1723]++ > 0) check ('a string 1723'); break; + case 1724: if (n[1724]++ > 0) check ('a string 1724'); break; + case 1725: if (n[1725]++ > 0) check ('a string 1725'); break; + case 1726: if (n[1726]++ > 0) check ('a string 1726'); break; + case 1727: if (n[1727]++ > 0) check ('a string 1727'); break; + case 1728: if (n[1728]++ > 0) check ('a string 1728'); break; + case 1729: if (n[1729]++ > 0) check ('a string 1729'); break; + case 1730: if (n[1730]++ > 0) check ('a string 1730'); break; + case 1731: if (n[1731]++ > 0) check ('a string 1731'); break; + case 1732: if (n[1732]++ > 0) check ('a string 1732'); break; + case 1733: if (n[1733]++ > 0) check ('a string 1733'); break; + case 1734: if (n[1734]++ > 0) check ('a string 1734'); break; + case 1735: if (n[1735]++ > 0) check ('a string 1735'); break; + case 1736: if (n[1736]++ > 0) check ('a string 1736'); break; + case 1737: if (n[1737]++ > 0) check ('a string 1737'); break; + case 1738: if (n[1738]++ > 0) check ('a string 1738'); break; + case 1739: if (n[1739]++ > 0) check ('a string 1739'); break; + case 1740: if (n[1740]++ > 0) check ('a string 1740'); break; + case 1741: if (n[1741]++ > 0) check ('a string 1741'); break; + case 1742: if (n[1742]++ > 0) check ('a string 1742'); break; + case 1743: if (n[1743]++ > 0) check ('a string 1743'); break; + case 1744: if (n[1744]++ > 0) check ('a string 1744'); break; + case 1745: if (n[1745]++ > 0) check ('a string 1745'); break; + case 1746: if (n[1746]++ > 0) check ('a string 1746'); break; + case 1747: if (n[1747]++ > 0) check ('a string 1747'); break; + case 1748: if (n[1748]++ > 0) check ('a string 1748'); break; + case 1749: if (n[1749]++ > 0) check ('a string 1749'); break; + case 1750: if (n[1750]++ > 0) check ('a string 1750'); break; + case 1751: if (n[1751]++ > 0) check ('a string 1751'); break; + case 1752: if (n[1752]++ > 0) check ('a string 1752'); break; + case 1753: if (n[1753]++ > 0) check ('a string 1753'); break; + case 1754: if (n[1754]++ > 0) check ('a string 1754'); break; + case 1755: if (n[1755]++ > 0) check ('a string 1755'); break; + case 1756: if (n[1756]++ > 0) check ('a string 1756'); break; + case 1757: if (n[1757]++ > 0) check ('a string 1757'); break; + case 1758: if (n[1758]++ > 0) check ('a string 1758'); break; + case 1759: if (n[1759]++ > 0) check ('a string 1759'); break; + case 1760: if (n[1760]++ > 0) check ('a string 1760'); break; + case 1761: if (n[1761]++ > 0) check ('a string 1761'); break; + case 1762: if (n[1762]++ > 0) check ('a string 1762'); break; + case 1763: if (n[1763]++ > 0) check ('a string 1763'); break; + case 1764: if (n[1764]++ > 0) check ('a string 1764'); break; + case 1765: if (n[1765]++ > 0) check ('a string 1765'); break; + case 1766: if (n[1766]++ > 0) check ('a string 1766'); break; + case 1767: if (n[1767]++ > 0) check ('a string 1767'); break; + case 1768: if (n[1768]++ > 0) check ('a string 1768'); break; + case 1769: if (n[1769]++ > 0) check ('a string 1769'); break; + case 1770: if (n[1770]++ > 0) check ('a string 1770'); break; + case 1771: if (n[1771]++ > 0) check ('a string 1771'); break; + case 1772: if (n[1772]++ > 0) check ('a string 1772'); break; + case 1773: if (n[1773]++ > 0) check ('a string 1773'); break; + case 1774: if (n[1774]++ > 0) check ('a string 1774'); break; + case 1775: if (n[1775]++ > 0) check ('a string 1775'); break; + case 1776: if (n[1776]++ > 0) check ('a string 1776'); break; + case 1777: if (n[1777]++ > 0) check ('a string 1777'); break; + case 1778: if (n[1778]++ > 0) check ('a string 1778'); break; + case 1779: if (n[1779]++ > 0) check ('a string 1779'); break; + case 1780: if (n[1780]++ > 0) check ('a string 1780'); break; + case 1781: if (n[1781]++ > 0) check ('a string 1781'); break; + case 1782: if (n[1782]++ > 0) check ('a string 1782'); break; + case 1783: if (n[1783]++ > 0) check ('a string 1783'); break; + case 1784: if (n[1784]++ > 0) check ('a string 1784'); break; + case 1785: if (n[1785]++ > 0) check ('a string 1785'); break; + case 1786: if (n[1786]++ > 0) check ('a string 1786'); break; + case 1787: if (n[1787]++ > 0) check ('a string 1787'); break; + case 1788: if (n[1788]++ > 0) check ('a string 1788'); break; + case 1789: if (n[1789]++ > 0) check ('a string 1789'); break; + case 1790: if (n[1790]++ > 0) check ('a string 1790'); break; + case 1791: if (n[1791]++ > 0) check ('a string 1791'); break; + case 1792: if (n[1792]++ > 0) check ('a string 1792'); break; + case 1793: if (n[1793]++ > 0) check ('a string 1793'); break; + case 1794: if (n[1794]++ > 0) check ('a string 1794'); break; + case 1795: if (n[1795]++ > 0) check ('a string 1795'); break; + case 1796: if (n[1796]++ > 0) check ('a string 1796'); break; + case 1797: if (n[1797]++ > 0) check ('a string 1797'); break; + case 1798: if (n[1798]++ > 0) check ('a string 1798'); break; + case 1799: if (n[1799]++ > 0) check ('a string 1799'); break; + case 1800: if (n[1800]++ > 0) check ('a string 1800'); break; + case 1801: if (n[1801]++ > 0) check ('a string 1801'); break; + case 1802: if (n[1802]++ > 0) check ('a string 1802'); break; + case 1803: if (n[1803]++ > 0) check ('a string 1803'); break; + case 1804: if (n[1804]++ > 0) check ('a string 1804'); break; + case 1805: if (n[1805]++ > 0) check ('a string 1805'); break; + case 1806: if (n[1806]++ > 0) check ('a string 1806'); break; + case 1807: if (n[1807]++ > 0) check ('a string 1807'); break; + case 1808: if (n[1808]++ > 0) check ('a string 1808'); break; + case 1809: if (n[1809]++ > 0) check ('a string 1809'); break; + case 1810: if (n[1810]++ > 0) check ('a string 1810'); break; + case 1811: if (n[1811]++ > 0) check ('a string 1811'); break; + case 1812: if (n[1812]++ > 0) check ('a string 1812'); break; + case 1813: if (n[1813]++ > 0) check ('a string 1813'); break; + case 1814: if (n[1814]++ > 0) check ('a string 1814'); break; + case 1815: if (n[1815]++ > 0) check ('a string 1815'); break; + case 1816: if (n[1816]++ > 0) check ('a string 1816'); break; + case 1817: if (n[1817]++ > 0) check ('a string 1817'); break; + case 1818: if (n[1818]++ > 0) check ('a string 1818'); break; + case 1819: if (n[1819]++ > 0) check ('a string 1819'); break; + case 1820: if (n[1820]++ > 0) check ('a string 1820'); break; + case 1821: if (n[1821]++ > 0) check ('a string 1821'); break; + case 1822: if (n[1822]++ > 0) check ('a string 1822'); break; + case 1823: if (n[1823]++ > 0) check ('a string 1823'); break; + case 1824: if (n[1824]++ > 0) check ('a string 1824'); break; + case 1825: if (n[1825]++ > 0) check ('a string 1825'); break; + case 1826: if (n[1826]++ > 0) check ('a string 1826'); break; + case 1827: if (n[1827]++ > 0) check ('a string 1827'); break; + case 1828: if (n[1828]++ > 0) check ('a string 1828'); break; + case 1829: if (n[1829]++ > 0) check ('a string 1829'); break; + case 1830: if (n[1830]++ > 0) check ('a string 1830'); break; + case 1831: if (n[1831]++ > 0) check ('a string 1831'); break; + case 1832: if (n[1832]++ > 0) check ('a string 1832'); break; + case 1833: if (n[1833]++ > 0) check ('a string 1833'); break; + case 1834: if (n[1834]++ > 0) check ('a string 1834'); break; + case 1835: if (n[1835]++ > 0) check ('a string 1835'); break; + case 1836: if (n[1836]++ > 0) check ('a string 1836'); break; + case 1837: if (n[1837]++ > 0) check ('a string 1837'); break; + case 1838: if (n[1838]++ > 0) check ('a string 1838'); break; + case 1839: if (n[1839]++ > 0) check ('a string 1839'); break; + case 1840: if (n[1840]++ > 0) check ('a string 1840'); break; + case 1841: if (n[1841]++ > 0) check ('a string 1841'); break; + case 1842: if (n[1842]++ > 0) check ('a string 1842'); break; + case 1843: if (n[1843]++ > 0) check ('a string 1843'); break; + case 1844: if (n[1844]++ > 0) check ('a string 1844'); break; + case 1845: if (n[1845]++ > 0) check ('a string 1845'); break; + case 1846: if (n[1846]++ > 0) check ('a string 1846'); break; + case 1847: if (n[1847]++ > 0) check ('a string 1847'); break; + case 1848: if (n[1848]++ > 0) check ('a string 1848'); break; + case 1849: if (n[1849]++ > 0) check ('a string 1849'); break; + case 1850: if (n[1850]++ > 0) check ('a string 1850'); break; + case 1851: if (n[1851]++ > 0) check ('a string 1851'); break; + case 1852: if (n[1852]++ > 0) check ('a string 1852'); break; + case 1853: if (n[1853]++ > 0) check ('a string 1853'); break; + case 1854: if (n[1854]++ > 0) check ('a string 1854'); break; + case 1855: if (n[1855]++ > 0) check ('a string 1855'); break; + case 1856: if (n[1856]++ > 0) check ('a string 1856'); break; + case 1857: if (n[1857]++ > 0) check ('a string 1857'); break; + case 1858: if (n[1858]++ > 0) check ('a string 1858'); break; + case 1859: if (n[1859]++ > 0) check ('a string 1859'); break; + case 1860: if (n[1860]++ > 0) check ('a string 1860'); break; + case 1861: if (n[1861]++ > 0) check ('a string 1861'); break; + case 1862: if (n[1862]++ > 0) check ('a string 1862'); break; + case 1863: if (n[1863]++ > 0) check ('a string 1863'); break; + case 1864: if (n[1864]++ > 0) check ('a string 1864'); break; + case 1865: if (n[1865]++ > 0) check ('a string 1865'); break; + case 1866: if (n[1866]++ > 0) check ('a string 1866'); break; + case 1867: if (n[1867]++ > 0) check ('a string 1867'); break; + case 1868: if (n[1868]++ > 0) check ('a string 1868'); break; + case 1869: if (n[1869]++ > 0) check ('a string 1869'); break; + case 1870: if (n[1870]++ > 0) check ('a string 1870'); break; + case 1871: if (n[1871]++ > 0) check ('a string 1871'); break; + case 1872: if (n[1872]++ > 0) check ('a string 1872'); break; + case 1873: if (n[1873]++ > 0) check ('a string 1873'); break; + case 1874: if (n[1874]++ > 0) check ('a string 1874'); break; + case 1875: if (n[1875]++ > 0) check ('a string 1875'); break; + case 1876: if (n[1876]++ > 0) check ('a string 1876'); break; + case 1877: if (n[1877]++ > 0) check ('a string 1877'); break; + case 1878: if (n[1878]++ > 0) check ('a string 1878'); break; + case 1879: if (n[1879]++ > 0) check ('a string 1879'); break; + case 1880: if (n[1880]++ > 0) check ('a string 1880'); break; + case 1881: if (n[1881]++ > 0) check ('a string 1881'); break; + case 1882: if (n[1882]++ > 0) check ('a string 1882'); break; + case 1883: if (n[1883]++ > 0) check ('a string 1883'); break; + case 1884: if (n[1884]++ > 0) check ('a string 1884'); break; + case 1885: if (n[1885]++ > 0) check ('a string 1885'); break; + case 1886: if (n[1886]++ > 0) check ('a string 1886'); break; + case 1887: if (n[1887]++ > 0) check ('a string 1887'); break; + case 1888: if (n[1888]++ > 0) check ('a string 1888'); break; + case 1889: if (n[1889]++ > 0) check ('a string 1889'); break; + case 1890: if (n[1890]++ > 0) check ('a string 1890'); break; + case 1891: if (n[1891]++ > 0) check ('a string 1891'); break; + case 1892: if (n[1892]++ > 0) check ('a string 1892'); break; + case 1893: if (n[1893]++ > 0) check ('a string 1893'); break; + case 1894: if (n[1894]++ > 0) check ('a string 1894'); break; + case 1895: if (n[1895]++ > 0) check ('a string 1895'); break; + case 1896: if (n[1896]++ > 0) check ('a string 1896'); break; + case 1897: if (n[1897]++ > 0) check ('a string 1897'); break; + case 1898: if (n[1898]++ > 0) check ('a string 1898'); break; + case 1899: if (n[1899]++ > 0) check ('a string 1899'); break; + case 1900: if (n[1900]++ > 0) check ('a string 1900'); break; + case 1901: if (n[1901]++ > 0) check ('a string 1901'); break; + case 1902: if (n[1902]++ > 0) check ('a string 1902'); break; + case 1903: if (n[1903]++ > 0) check ('a string 1903'); break; + case 1904: if (n[1904]++ > 0) check ('a string 1904'); break; + case 1905: if (n[1905]++ > 0) check ('a string 1905'); break; + case 1906: if (n[1906]++ > 0) check ('a string 1906'); break; + case 1907: if (n[1907]++ > 0) check ('a string 1907'); break; + case 1908: if (n[1908]++ > 0) check ('a string 1908'); break; + case 1909: if (n[1909]++ > 0) check ('a string 1909'); break; + case 1910: if (n[1910]++ > 0) check ('a string 1910'); break; + case 1911: if (n[1911]++ > 0) check ('a string 1911'); break; + case 1912: if (n[1912]++ > 0) check ('a string 1912'); break; + case 1913: if (n[1913]++ > 0) check ('a string 1913'); break; + case 1914: if (n[1914]++ > 0) check ('a string 1914'); break; + case 1915: if (n[1915]++ > 0) check ('a string 1915'); break; + case 1916: if (n[1916]++ > 0) check ('a string 1916'); break; + case 1917: if (n[1917]++ > 0) check ('a string 1917'); break; + case 1918: if (n[1918]++ > 0) check ('a string 1918'); break; + case 1919: if (n[1919]++ > 0) check ('a string 1919'); break; + case 1920: if (n[1920]++ > 0) check ('a string 1920'); break; + case 1921: if (n[1921]++ > 0) check ('a string 1921'); break; + case 1922: if (n[1922]++ > 0) check ('a string 1922'); break; + case 1923: if (n[1923]++ > 0) check ('a string 1923'); break; + case 1924: if (n[1924]++ > 0) check ('a string 1924'); break; + case 1925: if (n[1925]++ > 0) check ('a string 1925'); break; + case 1926: if (n[1926]++ > 0) check ('a string 1926'); break; + case 1927: if (n[1927]++ > 0) check ('a string 1927'); break; + case 1928: if (n[1928]++ > 0) check ('a string 1928'); break; + case 1929: if (n[1929]++ > 0) check ('a string 1929'); break; + case 1930: if (n[1930]++ > 0) check ('a string 1930'); break; + case 1931: if (n[1931]++ > 0) check ('a string 1931'); break; + case 1932: if (n[1932]++ > 0) check ('a string 1932'); break; + case 1933: if (n[1933]++ > 0) check ('a string 1933'); break; + case 1934: if (n[1934]++ > 0) check ('a string 1934'); break; + case 1935: if (n[1935]++ > 0) check ('a string 1935'); break; + case 1936: if (n[1936]++ > 0) check ('a string 1936'); break; + case 1937: if (n[1937]++ > 0) check ('a string 1937'); break; + case 1938: if (n[1938]++ > 0) check ('a string 1938'); break; + case 1939: if (n[1939]++ > 0) check ('a string 1939'); break; + case 1940: if (n[1940]++ > 0) check ('a string 1940'); break; + case 1941: if (n[1941]++ > 0) check ('a string 1941'); break; + case 1942: if (n[1942]++ > 0) check ('a string 1942'); break; + case 1943: if (n[1943]++ > 0) check ('a string 1943'); break; + case 1944: if (n[1944]++ > 0) check ('a string 1944'); break; + case 1945: if (n[1945]++ > 0) check ('a string 1945'); break; + case 1946: if (n[1946]++ > 0) check ('a string 1946'); break; + case 1947: if (n[1947]++ > 0) check ('a string 1947'); break; + case 1948: if (n[1948]++ > 0) check ('a string 1948'); break; + case 1949: if (n[1949]++ > 0) check ('a string 1949'); break; + case 1950: if (n[1950]++ > 0) check ('a string 1950'); break; + case 1951: if (n[1951]++ > 0) check ('a string 1951'); break; + case 1952: if (n[1952]++ > 0) check ('a string 1952'); break; + case 1953: if (n[1953]++ > 0) check ('a string 1953'); break; + case 1954: if (n[1954]++ > 0) check ('a string 1954'); break; + case 1955: if (n[1955]++ > 0) check ('a string 1955'); break; + case 1956: if (n[1956]++ > 0) check ('a string 1956'); break; + case 1957: if (n[1957]++ > 0) check ('a string 1957'); break; + case 1958: if (n[1958]++ > 0) check ('a string 1958'); break; + case 1959: if (n[1959]++ > 0) check ('a string 1959'); break; + case 1960: if (n[1960]++ > 0) check ('a string 1960'); break; + case 1961: if (n[1961]++ > 0) check ('a string 1961'); break; + case 1962: if (n[1962]++ > 0) check ('a string 1962'); break; + case 1963: if (n[1963]++ > 0) check ('a string 1963'); break; + case 1964: if (n[1964]++ > 0) check ('a string 1964'); break; + case 1965: if (n[1965]++ > 0) check ('a string 1965'); break; + case 1966: if (n[1966]++ > 0) check ('a string 1966'); break; + case 1967: if (n[1967]++ > 0) check ('a string 1967'); break; + case 1968: if (n[1968]++ > 0) check ('a string 1968'); break; + case 1969: if (n[1969]++ > 0) check ('a string 1969'); break; + case 1970: if (n[1970]++ > 0) check ('a string 1970'); break; + case 1971: if (n[1971]++ > 0) check ('a string 1971'); break; + case 1972: if (n[1972]++ > 0) check ('a string 1972'); break; + case 1973: if (n[1973]++ > 0) check ('a string 1973'); break; + case 1974: if (n[1974]++ > 0) check ('a string 1974'); break; + case 1975: if (n[1975]++ > 0) check ('a string 1975'); break; + case 1976: if (n[1976]++ > 0) check ('a string 1976'); break; + case 1977: if (n[1977]++ > 0) check ('a string 1977'); break; + case 1978: if (n[1978]++ > 0) check ('a string 1978'); break; + case 1979: if (n[1979]++ > 0) check ('a string 1979'); break; + case 1980: if (n[1980]++ > 0) check ('a string 1980'); break; + case 1981: if (n[1981]++ > 0) check ('a string 1981'); break; + case 1982: if (n[1982]++ > 0) check ('a string 1982'); break; + case 1983: if (n[1983]++ > 0) check ('a string 1983'); break; + case 1984: if (n[1984]++ > 0) check ('a string 1984'); break; + case 1985: if (n[1985]++ > 0) check ('a string 1985'); break; + case 1986: if (n[1986]++ > 0) check ('a string 1986'); break; + case 1987: if (n[1987]++ > 0) check ('a string 1987'); break; + case 1988: if (n[1988]++ > 0) check ('a string 1988'); break; + case 1989: if (n[1989]++ > 0) check ('a string 1989'); break; + case 1990: if (n[1990]++ > 0) check ('a string 1990'); break; + case 1991: if (n[1991]++ > 0) check ('a string 1991'); break; + case 1992: if (n[1992]++ > 0) check ('a string 1992'); break; + case 1993: if (n[1993]++ > 0) check ('a string 1993'); break; + case 1994: if (n[1994]++ > 0) check ('a string 1994'); break; + case 1995: if (n[1995]++ > 0) check ('a string 1995'); break; + case 1996: if (n[1996]++ > 0) check ('a string 1996'); break; + case 1997: if (n[1997]++ > 0) check ('a string 1997'); break; + case 1998: if (n[1998]++ > 0) check ('a string 1998'); break; + case 1999: if (n[1999]++ > 0) check ('a string 1999'); break; + case 2000: if (n[2000]++ > 0) check ('a string 2000'); break; + case 2001: if (n[2001]++ > 0) check ('a string 2001'); break; + case 2002: if (n[2002]++ > 0) check ('a string 2002'); break; + case 2003: if (n[2003]++ > 0) check ('a string 2003'); break; + case 2004: if (n[2004]++ > 0) check ('a string 2004'); break; + case 2005: if (n[2005]++ > 0) check ('a string 2005'); break; + case 2006: if (n[2006]++ > 0) check ('a string 2006'); break; + case 2007: if (n[2007]++ > 0) check ('a string 2007'); break; + case 2008: if (n[2008]++ > 0) check ('a string 2008'); break; + case 2009: if (n[2009]++ > 0) check ('a string 2009'); break; + case 2010: if (n[2010]++ > 0) check ('a string 2010'); break; + case 2011: if (n[2011]++ > 0) check ('a string 2011'); break; + case 2012: if (n[2012]++ > 0) check ('a string 2012'); break; + case 2013: if (n[2013]++ > 0) check ('a string 2013'); break; + case 2014: if (n[2014]++ > 0) check ('a string 2014'); break; + case 2015: if (n[2015]++ > 0) check ('a string 2015'); break; + case 2016: if (n[2016]++ > 0) check ('a string 2016'); break; + case 2017: if (n[2017]++ > 0) check ('a string 2017'); break; + case 2018: if (n[2018]++ > 0) check ('a string 2018'); break; + case 2019: if (n[2019]++ > 0) check ('a string 2019'); break; + case 2020: if (n[2020]++ > 0) check ('a string 2020'); break; + case 2021: if (n[2021]++ > 0) check ('a string 2021'); break; + case 2022: if (n[2022]++ > 0) check ('a string 2022'); break; + case 2023: if (n[2023]++ > 0) check ('a string 2023'); break; + case 2024: if (n[2024]++ > 0) check ('a string 2024'); break; + case 2025: if (n[2025]++ > 0) check ('a string 2025'); break; + case 2026: if (n[2026]++ > 0) check ('a string 2026'); break; + case 2027: if (n[2027]++ > 0) check ('a string 2027'); break; + case 2028: if (n[2028]++ > 0) check ('a string 2028'); break; + case 2029: if (n[2029]++ > 0) check ('a string 2029'); break; + case 2030: if (n[2030]++ > 0) check ('a string 2030'); break; + case 2031: if (n[2031]++ > 0) check ('a string 2031'); break; + case 2032: if (n[2032]++ > 0) check ('a string 2032'); break; + case 2033: if (n[2033]++ > 0) check ('a string 2033'); break; + case 2034: if (n[2034]++ > 0) check ('a string 2034'); break; + case 2035: if (n[2035]++ > 0) check ('a string 2035'); break; + case 2036: if (n[2036]++ > 0) check ('a string 2036'); break; + case 2037: if (n[2037]++ > 0) check ('a string 2037'); break; + case 2038: if (n[2038]++ > 0) check ('a string 2038'); break; + case 2039: if (n[2039]++ > 0) check ('a string 2039'); break; + case 2040: if (n[2040]++ > 0) check ('a string 2040'); break; + case 2041: if (n[2041]++ > 0) check ('a string 2041'); break; + case 2042: if (n[2042]++ > 0) check ('a string 2042'); break; + case 2043: if (n[2043]++ > 0) check ('a string 2043'); break; + case 2044: if (n[2044]++ > 0) check ('a string 2044'); break; + case 2045: if (n[2045]++ > 0) check ('a string 2045'); break; + case 2046: if (n[2046]++ > 0) check ('a string 2046'); break; + case 2047: if (n[2047]++ > 0) check ('a string 2047'); break; + case 2048: if (n[2048]++ > 0) check ('a string 2048'); break; + case 2049: if (n[2049]++ > 0) check ('a string 2049'); break; + case 2050: if (n[2050]++ > 0) check ('a string 2050'); break; + case 2051: if (n[2051]++ > 0) check ('a string 2051'); break; + case 2052: if (n[2052]++ > 0) check ('a string 2052'); break; + case 2053: if (n[2053]++ > 0) check ('a string 2053'); break; + case 2054: if (n[2054]++ > 0) check ('a string 2054'); break; + case 2055: if (n[2055]++ > 0) check ('a string 2055'); break; + case 2056: if (n[2056]++ > 0) check ('a string 2056'); break; + case 2057: if (n[2057]++ > 0) check ('a string 2057'); break; + case 2058: if (n[2058]++ > 0) check ('a string 2058'); break; + case 2059: if (n[2059]++ > 0) check ('a string 2059'); break; + case 2060: if (n[2060]++ > 0) check ('a string 2060'); break; + case 2061: if (n[2061]++ > 0) check ('a string 2061'); break; + case 2062: if (n[2062]++ > 0) check ('a string 2062'); break; + case 2063: if (n[2063]++ > 0) check ('a string 2063'); break; + case 2064: if (n[2064]++ > 0) check ('a string 2064'); break; + case 2065: if (n[2065]++ > 0) check ('a string 2065'); break; + case 2066: if (n[2066]++ > 0) check ('a string 2066'); break; + case 2067: if (n[2067]++ > 0) check ('a string 2067'); break; + case 2068: if (n[2068]++ > 0) check ('a string 2068'); break; + case 2069: if (n[2069]++ > 0) check ('a string 2069'); break; + case 2070: if (n[2070]++ > 0) check ('a string 2070'); break; + case 2071: if (n[2071]++ > 0) check ('a string 2071'); break; + case 2072: if (n[2072]++ > 0) check ('a string 2072'); break; + case 2073: if (n[2073]++ > 0) check ('a string 2073'); break; + case 2074: if (n[2074]++ > 0) check ('a string 2074'); break; + case 2075: if (n[2075]++ > 0) check ('a string 2075'); break; + case 2076: if (n[2076]++ > 0) check ('a string 2076'); break; + case 2077: if (n[2077]++ > 0) check ('a string 2077'); break; + case 2078: if (n[2078]++ > 0) check ('a string 2078'); break; + case 2079: if (n[2079]++ > 0) check ('a string 2079'); break; + case 2080: if (n[2080]++ > 0) check ('a string 2080'); break; + case 2081: if (n[2081]++ > 0) check ('a string 2081'); break; + case 2082: if (n[2082]++ > 0) check ('a string 2082'); break; + case 2083: if (n[2083]++ > 0) check ('a string 2083'); break; + case 2084: if (n[2084]++ > 0) check ('a string 2084'); break; + case 2085: if (n[2085]++ > 0) check ('a string 2085'); break; + case 2086: if (n[2086]++ > 0) check ('a string 2086'); break; + case 2087: if (n[2087]++ > 0) check ('a string 2087'); break; + case 2088: if (n[2088]++ > 0) check ('a string 2088'); break; + case 2089: if (n[2089]++ > 0) check ('a string 2089'); break; + case 2090: if (n[2090]++ > 0) check ('a string 2090'); break; + case 2091: if (n[2091]++ > 0) check ('a string 2091'); break; + case 2092: if (n[2092]++ > 0) check ('a string 2092'); break; + case 2093: if (n[2093]++ > 0) check ('a string 2093'); break; + case 2094: if (n[2094]++ > 0) check ('a string 2094'); break; + case 2095: if (n[2095]++ > 0) check ('a string 2095'); break; + case 2096: if (n[2096]++ > 0) check ('a string 2096'); break; + case 2097: if (n[2097]++ > 0) check ('a string 2097'); break; + case 2098: if (n[2098]++ > 0) check ('a string 2098'); break; + case 2099: if (n[2099]++ > 0) check ('a string 2099'); break; + case 2100: if (n[2100]++ > 0) check ('a string 2100'); break; + case 2101: if (n[2101]++ > 0) check ('a string 2101'); break; + case 2102: if (n[2102]++ > 0) check ('a string 2102'); break; + case 2103: if (n[2103]++ > 0) check ('a string 2103'); break; + case 2104: if (n[2104]++ > 0) check ('a string 2104'); break; + case 2105: if (n[2105]++ > 0) check ('a string 2105'); break; + case 2106: if (n[2106]++ > 0) check ('a string 2106'); break; + case 2107: if (n[2107]++ > 0) check ('a string 2107'); break; + case 2108: if (n[2108]++ > 0) check ('a string 2108'); break; + case 2109: if (n[2109]++ > 0) check ('a string 2109'); break; + case 2110: if (n[2110]++ > 0) check ('a string 2110'); break; + case 2111: if (n[2111]++ > 0) check ('a string 2111'); break; + case 2112: if (n[2112]++ > 0) check ('a string 2112'); break; + case 2113: if (n[2113]++ > 0) check ('a string 2113'); break; + case 2114: if (n[2114]++ > 0) check ('a string 2114'); break; + case 2115: if (n[2115]++ > 0) check ('a string 2115'); break; + case 2116: if (n[2116]++ > 0) check ('a string 2116'); break; + case 2117: if (n[2117]++ > 0) check ('a string 2117'); break; + case 2118: if (n[2118]++ > 0) check ('a string 2118'); break; + case 2119: if (n[2119]++ > 0) check ('a string 2119'); break; + case 2120: if (n[2120]++ > 0) check ('a string 2120'); break; + case 2121: if (n[2121]++ > 0) check ('a string 2121'); break; + case 2122: if (n[2122]++ > 0) check ('a string 2122'); break; + case 2123: if (n[2123]++ > 0) check ('a string 2123'); break; + case 2124: if (n[2124]++ > 0) check ('a string 2124'); break; + case 2125: if (n[2125]++ > 0) check ('a string 2125'); break; + case 2126: if (n[2126]++ > 0) check ('a string 2126'); break; + case 2127: if (n[2127]++ > 0) check ('a string 2127'); break; + case 2128: if (n[2128]++ > 0) check ('a string 2128'); break; + case 2129: if (n[2129]++ > 0) check ('a string 2129'); break; + case 2130: if (n[2130]++ > 0) check ('a string 2130'); break; + case 2131: if (n[2131]++ > 0) check ('a string 2131'); break; + case 2132: if (n[2132]++ > 0) check ('a string 2132'); break; + case 2133: if (n[2133]++ > 0) check ('a string 2133'); break; + case 2134: if (n[2134]++ > 0) check ('a string 2134'); break; + case 2135: if (n[2135]++ > 0) check ('a string 2135'); break; + case 2136: if (n[2136]++ > 0) check ('a string 2136'); break; + case 2137: if (n[2137]++ > 0) check ('a string 2137'); break; + case 2138: if (n[2138]++ > 0) check ('a string 2138'); break; + case 2139: if (n[2139]++ > 0) check ('a string 2139'); break; + case 2140: if (n[2140]++ > 0) check ('a string 2140'); break; + case 2141: if (n[2141]++ > 0) check ('a string 2141'); break; + case 2142: if (n[2142]++ > 0) check ('a string 2142'); break; + case 2143: if (n[2143]++ > 0) check ('a string 2143'); break; + case 2144: if (n[2144]++ > 0) check ('a string 2144'); break; + case 2145: if (n[2145]++ > 0) check ('a string 2145'); break; + case 2146: if (n[2146]++ > 0) check ('a string 2146'); break; + case 2147: if (n[2147]++ > 0) check ('a string 2147'); break; + case 2148: if (n[2148]++ > 0) check ('a string 2148'); break; + case 2149: if (n[2149]++ > 0) check ('a string 2149'); break; + case 2150: if (n[2150]++ > 0) check ('a string 2150'); break; + case 2151: if (n[2151]++ > 0) check ('a string 2151'); break; + case 2152: if (n[2152]++ > 0) check ('a string 2152'); break; + case 2153: if (n[2153]++ > 0) check ('a string 2153'); break; + case 2154: if (n[2154]++ > 0) check ('a string 2154'); break; + case 2155: if (n[2155]++ > 0) check ('a string 2155'); break; + case 2156: if (n[2156]++ > 0) check ('a string 2156'); break; + case 2157: if (n[2157]++ > 0) check ('a string 2157'); break; + case 2158: if (n[2158]++ > 0) check ('a string 2158'); break; + case 2159: if (n[2159]++ > 0) check ('a string 2159'); break; + case 2160: if (n[2160]++ > 0) check ('a string 2160'); break; + case 2161: if (n[2161]++ > 0) check ('a string 2161'); break; + case 2162: if (n[2162]++ > 0) check ('a string 2162'); break; + case 2163: if (n[2163]++ > 0) check ('a string 2163'); break; + case 2164: if (n[2164]++ > 0) check ('a string 2164'); break; + case 2165: if (n[2165]++ > 0) check ('a string 2165'); break; + case 2166: if (n[2166]++ > 0) check ('a string 2166'); break; + case 2167: if (n[2167]++ > 0) check ('a string 2167'); break; + case 2168: if (n[2168]++ > 0) check ('a string 2168'); break; + case 2169: if (n[2169]++ > 0) check ('a string 2169'); break; + case 2170: if (n[2170]++ > 0) check ('a string 2170'); break; + case 2171: if (n[2171]++ > 0) check ('a string 2171'); break; + case 2172: if (n[2172]++ > 0) check ('a string 2172'); break; + case 2173: if (n[2173]++ > 0) check ('a string 2173'); break; + case 2174: if (n[2174]++ > 0) check ('a string 2174'); break; + case 2175: if (n[2175]++ > 0) check ('a string 2175'); break; + case 2176: if (n[2176]++ > 0) check ('a string 2176'); break; + case 2177: if (n[2177]++ > 0) check ('a string 2177'); break; + case 2178: if (n[2178]++ > 0) check ('a string 2178'); break; + case 2179: if (n[2179]++ > 0) check ('a string 2179'); break; + case 2180: if (n[2180]++ > 0) check ('a string 2180'); break; + case 2181: if (n[2181]++ > 0) check ('a string 2181'); break; + case 2182: if (n[2182]++ > 0) check ('a string 2182'); break; + case 2183: if (n[2183]++ > 0) check ('a string 2183'); break; + case 2184: if (n[2184]++ > 0) check ('a string 2184'); break; + case 2185: if (n[2185]++ > 0) check ('a string 2185'); break; + case 2186: if (n[2186]++ > 0) check ('a string 2186'); break; + case 2187: if (n[2187]++ > 0) check ('a string 2187'); break; + case 2188: if (n[2188]++ > 0) check ('a string 2188'); break; + case 2189: if (n[2189]++ > 0) check ('a string 2189'); break; + case 2190: if (n[2190]++ > 0) check ('a string 2190'); break; + case 2191: if (n[2191]++ > 0) check ('a string 2191'); break; + case 2192: if (n[2192]++ > 0) check ('a string 2192'); break; + case 2193: if (n[2193]++ > 0) check ('a string 2193'); break; + case 2194: if (n[2194]++ > 0) check ('a string 2194'); break; + case 2195: if (n[2195]++ > 0) check ('a string 2195'); break; + case 2196: if (n[2196]++ > 0) check ('a string 2196'); break; + case 2197: if (n[2197]++ > 0) check ('a string 2197'); break; + case 2198: if (n[2198]++ > 0) check ('a string 2198'); break; + case 2199: if (n[2199]++ > 0) check ('a string 2199'); break; + case 2200: if (n[2200]++ > 0) check ('a string 2200'); break; + case 2201: if (n[2201]++ > 0) check ('a string 2201'); break; + case 2202: if (n[2202]++ > 0) check ('a string 2202'); break; + case 2203: if (n[2203]++ > 0) check ('a string 2203'); break; + case 2204: if (n[2204]++ > 0) check ('a string 2204'); break; + case 2205: if (n[2205]++ > 0) check ('a string 2205'); break; + case 2206: if (n[2206]++ > 0) check ('a string 2206'); break; + case 2207: if (n[2207]++ > 0) check ('a string 2207'); break; + case 2208: if (n[2208]++ > 0) check ('a string 2208'); break; + case 2209: if (n[2209]++ > 0) check ('a string 2209'); break; + case 2210: if (n[2210]++ > 0) check ('a string 2210'); break; + case 2211: if (n[2211]++ > 0) check ('a string 2211'); break; + case 2212: if (n[2212]++ > 0) check ('a string 2212'); break; + case 2213: if (n[2213]++ > 0) check ('a string 2213'); break; + case 2214: if (n[2214]++ > 0) check ('a string 2214'); break; + case 2215: if (n[2215]++ > 0) check ('a string 2215'); break; + case 2216: if (n[2216]++ > 0) check ('a string 2216'); break; + case 2217: if (n[2217]++ > 0) check ('a string 2217'); break; + case 2218: if (n[2218]++ > 0) check ('a string 2218'); break; + case 2219: if (n[2219]++ > 0) check ('a string 2219'); break; + case 2220: if (n[2220]++ > 0) check ('a string 2220'); break; + case 2221: if (n[2221]++ > 0) check ('a string 2221'); break; + case 2222: if (n[2222]++ > 0) check ('a string 2222'); break; + case 2223: if (n[2223]++ > 0) check ('a string 2223'); break; + case 2224: if (n[2224]++ > 0) check ('a string 2224'); break; + case 2225: if (n[2225]++ > 0) check ('a string 2225'); break; + case 2226: if (n[2226]++ > 0) check ('a string 2226'); break; + case 2227: if (n[2227]++ > 0) check ('a string 2227'); break; + case 2228: if (n[2228]++ > 0) check ('a string 2228'); break; + case 2229: if (n[2229]++ > 0) check ('a string 2229'); break; + case 2230: if (n[2230]++ > 0) check ('a string 2230'); break; + case 2231: if (n[2231]++ > 0) check ('a string 2231'); break; + case 2232: if (n[2232]++ > 0) check ('a string 2232'); break; + case 2233: if (n[2233]++ > 0) check ('a string 2233'); break; + case 2234: if (n[2234]++ > 0) check ('a string 2234'); break; + case 2235: if (n[2235]++ > 0) check ('a string 2235'); break; + case 2236: if (n[2236]++ > 0) check ('a string 2236'); break; + case 2237: if (n[2237]++ > 0) check ('a string 2237'); break; + case 2238: if (n[2238]++ > 0) check ('a string 2238'); break; + case 2239: if (n[2239]++ > 0) check ('a string 2239'); break; + case 2240: if (n[2240]++ > 0) check ('a string 2240'); break; + case 2241: if (n[2241]++ > 0) check ('a string 2241'); break; + case 2242: if (n[2242]++ > 0) check ('a string 2242'); break; + case 2243: if (n[2243]++ > 0) check ('a string 2243'); break; + case 2244: if (n[2244]++ > 0) check ('a string 2244'); break; + case 2245: if (n[2245]++ > 0) check ('a string 2245'); break; + case 2246: if (n[2246]++ > 0) check ('a string 2246'); break; + case 2247: if (n[2247]++ > 0) check ('a string 2247'); break; + case 2248: if (n[2248]++ > 0) check ('a string 2248'); break; + case 2249: if (n[2249]++ > 0) check ('a string 2249'); break; + case 2250: if (n[2250]++ > 0) check ('a string 2250'); break; + case 2251: if (n[2251]++ > 0) check ('a string 2251'); break; + case 2252: if (n[2252]++ > 0) check ('a string 2252'); break; + case 2253: if (n[2253]++ > 0) check ('a string 2253'); break; + case 2254: if (n[2254]++ > 0) check ('a string 2254'); break; + case 2255: if (n[2255]++ > 0) check ('a string 2255'); break; + case 2256: if (n[2256]++ > 0) check ('a string 2256'); break; + case 2257: if (n[2257]++ > 0) check ('a string 2257'); break; + case 2258: if (n[2258]++ > 0) check ('a string 2258'); break; + case 2259: if (n[2259]++ > 0) check ('a string 2259'); break; + case 2260: if (n[2260]++ > 0) check ('a string 2260'); break; + case 2261: if (n[2261]++ > 0) check ('a string 2261'); break; + case 2262: if (n[2262]++ > 0) check ('a string 2262'); break; + case 2263: if (n[2263]++ > 0) check ('a string 2263'); break; + case 2264: if (n[2264]++ > 0) check ('a string 2264'); break; + case 2265: if (n[2265]++ > 0) check ('a string 2265'); break; + case 2266: if (n[2266]++ > 0) check ('a string 2266'); break; + case 2267: if (n[2267]++ > 0) check ('a string 2267'); break; + case 2268: if (n[2268]++ > 0) check ('a string 2268'); break; + case 2269: if (n[2269]++ > 0) check ('a string 2269'); break; + case 2270: if (n[2270]++ > 0) check ('a string 2270'); break; + case 2271: if (n[2271]++ > 0) check ('a string 2271'); break; + case 2272: if (n[2272]++ > 0) check ('a string 2272'); break; + case 2273: if (n[2273]++ > 0) check ('a string 2273'); break; + case 2274: if (n[2274]++ > 0) check ('a string 2274'); break; + case 2275: if (n[2275]++ > 0) check ('a string 2275'); break; + case 2276: if (n[2276]++ > 0) check ('a string 2276'); break; + case 2277: if (n[2277]++ > 0) check ('a string 2277'); break; + case 2278: if (n[2278]++ > 0) check ('a string 2278'); break; + case 2279: if (n[2279]++ > 0) check ('a string 2279'); break; + case 2280: if (n[2280]++ > 0) check ('a string 2280'); break; + case 2281: if (n[2281]++ > 0) check ('a string 2281'); break; + case 2282: if (n[2282]++ > 0) check ('a string 2282'); break; + case 2283: if (n[2283]++ > 0) check ('a string 2283'); break; + case 2284: if (n[2284]++ > 0) check ('a string 2284'); break; + case 2285: if (n[2285]++ > 0) check ('a string 2285'); break; + case 2286: if (n[2286]++ > 0) check ('a string 2286'); break; + case 2287: if (n[2287]++ > 0) check ('a string 2287'); break; + case 2288: if (n[2288]++ > 0) check ('a string 2288'); break; + case 2289: if (n[2289]++ > 0) check ('a string 2289'); break; + case 2290: if (n[2290]++ > 0) check ('a string 2290'); break; + case 2291: if (n[2291]++ > 0) check ('a string 2291'); break; + case 2292: if (n[2292]++ > 0) check ('a string 2292'); break; + case 2293: if (n[2293]++ > 0) check ('a string 2293'); break; + case 2294: if (n[2294]++ > 0) check ('a string 2294'); break; + case 2295: if (n[2295]++ > 0) check ('a string 2295'); break; + case 2296: if (n[2296]++ > 0) check ('a string 2296'); break; + case 2297: if (n[2297]++ > 0) check ('a string 2297'); break; + case 2298: if (n[2298]++ > 0) check ('a string 2298'); break; + case 2299: if (n[2299]++ > 0) check ('a string 2299'); break; + case 2300: if (n[2300]++ > 0) check ('a string 2300'); break; + case 2301: if (n[2301]++ > 0) check ('a string 2301'); break; + case 2302: if (n[2302]++ > 0) check ('a string 2302'); break; + case 2303: if (n[2303]++ > 0) check ('a string 2303'); break; + case 2304: if (n[2304]++ > 0) check ('a string 2304'); break; + case 2305: if (n[2305]++ > 0) check ('a string 2305'); break; + case 2306: if (n[2306]++ > 0) check ('a string 2306'); break; + case 2307: if (n[2307]++ > 0) check ('a string 2307'); break; + case 2308: if (n[2308]++ > 0) check ('a string 2308'); break; + case 2309: if (n[2309]++ > 0) check ('a string 2309'); break; + case 2310: if (n[2310]++ > 0) check ('a string 2310'); break; + case 2311: if (n[2311]++ > 0) check ('a string 2311'); break; + case 2312: if (n[2312]++ > 0) check ('a string 2312'); break; + case 2313: if (n[2313]++ > 0) check ('a string 2313'); break; + case 2314: if (n[2314]++ > 0) check ('a string 2314'); break; + case 2315: if (n[2315]++ > 0) check ('a string 2315'); break; + case 2316: if (n[2316]++ > 0) check ('a string 2316'); break; + case 2317: if (n[2317]++ > 0) check ('a string 2317'); break; + case 2318: if (n[2318]++ > 0) check ('a string 2318'); break; + case 2319: if (n[2319]++ > 0) check ('a string 2319'); break; + case 2320: if (n[2320]++ > 0) check ('a string 2320'); break; + case 2321: if (n[2321]++ > 0) check ('a string 2321'); break; + case 2322: if (n[2322]++ > 0) check ('a string 2322'); break; + case 2323: if (n[2323]++ > 0) check ('a string 2323'); break; + case 2324: if (n[2324]++ > 0) check ('a string 2324'); break; + case 2325: if (n[2325]++ > 0) check ('a string 2325'); break; + case 2326: if (n[2326]++ > 0) check ('a string 2326'); break; + case 2327: if (n[2327]++ > 0) check ('a string 2327'); break; + case 2328: if (n[2328]++ > 0) check ('a string 2328'); break; + case 2329: if (n[2329]++ > 0) check ('a string 2329'); break; + case 2330: if (n[2330]++ > 0) check ('a string 2330'); break; + case 2331: if (n[2331]++ > 0) check ('a string 2331'); break; + case 2332: if (n[2332]++ > 0) check ('a string 2332'); break; + case 2333: if (n[2333]++ > 0) check ('a string 2333'); break; + case 2334: if (n[2334]++ > 0) check ('a string 2334'); break; + case 2335: if (n[2335]++ > 0) check ('a string 2335'); break; + case 2336: if (n[2336]++ > 0) check ('a string 2336'); break; + case 2337: if (n[2337]++ > 0) check ('a string 2337'); break; + case 2338: if (n[2338]++ > 0) check ('a string 2338'); break; + case 2339: if (n[2339]++ > 0) check ('a string 2339'); break; + case 2340: if (n[2340]++ > 0) check ('a string 2340'); break; + case 2341: if (n[2341]++ > 0) check ('a string 2341'); break; + case 2342: if (n[2342]++ > 0) check ('a string 2342'); break; + case 2343: if (n[2343]++ > 0) check ('a string 2343'); break; + case 2344: if (n[2344]++ > 0) check ('a string 2344'); break; + case 2345: if (n[2345]++ > 0) check ('a string 2345'); break; + case 2346: if (n[2346]++ > 0) check ('a string 2346'); break; + case 2347: if (n[2347]++ > 0) check ('a string 2347'); break; + case 2348: if (n[2348]++ > 0) check ('a string 2348'); break; + case 2349: if (n[2349]++ > 0) check ('a string 2349'); break; + case 2350: if (n[2350]++ > 0) check ('a string 2350'); break; + case 2351: if (n[2351]++ > 0) check ('a string 2351'); break; + case 2352: if (n[2352]++ > 0) check ('a string 2352'); break; + case 2353: if (n[2353]++ > 0) check ('a string 2353'); break; + case 2354: if (n[2354]++ > 0) check ('a string 2354'); break; + case 2355: if (n[2355]++ > 0) check ('a string 2355'); break; + case 2356: if (n[2356]++ > 0) check ('a string 2356'); break; + case 2357: if (n[2357]++ > 0) check ('a string 2357'); break; + case 2358: if (n[2358]++ > 0) check ('a string 2358'); break; + case 2359: if (n[2359]++ > 0) check ('a string 2359'); break; + case 2360: if (n[2360]++ > 0) check ('a string 2360'); break; + case 2361: if (n[2361]++ > 0) check ('a string 2361'); break; + case 2362: if (n[2362]++ > 0) check ('a string 2362'); break; + case 2363: if (n[2363]++ > 0) check ('a string 2363'); break; + case 2364: if (n[2364]++ > 0) check ('a string 2364'); break; + case 2365: if (n[2365]++ > 0) check ('a string 2365'); break; + case 2366: if (n[2366]++ > 0) check ('a string 2366'); break; + case 2367: if (n[2367]++ > 0) check ('a string 2367'); break; + case 2368: if (n[2368]++ > 0) check ('a string 2368'); break; + case 2369: if (n[2369]++ > 0) check ('a string 2369'); break; + case 2370: if (n[2370]++ > 0) check ('a string 2370'); break; + case 2371: if (n[2371]++ > 0) check ('a string 2371'); break; + case 2372: if (n[2372]++ > 0) check ('a string 2372'); break; + case 2373: if (n[2373]++ > 0) check ('a string 2373'); break; + case 2374: if (n[2374]++ > 0) check ('a string 2374'); break; + case 2375: if (n[2375]++ > 0) check ('a string 2375'); break; + case 2376: if (n[2376]++ > 0) check ('a string 2376'); break; + case 2377: if (n[2377]++ > 0) check ('a string 2377'); break; + case 2378: if (n[2378]++ > 0) check ('a string 2378'); break; + case 2379: if (n[2379]++ > 0) check ('a string 2379'); break; + case 2380: if (n[2380]++ > 0) check ('a string 2380'); break; + case 2381: if (n[2381]++ > 0) check ('a string 2381'); break; + case 2382: if (n[2382]++ > 0) check ('a string 2382'); break; + case 2383: if (n[2383]++ > 0) check ('a string 2383'); break; + case 2384: if (n[2384]++ > 0) check ('a string 2384'); break; + case 2385: if (n[2385]++ > 0) check ('a string 2385'); break; + case 2386: if (n[2386]++ > 0) check ('a string 2386'); break; + case 2387: if (n[2387]++ > 0) check ('a string 2387'); break; + case 2388: if (n[2388]++ > 0) check ('a string 2388'); break; + case 2389: if (n[2389]++ > 0) check ('a string 2389'); break; + case 2390: if (n[2390]++ > 0) check ('a string 2390'); break; + case 2391: if (n[2391]++ > 0) check ('a string 2391'); break; + case 2392: if (n[2392]++ > 0) check ('a string 2392'); break; + case 2393: if (n[2393]++ > 0) check ('a string 2393'); break; + case 2394: if (n[2394]++ > 0) check ('a string 2394'); break; + case 2395: if (n[2395]++ > 0) check ('a string 2395'); break; + case 2396: if (n[2396]++ > 0) check ('a string 2396'); break; + case 2397: if (n[2397]++ > 0) check ('a string 2397'); break; + case 2398: if (n[2398]++ > 0) check ('a string 2398'); break; + case 2399: if (n[2399]++ > 0) check ('a string 2399'); break; + case 2400: if (n[2400]++ > 0) check ('a string 2400'); break; + case 2401: if (n[2401]++ > 0) check ('a string 2401'); break; + case 2402: if (n[2402]++ > 0) check ('a string 2402'); break; + case 2403: if (n[2403]++ > 0) check ('a string 2403'); break; + case 2404: if (n[2404]++ > 0) check ('a string 2404'); break; + case 2405: if (n[2405]++ > 0) check ('a string 2405'); break; + case 2406: if (n[2406]++ > 0) check ('a string 2406'); break; + case 2407: if (n[2407]++ > 0) check ('a string 2407'); break; + case 2408: if (n[2408]++ > 0) check ('a string 2408'); break; + case 2409: if (n[2409]++ > 0) check ('a string 2409'); break; + case 2410: if (n[2410]++ > 0) check ('a string 2410'); break; + case 2411: if (n[2411]++ > 0) check ('a string 2411'); break; + case 2412: if (n[2412]++ > 0) check ('a string 2412'); break; + case 2413: if (n[2413]++ > 0) check ('a string 2413'); break; + case 2414: if (n[2414]++ > 0) check ('a string 2414'); break; + case 2415: if (n[2415]++ > 0) check ('a string 2415'); break; + case 2416: if (n[2416]++ > 0) check ('a string 2416'); break; + case 2417: if (n[2417]++ > 0) check ('a string 2417'); break; + case 2418: if (n[2418]++ > 0) check ('a string 2418'); break; + case 2419: if (n[2419]++ > 0) check ('a string 2419'); break; + case 2420: if (n[2420]++ > 0) check ('a string 2420'); break; + case 2421: if (n[2421]++ > 0) check ('a string 2421'); break; + case 2422: if (n[2422]++ > 0) check ('a string 2422'); break; + case 2423: if (n[2423]++ > 0) check ('a string 2423'); break; + case 2424: if (n[2424]++ > 0) check ('a string 2424'); break; + case 2425: if (n[2425]++ > 0) check ('a string 2425'); break; + case 2426: if (n[2426]++ > 0) check ('a string 2426'); break; + case 2427: if (n[2427]++ > 0) check ('a string 2427'); break; + case 2428: if (n[2428]++ > 0) check ('a string 2428'); break; + case 2429: if (n[2429]++ > 0) check ('a string 2429'); break; + case 2430: if (n[2430]++ > 0) check ('a string 2430'); break; + case 2431: if (n[2431]++ > 0) check ('a string 2431'); break; + case 2432: if (n[2432]++ > 0) check ('a string 2432'); break; + case 2433: if (n[2433]++ > 0) check ('a string 2433'); break; + case 2434: if (n[2434]++ > 0) check ('a string 2434'); break; + case 2435: if (n[2435]++ > 0) check ('a string 2435'); break; + case 2436: if (n[2436]++ > 0) check ('a string 2436'); break; + case 2437: if (n[2437]++ > 0) check ('a string 2437'); break; + case 2438: if (n[2438]++ > 0) check ('a string 2438'); break; + case 2439: if (n[2439]++ > 0) check ('a string 2439'); break; + case 2440: if (n[2440]++ > 0) check ('a string 2440'); break; + case 2441: if (n[2441]++ > 0) check ('a string 2441'); break; + case 2442: if (n[2442]++ > 0) check ('a string 2442'); break; + case 2443: if (n[2443]++ > 0) check ('a string 2443'); break; + case 2444: if (n[2444]++ > 0) check ('a string 2444'); break; + case 2445: if (n[2445]++ > 0) check ('a string 2445'); break; + case 2446: if (n[2446]++ > 0) check ('a string 2446'); break; + case 2447: if (n[2447]++ > 0) check ('a string 2447'); break; + case 2448: if (n[2448]++ > 0) check ('a string 2448'); break; + case 2449: if (n[2449]++ > 0) check ('a string 2449'); break; + case 2450: if (n[2450]++ > 0) check ('a string 2450'); break; + case 2451: if (n[2451]++ > 0) check ('a string 2451'); break; + case 2452: if (n[2452]++ > 0) check ('a string 2452'); break; + case 2453: if (n[2453]++ > 0) check ('a string 2453'); break; + case 2454: if (n[2454]++ > 0) check ('a string 2454'); break; + case 2455: if (n[2455]++ > 0) check ('a string 2455'); break; + case 2456: if (n[2456]++ > 0) check ('a string 2456'); break; + case 2457: if (n[2457]++ > 0) check ('a string 2457'); break; + case 2458: if (n[2458]++ > 0) check ('a string 2458'); break; + case 2459: if (n[2459]++ > 0) check ('a string 2459'); break; + case 2460: if (n[2460]++ > 0) check ('a string 2460'); break; + case 2461: if (n[2461]++ > 0) check ('a string 2461'); break; + case 2462: if (n[2462]++ > 0) check ('a string 2462'); break; + case 2463: if (n[2463]++ > 0) check ('a string 2463'); break; + case 2464: if (n[2464]++ > 0) check ('a string 2464'); break; + case 2465: if (n[2465]++ > 0) check ('a string 2465'); break; + case 2466: if (n[2466]++ > 0) check ('a string 2466'); break; + case 2467: if (n[2467]++ > 0) check ('a string 2467'); break; + case 2468: if (n[2468]++ > 0) check ('a string 2468'); break; + case 2469: if (n[2469]++ > 0) check ('a string 2469'); break; + case 2470: if (n[2470]++ > 0) check ('a string 2470'); break; + case 2471: if (n[2471]++ > 0) check ('a string 2471'); break; + case 2472: if (n[2472]++ > 0) check ('a string 2472'); break; + case 2473: if (n[2473]++ > 0) check ('a string 2473'); break; + case 2474: if (n[2474]++ > 0) check ('a string 2474'); break; + case 2475: if (n[2475]++ > 0) check ('a string 2475'); break; + case 2476: if (n[2476]++ > 0) check ('a string 2476'); break; + case 2477: if (n[2477]++ > 0) check ('a string 2477'); break; + case 2478: if (n[2478]++ > 0) check ('a string 2478'); break; + case 2479: if (n[2479]++ > 0) check ('a string 2479'); break; + case 2480: if (n[2480]++ > 0) check ('a string 2480'); break; + case 2481: if (n[2481]++ > 0) check ('a string 2481'); break; + case 2482: if (n[2482]++ > 0) check ('a string 2482'); break; + case 2483: if (n[2483]++ > 0) check ('a string 2483'); break; + case 2484: if (n[2484]++ > 0) check ('a string 2484'); break; + case 2485: if (n[2485]++ > 0) check ('a string 2485'); break; + case 2486: if (n[2486]++ > 0) check ('a string 2486'); break; + case 2487: if (n[2487]++ > 0) check ('a string 2487'); break; + case 2488: if (n[2488]++ > 0) check ('a string 2488'); break; + case 2489: if (n[2489]++ > 0) check ('a string 2489'); break; + case 2490: if (n[2490]++ > 0) check ('a string 2490'); break; + case 2491: if (n[2491]++ > 0) check ('a string 2491'); break; + case 2492: if (n[2492]++ > 0) check ('a string 2492'); break; + case 2493: if (n[2493]++ > 0) check ('a string 2493'); break; + case 2494: if (n[2494]++ > 0) check ('a string 2494'); break; + case 2495: if (n[2495]++ > 0) check ('a string 2495'); break; + case 2496: if (n[2496]++ > 0) check ('a string 2496'); break; + case 2497: if (n[2497]++ > 0) check ('a string 2497'); break; + case 2498: if (n[2498]++ > 0) check ('a string 2498'); break; + case 2499: if (n[2499]++ > 0) check ('a string 2499'); break; + case 2500: if (n[2500]++ > 0) check ('a string 2500'); break; + case 2501: if (n[2501]++ > 0) check ('a string 2501'); break; + case 2502: if (n[2502]++ > 0) check ('a string 2502'); break; + case 2503: if (n[2503]++ > 0) check ('a string 2503'); break; + case 2504: if (n[2504]++ > 0) check ('a string 2504'); break; + case 2505: if (n[2505]++ > 0) check ('a string 2505'); break; + case 2506: if (n[2506]++ > 0) check ('a string 2506'); break; + case 2507: if (n[2507]++ > 0) check ('a string 2507'); break; + case 2508: if (n[2508]++ > 0) check ('a string 2508'); break; + case 2509: if (n[2509]++ > 0) check ('a string 2509'); break; + case 2510: if (n[2510]++ > 0) check ('a string 2510'); break; + case 2511: if (n[2511]++ > 0) check ('a string 2511'); break; + case 2512: if (n[2512]++ > 0) check ('a string 2512'); break; + case 2513: if (n[2513]++ > 0) check ('a string 2513'); break; + case 2514: if (n[2514]++ > 0) check ('a string 2514'); break; + case 2515: if (n[2515]++ > 0) check ('a string 2515'); break; + case 2516: if (n[2516]++ > 0) check ('a string 2516'); break; + case 2517: if (n[2517]++ > 0) check ('a string 2517'); break; + case 2518: if (n[2518]++ > 0) check ('a string 2518'); break; + case 2519: if (n[2519]++ > 0) check ('a string 2519'); break; + case 2520: if (n[2520]++ > 0) check ('a string 2520'); break; + case 2521: if (n[2521]++ > 0) check ('a string 2521'); break; + case 2522: if (n[2522]++ > 0) check ('a string 2522'); break; + case 2523: if (n[2523]++ > 0) check ('a string 2523'); break; + case 2524: if (n[2524]++ > 0) check ('a string 2524'); break; + case 2525: if (n[2525]++ > 0) check ('a string 2525'); break; + case 2526: if (n[2526]++ > 0) check ('a string 2526'); break; + case 2527: if (n[2527]++ > 0) check ('a string 2527'); break; + case 2528: if (n[2528]++ > 0) check ('a string 2528'); break; + case 2529: if (n[2529]++ > 0) check ('a string 2529'); break; + case 2530: if (n[2530]++ > 0) check ('a string 2530'); break; + case 2531: if (n[2531]++ > 0) check ('a string 2531'); break; + case 2532: if (n[2532]++ > 0) check ('a string 2532'); break; + case 2533: if (n[2533]++ > 0) check ('a string 2533'); break; + case 2534: if (n[2534]++ > 0) check ('a string 2534'); break; + case 2535: if (n[2535]++ > 0) check ('a string 2535'); break; + case 2536: if (n[2536]++ > 0) check ('a string 2536'); break; + case 2537: if (n[2537]++ > 0) check ('a string 2537'); break; + case 2538: if (n[2538]++ > 0) check ('a string 2538'); break; + case 2539: if (n[2539]++ > 0) check ('a string 2539'); break; + case 2540: if (n[2540]++ > 0) check ('a string 2540'); break; + case 2541: if (n[2541]++ > 0) check ('a string 2541'); break; + case 2542: if (n[2542]++ > 0) check ('a string 2542'); break; + case 2543: if (n[2543]++ > 0) check ('a string 2543'); break; + case 2544: if (n[2544]++ > 0) check ('a string 2544'); break; + case 2545: if (n[2545]++ > 0) check ('a string 2545'); break; + case 2546: if (n[2546]++ > 0) check ('a string 2546'); break; + case 2547: if (n[2547]++ > 0) check ('a string 2547'); break; + case 2548: if (n[2548]++ > 0) check ('a string 2548'); break; + case 2549: if (n[2549]++ > 0) check ('a string 2549'); break; + case 2550: if (n[2550]++ > 0) check ('a string 2550'); break; + case 2551: if (n[2551]++ > 0) check ('a string 2551'); break; + case 2552: if (n[2552]++ > 0) check ('a string 2552'); break; + case 2553: if (n[2553]++ > 0) check ('a string 2553'); break; + case 2554: if (n[2554]++ > 0) check ('a string 2554'); break; + case 2555: if (n[2555]++ > 0) check ('a string 2555'); break; + case 2556: if (n[2556]++ > 0) check ('a string 2556'); break; + case 2557: if (n[2557]++ > 0) check ('a string 2557'); break; + case 2558: if (n[2558]++ > 0) check ('a string 2558'); break; + case 2559: if (n[2559]++ > 0) check ('a string 2559'); break; + case 2560: if (n[2560]++ > 0) check ('a string 2560'); break; + case 2561: if (n[2561]++ > 0) check ('a string 2561'); break; + case 2562: if (n[2562]++ > 0) check ('a string 2562'); break; + case 2563: if (n[2563]++ > 0) check ('a string 2563'); break; + case 2564: if (n[2564]++ > 0) check ('a string 2564'); break; + case 2565: if (n[2565]++ > 0) check ('a string 2565'); break; + case 2566: if (n[2566]++ > 0) check ('a string 2566'); break; + case 2567: if (n[2567]++ > 0) check ('a string 2567'); break; + case 2568: if (n[2568]++ > 0) check ('a string 2568'); break; + case 2569: if (n[2569]++ > 0) check ('a string 2569'); break; + case 2570: if (n[2570]++ > 0) check ('a string 2570'); break; + case 2571: if (n[2571]++ > 0) check ('a string 2571'); break; + case 2572: if (n[2572]++ > 0) check ('a string 2572'); break; + case 2573: if (n[2573]++ > 0) check ('a string 2573'); break; + case 2574: if (n[2574]++ > 0) check ('a string 2574'); break; + case 2575: if (n[2575]++ > 0) check ('a string 2575'); break; + case 2576: if (n[2576]++ > 0) check ('a string 2576'); break; + case 2577: if (n[2577]++ > 0) check ('a string 2577'); break; + case 2578: if (n[2578]++ > 0) check ('a string 2578'); break; + case 2579: if (n[2579]++ > 0) check ('a string 2579'); break; + case 2580: if (n[2580]++ > 0) check ('a string 2580'); break; + case 2581: if (n[2581]++ > 0) check ('a string 2581'); break; + case 2582: if (n[2582]++ > 0) check ('a string 2582'); break; + case 2583: if (n[2583]++ > 0) check ('a string 2583'); break; + case 2584: if (n[2584]++ > 0) check ('a string 2584'); break; + case 2585: if (n[2585]++ > 0) check ('a string 2585'); break; + case 2586: if (n[2586]++ > 0) check ('a string 2586'); break; + case 2587: if (n[2587]++ > 0) check ('a string 2587'); break; + case 2588: if (n[2588]++ > 0) check ('a string 2588'); break; + case 2589: if (n[2589]++ > 0) check ('a string 2589'); break; + case 2590: if (n[2590]++ > 0) check ('a string 2590'); break; + case 2591: if (n[2591]++ > 0) check ('a string 2591'); break; + case 2592: if (n[2592]++ > 0) check ('a string 2592'); break; + case 2593: if (n[2593]++ > 0) check ('a string 2593'); break; + case 2594: if (n[2594]++ > 0) check ('a string 2594'); break; + case 2595: if (n[2595]++ > 0) check ('a string 2595'); break; + case 2596: if (n[2596]++ > 0) check ('a string 2596'); break; + case 2597: if (n[2597]++ > 0) check ('a string 2597'); break; + case 2598: if (n[2598]++ > 0) check ('a string 2598'); break; + case 2599: if (n[2599]++ > 0) check ('a string 2599'); break; + case 2600: if (n[2600]++ > 0) check ('a string 2600'); break; + case 2601: if (n[2601]++ > 0) check ('a string 2601'); break; + case 2602: if (n[2602]++ > 0) check ('a string 2602'); break; + case 2603: if (n[2603]++ > 0) check ('a string 2603'); break; + case 2604: if (n[2604]++ > 0) check ('a string 2604'); break; + case 2605: if (n[2605]++ > 0) check ('a string 2605'); break; + case 2606: if (n[2606]++ > 0) check ('a string 2606'); break; + case 2607: if (n[2607]++ > 0) check ('a string 2607'); break; + case 2608: if (n[2608]++ > 0) check ('a string 2608'); break; + case 2609: if (n[2609]++ > 0) check ('a string 2609'); break; + case 2610: if (n[2610]++ > 0) check ('a string 2610'); break; + case 2611: if (n[2611]++ > 0) check ('a string 2611'); break; + case 2612: if (n[2612]++ > 0) check ('a string 2612'); break; + case 2613: if (n[2613]++ > 0) check ('a string 2613'); break; + case 2614: if (n[2614]++ > 0) check ('a string 2614'); break; + case 2615: if (n[2615]++ > 0) check ('a string 2615'); break; + case 2616: if (n[2616]++ > 0) check ('a string 2616'); break; + case 2617: if (n[2617]++ > 0) check ('a string 2617'); break; + case 2618: if (n[2618]++ > 0) check ('a string 2618'); break; + case 2619: if (n[2619]++ > 0) check ('a string 2619'); break; + case 2620: if (n[2620]++ > 0) check ('a string 2620'); break; + case 2621: if (n[2621]++ > 0) check ('a string 2621'); break; + case 2622: if (n[2622]++ > 0) check ('a string 2622'); break; + case 2623: if (n[2623]++ > 0) check ('a string 2623'); break; + case 2624: if (n[2624]++ > 0) check ('a string 2624'); break; + case 2625: if (n[2625]++ > 0) check ('a string 2625'); break; + case 2626: if (n[2626]++ > 0) check ('a string 2626'); break; + case 2627: if (n[2627]++ > 0) check ('a string 2627'); break; + case 2628: if (n[2628]++ > 0) check ('a string 2628'); break; + case 2629: if (n[2629]++ > 0) check ('a string 2629'); break; + case 2630: if (n[2630]++ > 0) check ('a string 2630'); break; + case 2631: if (n[2631]++ > 0) check ('a string 2631'); break; + case 2632: if (n[2632]++ > 0) check ('a string 2632'); break; + case 2633: if (n[2633]++ > 0) check ('a string 2633'); break; + case 2634: if (n[2634]++ > 0) check ('a string 2634'); break; + case 2635: if (n[2635]++ > 0) check ('a string 2635'); break; + case 2636: if (n[2636]++ > 0) check ('a string 2636'); break; + case 2637: if (n[2637]++ > 0) check ('a string 2637'); break; + case 2638: if (n[2638]++ > 0) check ('a string 2638'); break; + case 2639: if (n[2639]++ > 0) check ('a string 2639'); break; + case 2640: if (n[2640]++ > 0) check ('a string 2640'); break; + case 2641: if (n[2641]++ > 0) check ('a string 2641'); break; + case 2642: if (n[2642]++ > 0) check ('a string 2642'); break; + case 2643: if (n[2643]++ > 0) check ('a string 2643'); break; + case 2644: if (n[2644]++ > 0) check ('a string 2644'); break; + case 2645: if (n[2645]++ > 0) check ('a string 2645'); break; + case 2646: if (n[2646]++ > 0) check ('a string 2646'); break; + case 2647: if (n[2647]++ > 0) check ('a string 2647'); break; + case 2648: if (n[2648]++ > 0) check ('a string 2648'); break; + case 2649: if (n[2649]++ > 0) check ('a string 2649'); break; + case 2650: if (n[2650]++ > 0) check ('a string 2650'); break; + case 2651: if (n[2651]++ > 0) check ('a string 2651'); break; + case 2652: if (n[2652]++ > 0) check ('a string 2652'); break; + case 2653: if (n[2653]++ > 0) check ('a string 2653'); break; + case 2654: if (n[2654]++ > 0) check ('a string 2654'); break; + case 2655: if (n[2655]++ > 0) check ('a string 2655'); break; + case 2656: if (n[2656]++ > 0) check ('a string 2656'); break; + case 2657: if (n[2657]++ > 0) check ('a string 2657'); break; + case 2658: if (n[2658]++ > 0) check ('a string 2658'); break; + case 2659: if (n[2659]++ > 0) check ('a string 2659'); break; + case 2660: if (n[2660]++ > 0) check ('a string 2660'); break; + case 2661: if (n[2661]++ > 0) check ('a string 2661'); break; + case 2662: if (n[2662]++ > 0) check ('a string 2662'); break; + case 2663: if (n[2663]++ > 0) check ('a string 2663'); break; + case 2664: if (n[2664]++ > 0) check ('a string 2664'); break; + case 2665: if (n[2665]++ > 0) check ('a string 2665'); break; + case 2666: if (n[2666]++ > 0) check ('a string 2666'); break; + case 2667: if (n[2667]++ > 0) check ('a string 2667'); break; + case 2668: if (n[2668]++ > 0) check ('a string 2668'); break; + case 2669: if (n[2669]++ > 0) check ('a string 2669'); break; + case 2670: if (n[2670]++ > 0) check ('a string 2670'); break; + case 2671: if (n[2671]++ > 0) check ('a string 2671'); break; + case 2672: if (n[2672]++ > 0) check ('a string 2672'); break; + case 2673: if (n[2673]++ > 0) check ('a string 2673'); break; + case 2674: if (n[2674]++ > 0) check ('a string 2674'); break; + case 2675: if (n[2675]++ > 0) check ('a string 2675'); break; + case 2676: if (n[2676]++ > 0) check ('a string 2676'); break; + case 2677: if (n[2677]++ > 0) check ('a string 2677'); break; + case 2678: if (n[2678]++ > 0) check ('a string 2678'); break; + case 2679: if (n[2679]++ > 0) check ('a string 2679'); break; + case 2680: if (n[2680]++ > 0) check ('a string 2680'); break; + case 2681: if (n[2681]++ > 0) check ('a string 2681'); break; + case 2682: if (n[2682]++ > 0) check ('a string 2682'); break; + case 2683: if (n[2683]++ > 0) check ('a string 2683'); break; + case 2684: if (n[2684]++ > 0) check ('a string 2684'); break; + case 2685: if (n[2685]++ > 0) check ('a string 2685'); break; + case 2686: if (n[2686]++ > 0) check ('a string 2686'); break; + case 2687: if (n[2687]++ > 0) check ('a string 2687'); break; + case 2688: if (n[2688]++ > 0) check ('a string 2688'); break; + case 2689: if (n[2689]++ > 0) check ('a string 2689'); break; + case 2690: if (n[2690]++ > 0) check ('a string 2690'); break; + case 2691: if (n[2691]++ > 0) check ('a string 2691'); break; + case 2692: if (n[2692]++ > 0) check ('a string 2692'); break; + case 2693: if (n[2693]++ > 0) check ('a string 2693'); break; + case 2694: if (n[2694]++ > 0) check ('a string 2694'); break; + case 2695: if (n[2695]++ > 0) check ('a string 2695'); break; + case 2696: if (n[2696]++ > 0) check ('a string 2696'); break; + case 2697: if (n[2697]++ > 0) check ('a string 2697'); break; + case 2698: if (n[2698]++ > 0) check ('a string 2698'); break; + case 2699: if (n[2699]++ > 0) check ('a string 2699'); break; + case 2700: if (n[2700]++ > 0) check ('a string 2700'); break; + case 2701: if (n[2701]++ > 0) check ('a string 2701'); break; + case 2702: if (n[2702]++ > 0) check ('a string 2702'); break; + case 2703: if (n[2703]++ > 0) check ('a string 2703'); break; + case 2704: if (n[2704]++ > 0) check ('a string 2704'); break; + case 2705: if (n[2705]++ > 0) check ('a string 2705'); break; + case 2706: if (n[2706]++ > 0) check ('a string 2706'); break; + case 2707: if (n[2707]++ > 0) check ('a string 2707'); break; + case 2708: if (n[2708]++ > 0) check ('a string 2708'); break; + case 2709: if (n[2709]++ > 0) check ('a string 2709'); break; + case 2710: if (n[2710]++ > 0) check ('a string 2710'); break; + case 2711: if (n[2711]++ > 0) check ('a string 2711'); break; + case 2712: if (n[2712]++ > 0) check ('a string 2712'); break; + case 2713: if (n[2713]++ > 0) check ('a string 2713'); break; + case 2714: if (n[2714]++ > 0) check ('a string 2714'); break; + case 2715: if (n[2715]++ > 0) check ('a string 2715'); break; + case 2716: if (n[2716]++ > 0) check ('a string 2716'); break; + case 2717: if (n[2717]++ > 0) check ('a string 2717'); break; + case 2718: if (n[2718]++ > 0) check ('a string 2718'); break; + case 2719: if (n[2719]++ > 0) check ('a string 2719'); break; + case 2720: if (n[2720]++ > 0) check ('a string 2720'); break; + case 2721: if (n[2721]++ > 0) check ('a string 2721'); break; + case 2722: if (n[2722]++ > 0) check ('a string 2722'); break; + case 2723: if (n[2723]++ > 0) check ('a string 2723'); break; + case 2724: if (n[2724]++ > 0) check ('a string 2724'); break; + case 2725: if (n[2725]++ > 0) check ('a string 2725'); break; + case 2726: if (n[2726]++ > 0) check ('a string 2726'); break; + case 2727: if (n[2727]++ > 0) check ('a string 2727'); break; + case 2728: if (n[2728]++ > 0) check ('a string 2728'); break; + case 2729: if (n[2729]++ > 0) check ('a string 2729'); break; + case 2730: if (n[2730]++ > 0) check ('a string 2730'); break; + case 2731: if (n[2731]++ > 0) check ('a string 2731'); break; + case 2732: if (n[2732]++ > 0) check ('a string 2732'); break; + case 2733: if (n[2733]++ > 0) check ('a string 2733'); break; + case 2734: if (n[2734]++ > 0) check ('a string 2734'); break; + case 2735: if (n[2735]++ > 0) check ('a string 2735'); break; + case 2736: if (n[2736]++ > 0) check ('a string 2736'); break; + case 2737: if (n[2737]++ > 0) check ('a string 2737'); break; + case 2738: if (n[2738]++ > 0) check ('a string 2738'); break; + case 2739: if (n[2739]++ > 0) check ('a string 2739'); break; + case 2740: if (n[2740]++ > 0) check ('a string 2740'); break; + case 2741: if (n[2741]++ > 0) check ('a string 2741'); break; + case 2742: if (n[2742]++ > 0) check ('a string 2742'); break; + case 2743: if (n[2743]++ > 0) check ('a string 2743'); break; + case 2744: if (n[2744]++ > 0) check ('a string 2744'); break; + case 2745: if (n[2745]++ > 0) check ('a string 2745'); break; + case 2746: if (n[2746]++ > 0) check ('a string 2746'); break; + case 2747: if (n[2747]++ > 0) check ('a string 2747'); break; + case 2748: if (n[2748]++ > 0) check ('a string 2748'); break; + case 2749: if (n[2749]++ > 0) check ('a string 2749'); break; + case 2750: if (n[2750]++ > 0) check ('a string 2750'); break; + case 2751: if (n[2751]++ > 0) check ('a string 2751'); break; + case 2752: if (n[2752]++ > 0) check ('a string 2752'); break; + case 2753: if (n[2753]++ > 0) check ('a string 2753'); break; + case 2754: if (n[2754]++ > 0) check ('a string 2754'); break; + case 2755: if (n[2755]++ > 0) check ('a string 2755'); break; + case 2756: if (n[2756]++ > 0) check ('a string 2756'); break; + case 2757: if (n[2757]++ > 0) check ('a string 2757'); break; + case 2758: if (n[2758]++ > 0) check ('a string 2758'); break; + case 2759: if (n[2759]++ > 0) check ('a string 2759'); break; + case 2760: if (n[2760]++ > 0) check ('a string 2760'); break; + case 2761: if (n[2761]++ > 0) check ('a string 2761'); break; + case 2762: if (n[2762]++ > 0) check ('a string 2762'); break; + case 2763: if (n[2763]++ > 0) check ('a string 2763'); break; + case 2764: if (n[2764]++ > 0) check ('a string 2764'); break; + case 2765: if (n[2765]++ > 0) check ('a string 2765'); break; + case 2766: if (n[2766]++ > 0) check ('a string 2766'); break; + case 2767: if (n[2767]++ > 0) check ('a string 2767'); break; + case 2768: if (n[2768]++ > 0) check ('a string 2768'); break; + case 2769: if (n[2769]++ > 0) check ('a string 2769'); break; + case 2770: if (n[2770]++ > 0) check ('a string 2770'); break; + case 2771: if (n[2771]++ > 0) check ('a string 2771'); break; + case 2772: if (n[2772]++ > 0) check ('a string 2772'); break; + case 2773: if (n[2773]++ > 0) check ('a string 2773'); break; + case 2774: if (n[2774]++ > 0) check ('a string 2774'); break; + case 2775: if (n[2775]++ > 0) check ('a string 2775'); break; + case 2776: if (n[2776]++ > 0) check ('a string 2776'); break; + case 2777: if (n[2777]++ > 0) check ('a string 2777'); break; + case 2778: if (n[2778]++ > 0) check ('a string 2778'); break; + case 2779: if (n[2779]++ > 0) check ('a string 2779'); break; + case 2780: if (n[2780]++ > 0) check ('a string 2780'); break; + case 2781: if (n[2781]++ > 0) check ('a string 2781'); break; + case 2782: if (n[2782]++ > 0) check ('a string 2782'); break; + case 2783: if (n[2783]++ > 0) check ('a string 2783'); break; + case 2784: if (n[2784]++ > 0) check ('a string 2784'); break; + case 2785: if (n[2785]++ > 0) check ('a string 2785'); break; + case 2786: if (n[2786]++ > 0) check ('a string 2786'); break; + case 2787: if (n[2787]++ > 0) check ('a string 2787'); break; + case 2788: if (n[2788]++ > 0) check ('a string 2788'); break; + case 2789: if (n[2789]++ > 0) check ('a string 2789'); break; + case 2790: if (n[2790]++ > 0) check ('a string 2790'); break; + case 2791: if (n[2791]++ > 0) check ('a string 2791'); break; + case 2792: if (n[2792]++ > 0) check ('a string 2792'); break; + case 2793: if (n[2793]++ > 0) check ('a string 2793'); break; + case 2794: if (n[2794]++ > 0) check ('a string 2794'); break; + case 2795: if (n[2795]++ > 0) check ('a string 2795'); break; + case 2796: if (n[2796]++ > 0) check ('a string 2796'); break; + case 2797: if (n[2797]++ > 0) check ('a string 2797'); break; + case 2798: if (n[2798]++ > 0) check ('a string 2798'); break; + case 2799: if (n[2799]++ > 0) check ('a string 2799'); break; + case 2800: if (n[2800]++ > 0) check ('a string 2800'); break; + case 2801: if (n[2801]++ > 0) check ('a string 2801'); break; + case 2802: if (n[2802]++ > 0) check ('a string 2802'); break; + case 2803: if (n[2803]++ > 0) check ('a string 2803'); break; + case 2804: if (n[2804]++ > 0) check ('a string 2804'); break; + case 2805: if (n[2805]++ > 0) check ('a string 2805'); break; + case 2806: if (n[2806]++ > 0) check ('a string 2806'); break; + case 2807: if (n[2807]++ > 0) check ('a string 2807'); break; + case 2808: if (n[2808]++ > 0) check ('a string 2808'); break; + case 2809: if (n[2809]++ > 0) check ('a string 2809'); break; + case 2810: if (n[2810]++ > 0) check ('a string 2810'); break; + case 2811: if (n[2811]++ > 0) check ('a string 2811'); break; + case 2812: if (n[2812]++ > 0) check ('a string 2812'); break; + case 2813: if (n[2813]++ > 0) check ('a string 2813'); break; + case 2814: if (n[2814]++ > 0) check ('a string 2814'); break; + case 2815: if (n[2815]++ > 0) check ('a string 2815'); break; + case 2816: if (n[2816]++ > 0) check ('a string 2816'); break; + case 2817: if (n[2817]++ > 0) check ('a string 2817'); break; + case 2818: if (n[2818]++ > 0) check ('a string 2818'); break; + case 2819: if (n[2819]++ > 0) check ('a string 2819'); break; + case 2820: if (n[2820]++ > 0) check ('a string 2820'); break; + case 2821: if (n[2821]++ > 0) check ('a string 2821'); break; + case 2822: if (n[2822]++ > 0) check ('a string 2822'); break; + case 2823: if (n[2823]++ > 0) check ('a string 2823'); break; + case 2824: if (n[2824]++ > 0) check ('a string 2824'); break; + case 2825: if (n[2825]++ > 0) check ('a string 2825'); break; + case 2826: if (n[2826]++ > 0) check ('a string 2826'); break; + case 2827: if (n[2827]++ > 0) check ('a string 2827'); break; + case 2828: if (n[2828]++ > 0) check ('a string 2828'); break; + case 2829: if (n[2829]++ > 0) check ('a string 2829'); break; + case 2830: if (n[2830]++ > 0) check ('a string 2830'); break; + case 2831: if (n[2831]++ > 0) check ('a string 2831'); break; + case 2832: if (n[2832]++ > 0) check ('a string 2832'); break; + case 2833: if (n[2833]++ > 0) check ('a string 2833'); break; + case 2834: if (n[2834]++ > 0) check ('a string 2834'); break; + case 2835: if (n[2835]++ > 0) check ('a string 2835'); break; + case 2836: if (n[2836]++ > 0) check ('a string 2836'); break; + case 2837: if (n[2837]++ > 0) check ('a string 2837'); break; + case 2838: if (n[2838]++ > 0) check ('a string 2838'); break; + case 2839: if (n[2839]++ > 0) check ('a string 2839'); break; + case 2840: if (n[2840]++ > 0) check ('a string 2840'); break; + case 2841: if (n[2841]++ > 0) check ('a string 2841'); break; + case 2842: if (n[2842]++ > 0) check ('a string 2842'); break; + case 2843: if (n[2843]++ > 0) check ('a string 2843'); break; + case 2844: if (n[2844]++ > 0) check ('a string 2844'); break; + case 2845: if (n[2845]++ > 0) check ('a string 2845'); break; + case 2846: if (n[2846]++ > 0) check ('a string 2846'); break; + case 2847: if (n[2847]++ > 0) check ('a string 2847'); break; + case 2848: if (n[2848]++ > 0) check ('a string 2848'); break; + case 2849: if (n[2849]++ > 0) check ('a string 2849'); break; + case 2850: if (n[2850]++ > 0) check ('a string 2850'); break; + case 2851: if (n[2851]++ > 0) check ('a string 2851'); break; + case 2852: if (n[2852]++ > 0) check ('a string 2852'); break; + case 2853: if (n[2853]++ > 0) check ('a string 2853'); break; + case 2854: if (n[2854]++ > 0) check ('a string 2854'); break; + case 2855: if (n[2855]++ > 0) check ('a string 2855'); break; + case 2856: if (n[2856]++ > 0) check ('a string 2856'); break; + case 2857: if (n[2857]++ > 0) check ('a string 2857'); break; + case 2858: if (n[2858]++ > 0) check ('a string 2858'); break; + case 2859: if (n[2859]++ > 0) check ('a string 2859'); break; + case 2860: if (n[2860]++ > 0) check ('a string 2860'); break; + case 2861: if (n[2861]++ > 0) check ('a string 2861'); break; + case 2862: if (n[2862]++ > 0) check ('a string 2862'); break; + case 2863: if (n[2863]++ > 0) check ('a string 2863'); break; + case 2864: if (n[2864]++ > 0) check ('a string 2864'); break; + case 2865: if (n[2865]++ > 0) check ('a string 2865'); break; + case 2866: if (n[2866]++ > 0) check ('a string 2866'); break; + case 2867: if (n[2867]++ > 0) check ('a string 2867'); break; + case 2868: if (n[2868]++ > 0) check ('a string 2868'); break; + case 2869: if (n[2869]++ > 0) check ('a string 2869'); break; + case 2870: if (n[2870]++ > 0) check ('a string 2870'); break; + case 2871: if (n[2871]++ > 0) check ('a string 2871'); break; + case 2872: if (n[2872]++ > 0) check ('a string 2872'); break; + case 2873: if (n[2873]++ > 0) check ('a string 2873'); break; + case 2874: if (n[2874]++ > 0) check ('a string 2874'); break; + case 2875: if (n[2875]++ > 0) check ('a string 2875'); break; + case 2876: if (n[2876]++ > 0) check ('a string 2876'); break; + case 2877: if (n[2877]++ > 0) check ('a string 2877'); break; + case 2878: if (n[2878]++ > 0) check ('a string 2878'); break; + case 2879: if (n[2879]++ > 0) check ('a string 2879'); break; + case 2880: if (n[2880]++ > 0) check ('a string 2880'); break; + case 2881: if (n[2881]++ > 0) check ('a string 2881'); break; + case 2882: if (n[2882]++ > 0) check ('a string 2882'); break; + case 2883: if (n[2883]++ > 0) check ('a string 2883'); break; + case 2884: if (n[2884]++ > 0) check ('a string 2884'); break; + case 2885: if (n[2885]++ > 0) check ('a string 2885'); break; + case 2886: if (n[2886]++ > 0) check ('a string 2886'); break; + case 2887: if (n[2887]++ > 0) check ('a string 2887'); break; + case 2888: if (n[2888]++ > 0) check ('a string 2888'); break; + case 2889: if (n[2889]++ > 0) check ('a string 2889'); break; + case 2890: if (n[2890]++ > 0) check ('a string 2890'); break; + case 2891: if (n[2891]++ > 0) check ('a string 2891'); break; + case 2892: if (n[2892]++ > 0) check ('a string 2892'); break; + case 2893: if (n[2893]++ > 0) check ('a string 2893'); break; + case 2894: if (n[2894]++ > 0) check ('a string 2894'); break; + case 2895: if (n[2895]++ > 0) check ('a string 2895'); break; + case 2896: if (n[2896]++ > 0) check ('a string 2896'); break; + case 2897: if (n[2897]++ > 0) check ('a string 2897'); break; + case 2898: if (n[2898]++ > 0) check ('a string 2898'); break; + case 2899: if (n[2899]++ > 0) check ('a string 2899'); break; + case 2900: if (n[2900]++ > 0) check ('a string 2900'); break; + case 2901: if (n[2901]++ > 0) check ('a string 2901'); break; + case 2902: if (n[2902]++ > 0) check ('a string 2902'); break; + case 2903: if (n[2903]++ > 0) check ('a string 2903'); break; + case 2904: if (n[2904]++ > 0) check ('a string 2904'); break; + case 2905: if (n[2905]++ > 0) check ('a string 2905'); break; + case 2906: if (n[2906]++ > 0) check ('a string 2906'); break; + case 2907: if (n[2907]++ > 0) check ('a string 2907'); break; + case 2908: if (n[2908]++ > 0) check ('a string 2908'); break; + case 2909: if (n[2909]++ > 0) check ('a string 2909'); break; + case 2910: if (n[2910]++ > 0) check ('a string 2910'); break; + case 2911: if (n[2911]++ > 0) check ('a string 2911'); break; + case 2912: if (n[2912]++ > 0) check ('a string 2912'); break; + case 2913: if (n[2913]++ > 0) check ('a string 2913'); break; + case 2914: if (n[2914]++ > 0) check ('a string 2914'); break; + case 2915: if (n[2915]++ > 0) check ('a string 2915'); break; + case 2916: if (n[2916]++ > 0) check ('a string 2916'); break; + case 2917: if (n[2917]++ > 0) check ('a string 2917'); break; + case 2918: if (n[2918]++ > 0) check ('a string 2918'); break; + case 2919: if (n[2919]++ > 0) check ('a string 2919'); break; + case 2920: if (n[2920]++ > 0) check ('a string 2920'); break; + case 2921: if (n[2921]++ > 0) check ('a string 2921'); break; + case 2922: if (n[2922]++ > 0) check ('a string 2922'); break; + case 2923: if (n[2923]++ > 0) check ('a string 2923'); break; + case 2924: if (n[2924]++ > 0) check ('a string 2924'); break; + case 2925: if (n[2925]++ > 0) check ('a string 2925'); break; + case 2926: if (n[2926]++ > 0) check ('a string 2926'); break; + case 2927: if (n[2927]++ > 0) check ('a string 2927'); break; + case 2928: if (n[2928]++ > 0) check ('a string 2928'); break; + case 2929: if (n[2929]++ > 0) check ('a string 2929'); break; + case 2930: if (n[2930]++ > 0) check ('a string 2930'); break; + case 2931: if (n[2931]++ > 0) check ('a string 2931'); break; + case 2932: if (n[2932]++ > 0) check ('a string 2932'); break; + case 2933: if (n[2933]++ > 0) check ('a string 2933'); break; + case 2934: if (n[2934]++ > 0) check ('a string 2934'); break; + case 2935: if (n[2935]++ > 0) check ('a string 2935'); break; + case 2936: if (n[2936]++ > 0) check ('a string 2936'); break; + case 2937: if (n[2937]++ > 0) check ('a string 2937'); break; + case 2938: if (n[2938]++ > 0) check ('a string 2938'); break; + case 2939: if (n[2939]++ > 0) check ('a string 2939'); break; + case 2940: if (n[2940]++ > 0) check ('a string 2940'); break; + case 2941: if (n[2941]++ > 0) check ('a string 2941'); break; + case 2942: if (n[2942]++ > 0) check ('a string 2942'); break; + case 2943: if (n[2943]++ > 0) check ('a string 2943'); break; + case 2944: if (n[2944]++ > 0) check ('a string 2944'); break; + case 2945: if (n[2945]++ > 0) check ('a string 2945'); break; + case 2946: if (n[2946]++ > 0) check ('a string 2946'); break; + case 2947: if (n[2947]++ > 0) check ('a string 2947'); break; + case 2948: if (n[2948]++ > 0) check ('a string 2948'); break; + case 2949: if (n[2949]++ > 0) check ('a string 2949'); break; + case 2950: if (n[2950]++ > 0) check ('a string 2950'); break; + case 2951: if (n[2951]++ > 0) check ('a string 2951'); break; + case 2952: if (n[2952]++ > 0) check ('a string 2952'); break; + case 2953: if (n[2953]++ > 0) check ('a string 2953'); break; + case 2954: if (n[2954]++ > 0) check ('a string 2954'); break; + case 2955: if (n[2955]++ > 0) check ('a string 2955'); break; + case 2956: if (n[2956]++ > 0) check ('a string 2956'); break; + case 2957: if (n[2957]++ > 0) check ('a string 2957'); break; + case 2958: if (n[2958]++ > 0) check ('a string 2958'); break; + case 2959: if (n[2959]++ > 0) check ('a string 2959'); break; + case 2960: if (n[2960]++ > 0) check ('a string 2960'); break; + case 2961: if (n[2961]++ > 0) check ('a string 2961'); break; + case 2962: if (n[2962]++ > 0) check ('a string 2962'); break; + case 2963: if (n[2963]++ > 0) check ('a string 2963'); break; + case 2964: if (n[2964]++ > 0) check ('a string 2964'); break; + case 2965: if (n[2965]++ > 0) check ('a string 2965'); break; + case 2966: if (n[2966]++ > 0) check ('a string 2966'); break; + case 2967: if (n[2967]++ > 0) check ('a string 2967'); break; + case 2968: if (n[2968]++ > 0) check ('a string 2968'); break; + case 2969: if (n[2969]++ > 0) check ('a string 2969'); break; + case 2970: if (n[2970]++ > 0) check ('a string 2970'); break; + case 2971: if (n[2971]++ > 0) check ('a string 2971'); break; + case 2972: if (n[2972]++ > 0) check ('a string 2972'); break; + case 2973: if (n[2973]++ > 0) check ('a string 2973'); break; + case 2974: if (n[2974]++ > 0) check ('a string 2974'); break; + case 2975: if (n[2975]++ > 0) check ('a string 2975'); break; + case 2976: if (n[2976]++ > 0) check ('a string 2976'); break; + case 2977: if (n[2977]++ > 0) check ('a string 2977'); break; + case 2978: if (n[2978]++ > 0) check ('a string 2978'); break; + case 2979: if (n[2979]++ > 0) check ('a string 2979'); break; + case 2980: if (n[2980]++ > 0) check ('a string 2980'); break; + case 2981: if (n[2981]++ > 0) check ('a string 2981'); break; + case 2982: if (n[2982]++ > 0) check ('a string 2982'); break; + case 2983: if (n[2983]++ > 0) check ('a string 2983'); break; + case 2984: if (n[2984]++ > 0) check ('a string 2984'); break; + case 2985: if (n[2985]++ > 0) check ('a string 2985'); break; + case 2986: if (n[2986]++ > 0) check ('a string 2986'); break; + case 2987: if (n[2987]++ > 0) check ('a string 2987'); break; + case 2988: if (n[2988]++ > 0) check ('a string 2988'); break; + case 2989: if (n[2989]++ > 0) check ('a string 2989'); break; + case 2990: if (n[2990]++ > 0) check ('a string 2990'); break; + case 2991: if (n[2991]++ > 0) check ('a string 2991'); break; + case 2992: if (n[2992]++ > 0) check ('a string 2992'); break; + case 2993: if (n[2993]++ > 0) check ('a string 2993'); break; + case 2994: if (n[2994]++ > 0) check ('a string 2994'); break; + case 2995: if (n[2995]++ > 0) check ('a string 2995'); break; + case 2996: if (n[2996]++ > 0) check ('a string 2996'); break; + case 2997: if (n[2997]++ > 0) check ('a string 2997'); break; + case 2998: if (n[2998]++ > 0) check ('a string 2998'); break; + case 2999: if (n[2999]++ > 0) check ('a string 2999'); break; + case 3000: if (n[3000]++ > 0) check ('a string 3000'); break; + case 3001: if (n[3001]++ > 0) check ('a string 3001'); break; + case 3002: if (n[3002]++ > 0) check ('a string 3002'); break; + case 3003: if (n[3003]++ > 0) check ('a string 3003'); break; + case 3004: if (n[3004]++ > 0) check ('a string 3004'); break; + case 3005: if (n[3005]++ > 0) check ('a string 3005'); break; + case 3006: if (n[3006]++ > 0) check ('a string 3006'); break; + case 3007: if (n[3007]++ > 0) check ('a string 3007'); break; + case 3008: if (n[3008]++ > 0) check ('a string 3008'); break; + case 3009: if (n[3009]++ > 0) check ('a string 3009'); break; + default : if (n[3010]++ > 0) check ('a string 3010'); break; + } + } + + b4(); + b_after(); +} + + +function check(status) +{ + print('k = ' + k + ' j = ' + j + ' ' + status); + + for (i = 0; i < i2; i++) + { + if (n[i] != 1) + { + print('n[' + i + '] = ' + n[i]); + if (i != j) + { + print('Test failed'); + err_num++; + break; + } + } + } +} + + +function b4() +{ + print('Visited b4'); +} + + +function b_after() +{ + print('Visited b_after'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js new file mode 100644 index 0000000..6841fd5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js @@ -0,0 +1,59 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, epstein@tellme.com +* Date: 23 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 82306 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=82306 +* +* This test used to crash the JS engine. This was discovered +* by Mike Epstein <epstein@tellme.com> +*/ +//------------------------------------------------------------------------------------------------- +var bug = 82306; +var summary = "Testing we don't crash on encodeURI()"; +var URI = ''; + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + URI += '<?xml version="1.0"?>'; + URI += '<zcti application="xxxx_demo">'; + URI += '<pstn_data>'; + URI += '<ani>650-930-xxxx</ani>'; + URI += '<dnis>877-485-xxxx</dnis>'; + URI += '</pstn_data>'; + URI += '<keyvalue key="name" value="xxx"/>'; + URI += '<keyvalue key="phone" value="6509309000"/>'; + URI += '</zcti>'; + + // Just testing that we don't crash on this + encodeURI(URI); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js new file mode 100644 index 0000000..ba4e1db --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js @@ -0,0 +1,2130 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-12 +* +* SUMMARY: Regression test for bug 89443 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=89443 +* +* Just seeing if this script will compile without stack overflow. +*/ +//------------------------------------------------------------------------------------------------- +var bug = 89443; +var summary = 'Testing this script will compile without stack overflow'; + +printBugNumber (bug); +printStatus (summary); + + +// I don't know what these functions are supposed to be; use dummies - +function isPlainHostName() +{ +} + +function dnsDomainIs() +{ +} + +// Here's the big function - +function FindProxyForURL(url, host) +{ + +if (isPlainHostName(host) +|| dnsDomainIs(host, ".hennepin.lib.mn.us") +|| dnsDomainIs(host, ".hclib.org") +) + return "DIRECT"; +else if (isPlainHostName(host) + +// subscription database access + +|| dnsDomainIs(host, ".asahi.com") +|| dnsDomainIs(host, ".2facts.com") +|| dnsDomainIs(host, ".oclc.org") +|| dnsDomainIs(host, ".collegesource.com") +|| dnsDomainIs(host, ".cq.com") +|| dnsDomainIs(host, ".grolier.com") +|| dnsDomainIs(host, ".groveart.com") +|| dnsDomainIs(host, ".groveopera.com") +|| dnsDomainIs(host, ".fsonline.com") +|| dnsDomainIs(host, ".carl.org") +|| dnsDomainIs(host, ".newslibrary.com") +|| dnsDomainIs(host, ".pioneerplanet.com") +|| dnsDomainIs(host, ".startribune.com") +|| dnsDomainIs(host, ".poemfinder.com") +|| dnsDomainIs(host, ".umi.com") +|| dnsDomainIs(host, ".referenceusa.com") +|| dnsDomainIs(host, ".sirs.com") +|| dnsDomainIs(host, ".krmediastream.com") +|| dnsDomainIs(host, ".gale.com") +|| dnsDomainIs(host, ".galenet.com") +|| dnsDomainIs(host, ".galegroup.com") +|| dnsDomainIs(host, ".facts.com") +|| dnsDomainIs(host, ".eb.com") +|| dnsDomainIs(host, ".worldbookonline.com") +|| dnsDomainIs(host, ".galegroup.com") +|| dnsDomainIs(host, ".accessscience.com") +|| dnsDomainIs(host, ".booksinprint.com") +|| dnsDomainIs(host, ".infolearning.com") +|| dnsDomainIs(host, ".standardpoor.com") + +// image servers +|| dnsDomainIs(host, ".akamaitech.net") +|| dnsDomainIs(host, ".akamai.net") +|| dnsDomainIs(host, ".yimg.com") +|| dnsDomainIs(host, ".imgis.com") +|| dnsDomainIs(host, ".ibsys.com") + +// KidsClick-linked kids search engines +|| dnsDomainIs(host, ".edview.com") +|| dnsDomainIs(host, ".searchopolis.com") +|| dnsDomainIs(host, ".onekey.com") +|| dnsDomainIs(host, ".askjeeves.com") + +// Non-subscription Reference Tools URLs from the RecWebSites DBData table + || dnsDomainIs(host, "www.cnn.com") + || dnsDomainIs(host, "www.emulateme.com") + || dnsDomainIs(host, "terraserver.microsoft.com") + || dnsDomainIs(host, "www.theodora.com") + || dnsDomainIs(host, "www.3datlas.com") + || dnsDomainIs(host, "www.infoplease.com") + || dnsDomainIs(host, "www.switchboard.com") + || dnsDomainIs(host, "www.bartleby.com") + || dnsDomainIs(host, "www.mn-politics.com") + || dnsDomainIs(host, "www.thesaurus.com") + || dnsDomainIs(host, "www.usnews.com") + || dnsDomainIs(host, "www.petersons.com") + || dnsDomainIs(host, "www.collegenet.com") + || dnsDomainIs(host, "www.m-w.com") + || dnsDomainIs(host, "clever.net") + || dnsDomainIs(host, "maps.expedia.com") + || dnsDomainIs(host, "www.CollegeEdge.com") + || dnsDomainIs(host, "www.homeworkcentral.com") + || dnsDomainIs(host, "www.studyweb.com") + || dnsDomainIs(host, "www.mnpro.com") + +// custom URLs for local and other access +|| dnsDomainIs(host, ".dsdukes.com") +|| dnsDomainIs(host, ".spsaints.com") +|| dnsDomainIs(host, ".mnzoo.com") +|| dnsDomainIs(host, ".realaudio.com") +|| dnsDomainIs(host, ".co.hennepin.mn.us") +|| dnsDomainIs(host, ".gov") +|| dnsDomainIs(host, ".org") +|| dnsDomainIs(host, ".edu") +|| dnsDomainIs(host, ".fox29.com") +|| dnsDomainIs(host, ".wcco.com") +|| dnsDomainIs(host, ".kstp.com") +|| dnsDomainIs(host, ".kmsp.com") +|| dnsDomainIs(host, ".kare11.com") +|| dnsDomainIs(host, ".macromedia.com") +|| dnsDomainIs(host, ".shockwave.com") +|| dnsDomainIs(host, ".wwf.com") +|| dnsDomainIs(host, ".wwfsuperstars.com") +|| dnsDomainIs(host, ".summerslam.com") +|| dnsDomainIs(host, ".yahooligans.com") +|| dnsDomainIs(host, ".mhoob.com") +|| dnsDomainIs(host, "www.hmonginternet.com") +|| dnsDomainIs(host, "www.hmongonline.com") +|| dnsDomainIs(host, ".yahoo.com") +|| dnsDomainIs(host, ".pokemon.com") +|| dnsDomainIs(host, ".bet.com") +|| dnsDomainIs(host, ".smallworld.com") +|| dnsDomainIs(host, ".cartoonnetwork.com") +|| dnsDomainIs(host, ".carmensandiego.com") +|| dnsDomainIs(host, ".disney.com") +|| dnsDomainIs(host, ".powerpuffgirls.com") +|| dnsDomainIs(host, ".aol.com") + +// Smithsonian +|| dnsDomainIs(host, "160.111.100.190") + +// Hotmail +|| dnsDomainIs(host, ".passport.com") +|| dnsDomainIs(host, ".hotmail.com") +|| dnsDomainIs(host, "216.33.236.24") +|| dnsDomainIs(host, "216.32.182.251") +|| dnsDomainIs(host, ".hotmail.msn.com") + +// K12 schools +|| dnsDomainIs(host, ".k12.al.us") +|| dnsDomainIs(host, ".k12.ak.us") +|| dnsDomainIs(host, ".k12.ar.us") +|| dnsDomainIs(host, ".k12.az.us") +|| dnsDomainIs(host, ".k12.ca.us") +|| dnsDomainIs(host, ".k12.co.us") +|| dnsDomainIs(host, ".k12.ct.us") +|| dnsDomainIs(host, ".k12.dc.us") +|| dnsDomainIs(host, ".k12.de.us") +|| dnsDomainIs(host, ".k12.fl.us") +|| dnsDomainIs(host, ".k12.ga.us") +|| dnsDomainIs(host, ".k12.hi.us") +|| dnsDomainIs(host, ".k12.id.us") +|| dnsDomainIs(host, ".k12.il.us") +|| dnsDomainIs(host, ".k12.in.us") +|| dnsDomainIs(host, ".k12.ia.us") +|| dnsDomainIs(host, ".k12.ks.us") +|| dnsDomainIs(host, ".k12.ky.us") +|| dnsDomainIs(host, ".k12.la.us") +|| dnsDomainIs(host, ".k12.me.us") +|| dnsDomainIs(host, ".k12.md.us") +|| dnsDomainIs(host, ".k12.ma.us") +|| dnsDomainIs(host, ".k12.mi.us") +|| dnsDomainIs(host, ".k12.mn.us") +|| dnsDomainIs(host, ".k12.ms.us") +|| dnsDomainIs(host, ".k12.mo.us") +|| dnsDomainIs(host, ".k12.mt.us") +|| dnsDomainIs(host, ".k12.ne.us") +|| dnsDomainIs(host, ".k12.nv.us") +|| dnsDomainIs(host, ".k12.nh.us") +|| dnsDomainIs(host, ".k12.nj.us") +|| dnsDomainIs(host, ".k12.nm.us") +|| dnsDomainIs(host, ".k12.ny.us") +|| dnsDomainIs(host, ".k12.nc.us") +|| dnsDomainIs(host, ".k12.nd.us") +|| dnsDomainIs(host, ".k12.oh.us") +|| dnsDomainIs(host, ".k12.ok.us") +|| dnsDomainIs(host, ".k12.or.us") +|| dnsDomainIs(host, ".k12.pa.us") +|| dnsDomainIs(host, ".k12.ri.us") +|| dnsDomainIs(host, ".k12.sc.us") +|| dnsDomainIs(host, ".k12.sd.us") +|| dnsDomainIs(host, ".k12.tn.us") +|| dnsDomainIs(host, ".k12.tx.us") +|| dnsDomainIs(host, ".k12.ut.us") +|| dnsDomainIs(host, ".k12.vt.us") +|| dnsDomainIs(host, ".k12.va.us") +|| dnsDomainIs(host, ".k12.wa.us") +|| dnsDomainIs(host, ".k12.wv.us") +|| dnsDomainIs(host, ".k12.wi.us") +|| dnsDomainIs(host, ".k12.wy.us") + +// U.S. Libraries +|| dnsDomainIs(host, ".lib.al.us") +|| dnsDomainIs(host, ".lib.ak.us") +|| dnsDomainIs(host, ".lib.ar.us") +|| dnsDomainIs(host, ".lib.az.us") +|| dnsDomainIs(host, ".lib.ca.us") +|| dnsDomainIs(host, ".lib.co.us") +|| dnsDomainIs(host, ".lib.ct.us") +|| dnsDomainIs(host, ".lib.dc.us") +|| dnsDomainIs(host, ".lib.de.us") +|| dnsDomainIs(host, ".lib.fl.us") +|| dnsDomainIs(host, ".lib.ga.us") +|| dnsDomainIs(host, ".lib.hi.us") +|| dnsDomainIs(host, ".lib.id.us") +|| dnsDomainIs(host, ".lib.il.us") +|| dnsDomainIs(host, ".lib.in.us") +|| dnsDomainIs(host, ".lib.ia.us") +|| dnsDomainIs(host, ".lib.ks.us") +|| dnsDomainIs(host, ".lib.ky.us") +|| dnsDomainIs(host, ".lib.la.us") +|| dnsDomainIs(host, ".lib.me.us") +|| dnsDomainIs(host, ".lib.md.us") +|| dnsDomainIs(host, ".lib.ma.us") +|| dnsDomainIs(host, ".lib.mi.us") +|| dnsDomainIs(host, ".lib.mn.us") +|| dnsDomainIs(host, ".lib.ms.us") +|| dnsDomainIs(host, ".lib.mo.us") +|| dnsDomainIs(host, ".lib.mt.us") +|| dnsDomainIs(host, ".lib.ne.us") +|| dnsDomainIs(host, ".lib.nv.us") +|| dnsDomainIs(host, ".lib.nh.us") +|| dnsDomainIs(host, ".lib.nj.us") +|| dnsDomainIs(host, ".lib.nm.us") +|| dnsDomainIs(host, ".lib.ny.us") +|| dnsDomainIs(host, ".lib.nc.us") +|| dnsDomainIs(host, ".lib.nd.us") +|| dnsDomainIs(host, ".lib.oh.us") +|| dnsDomainIs(host, ".lib.ok.us") +|| dnsDomainIs(host, ".lib.or.us") +|| dnsDomainIs(host, ".lib.pa.us") +|| dnsDomainIs(host, ".lib.ri.us") +|| dnsDomainIs(host, ".lib.sc.us") +|| dnsDomainIs(host, ".lib.sd.us") +|| dnsDomainIs(host, ".lib.tn.us") +|| dnsDomainIs(host, ".lib.tx.us") +|| dnsDomainIs(host, ".lib.ut.us") +|| dnsDomainIs(host, ".lib.vt.us") +|| dnsDomainIs(host, ".lib.va.us") +|| dnsDomainIs(host, ".lib.wa.us") +|| dnsDomainIs(host, ".lib.wv.us") +|| dnsDomainIs(host, ".lib.wi.us") +|| dnsDomainIs(host, ".lib.wy.us") + +// U.S. Cities +|| dnsDomainIs(host, ".ci.al.us") +|| dnsDomainIs(host, ".ci.ak.us") +|| dnsDomainIs(host, ".ci.ar.us") +|| dnsDomainIs(host, ".ci.az.us") +|| dnsDomainIs(host, ".ci.ca.us") +|| dnsDomainIs(host, ".ci.co.us") +|| dnsDomainIs(host, ".ci.ct.us") +|| dnsDomainIs(host, ".ci.dc.us") +|| dnsDomainIs(host, ".ci.de.us") +|| dnsDomainIs(host, ".ci.fl.us") +|| dnsDomainIs(host, ".ci.ga.us") +|| dnsDomainIs(host, ".ci.hi.us") +|| dnsDomainIs(host, ".ci.id.us") +|| dnsDomainIs(host, ".ci.il.us") +|| dnsDomainIs(host, ".ci.in.us") +|| dnsDomainIs(host, ".ci.ia.us") +|| dnsDomainIs(host, ".ci.ks.us") +|| dnsDomainIs(host, ".ci.ky.us") +|| dnsDomainIs(host, ".ci.la.us") +|| dnsDomainIs(host, ".ci.me.us") +|| dnsDomainIs(host, ".ci.md.us") +|| dnsDomainIs(host, ".ci.ma.us") +|| dnsDomainIs(host, ".ci.mi.us") +|| dnsDomainIs(host, ".ci.mn.us") +|| dnsDomainIs(host, ".ci.ms.us") +|| dnsDomainIs(host, ".ci.mo.us") +|| dnsDomainIs(host, ".ci.mt.us") +|| dnsDomainIs(host, ".ci.ne.us") +|| dnsDomainIs(host, ".ci.nv.us") +|| dnsDomainIs(host, ".ci.nh.us") +|| dnsDomainIs(host, ".ci.nj.us") +|| dnsDomainIs(host, ".ci.nm.us") +|| dnsDomainIs(host, ".ci.ny.us") +|| dnsDomainIs(host, ".ci.nc.us") +|| dnsDomainIs(host, ".ci.nd.us") +|| dnsDomainIs(host, ".ci.oh.us") +|| dnsDomainIs(host, ".ci.ok.us") +|| dnsDomainIs(host, ".ci.or.us") +|| dnsDomainIs(host, ".ci.pa.us") +|| dnsDomainIs(host, ".ci.ri.us") +|| dnsDomainIs(host, ".ci.sc.us") +|| dnsDomainIs(host, ".ci.sd.us") +|| dnsDomainIs(host, ".ci.tn.us") +|| dnsDomainIs(host, ".ci.tx.us") +|| dnsDomainIs(host, ".ci.ut.us") +|| dnsDomainIs(host, ".ci.vt.us") +|| dnsDomainIs(host, ".ci.va.us") +|| dnsDomainIs(host, ".ci.wa.us") +|| dnsDomainIs(host, ".ci.wv.us") +|| dnsDomainIs(host, ".ci.wi.us") +|| dnsDomainIs(host, ".ci.wy.us") + +// U.S. Counties +|| dnsDomainIs(host, ".co.al.us") +|| dnsDomainIs(host, ".co.ak.us") +|| dnsDomainIs(host, ".co.ar.us") +|| dnsDomainIs(host, ".co.az.us") +|| dnsDomainIs(host, ".co.ca.us") +|| dnsDomainIs(host, ".co.co.us") +|| dnsDomainIs(host, ".co.ct.us") +|| dnsDomainIs(host, ".co.dc.us") +|| dnsDomainIs(host, ".co.de.us") +|| dnsDomainIs(host, ".co.fl.us") +|| dnsDomainIs(host, ".co.ga.us") +|| dnsDomainIs(host, ".co.hi.us") +|| dnsDomainIs(host, ".co.id.us") +|| dnsDomainIs(host, ".co.il.us") +|| dnsDomainIs(host, ".co.in.us") +|| dnsDomainIs(host, ".co.ia.us") +|| dnsDomainIs(host, ".co.ks.us") +|| dnsDomainIs(host, ".co.ky.us") +|| dnsDomainIs(host, ".co.la.us") +|| dnsDomainIs(host, ".co.me.us") +|| dnsDomainIs(host, ".co.md.us") +|| dnsDomainIs(host, ".co.ma.us") +|| dnsDomainIs(host, ".co.mi.us") +|| dnsDomainIs(host, ".co.mn.us") +|| dnsDomainIs(host, ".co.ms.us") +|| dnsDomainIs(host, ".co.mo.us") +|| dnsDomainIs(host, ".co.mt.us") +|| dnsDomainIs(host, ".co.ne.us") +|| dnsDomainIs(host, ".co.nv.us") +|| dnsDomainIs(host, ".co.nh.us") +|| dnsDomainIs(host, ".co.nj.us") +|| dnsDomainIs(host, ".co.nm.us") +|| dnsDomainIs(host, ".co.ny.us") +|| dnsDomainIs(host, ".co.nc.us") +|| dnsDomainIs(host, ".co.nd.us") +|| dnsDomainIs(host, ".co.oh.us") +|| dnsDomainIs(host, ".co.ok.us") +|| dnsDomainIs(host, ".co.or.us") +|| dnsDomainIs(host, ".co.pa.us") +|| dnsDomainIs(host, ".co.ri.us") +|| dnsDomainIs(host, ".co.sc.us") +|| dnsDomainIs(host, ".co.sd.us") +|| dnsDomainIs(host, ".co.tn.us") +|| dnsDomainIs(host, ".co.tx.us") +|| dnsDomainIs(host, ".co.ut.us") +|| dnsDomainIs(host, ".co.vt.us") +|| dnsDomainIs(host, ".co.va.us") +|| dnsDomainIs(host, ".co.wa.us") +|| dnsDomainIs(host, ".co.wv.us") +|| dnsDomainIs(host, ".co.wi.us") +|| dnsDomainIs(host, ".co.wy.us") + +// U.S. States +|| dnsDomainIs(host, ".state.al.us") +|| dnsDomainIs(host, ".state.ak.us") +|| dnsDomainIs(host, ".state.ar.us") +|| dnsDomainIs(host, ".state.az.us") +|| dnsDomainIs(host, ".state.ca.us") +|| dnsDomainIs(host, ".state.co.us") +|| dnsDomainIs(host, ".state.ct.us") +|| dnsDomainIs(host, ".state.dc.us") +|| dnsDomainIs(host, ".state.de.us") +|| dnsDomainIs(host, ".state.fl.us") +|| dnsDomainIs(host, ".state.ga.us") +|| dnsDomainIs(host, ".state.hi.us") +|| dnsDomainIs(host, ".state.id.us") +|| dnsDomainIs(host, ".state.il.us") +|| dnsDomainIs(host, ".state.in.us") +|| dnsDomainIs(host, ".state.ia.us") +|| dnsDomainIs(host, ".state.ks.us") +|| dnsDomainIs(host, ".state.ky.us") +|| dnsDomainIs(host, ".state.la.us") +|| dnsDomainIs(host, ".state.me.us") +|| dnsDomainIs(host, ".state.md.us") +|| dnsDomainIs(host, ".state.ma.us") +|| dnsDomainIs(host, ".state.mi.us") +|| dnsDomainIs(host, ".state.mn.us") +|| dnsDomainIs(host, ".state.ms.us") +|| dnsDomainIs(host, ".state.mo.us") +|| dnsDomainIs(host, ".state.mt.us") +|| dnsDomainIs(host, ".state.ne.us") +|| dnsDomainIs(host, ".state.nv.us") +|| dnsDomainIs(host, ".state.nh.us") +|| dnsDomainIs(host, ".state.nj.us") +|| dnsDomainIs(host, ".state.nm.us") +|| dnsDomainIs(host, ".state.ny.us") +|| dnsDomainIs(host, ".state.nc.us") +|| dnsDomainIs(host, ".state.nd.us") +|| dnsDomainIs(host, ".state.oh.us") +|| dnsDomainIs(host, ".state.ok.us") +|| dnsDomainIs(host, ".state.or.us") +|| dnsDomainIs(host, ".state.pa.us") +|| dnsDomainIs(host, ".state.ri.us") +|| dnsDomainIs(host, ".state.sc.us") +|| dnsDomainIs(host, ".state.sd.us") +|| dnsDomainIs(host, ".state.tn.us") +|| dnsDomainIs(host, ".state.tx.us") +|| dnsDomainIs(host, ".state.ut.us") +|| dnsDomainIs(host, ".state.vt.us") +|| dnsDomainIs(host, ".state.va.us") +|| dnsDomainIs(host, ".state.wa.us") +|| dnsDomainIs(host, ".state.wv.us") +|| dnsDomainIs(host, ".state.wi.us") +|| dnsDomainIs(host, ".state.wy.us") + +// KidsClick URLs + +|| dnsDomainIs(host, "12.16.163.163") +|| dnsDomainIs(host, "128.59.173.136") +|| dnsDomainIs(host, "165.112.78.61") +|| dnsDomainIs(host, "216.55.23.140") +|| dnsDomainIs(host, "63.111.53.150") +|| dnsDomainIs(host, "64.94.206.8") + +|| dnsDomainIs(host, "abc.go.com") +|| dnsDomainIs(host, "acmepet.petsmart.com") +|| dnsDomainIs(host, "adver-net.com") +|| dnsDomainIs(host, "aint-it-cool-news.com") +|| dnsDomainIs(host, "akidsheart.com") +|| dnsDomainIs(host, "alabanza.com") +|| dnsDomainIs(host, "allerdays.com") +|| dnsDomainIs(host, "allgame.com") +|| dnsDomainIs(host, "allowancenet.com") +|| dnsDomainIs(host, "amish-heartland.com") +|| dnsDomainIs(host, "ancienthistory.about.com") +|| dnsDomainIs(host, "animals.about.com") +|| dnsDomainIs(host, "antenna.nl") +|| dnsDomainIs(host, "arcweb.sos.state.or.us") +|| dnsDomainIs(host, "artistmummer.homestead.com") +|| dnsDomainIs(host, "artists.vh1.com") +|| dnsDomainIs(host, "arts.lausd.k12.ca.us") +|| dnsDomainIs(host, "asiatravel.com") +|| dnsDomainIs(host, "asterius.com") +|| dnsDomainIs(host, "atlas.gc.ca") +|| dnsDomainIs(host, "atschool.eduweb.co.uk") +|| dnsDomainIs(host, "ayya.pd.net") +|| dnsDomainIs(host, "babelfish.altavista.com") +|| dnsDomainIs(host, "babylon5.warnerbros.com") +|| dnsDomainIs(host, "banzai.neosoft.com") +|| dnsDomainIs(host, "barneyonline.com") +|| dnsDomainIs(host, "baroque-music.com") +|| dnsDomainIs(host, "barsoom.msss.com") +|| dnsDomainIs(host, "baseball-almanac.com") +|| dnsDomainIs(host, "bcadventure.com") +|| dnsDomainIs(host, "beadiecritters.hosting4less.com") +|| dnsDomainIs(host, "beverlyscrafts.com") +|| dnsDomainIs(host, "biology.about.com") +|| dnsDomainIs(host, "birding.about.com") +|| dnsDomainIs(host, "boatsafe.com") +|| dnsDomainIs(host, "bombpop.com") +|| dnsDomainIs(host, "boulter.com") +|| dnsDomainIs(host, "bright-ideas-software.com") +|| dnsDomainIs(host, "buckman.pps.k12.or.us") +|| dnsDomainIs(host, "buffalobills.com") +|| dnsDomainIs(host, "bvsd.k12.co.us") +|| dnsDomainIs(host, "cagle.slate.msn.com") +|| dnsDomainIs(host, "calc.entisoft.com") +|| dnsDomainIs(host, "canada.gc.ca") +|| dnsDomainIs(host, "candleandsoap.about.com") +|| dnsDomainIs(host, "caselaw.lp.findlaw.com") +|| dnsDomainIs(host, "catalog.com") +|| dnsDomainIs(host, "catalog.socialstudies.com") +|| dnsDomainIs(host, "cavern.com") +|| dnsDomainIs(host, "cbs.sportsline.com") +|| dnsDomainIs(host, "cc.matsuyama-u.ac.jp") +|| dnsDomainIs(host, "celt.net") +|| dnsDomainIs(host, "cgfa.kelloggcreek.com") +|| dnsDomainIs(host, "channel4000.com") +|| dnsDomainIs(host, "chess.delorie.com") +|| dnsDomainIs(host, "chess.liveonthenet.com") +|| dnsDomainIs(host, "childfun.com") +|| dnsDomainIs(host, "christmas.com") +|| dnsDomainIs(host, "citystar.com") +|| dnsDomainIs(host, "claim.goldrush.com") +|| dnsDomainIs(host, "clairerosemaryjane.com") +|| dnsDomainIs(host, "clevermedia.com") +|| dnsDomainIs(host, "cobblestonepub.com") +|| dnsDomainIs(host, "codebrkr.infopages.net") +|| dnsDomainIs(host, "colitz.com") +|| dnsDomainIs(host, "collections.ic.gc.ca") +|| dnsDomainIs(host, "coloquio.com") +|| dnsDomainIs(host, "come.to") +|| dnsDomainIs(host, "coombs.anu.edu.au") +|| dnsDomainIs(host, "crafterscommunity.com") +|| dnsDomainIs(host, "craftsforkids.about.com") +|| dnsDomainIs(host, "creativity.net") +|| dnsDomainIs(host, "cslewis.drzeus.net") +|| dnsDomainIs(host, "cust.idl.com.au") +|| dnsDomainIs(host, "cvs.anu.edu.au") +|| dnsDomainIs(host, "cybersleuth-kids.com") +|| dnsDomainIs(host, "cybertown.com") +|| dnsDomainIs(host, "darkfish.com") +|| dnsDomainIs(host, "datadragon.com") +|| dnsDomainIs(host, "davesite.com") +|| dnsDomainIs(host, "dbertens.www.cistron.nl") +|| dnsDomainIs(host, "detnews.com") +|| dnsDomainIs(host, "dhr.dos.state.fl.us") +|| dnsDomainIs(host, "dialspace.dial.pipex.com") +|| dnsDomainIs(host, "dictionaries.travlang.com") +|| dnsDomainIs(host, "disney.go.com") +|| dnsDomainIs(host, "disneyland.disney.go.com") +|| dnsDomainIs(host, "district.gresham.k12.or.us") +|| dnsDomainIs(host, "dmarie.com") +|| dnsDomainIs(host, "dreamwater.com") +|| dnsDomainIs(host, "duke.fuse.net") +|| dnsDomainIs(host, "earlyamerica.com") +|| dnsDomainIs(host, "earthsky.com") +|| dnsDomainIs(host, "easyweb.easynet.co.uk") +|| dnsDomainIs(host, "ecards1.bansheeweb.com") +|| dnsDomainIs(host, "edugreen.teri.res.in") +|| dnsDomainIs(host, "edwardlear.tripod.com") +|| dnsDomainIs(host, "eelink.net") +|| dnsDomainIs(host, "elizabethsings.com") +|| dnsDomainIs(host, "enature.com") +|| dnsDomainIs(host, "encarta.msn.com") +|| dnsDomainIs(host, "endangeredspecie.com") +|| dnsDomainIs(host, "enterprise.america.com") +|| dnsDomainIs(host, "ericae.net") +|| dnsDomainIs(host, "esl.about.com") +|| dnsDomainIs(host, "eveander.com") +|| dnsDomainIs(host, "exn.ca") +|| dnsDomainIs(host, "fallscam.niagara.com") +|| dnsDomainIs(host, "family.go.com") +|| dnsDomainIs(host, "family2.go.com") +|| dnsDomainIs(host, "familyeducation.com") +|| dnsDomainIs(host, "finditquick.com") +|| dnsDomainIs(host, "fln-bma.yazigi.com.br") +|| dnsDomainIs(host, "fln-con.yazigi.com.br") +|| dnsDomainIs(host, "food.epicurious.com") +|| dnsDomainIs(host, "forums.sympatico.ca") +|| dnsDomainIs(host, "fotw.vexillum.com") +|| dnsDomainIs(host, "fox.nstn.ca") +|| dnsDomainIs(host, "framingham.com") +|| dnsDomainIs(host, "freevote.com") +|| dnsDomainIs(host, "freeweb.pdq.net") +|| dnsDomainIs(host, "games.yahoo.com") +|| dnsDomainIs(host, "gardening.sierrahome.com") +|| dnsDomainIs(host, "gardenofpraise.com") +|| dnsDomainIs(host, "gcclearn.gcc.cc.va.us") +|| dnsDomainIs(host, "genealogytoday.com") +|| dnsDomainIs(host, "genesis.ne.mediaone.net") +|| dnsDomainIs(host, "geniefind.com") +|| dnsDomainIs(host, "geography.about.com") +|| dnsDomainIs(host, "gf.state.wy.us") +|| dnsDomainIs(host, "gi.grolier.com") +|| dnsDomainIs(host, "golf.com") +|| dnsDomainIs(host, "greatseal.com") +|| dnsDomainIs(host, "guardians.net") +|| dnsDomainIs(host, "hamlet.hypermart.net") +|| dnsDomainIs(host, "happypuppy.com") +|| dnsDomainIs(host, "harcourt.fsc.follett.com") +|| dnsDomainIs(host, "haringkids.com") +|| dnsDomainIs(host, "harrietmaysavitz.com") +|| dnsDomainIs(host, "harrypotter.warnerbros.com") +|| dnsDomainIs(host, "hca.gilead.org.il") +|| dnsDomainIs(host, "header.future.easyspace.com") +|| dnsDomainIs(host, "historymedren.about.com") +|| dnsDomainIs(host, "home.att.net") +|| dnsDomainIs(host, "home.austin.rr.com") +|| dnsDomainIs(host, "home.capu.net") +|| dnsDomainIs(host, "home.cfl.rr.com") +|| dnsDomainIs(host, "home.clara.net") +|| dnsDomainIs(host, "home.clear.net.nz") +|| dnsDomainIs(host, "home.earthlink.net") +|| dnsDomainIs(host, "home.eznet.net") +|| dnsDomainIs(host, "home.flash.net") +|| dnsDomainIs(host, "home.hiwaay.net") +|| dnsDomainIs(host, "home.hkstar.com") +|| dnsDomainIs(host, "home.ici.net") +|| dnsDomainIs(host, "home.inreach.com") +|| dnsDomainIs(host, "home.interlynx.net") +|| dnsDomainIs(host, "home.istar.ca") +|| dnsDomainIs(host, "home.mira.net") +|| dnsDomainIs(host, "home.nycap.rr.com") +|| dnsDomainIs(host, "home.online.no") +|| dnsDomainIs(host, "home.pb.net") +|| dnsDomainIs(host, "home2.pacific.net.sg") +|| dnsDomainIs(host, "homearts.com") +|| dnsDomainIs(host, "homepage.mac.com") +|| dnsDomainIs(host, "hometown.aol.com") +|| dnsDomainIs(host, "homiliesbyemail.com") +|| dnsDomainIs(host, "hotei.fix.co.jp") +|| dnsDomainIs(host, "hotwired.lycos.com") +|| dnsDomainIs(host, "hp.vector.co.jp") +|| dnsDomainIs(host, "hum.amu.edu.pl") +|| dnsDomainIs(host, "i-cias.com") +|| dnsDomainIs(host, "icatapults.freeservers.com") +|| dnsDomainIs(host, "ind.cioe.com") +|| dnsDomainIs(host, "info.ex.ac.uk") +|| dnsDomainIs(host, "infocan.gc.ca") +|| dnsDomainIs(host, "infoservice.gc.ca") +|| dnsDomainIs(host, "interoz.com") +|| dnsDomainIs(host, "ireland.iol.ie") +|| dnsDomainIs(host, "is.dal.ca") +|| dnsDomainIs(host, "itss.raytheon.com") +|| dnsDomainIs(host, "iul.com") +|| dnsDomainIs(host, "jameswhitcombriley.com") +|| dnsDomainIs(host, "jellieszone.com") +|| dnsDomainIs(host, "jordan.sportsline.com") +|| dnsDomainIs(host, "judyanddavid.com") +|| dnsDomainIs(host, "jurai.murdoch.edu.au") +|| dnsDomainIs(host, "just.about.com") +|| dnsDomainIs(host, "kayleigh.tierranet.com") +|| dnsDomainIs(host, "kcwingwalker.tripod.com") +|| dnsDomainIs(host, "kidexchange.about.com") +|| dnsDomainIs(host, "kids-world.colgatepalmolive.com") +|| dnsDomainIs(host, "kids.mysterynet.com") +|| dnsDomainIs(host, "kids.ot.com") +|| dnsDomainIs(host, "kidsartscrafts.about.com") +|| dnsDomainIs(host, "kidsastronomy.about.com") +|| dnsDomainIs(host, "kidscience.about.com") +|| dnsDomainIs(host, "kidscience.miningco.com") +|| dnsDomainIs(host, "kidscollecting.about.com") +|| dnsDomainIs(host, "kidsfun.co.uk") +|| dnsDomainIs(host, "kidsinternet.about.com") +|| dnsDomainIs(host, "kidslangarts.about.com") +|| dnsDomainIs(host, "kidspenpals.about.com") +|| dnsDomainIs(host, "kitecast.com") +|| dnsDomainIs(host, "knight.city.ba.k12.md.us") +|| dnsDomainIs(host, "kodak.com") +|| dnsDomainIs(host, "kwanzaa4kids.homestead.com") +|| dnsDomainIs(host, "lagos.africaonline.com") +|| dnsDomainIs(host, "lancearmstrong.com") +|| dnsDomainIs(host, "landru.i-link-2.net") +|| dnsDomainIs(host, "lang.nagoya-u.ac.jp") +|| dnsDomainIs(host, "lascala.milano.it") +|| dnsDomainIs(host, "latinoculture.about.com") +|| dnsDomainIs(host, "litcal.yasuda-u.ac.jp") +|| dnsDomainIs(host, "littlebit.com") +|| dnsDomainIs(host, "live.edventures.com") +|| dnsDomainIs(host, "look.net") +|| dnsDomainIs(host, "lycoskids.infoplease.com") +|| dnsDomainIs(host, "lynx.uio.no") +|| dnsDomainIs(host, "macdict.dict.mq.edu.au") +|| dnsDomainIs(host, "maori.culture.co.nz") +|| dnsDomainIs(host, "marktwain.about.com") +|| dnsDomainIs(host, "marktwain.miningco.com") +|| dnsDomainIs(host, "mars2030.net") +|| dnsDomainIs(host, "martin.parasitology.mcgill.ca") +|| dnsDomainIs(host, "martinlutherking.8m.com") +|| dnsDomainIs(host, "mastercollector.com") +|| dnsDomainIs(host, "mathcentral.uregina.ca") +|| dnsDomainIs(host, "members.aol.com") +|| dnsDomainIs(host, "members.carol.net") +|| dnsDomainIs(host, "members.cland.net") +|| dnsDomainIs(host, "members.cruzio.com") +|| dnsDomainIs(host, "members.easyspace.com") +|| dnsDomainIs(host, "members.eisa.net.au") +|| dnsDomainIs(host, "members.home.net") +|| dnsDomainIs(host, "members.iinet.net.au") +|| dnsDomainIs(host, "members.nbci.com") +|| dnsDomainIs(host, "members.ozemail.com.au") +|| dnsDomainIs(host, "members.surfsouth.com") +|| dnsDomainIs(host, "members.theglobe.com") +|| dnsDomainIs(host, "members.tripod.com") +|| dnsDomainIs(host, "mexplaza.udg.mx") +|| dnsDomainIs(host, "mgfx.com") +|| dnsDomainIs(host, "microimg.com") +|| dnsDomainIs(host, "midusa.net") +|| dnsDomainIs(host, "mildan.com") +|| dnsDomainIs(host, "millennianet.com") +|| dnsDomainIs(host, "mindbreakers.e-fun.nu") +|| dnsDomainIs(host, "missjanet.xs4all.nl") +|| dnsDomainIs(host, "mistral.culture.fr") +|| dnsDomainIs(host, "mobileation.com") +|| dnsDomainIs(host, "mrshowbiz.go.com") +|| dnsDomainIs(host, "ms.simplenet.com") +|| dnsDomainIs(host, "museum.gov.ns.ca") +|| dnsDomainIs(host, "music.excite.com") +|| dnsDomainIs(host, "musicfinder.yahoo.com") +|| dnsDomainIs(host, "my.freeway.net") +|| dnsDomainIs(host, "mytrains.com") +|| dnsDomainIs(host, "nativeauthors.com") +|| dnsDomainIs(host, "nba.com") +|| dnsDomainIs(host, "nch.ari.net") +|| dnsDomainIs(host, "neonpeach.tripod.com") +|| dnsDomainIs(host, "net.indra.com") +|| dnsDomainIs(host, "ngeorgia.com") +|| dnsDomainIs(host, "ngp.ngpc.state.ne.us") +|| dnsDomainIs(host, "nhd.heinle.com") +|| dnsDomainIs(host, "nick.com") +|| dnsDomainIs(host, "normandy.eb.com") +|| dnsDomainIs(host, "northshore.shore.net") +|| dnsDomainIs(host, "now2000.com") +|| dnsDomainIs(host, "npc.nunavut.ca") +|| dnsDomainIs(host, "ns2.carib-link.net") +|| dnsDomainIs(host, "ntl.sympatico.ca") +|| dnsDomainIs(host, "oceanographer.navy.mil") +|| dnsDomainIs(host, "oddens.geog.uu.nl") +|| dnsDomainIs(host, "officialcitysites.com") +|| dnsDomainIs(host, "oneida-nation.net") +|| dnsDomainIs(host, "onlinegeorgia.com") +|| dnsDomainIs(host, "originator_2.tripod.com") +|| dnsDomainIs(host, "ortech-engr.com") +|| dnsDomainIs(host, "osage.voorhees.k12.nj.us") +|| dnsDomainIs(host, "osiris.sund.ac.uk") +|| dnsDomainIs(host, "ourworld.compuserve.com") +|| dnsDomainIs(host, "outdoorphoto.com") +|| dnsDomainIs(host, "pages.map.com") +|| dnsDomainIs(host, "pages.prodigy.com") +|| dnsDomainIs(host, "pages.prodigy.net") +|| dnsDomainIs(host, "pages.tca.net") +|| dnsDomainIs(host, "parcsafari.qc.ca") +|| dnsDomainIs(host, "parenthoodweb.com") +|| dnsDomainIs(host, "pathfinder.com") +|| dnsDomainIs(host, "people.clarityconnect.com") +|| dnsDomainIs(host, "people.enternet.com.au") +|| dnsDomainIs(host, "people.ne.mediaone.net") +|| dnsDomainIs(host, "phonics.jazzles.com") +|| dnsDomainIs(host, "pibburns.com") +|| dnsDomainIs(host, "pilgrims.net") +|| dnsDomainIs(host, "pinenet.com") +|| dnsDomainIs(host, "place.scholastic.com") +|| dnsDomainIs(host, "playground.kodak.com") +|| dnsDomainIs(host, "politicalgraveyard.com") +|| dnsDomainIs(host, "polk.ga.net") +|| dnsDomainIs(host, "pompstory.home.mindspring.com") +|| dnsDomainIs(host, "popularmechanics.com") +|| dnsDomainIs(host, "projects.edtech.sandi.net") +|| dnsDomainIs(host, "psyche.usno.navy.mil") +|| dnsDomainIs(host, "pubweb.parc.xerox.com") +|| dnsDomainIs(host, "puzzlemaker.school.discovery.com") +|| dnsDomainIs(host, "quest.classroom.com") +|| dnsDomainIs(host, "quilting.about.com") +|| dnsDomainIs(host, "rabbitmoon.home.mindspring.com") +|| dnsDomainIs(host, "radio.cbc.ca") +|| dnsDomainIs(host, "rats2u.com") +|| dnsDomainIs(host, "rbcm1.rbcm.gov.bc.ca") +|| dnsDomainIs(host, "readplay.com") +|| dnsDomainIs(host, "recipes4children.homestead.com") +|| dnsDomainIs(host, "redsox.com") +|| dnsDomainIs(host, "renaissance.district96.k12.il.us") +|| dnsDomainIs(host, "rhyme.lycos.com") +|| dnsDomainIs(host, "rhythmweb.com") +|| dnsDomainIs(host, "riverresource.com") +|| dnsDomainIs(host, "rockhoundingar.com") +|| dnsDomainIs(host, "rockies.mlb.com") +|| dnsDomainIs(host, "rosecity.net") +|| dnsDomainIs(host, "rr-vs.informatik.uni-ulm.de") +|| dnsDomainIs(host, "rubens.anu.edu.au") +|| dnsDomainIs(host, "rummelplatz.uni-mannheim.de") +|| dnsDomainIs(host, "sandbox.xerox.com") +|| dnsDomainIs(host, "sarah.fredart.com") +|| dnsDomainIs(host, "schmidel.com") +|| dnsDomainIs(host, "scholastic.com") +|| dnsDomainIs(host, "school.discovery.com") +|| dnsDomainIs(host, "schoolcentral.com") +|| dnsDomainIs(host, "seattletimes.nwsource.com") +|| dnsDomainIs(host, "sericulum.com") +|| dnsDomainIs(host, "sf.airforce.com") +|| dnsDomainIs(host, "shop.usps.com") +|| dnsDomainIs(host, "showcase.netins.net") +|| dnsDomainIs(host, "sikids.com") +|| dnsDomainIs(host, "sites.huji.ac.il") +|| dnsDomainIs(host, "sjliving.com") +|| dnsDomainIs(host, "skullduggery.com") +|| dnsDomainIs(host, "skyways.lib.ks.us") +|| dnsDomainIs(host, "snowdaymovie.nick.com") +|| dnsDomainIs(host, "sosa21.hypermart.net") +|| dnsDomainIs(host, "soundamerica.com") +|| dnsDomainIs(host, "spaceboy.nasda.go.jp") +|| dnsDomainIs(host, "sports.nfl.com") +|| dnsDomainIs(host, "sportsillustrated.cnn.com") +|| dnsDomainIs(host, "starwars.hasbro.com") +|| dnsDomainIs(host, "statelibrary.dcr.state.nc.us") +|| dnsDomainIs(host, "streetplay.com") +|| dnsDomainIs(host, "sts.gsc.nrcan.gc.ca") +|| dnsDomainIs(host, "sunniebunniezz.com") +|| dnsDomainIs(host, "sunsite.nus.edu.sg") +|| dnsDomainIs(host, "sunsite.sut.ac.jp") +|| dnsDomainIs(host, "superm.bart.nl") +|| dnsDomainIs(host, "surf.to") +|| dnsDomainIs(host, "svinet2.fs.fed.us") +|| dnsDomainIs(host, "swiminfo.com") +|| dnsDomainIs(host, "tabletennis.about.com") +|| dnsDomainIs(host, "teacher.scholastic.com") +|| dnsDomainIs(host, "theforce.net") +|| dnsDomainIs(host, "thejessicas.homestead.com") +|| dnsDomainIs(host, "themes.editthispage.com") +|| dnsDomainIs(host, "theory.uwinnipeg.ca") +|| dnsDomainIs(host, "theshadowlands.net") +|| dnsDomainIs(host, "thinks.com") +|| dnsDomainIs(host, "thryomanes.tripod.com") +|| dnsDomainIs(host, "time_zone.tripod.com") +|| dnsDomainIs(host, "titania.cobuild.collins.co.uk") +|| dnsDomainIs(host, "torre.duomo.pisa.it") +|| dnsDomainIs(host, "touregypt.net") +|| dnsDomainIs(host, "toycollecting.about.com") +|| dnsDomainIs(host, "trace.ntu.ac.uk") +|| dnsDomainIs(host, "travelwithkids.about.com") +|| dnsDomainIs(host, "tukids.tucows.com") +|| dnsDomainIs(host, "tv.yahoo.com") +|| dnsDomainIs(host, "tycho.usno.navy.mil") +|| dnsDomainIs(host, "ubl.artistdirect.com") +|| dnsDomainIs(host, "uk-pages.net") +|| dnsDomainIs(host, "ukraine.uazone.net") +|| dnsDomainIs(host, "unmuseum.mus.pa.us") +|| dnsDomainIs(host, "us.imdb.com") +|| dnsDomainIs(host, "userpage.chemie.fu-berlin.de") +|| dnsDomainIs(host, "userpage.fu-berlin.de") +|| dnsDomainIs(host, "userpages.aug.com") +|| dnsDomainIs(host, "users.aol.com") +|| dnsDomainIs(host, "users.bigpond.net.au") +|| dnsDomainIs(host, "users.breathemail.net") +|| dnsDomainIs(host, "users.erols.com") +|| dnsDomainIs(host, "users.imag.net") +|| dnsDomainIs(host, "users.inetw.net") +|| dnsDomainIs(host, "users.massed.net") +|| dnsDomainIs(host, "users.skynet.be") +|| dnsDomainIs(host, "users.uniserve.com") +|| dnsDomainIs(host, "venus.spaceports.com") +|| dnsDomainIs(host, "vgstrategies.about.com") +|| dnsDomainIs(host, "victorian.fortunecity.com") +|| dnsDomainIs(host, "vilenski.com") +|| dnsDomainIs(host, "village.infoweb.ne.jp") +|| dnsDomainIs(host, "virtual.finland.fi") +|| dnsDomainIs(host, "vrml.fornax.hu") +|| dnsDomainIs(host, "vvv.com") +|| dnsDomainIs(host, "w1.xrefer.com") +|| dnsDomainIs(host, "w3.one.net") +|| dnsDomainIs(host, "w3.rz-berlin.mpg.de") +|| dnsDomainIs(host, "w3.trib.com") +|| dnsDomainIs(host, "wallofsound.go.com") +|| dnsDomainIs(host, "web.aimnet.com") +|| dnsDomainIs(host, "web.ccsd.k12.wy.us") +|| dnsDomainIs(host, "web.cs.ualberta.ca") +|| dnsDomainIs(host, "web.idirect.com") +|| dnsDomainIs(host, "web.kyoto-inet.or.jp") +|| dnsDomainIs(host, "web.macam98.ac.il") +|| dnsDomainIs(host, "web.massvacation.com") +|| dnsDomainIs(host, "web.one.net.au") +|| dnsDomainIs(host, "web.qx.net") +|| dnsDomainIs(host, "web.uvic.ca") +|| dnsDomainIs(host, "web2.airmail.net") +|| dnsDomainIs(host, "webcoast.com") +|| dnsDomainIs(host, "webgames.kalisto.com") +|| dnsDomainIs(host, "webhome.idirect.com") +|| dnsDomainIs(host, "webpages.homestead.com") +|| dnsDomainIs(host, "webrum.uni-mannheim.de") +|| dnsDomainIs(host, "webusers.anet-stl.com") +|| dnsDomainIs(host, "welcome.to") +|| dnsDomainIs(host, "wgntv.com") +|| dnsDomainIs(host, "whales.magna.com.au") +|| dnsDomainIs(host, "wildheart.com") +|| dnsDomainIs(host, "wilstar.net") +|| dnsDomainIs(host, "winter-wonderland.com") +|| dnsDomainIs(host, "women.com") +|| dnsDomainIs(host, "woodrow.mpls.frb.fed.us") +|| dnsDomainIs(host, "wordzap.com") +|| dnsDomainIs(host, "worldkids.net") +|| dnsDomainIs(host, "worldwideguide.net") +|| dnsDomainIs(host, "ww3.bay.k12.fl.us") +|| dnsDomainIs(host, "ww3.sportsline.com") +|| dnsDomainIs(host, "www-groups.dcs.st-and.ac.uk") +|| dnsDomainIs(host, "www-public.rz.uni-duesseldorf.de") +|| dnsDomainIs(host, "www.1stkids.com") +|| dnsDomainIs(host, "www.2020tech.com") +|| dnsDomainIs(host, "www.21stcenturytoys.com") +|| dnsDomainIs(host, "www.4adventure.com") +|| dnsDomainIs(host, "www.50states.com") +|| dnsDomainIs(host, "www.800padutch.com") +|| dnsDomainIs(host, "www.88.com") +|| dnsDomainIs(host, "www.a-better.com") +|| dnsDomainIs(host, "www.aaa.com.au") +|| dnsDomainIs(host, "www.aacca.com") +|| dnsDomainIs(host, "www.aalbc.com") +|| dnsDomainIs(host, "www.aardman.com") +|| dnsDomainIs(host, "www.aardvarkelectric.com") +|| dnsDomainIs(host, "www.aawc.com") +|| dnsDomainIs(host, "www.ababmx.com") +|| dnsDomainIs(host, "www.abbeville.com") +|| dnsDomainIs(host, "www.abc.net.au") +|| dnsDomainIs(host, "www.abcb.com") +|| dnsDomainIs(host, "www.abctooncenter.com") +|| dnsDomainIs(host, "www.about.ch") +|| dnsDomainIs(host, "www.accessart.org.uk") +|| dnsDomainIs(host, "www.accu.or.jp") +|| dnsDomainIs(host, "www.accuweather.com") +|| dnsDomainIs(host, "www.achuka.co.uk") +|| dnsDomainIs(host, "www.acmecity.com") +|| dnsDomainIs(host, "www.acorn-group.com") +|| dnsDomainIs(host, "www.acs.ucalgary.ca") +|| dnsDomainIs(host, "www.actden.com") +|| dnsDomainIs(host, "www.actionplanet.com") +|| dnsDomainIs(host, "www.activityvillage.co.uk") +|| dnsDomainIs(host, "www.actwin.com") +|| dnsDomainIs(host, "www.adequate.com") +|| dnsDomainIs(host, "www.adidas.com") +|| dnsDomainIs(host, "www.advent-calendars.com") +|| dnsDomainIs(host, "www.aegis.com") +|| dnsDomainIs(host, "www.af.mil") +|| dnsDomainIs(host, "www.africaindex.africainfo.no") +|| dnsDomainIs(host, "www.africam.com") +|| dnsDomainIs(host, "www.africancrafts.com") +|| dnsDomainIs(host, "www.aggressive.com") +|| dnsDomainIs(host, "www.aghines.com") +|| dnsDomainIs(host, "www.agirlsworld.com") +|| dnsDomainIs(host, "www.agora.stm.it") +|| dnsDomainIs(host, "www.agriculture.com") +|| dnsDomainIs(host, "www.aikidofaq.com") +|| dnsDomainIs(host, "www.ajkids.com") +|| dnsDomainIs(host, "www.akfkoala.gil.com.au") +|| dnsDomainIs(host, "www.akhlah.com") +|| dnsDomainIs(host, "www.alabamainfo.com") +|| dnsDomainIs(host, "www.aland.fi") +|| dnsDomainIs(host, "www.albion.com") +|| dnsDomainIs(host, "www.alcoholismhelp.com") +|| dnsDomainIs(host, "www.alcottweb.com") +|| dnsDomainIs(host, "www.alfanet.it") +|| dnsDomainIs(host, "www.alfy.com") +|| dnsDomainIs(host, "www.algebra-online.com") +|| dnsDomainIs(host, "www.alienexplorer.com") +|| dnsDomainIs(host, "www.aliensatschool.com") +|| dnsDomainIs(host, "www.all-links.com") +|| dnsDomainIs(host, "www.alldetroit.com") +|| dnsDomainIs(host, "www.allexperts.com") +|| dnsDomainIs(host, "www.allmixedup.com") +|| dnsDomainIs(host, "www.allmusic.com") +|| dnsDomainIs(host, "www.almanac.com") +|| dnsDomainIs(host, "www.almaz.com") +|| dnsDomainIs(host, "www.almondseed.com") +|| dnsDomainIs(host, "www.aloha.com") +|| dnsDomainIs(host, "www.aloha.net") +|| dnsDomainIs(host, "www.altonweb.com") +|| dnsDomainIs(host, "www.alyeska-pipe.com") +|| dnsDomainIs(host, "www.am-wood.com") +|| dnsDomainIs(host, "www.amazingadventure.com") +|| dnsDomainIs(host, "www.amazon.com") +|| dnsDomainIs(host, "www.americancheerleader.com") +|| dnsDomainIs(host, "www.americancowboy.com") +|| dnsDomainIs(host, "www.americangirl.com") +|| dnsDomainIs(host, "www.americanparknetwork.com") +|| dnsDomainIs(host, "www.americansouthwest.net") +|| dnsDomainIs(host, "www.americanwest.com") +|| dnsDomainIs(host, "www.ameritech.net") +|| dnsDomainIs(host, "www.amtexpo.com") +|| dnsDomainIs(host, "www.anbg.gov.au") +|| dnsDomainIs(host, "www.anc.org.za") +|| dnsDomainIs(host, "www.ancientegypt.co.uk") +|| dnsDomainIs(host, "www.angelfire.com") +|| dnsDomainIs(host, "www.angelsbaseball.com") +|| dnsDomainIs(host, "www.anholt.co.uk") +|| dnsDomainIs(host, "www.animabets.com") +|| dnsDomainIs(host, "www.animalnetwork.com") +|| dnsDomainIs(host, "www.animalpicturesarchive.com") +|| dnsDomainIs(host, "www.anime-genesis.com") +|| dnsDomainIs(host, "www.annefrank.com") +|| dnsDomainIs(host, "www.annefrank.nl") +|| dnsDomainIs(host, "www.annie75.com") +|| dnsDomainIs(host, "www.antbee.com") +|| dnsDomainIs(host, "www.antiquetools.com") +|| dnsDomainIs(host, "www.antiquetoy.com") +|| dnsDomainIs(host, "www.anzsbeg.org.au") +|| dnsDomainIs(host, "www.aol.com") +|| dnsDomainIs(host, "www.aone.com") +|| dnsDomainIs(host, "www.aphids.com") +|| dnsDomainIs(host, "www.apl.com") +|| dnsDomainIs(host, "www.aplusmath.com") +|| dnsDomainIs(host, "www.applebookshop.co.uk") +|| dnsDomainIs(host, "www.appropriatesoftware.com") +|| dnsDomainIs(host, "www.appukids.com") +|| dnsDomainIs(host, "www.april-joy.com") +|| dnsDomainIs(host, "www.arab.net") +|| dnsDomainIs(host, "www.aracnet.com") +|| dnsDomainIs(host, "www.arborday.com") +|| dnsDomainIs(host, "www.arcadevillage.com") +|| dnsDomainIs(host, "www.archiecomics.com") +|| dnsDomainIs(host, "www.archives.state.al.us") +|| dnsDomainIs(host, "www.arctic.ca") +|| dnsDomainIs(host, "www.ardenjohnson.com") +|| dnsDomainIs(host, "www.aristotle.net") +|| dnsDomainIs(host, "www.arizhwys.com") +|| dnsDomainIs(host, "www.arizonaguide.com") +|| dnsDomainIs(host, "www.arlingtoncemetery.com") +|| dnsDomainIs(host, "www.armory.com") +|| dnsDomainIs(host, "www.armwrestling.com") +|| dnsDomainIs(host, "www.arnprior.com") +|| dnsDomainIs(host, "www.artabunga.com") +|| dnsDomainIs(host, "www.artcarte.com") +|| dnsDomainIs(host, "www.artchive.com") +|| dnsDomainIs(host, "www.artcontest.com") +|| dnsDomainIs(host, "www.artcyclopedia.com") +|| dnsDomainIs(host, "www.artisandevelopers.com") +|| dnsDomainIs(host, "www.artlex.com") +|| dnsDomainIs(host, "www.artsandkids.com") +|| dnsDomainIs(host, "www.artyastro.com") +|| dnsDomainIs(host, "www.arwhead.com") +|| dnsDomainIs(host, "www.asahi-net.or.jp") +|| dnsDomainIs(host, "www.asap.unimelb.edu.au") +|| dnsDomainIs(host, "www.ascpl.lib.oh.us") +|| dnsDomainIs(host, "www.asia-art.net") +|| dnsDomainIs(host, "www.asiabigtime.com") +|| dnsDomainIs(host, "www.asianart.com") +|| dnsDomainIs(host, "www.asiatour.com") +|| dnsDomainIs(host, "www.asiaweek.com") +|| dnsDomainIs(host, "www.askanexpert.com") +|| dnsDomainIs(host, "www.askbasil.com") +|| dnsDomainIs(host, "www.assa.org.au") +|| dnsDomainIs(host, "www.ast.cam.ac.uk") +|| dnsDomainIs(host, "www.astronomy.com") +|| dnsDomainIs(host, "www.astros.com") +|| dnsDomainIs(host, "www.atek.com") +|| dnsDomainIs(host, "www.athlete.com") +|| dnsDomainIs(host, "www.athropolis.com") +|| dnsDomainIs(host, "www.atkielski.com") +|| dnsDomainIs(host, "www.atlantabraves.com") +|| dnsDomainIs(host, "www.atlantafalcons.com") +|| dnsDomainIs(host, "www.atlantathrashers.com") +|| dnsDomainIs(host, "www.atlanticus.com") +|| dnsDomainIs(host, "www.atm.ch.cam.ac.uk") +|| dnsDomainIs(host, "www.atom.co.jp") +|| dnsDomainIs(host, "www.atomicarchive.com") +|| dnsDomainIs(host, "www.att.com") +|| dnsDomainIs(host, "www.audreywood.com") +|| dnsDomainIs(host, "www.auntannie.com") +|| dnsDomainIs(host, "www.auntie.com") +|| dnsDomainIs(host, "www.avi-writer.com") +|| dnsDomainIs(host, "www.awesomeclipartforkids.com") +|| dnsDomainIs(host, "www.awhitehorse.com") +|| dnsDomainIs(host, "www.axess.com") +|| dnsDomainIs(host, "www.ayles.com") +|| dnsDomainIs(host, "www.ayn.ca") +|| dnsDomainIs(host, "www.azcardinals.com") +|| dnsDomainIs(host, "www.azdiamondbacks.com") +|| dnsDomainIs(host, "www.azsolarcenter.com") +|| dnsDomainIs(host, "www.azstarnet.com") +|| dnsDomainIs(host, "www.aztecafoods.com") +|| dnsDomainIs(host, "www.b-witched.com") +|| dnsDomainIs(host, "www.baberuthmuseum.com") +|| dnsDomainIs(host, "www.backstreetboys.com") +|| dnsDomainIs(host, "www.bagheera.com") +|| dnsDomainIs(host, "www.bahamas.com") +|| dnsDomainIs(host, "www.baileykids.com") +|| dnsDomainIs(host, "www.baldeagleinfo.com") +|| dnsDomainIs(host, "www.balloonhq.com") +|| dnsDomainIs(host, "www.balloonzone.com") +|| dnsDomainIs(host, "www.ballparks.com") +|| dnsDomainIs(host, "www.balmoralsoftware.com") +|| dnsDomainIs(host, "www.banja.com") +|| dnsDomainIs(host, "www.banph.com") +|| dnsDomainIs(host, "www.barbie.com") +|| dnsDomainIs(host, "www.barkingbuddies.com") +|| dnsDomainIs(host, "www.barnsdle.demon.co.uk") +|| dnsDomainIs(host, "www.barrysclipart.com") +|| dnsDomainIs(host, "www.bartleby.com") +|| dnsDomainIs(host, "www.baseplate.com") +|| dnsDomainIs(host, "www.batman-superman.com") +|| dnsDomainIs(host, "www.batmanbeyond.com") +|| dnsDomainIs(host, "www.bbc.co.uk") +|| dnsDomainIs(host, "www.bbhighway.com") +|| dnsDomainIs(host, "www.bboy.com") +|| dnsDomainIs(host, "www.bcit.tec.nj.us") +|| dnsDomainIs(host, "www.bconnex.net") +|| dnsDomainIs(host, "www.bcpl.net") +|| dnsDomainIs(host, "www.beach-net.com") +|| dnsDomainIs(host, "www.beachboys.com") +|| dnsDomainIs(host, "www.beakman.com") +|| dnsDomainIs(host, "www.beano.co.uk") +|| dnsDomainIs(host, "www.beans.demon.co.uk") +|| dnsDomainIs(host, "www.beartime.com") +|| dnsDomainIs(host, "www.bearyspecial.co.uk") +|| dnsDomainIs(host, "www.bedtime.com") +|| dnsDomainIs(host, "www.beingme.com") +|| dnsDomainIs(host, "www.belizeexplorer.com") +|| dnsDomainIs(host, "www.bell-labs.com") +|| dnsDomainIs(host, "www.bemorecreative.com") +|| dnsDomainIs(host, "www.bengals.com") +|| dnsDomainIs(host, "www.benjerry.com") +|| dnsDomainIs(host, "www.bennygoodsport.com") +|| dnsDomainIs(host, "www.berenstainbears.com") +|| dnsDomainIs(host, "www.beringia.com") +|| dnsDomainIs(host, "www.beritsbest.com") +|| dnsDomainIs(host, "www.berksweb.com") +|| dnsDomainIs(host, "www.best.com") +|| dnsDomainIs(host, "www.betsybyars.com") +|| dnsDomainIs(host, "www.bfro.net") +|| dnsDomainIs(host, "www.bgmm.com") +|| dnsDomainIs(host, "www.bibliography.com") +|| dnsDomainIs(host, "www.bigblue.com.au") +|| dnsDomainIs(host, "www.bigchalk.com") +|| dnsDomainIs(host, "www.bigidea.com") +|| dnsDomainIs(host, "www.bigtop.com") +|| dnsDomainIs(host, "www.bikecrawler.com") +|| dnsDomainIs(host, "www.billboard.com") +|| dnsDomainIs(host, "www.billybear4kids.com") +|| dnsDomainIs(host, "www.biography.com") +|| dnsDomainIs(host, "www.birdnature.com") +|| dnsDomainIs(host, "www.birdsnways.com") +|| dnsDomainIs(host, "www.birdtimes.com") +|| dnsDomainIs(host, "www.birminghamzoo.com") +|| dnsDomainIs(host, "www.birthdaypartyideas.com") +|| dnsDomainIs(host, "www.bis.arachsys.com") +|| dnsDomainIs(host, "www.bkgm.com") +|| dnsDomainIs(host, "www.blackbaseball.com") +|| dnsDomainIs(host, "www.blackbeardthepirate.com") +|| dnsDomainIs(host, "www.blackbeltmag.com") +|| dnsDomainIs(host, "www.blackfacts.com") +|| dnsDomainIs(host, "www.blackfeetnation.com") +|| dnsDomainIs(host, "www.blackhills-info.com") +|| dnsDomainIs(host, "www.blackholegang.com") +|| dnsDomainIs(host, "www.blaque.net") +|| dnsDomainIs(host, "www.blarg.net") +|| dnsDomainIs(host, "www.blasternaut.com") +|| dnsDomainIs(host, "www.blizzard.com") +|| dnsDomainIs(host, "www.blocksite.com") +|| dnsDomainIs(host, "www.bluejackets.com") +|| dnsDomainIs(host, "www.bluejays.ca") +|| dnsDomainIs(host, "www.bluemountain.com") +|| dnsDomainIs(host, "www.blupete.com") +|| dnsDomainIs(host, "www.blyton.co.uk") +|| dnsDomainIs(host, "www.boatnerd.com") +|| dnsDomainIs(host, "www.boatsafe.com") +|| dnsDomainIs(host, "www.bonus.com") +|| dnsDomainIs(host, "www.boowakwala.com") +|| dnsDomainIs(host, "www.bostonbruins.com") +|| dnsDomainIs(host, "www.braceface.com") +|| dnsDomainIs(host, "www.bracesinfo.com") +|| dnsDomainIs(host, "www.bradkent.com") +|| dnsDomainIs(host, "www.brainium.com") +|| dnsDomainIs(host, "www.brainmania.com") +|| dnsDomainIs(host, "www.brainpop.com") +|| dnsDomainIs(host, "www.bridalcave.com") +|| dnsDomainIs(host, "www.brightmoments.com") +|| dnsDomainIs(host, "www.britannia.com") +|| dnsDomainIs(host, "www.britannica.com") +|| dnsDomainIs(host, "www.british-museum.ac.uk") +|| dnsDomainIs(host, "www.brookes.ac.uk") +|| dnsDomainIs(host, "www.brookfieldreader.com") +|| dnsDomainIs(host, "www.btinternet.com") +|| dnsDomainIs(host, "www.bubbledome.co.nz") +|| dnsDomainIs(host, "www.buccaneers.com") +|| dnsDomainIs(host, "www.buffy.com") +|| dnsDomainIs(host, "www.bullying.co.uk") +|| dnsDomainIs(host, "www.bumply.com") +|| dnsDomainIs(host, "www.bungi.com") +|| dnsDomainIs(host, "www.burlco.lib.nj.us") +|| dnsDomainIs(host, "www.burlingamepezmuseum.com") +|| dnsDomainIs(host, "www.bus.ualberta.ca") +|| dnsDomainIs(host, "www.busprod.com") +|| dnsDomainIs(host, "www.butlerart.com") +|| dnsDomainIs(host, "www.butterflies.com") +|| dnsDomainIs(host, "www.butterflyfarm.co.cr") +|| dnsDomainIs(host, "www.bway.net") +|| dnsDomainIs(host, "www.bydonovan.com") +|| dnsDomainIs(host, "www.ca-mall.com") +|| dnsDomainIs(host, "www.cabinessence.com") +|| dnsDomainIs(host, "www.cablecarmuseum.com") +|| dnsDomainIs(host, "www.cadbury.co.uk") +|| dnsDomainIs(host, "www.calendarzone.com") +|| dnsDomainIs(host, "www.calgaryflames.com") +|| dnsDomainIs(host, "www.californiamissions.com") +|| dnsDomainIs(host, "www.camalott.com") +|| dnsDomainIs(host, "www.camelotintl.com") +|| dnsDomainIs(host, "www.campbellsoup.com") +|| dnsDomainIs(host, "www.camvista.com") +|| dnsDomainIs(host, "www.canadiens.com") +|| dnsDomainIs(host, "www.canals.state.ny.us") +|| dnsDomainIs(host, "www.candlelightstories.com") +|| dnsDomainIs(host, "www.candles-museum.com") +|| dnsDomainIs(host, "www.candystand.com") +|| dnsDomainIs(host, "www.caneshockey.com") +|| dnsDomainIs(host, "www.canismajor.com") +|| dnsDomainIs(host, "www.canucks.com") +|| dnsDomainIs(host, "www.capecod.net") +|| dnsDomainIs(host, "www.capital.net") +|| dnsDomainIs(host, "www.capstonestudio.com") +|| dnsDomainIs(host, "www.cardblvd.com") +|| dnsDomainIs(host, "www.caro.net") +|| dnsDomainIs(host, "www.carolhurst.com") +|| dnsDomainIs(host, "www.carr.lib.md.us") +|| dnsDomainIs(host, "www.cartooncorner.com") +|| dnsDomainIs(host, "www.cartooncritters.com") +|| dnsDomainIs(host, "www.cartoonnetwork.com") +|| dnsDomainIs(host, "www.carvingpatterns.com") +|| dnsDomainIs(host, "www.cashuniversity.com") +|| dnsDomainIs(host, "www.castles-of-britain.com") +|| dnsDomainIs(host, "www.castlewales.com") +|| dnsDomainIs(host, "www.catholic-forum.com") +|| dnsDomainIs(host, "www.catholic.net") +|| dnsDomainIs(host, "www.cattle.guelph.on.ca") +|| dnsDomainIs(host, "www.cavedive.com") +|| dnsDomainIs(host, "www.caveofthewinds.com") +|| dnsDomainIs(host, "www.cbc4kids.ca") +|| dnsDomainIs(host, "www.ccer.ggl.ruu.nl") +|| dnsDomainIs(host, "www.ccnet.com") +|| dnsDomainIs(host, "www.celineonline.com") +|| dnsDomainIs(host, "www.cellsalive.com") +|| dnsDomainIs(host, "www.centuryinshoes.com") +|| dnsDomainIs(host, "www.cfl.ca") +|| dnsDomainIs(host, "www.channel4.com") +|| dnsDomainIs(host, "www.channel8.net") +|| dnsDomainIs(host, "www.chanukah99.com") +|| dnsDomainIs(host, "www.charged.com") +|| dnsDomainIs(host, "www.chargers.com") +|| dnsDomainIs(host, "www.charlotte.com") +|| dnsDomainIs(host, "www.chaseday.com") +|| dnsDomainIs(host, "www.chateauversailles.fr") +|| dnsDomainIs(host, "www.cheatcc.com") +|| dnsDomainIs(host, "www.cheerleading.net") +|| dnsDomainIs(host, "www.cheese.com") +|| dnsDomainIs(host, "www.chem4kids.com") +|| dnsDomainIs(host, "www.chemicool.com") +|| dnsDomainIs(host, "www.cherbearsden.com") +|| dnsDomainIs(host, "www.chesskids.com") +|| dnsDomainIs(host, "www.chessvariants.com") +|| dnsDomainIs(host, "www.cheungswingchun.com") +|| dnsDomainIs(host, "www.chevroncars.com") +|| dnsDomainIs(host, "www.chibi.simplenet.com") +|| dnsDomainIs(host, "www.chicagobears.com") +|| dnsDomainIs(host, "www.chicagoblackhawks.com") +|| dnsDomainIs(host, "www.chickasaw.net") +|| dnsDomainIs(host, "www.childrensmusic.co.uk") +|| dnsDomainIs(host, "www.childrenssoftware.com") +|| dnsDomainIs(host, "www.childrenstory.com") +|| dnsDomainIs(host, "www.childrenwithdiabetes.com") +|| dnsDomainIs(host, "www.chinapage.com") +|| dnsDomainIs(host, "www.chinatoday.com") +|| dnsDomainIs(host, "www.chinavista.com") +|| dnsDomainIs(host, "www.chinnet.net") +|| dnsDomainIs(host, "www.chiquita.com") +|| dnsDomainIs(host, "www.chisox.com") +|| dnsDomainIs(host, "www.chivalry.com") +|| dnsDomainIs(host, "www.christiananswers.net") +|| dnsDomainIs(host, "www.christianity.com") +|| dnsDomainIs(host, "www.christmas.com") +|| dnsDomainIs(host, "www.christmas98.com") +|| dnsDomainIs(host, "www.chron.com") +|| dnsDomainIs(host, "www.chronique.com") +|| dnsDomainIs(host, "www.chuckecheese.com") +|| dnsDomainIs(host, "www.chucklebait.com") +|| dnsDomainIs(host, "www.chunkymonkey.com") +|| dnsDomainIs(host, "www.ci.chi.il.us") +|| dnsDomainIs(host, "www.ci.nyc.ny.us") +|| dnsDomainIs(host, "www.ci.phoenix.az.us") +|| dnsDomainIs(host, "www.ci.san-diego.ca.us") +|| dnsDomainIs(host, "www.cibc.com") +|| dnsDomainIs(host, "www.ciderpresspottery.com") +|| dnsDomainIs(host, "www.cincinnatireds.com") +|| dnsDomainIs(host, "www.circusparade.com") +|| dnsDomainIs(host, "www.circusweb.com") +|| dnsDomainIs(host, "www.cirquedusoleil.com") +|| dnsDomainIs(host, "www.cit.state.vt.us") +|| dnsDomainIs(host, "www.citycastles.com") +|| dnsDomainIs(host, "www.cityu.edu.hk") +|| dnsDomainIs(host, "www.civicmind.com") +|| dnsDomainIs(host, "www.civil-war.net") +|| dnsDomainIs(host, "www.civilization.ca") +|| dnsDomainIs(host, "www.cl.cam.ac.uk") +|| dnsDomainIs(host, "www.clantongang.com") +|| dnsDomainIs(host, "www.clark.net") +|| dnsDomainIs(host, "www.classicgaming.com") +|| dnsDomainIs(host, "www.claus.com") +|| dnsDomainIs(host, "www.clayz.com") +|| dnsDomainIs(host, "www.clearcf.uvic.ca") +|| dnsDomainIs(host, "www.clearlight.com") +|| dnsDomainIs(host, "www.clemusart.com") +|| dnsDomainIs(host, "www.clevelandbrowns.com") +|| dnsDomainIs(host, "www.clipartcastle.com") +|| dnsDomainIs(host, "www.clubi.ie") +|| dnsDomainIs(host, "www.cnn.com") +|| dnsDomainIs(host, "www.co.henrico.va.us") +|| dnsDomainIs(host, "www.coax.net") +|| dnsDomainIs(host, "www.cocacola.com") +|| dnsDomainIs(host, "www.cocori.com") +|| dnsDomainIs(host, "www.codesmiths.com") +|| dnsDomainIs(host, "www.codetalk.fed.us") +|| dnsDomainIs(host, "www.coin-gallery.com") +|| dnsDomainIs(host, "www.colinthompson.com") +|| dnsDomainIs(host, "www.collectoronline.com") +|| dnsDomainIs(host, "www.colonialhall.com") +|| dnsDomainIs(host, "www.coloradoavalanche.com") +|| dnsDomainIs(host, "www.coloradorockies.com") +|| dnsDomainIs(host, "www.colormathpink.com") +|| dnsDomainIs(host, "www.colts.com") +|| dnsDomainIs(host, "www.comet.net") +|| dnsDomainIs(host, "www.cometsystems.com") +|| dnsDomainIs(host, "www.comicbookresources.com") +|| dnsDomainIs(host, "www.comicspage.com") +|| dnsDomainIs(host, "www.compassnet.com") +|| dnsDomainIs(host, "www.compleatbellairs.com") +|| dnsDomainIs(host, "www.comptons.com") +|| dnsDomainIs(host, "www.concentric.net") +|| dnsDomainIs(host, "www.congogorillaforest.com") +|| dnsDomainIs(host, "www.conjuror.com") +|| dnsDomainIs(host, "www.conk.com") +|| dnsDomainIs(host, "www.conservation.state.mo.us") +|| dnsDomainIs(host, "www.contracostatimes.com") +|| dnsDomainIs(host, "www.control.chalmers.se") +|| dnsDomainIs(host, "www.cookierecipe.com") +|| dnsDomainIs(host, "www.cooljapanesetoys.com") +|| dnsDomainIs(host, "www.cooper.com") +|| dnsDomainIs(host, "www.corpcomm.net") +|| dnsDomainIs(host, "www.corrietenboom.com") +|| dnsDomainIs(host, "www.corynet.com") +|| dnsDomainIs(host, "www.corypaints.com") +|| dnsDomainIs(host, "www.cosmosmith.com") +|| dnsDomainIs(host, "www.countdown2000.com") +|| dnsDomainIs(host, "www.cowboy.net") +|| dnsDomainIs(host, "www.cowboypal.com") +|| dnsDomainIs(host, "www.cowcreek.com") +|| dnsDomainIs(host, "www.cowgirl.net") +|| dnsDomainIs(host, "www.cowgirls.com") +|| dnsDomainIs(host, "www.cp.duluth.mn.us") +|| dnsDomainIs(host, "www.cpsweb.com") +|| dnsDomainIs(host, "www.craftideas.com") +|| dnsDomainIs(host, "www.craniamania.com") +|| dnsDomainIs(host, "www.crater.lake.national-park.com") +|| dnsDomainIs(host, "www.crayoncrawler.com") +|| dnsDomainIs(host, "www.crazybone.com") +|| dnsDomainIs(host, "www.crazybones.com") +|| dnsDomainIs(host, "www.crd.ge.com") +|| dnsDomainIs(host, "www.create4kids.com") +|| dnsDomainIs(host, "www.creativemusic.com") +|| dnsDomainIs(host, "www.crocodilian.com") +|| dnsDomainIs(host, "www.crop.cri.nz") +|| dnsDomainIs(host, "www.cruzio.com") +|| dnsDomainIs(host, "www.crwflags.com") +|| dnsDomainIs(host, "www.cryptograph.com") +|| dnsDomainIs(host, "www.cryst.bbk.ac.uk") +|| dnsDomainIs(host, "www.cs.bilkent.edu.tr") +|| dnsDomainIs(host, "www.cs.man.ac.uk") +|| dnsDomainIs(host, "www.cs.sfu.ca") +|| dnsDomainIs(host, "www.cs.ubc.ca") +|| dnsDomainIs(host, "www.csd.uu.se") +|| dnsDomainIs(host, "www.csmonitor.com") +|| dnsDomainIs(host, "www.csse.monash.edu.au") +|| dnsDomainIs(host, "www.cstone.net") +|| dnsDomainIs(host, "www.csu.edu.au") +|| dnsDomainIs(host, "www.cubs.com") +|| dnsDomainIs(host, "www.culture.fr") +|| dnsDomainIs(host, "www.cultures.com") +|| dnsDomainIs(host, "www.curtis-collection.com") +|| dnsDomainIs(host, "www.cut-the-knot.com") +|| dnsDomainIs(host, "www.cws-scf.ec.gc.ca") +|| dnsDomainIs(host, "www.cyber-dyne.com") +|| dnsDomainIs(host, "www.cyberbee.com") +|| dnsDomainIs(host, "www.cyberbee.net") +|| dnsDomainIs(host, "www.cybercom.net") +|| dnsDomainIs(host, "www.cybercomm.net") +|| dnsDomainIs(host, "www.cybercomm.nl") +|| dnsDomainIs(host, "www.cybercorp.co.nz") +|| dnsDomainIs(host, "www.cybercs.com") +|| dnsDomainIs(host, "www.cybergoal.com") +|| dnsDomainIs(host, "www.cyberkids.com") +|| dnsDomainIs(host, "www.cyberspaceag.com") +|| dnsDomainIs(host, "www.cyberteens.com") +|| dnsDomainIs(host, "www.cybertours.com") +|| dnsDomainIs(host, "www.cybiko.com") +|| dnsDomainIs(host, "www.czweb.com") +|| dnsDomainIs(host, "www.d91.k12.id.us") +|| dnsDomainIs(host, "www.dailygrammar.com") +|| dnsDomainIs(host, "www.dakidz.com") +|| dnsDomainIs(host, "www.dalejarrettonline.com") +|| dnsDomainIs(host, "www.dallascowboys.com") +|| dnsDomainIs(host, "www.dallasdogndisc.com") +|| dnsDomainIs(host, "www.dallasstars.com") +|| dnsDomainIs(host, "www.damnyankees.com") +|| dnsDomainIs(host, "www.danceart.com") +|| dnsDomainIs(host, "www.daniellesplace.com") +|| dnsDomainIs(host, "www.dare-america.com") +|| dnsDomainIs(host, "www.darkfish.com") +|| dnsDomainIs(host, "www.darsbydesign.com") +|| dnsDomainIs(host, "www.datadragon.com") +|| dnsDomainIs(host, "www.davidreilly.com") +|| dnsDomainIs(host, "www.dccomics.com") +|| dnsDomainIs(host, "www.dcn.davis.ca.us") +|| dnsDomainIs(host, "www.deepseaworld.com") +|| dnsDomainIs(host, "www.delawaretribeofindians.nsn.us") +|| dnsDomainIs(host, "www.demon.co.uk") +|| dnsDomainIs(host, "www.denverbroncos.com") +|| dnsDomainIs(host, "www.denverpost.com") +|| dnsDomainIs(host, "www.dep.state.pa.us") +|| dnsDomainIs(host, "www.desert-fairy.com") +|| dnsDomainIs(host, "www.desert-storm.com") +|| dnsDomainIs(host, "www.desertusa.com") +|| dnsDomainIs(host, "www.designltd.com") +|| dnsDomainIs(host, "www.designsbykat.com") +|| dnsDomainIs(host, "www.detnews.com") +|| dnsDomainIs(host, "www.detroitlions.com") +|| dnsDomainIs(host, "www.detroitredwings.com") +|| dnsDomainIs(host, "www.detroittigers.com") +|| dnsDomainIs(host, "www.deutsches-museum.de") +|| dnsDomainIs(host, "www.devilray.com") +|| dnsDomainIs(host, "www.dhorse.com") +|| dnsDomainIs(host, "www.diana-ross.co.uk") +|| dnsDomainIs(host, "www.dianarossandthesupremes.net") +|| dnsDomainIs(host, "www.diaryproject.com") +|| dnsDomainIs(host, "www.dickbutkus.com") +|| dnsDomainIs(host, "www.dickshovel.com") +|| dnsDomainIs(host, "www.dictionary.com") +|| dnsDomainIs(host, "www.didyouknow.com") +|| dnsDomainIs(host, "www.diegorivera.com") +|| dnsDomainIs(host, "www.digitalcentury.com") +|| dnsDomainIs(host, "www.digitaldog.com") +|| dnsDomainIs(host, "www.digiweb.com") +|| dnsDomainIs(host, "www.dimdima.com") +|| dnsDomainIs(host, "www.dinodon.com") +|| dnsDomainIs(host, "www.dinosauria.com") +|| dnsDomainIs(host, "www.discovereso.com") +|| dnsDomainIs(host, "www.discovergalapagos.com") +|| dnsDomainIs(host, "www.discovergames.com") +|| dnsDomainIs(host, "www.discoveringarchaeology.com") +|| dnsDomainIs(host, "www.discoveringmontana.com") +|| dnsDomainIs(host, "www.discoverlearning.com") +|| dnsDomainIs(host, "www.discovery.com") +|| dnsDomainIs(host, "www.disknet.com") +|| dnsDomainIs(host, "www.disney.go.com") +|| dnsDomainIs(host, "www.distinguishedwomen.com") +|| dnsDomainIs(host, "www.dkonline.com") +|| dnsDomainIs(host, "www.dltk-kids.com") +|| dnsDomainIs(host, "www.dmgi.com") +|| dnsDomainIs(host, "www.dnr.state.md.us") +|| dnsDomainIs(host, "www.dnr.state.mi.us") +|| dnsDomainIs(host, "www.dnr.state.wi.us") +|| dnsDomainIs(host, "www.dodgers.com") +|| dnsDomainIs(host, "www.dodoland.com") +|| dnsDomainIs(host, "www.dog-play.com") +|| dnsDomainIs(host, "www.dogbreedinfo.com") +|| dnsDomainIs(host, "www.doginfomat.com") +|| dnsDomainIs(host, "www.dole5aday.com") +|| dnsDomainIs(host, "www.dollart.com") +|| dnsDomainIs(host, "www.dolliedish.com") +|| dnsDomainIs(host, "www.dome2000.co.uk") +|| dnsDomainIs(host, "www.domtar.com") +|| dnsDomainIs(host, "www.donegal.k12.pa.us") +|| dnsDomainIs(host, "www.dorneypark.com") +|| dnsDomainIs(host, "www.dorothyhinshawpatent.com") +|| dnsDomainIs(host, "www.dougweb.com") +|| dnsDomainIs(host, "www.dps.state.ak.us") +|| dnsDomainIs(host, "www.draw3d.com") +|| dnsDomainIs(host, "www.dreamgate.com") +|| dnsDomainIs(host, "www.dreamkitty.com") +|| dnsDomainIs(host, "www.dreamscape.com") +|| dnsDomainIs(host, "www.dreamtime.net.au") +|| dnsDomainIs(host, "www.drpeppermuseum.com") +|| dnsDomainIs(host, "www.drscience.com") +|| dnsDomainIs(host, "www.drseward.com") +|| dnsDomainIs(host, "www.drtoy.com") +|| dnsDomainIs(host, "www.dse.nl") +|| dnsDomainIs(host, "www.dtic.mil") +|| dnsDomainIs(host, "www.duracell.com") +|| dnsDomainIs(host, "www.dustbunny.com") +|| dnsDomainIs(host, "www.dynanet.com") +|| dnsDomainIs(host, "www.eagerreaders.com") +|| dnsDomainIs(host, "www.eaglekids.com") +|| dnsDomainIs(host, "www.earthcalendar.net") +|| dnsDomainIs(host, "www.earthday.net") +|| dnsDomainIs(host, "www.earthdog.com") +|| dnsDomainIs(host, "www.earthwatch.com") +|| dnsDomainIs(host, "www.ease.com") +|| dnsDomainIs(host, "www.eastasia.ws") +|| dnsDomainIs(host, "www.easytype.com") +|| dnsDomainIs(host, "www.eblewis.com") +|| dnsDomainIs(host, "www.ebs.hw.ac.uk") +|| dnsDomainIs(host, "www.eclipse.net") +|| dnsDomainIs(host, "www.eco-pros.com") +|| dnsDomainIs(host, "www.edbydesign.com") +|| dnsDomainIs(host, "www.eddytheeco-dog.com") +|| dnsDomainIs(host, "www.edgate.com") +|| dnsDomainIs(host, "www.edmontonoilers.com") +|| dnsDomainIs(host, "www.edu-source.com") +|| dnsDomainIs(host, "www.edu.gov.on.ca") +|| dnsDomainIs(host, "www.edu4kids.com") +|| dnsDomainIs(host, "www.educ.uvic.ca") +|| dnsDomainIs(host, "www.educate.org.uk") +|| dnsDomainIs(host, "www.education-world.com") +|| dnsDomainIs(host, "www.edunet.com") +|| dnsDomainIs(host, "www.eduplace.com") +|| dnsDomainIs(host, "www.edupuppy.com") +|| dnsDomainIs(host, "www.eduweb.com") +|| dnsDomainIs(host, "www.ee.ryerson.ca") +|| dnsDomainIs(host, "www.ee.surrey.ac.uk") +|| dnsDomainIs(host, "www.eeggs.com") +|| dnsDomainIs(host, "www.efes.com") +|| dnsDomainIs(host, "www.egalvao.com") +|| dnsDomainIs(host, "www.egypt.com") +|| dnsDomainIs(host, "www.egyptology.com") +|| dnsDomainIs(host, "www.ehobbies.com") +|| dnsDomainIs(host, "www.ehow.com") +|| dnsDomainIs(host, "www.eia.brad.ac.uk") +|| dnsDomainIs(host, "www.elbalero.gob.mx") +|| dnsDomainIs(host, "www.eliki.com") +|| dnsDomainIs(host, "www.elnino.com") +|| dnsDomainIs(host, "www.elok.com") +|| dnsDomainIs(host, "www.emf.net") +|| dnsDomainIs(host, "www.emsphone.com") +|| dnsDomainIs(host, "www.emulateme.com") +|| dnsDomainIs(host, "www.en.com") +|| dnsDomainIs(host, "www.enature.com") +|| dnsDomainIs(host, "www.enchantedlearning.com") +|| dnsDomainIs(host, "www.encyclopedia.com") +|| dnsDomainIs(host, "www.endex.com") +|| dnsDomainIs(host, "www.enjoyillinois.com") +|| dnsDomainIs(host, "www.enn.com") +|| dnsDomainIs(host, "www.enriqueig.com") +|| dnsDomainIs(host, "www.enteract.com") +|| dnsDomainIs(host, "www.epals.com") +|| dnsDomainIs(host, "www.equine-world.co.uk") +|| dnsDomainIs(host, "www.eric-carle.com") +|| dnsDomainIs(host, "www.ericlindros.net") +|| dnsDomainIs(host, "www.escape.com") +|| dnsDomainIs(host, "www.eskimo.com") +|| dnsDomainIs(host, "www.essentialsofmusic.com") +|| dnsDomainIs(host, "www.etch-a-sketch.com") +|| dnsDomainIs(host, "www.ethanallen.together.com") +|| dnsDomainIs(host, "www.etoys.com") +|| dnsDomainIs(host, "www.eurekascience.com") +|| dnsDomainIs(host, "www.euronet.nl") +|| dnsDomainIs(host, "www.everyrule.com") +|| dnsDomainIs(host, "www.ex.ac.uk") +|| dnsDomainIs(host, "www.excite.com") +|| dnsDomainIs(host, "www.execpc.com") +|| dnsDomainIs(host, "www.execulink.com") +|| dnsDomainIs(host, "www.exn.net") +|| dnsDomainIs(host, "www.expa.hvu.nl") +|| dnsDomainIs(host, "www.expage.com") +|| dnsDomainIs(host, "www.explode.to") +|| dnsDomainIs(host, "www.explorescience.com") +|| dnsDomainIs(host, "www.explorezone.com") +|| dnsDomainIs(host, "www.extremescience.com") +|| dnsDomainIs(host, "www.eyelid.co.uk") +|| dnsDomainIs(host, "www.eyeneer.com") +|| dnsDomainIs(host, "www.eyesofachild.com") +|| dnsDomainIs(host, "www.eyesofglory.com") +|| dnsDomainIs(host, "www.ezschool.com") +|| dnsDomainIs(host, "www.f1-live.com") +|| dnsDomainIs(host, "www.fables.co.uk") +|| dnsDomainIs(host, "www.factmonster.com") +|| dnsDomainIs(host, "www.fairygodmother.com") +|| dnsDomainIs(host, "www.familybuzz.com") +|| dnsDomainIs(host, "www.familygames.com") +|| dnsDomainIs(host, "www.familygardening.com") +|| dnsDomainIs(host, "www.familyinternet.com") +|| dnsDomainIs(host, "www.familymoney.com") +|| dnsDomainIs(host, "www.familyplay.com") +|| dnsDomainIs(host, "www.famousbirthdays.com") +|| dnsDomainIs(host, "www.fandom.com") +|| dnsDomainIs(host, "www.fansites.com") +|| dnsDomainIs(host, "www.faoschwarz.com") +|| dnsDomainIs(host, "www.fbe.unsw.edu.au") +|| dnsDomainIs(host, "www.fcps.k12.va.us") +|| dnsDomainIs(host, "www.fellersartsfactory.com") +|| dnsDomainIs(host, "www.ferrari.it") +|| dnsDomainIs(host, "www.fertnel.com") +|| dnsDomainIs(host, "www.fh-konstanz.de") +|| dnsDomainIs(host, "www.fhw.gr") +|| dnsDomainIs(host, "www.fibblesnork.com") +|| dnsDomainIs(host, "www.fidnet.com") +|| dnsDomainIs(host, "www.fieldhockey.com") +|| dnsDomainIs(host, "www.fieldhockeytraining.com") +|| dnsDomainIs(host, "www.fieler.com") +|| dnsDomainIs(host, "www.finalfour.net") +|| dnsDomainIs(host, "www.finifter.com") +|| dnsDomainIs(host, "www.fireworks-safety.com") +|| dnsDomainIs(host, "www.firstcut.com") +|| dnsDomainIs(host, "www.firstnations.com") +|| dnsDomainIs(host, "www.fishbc.com") +|| dnsDomainIs(host, "www.fisher-price.com") +|| dnsDomainIs(host, "www.fisheyeview.com") +|| dnsDomainIs(host, "www.fishgeeks.com") +|| dnsDomainIs(host, "www.fishindex.com") +|| dnsDomainIs(host, "www.fitzgeraldstudio.com") +|| dnsDomainIs(host, "www.flags.net") +|| dnsDomainIs(host, "www.flail.com") +|| dnsDomainIs(host, "www.flamarlins.com") +|| dnsDomainIs(host, "www.flausa.com") +|| dnsDomainIs(host, "www.floodlight-findings.com") +|| dnsDomainIs(host, "www.floridahistory.com") +|| dnsDomainIs(host, "www.floridapanthers.com") +|| dnsDomainIs(host, "www.fng.fi") +|| dnsDomainIs(host, "www.foodsci.uoguelph.ca") +|| dnsDomainIs(host, "www.foremost.com") +|| dnsDomainIs(host, "www.fortress.am") +|| dnsDomainIs(host, "www.fortunecity.com") +|| dnsDomainIs(host, "www.fosterclub.com") +|| dnsDomainIs(host, "www.foundus.com") +|| dnsDomainIs(host, "www.fourmilab.ch") +|| dnsDomainIs(host, "www.fox.com") +|| dnsDomainIs(host, "www.foxfamilychannel.com") +|| dnsDomainIs(host, "www.foxhome.com") +|| dnsDomainIs(host, "www.foxkids.com") +|| dnsDomainIs(host, "www.franceway.com") +|| dnsDomainIs(host, "www.fred.net") +|| dnsDomainIs(host, "www.fredpenner.com") +|| dnsDomainIs(host, "www.freedomknot.com") +|| dnsDomainIs(host, "www.freejigsawpuzzles.com") +|| dnsDomainIs(host, "www.freenet.edmonton.ab.ca") +|| dnsDomainIs(host, "www.frii.com") +|| dnsDomainIs(host, "www.frisbee.com") +|| dnsDomainIs(host, "www.fritolay.com") +|| dnsDomainIs(host, "www.frogsonice.com") +|| dnsDomainIs(host, "www.frontiernet.net") +|| dnsDomainIs(host, "www.fs.fed.us") +|| dnsDomainIs(host, "www.funattic.com") +|| dnsDomainIs(host, ".funbrain.com") +|| dnsDomainIs(host, "www.fundango.com") +|| dnsDomainIs(host, "www.funisland.com") +|| dnsDomainIs(host, "www.funkandwagnalls.com") +|| dnsDomainIs(host, "www.funorama.com") +|| dnsDomainIs(host, "www.funschool.com") +|| dnsDomainIs(host, "www.funster.com") +|| dnsDomainIs(host, "www.furby.com") +|| dnsDomainIs(host, "www.fusion.org.uk") +|| dnsDomainIs(host, "www.futcher.com") +|| dnsDomainIs(host, "www.futurescan.com") +|| dnsDomainIs(host, "www.fyi.net") +|| dnsDomainIs(host, "www.gailgibbons.com") +|| dnsDomainIs(host, "www.galegroup.com") +|| dnsDomainIs(host, "www.gambia.com") +|| dnsDomainIs(host, "www.gamecabinet.com") +|| dnsDomainIs(host, "www.gamecenter.com") +|| dnsDomainIs(host, "www.gamefaqs.com") +|| dnsDomainIs(host, "www.garfield.com") +|| dnsDomainIs(host, "www.garyharbo.com") +|| dnsDomainIs(host, "www.gatefish.com") +|| dnsDomainIs(host, "www.gateway-va.com") +|| dnsDomainIs(host, "www.gazillionaire.com") +|| dnsDomainIs(host, "www.gearhead.com") +|| dnsDomainIs(host, "www.genesplicing.com") +|| dnsDomainIs(host, "www.genhomepage.com") +|| dnsDomainIs(host, "www.geobop.com") +|| dnsDomainIs(host, "www.geocities.com") +|| dnsDomainIs(host, "www.geographia.com") +|| dnsDomainIs(host, "www.georgeworld.com") +|| dnsDomainIs(host, "www.georgian.net") +|| dnsDomainIs(host, "www.german-way.com") +|| dnsDomainIs(host, "www.germanfortravellers.com") +|| dnsDomainIs(host, "www.germantown.k12.il.us") +|| dnsDomainIs(host, "www.germany-tourism.de") +|| dnsDomainIs(host, "www.getmusic.com") +|| dnsDomainIs(host, "www.gettysburg.com") +|| dnsDomainIs(host, "www.ghirardellisq.com") +|| dnsDomainIs(host, "www.ghosttowngallery.com") +|| dnsDomainIs(host, "www.ghosttownsusa.com") +|| dnsDomainIs(host, "www.giants.com") +|| dnsDomainIs(host, "www.gibraltar.gi") +|| dnsDomainIs(host, "www.gigglepoetry.com") +|| dnsDomainIs(host, "www.gilchriststudios.com") +|| dnsDomainIs(host, "www.gillslap.freeserve.co.uk") +|| dnsDomainIs(host, "www.gilmer.net") +|| dnsDomainIs(host, "www.gio.gov.tw") +|| dnsDomainIs(host, "www.girltech.com") +|| dnsDomainIs(host, "www.girlzone.com") +|| dnsDomainIs(host, "www.globalgang.org.uk") +|| dnsDomainIs(host, "www.globalindex.com") +|| dnsDomainIs(host, "www.globalinfo.com") +|| dnsDomainIs(host, "www.gloriafan.com") +|| dnsDomainIs(host, "www.gms.ocps.k12.fl.us") +|| dnsDomainIs(host, "www.go-go-diggity.com") +|| dnsDomainIs(host, "www.goals.com") +|| dnsDomainIs(host, "www.godiva.com") +|| dnsDomainIs(host, "www.golden-retriever.com") +|| dnsDomainIs(host, "www.goldenbooks.com") +|| dnsDomainIs(host, "www.goldeneggs.com.au") +|| dnsDomainIs(host, "www.golfonline.com") +|| dnsDomainIs(host, "www.goobo.com") +|| dnsDomainIs(host, "www.goodearthgraphics.com") +|| dnsDomainIs(host, "www.goodyear.com") +|| dnsDomainIs(host, "www.gopbi.com") +|| dnsDomainIs(host, "www.gorge.net") +|| dnsDomainIs(host, "www.gorp.com") +|| dnsDomainIs(host, "www.got-milk.com") +|| dnsDomainIs(host, "www.gov.ab.ca") +|| dnsDomainIs(host, "www.gov.nb.ca") +|| dnsDomainIs(host, "www.grammarbook.com") +|| dnsDomainIs(host, "www.grammarlady.com") +|| dnsDomainIs(host, "www.grandparents-day.com") +|| dnsDomainIs(host, "www.granthill.com") +|| dnsDomainIs(host, "www.grayweb.com") +|| dnsDomainIs(host, "www.greatbuildings.com") +|| dnsDomainIs(host, "www.greatkids.com") +|| dnsDomainIs(host, "www.greatscience.com") +|| dnsDomainIs(host, "www.greeceny.com") +|| dnsDomainIs(host, "www.greenkeepers.com") +|| dnsDomainIs(host, "www.greylabyrinth.com") +|| dnsDomainIs(host, "www.grimmy.com") +|| dnsDomainIs(host, "www.gsrg.nmh.ac.uk") +|| dnsDomainIs(host, "www.gti.net") +|| dnsDomainIs(host, "www.guinnessworldrecords.com") +|| dnsDomainIs(host, "www.guitar.net") +|| dnsDomainIs(host, "www.guitarplaying.com") +|| dnsDomainIs(host, "www.gumbyworld.com") +|| dnsDomainIs(host, "www.gurlwurld.com") +|| dnsDomainIs(host, "www.gwi.net") +|| dnsDomainIs(host, "www.gymn-forum.com") +|| dnsDomainIs(host, "www.gzkidzone.com") +|| dnsDomainIs(host, "www.haemibalgassi.com") +|| dnsDomainIs(host, "www.hairstylist.com") +|| dnsDomainIs(host, "www.halcyon.com") +|| dnsDomainIs(host, "www.halifax.cbc.ca") +|| dnsDomainIs(host, "www.halloween-online.com") +|| dnsDomainIs(host, "www.halloweenkids.com") +|| dnsDomainIs(host, "www.halloweenmagazine.com") +|| dnsDomainIs(host, "www.hamill.co.uk") +|| dnsDomainIs(host, "www.hamsterdance2.com") +|| dnsDomainIs(host, "www.hamsters.co.uk") +|| dnsDomainIs(host, "www.hamstertours.com") +|| dnsDomainIs(host, "www.handsonmath.com") +|| dnsDomainIs(host, "www.handspeak.com") +|| dnsDomainIs(host, "www.hansonline.com") +|| dnsDomainIs(host, "www.happychild.org.uk") +|| dnsDomainIs(host, "www.happyfamilies.com") +|| dnsDomainIs(host, "www.happytoy.com") +|| dnsDomainIs(host, "www.harley-davidson.com") +|| dnsDomainIs(host, "www.harmonicalessons.com") +|| dnsDomainIs(host, "www.harperchildrens.com") +|| dnsDomainIs(host, "www.harvey.com") +|| dnsDomainIs(host, "www.hasbro-interactive.com") +|| dnsDomainIs(host, "www.haynet.net") +|| dnsDomainIs(host, "www.hbc.com") +|| dnsDomainIs(host, "www.hblewis.com") +|| dnsDomainIs(host, "www.hbook.com") +|| dnsDomainIs(host, "www.he.net") +|| dnsDomainIs(host, "www.headbone.com") +|| dnsDomainIs(host, "www.healthatoz.com") +|| dnsDomainIs(host, "www.healthypet.com") +|| dnsDomainIs(host, "www.heartfoundation.com.au") +|| dnsDomainIs(host, "www.heatersworld.com") +|| dnsDomainIs(host, "www.her-online.com") +|| dnsDomainIs(host, "www.heroesofhistory.com") +|| dnsDomainIs(host, "www.hersheypa.com") +|| dnsDomainIs(host, "www.hersheys.com") +|| dnsDomainIs(host, "www.hevanet.com") +|| dnsDomainIs(host, "www.heynetwork.com") +|| dnsDomainIs(host, "www.hgo.com") +|| dnsDomainIs(host, "www.hhof.com") +|| dnsDomainIs(host, "www.hideandseekpuppies.com") +|| dnsDomainIs(host, "www.hifusion.com") +|| dnsDomainIs(host, "www.highbridgepress.com") +|| dnsDomainIs(host, "www.his.com") +|| dnsDomainIs(host, "www.history.navy.mil") +|| dnsDomainIs(host, "www.historychannel.com") +|| dnsDomainIs(host, "www.historyhouse.com") +|| dnsDomainIs(host, "www.historyplace.com") +|| dnsDomainIs(host, "www.hisurf.com") +|| dnsDomainIs(host, "www.hiyah.com") +|| dnsDomainIs(host, "www.hmnet.com") +|| dnsDomainIs(host, "www.hoboes.com") +|| dnsDomainIs(host, "www.hockeydb.com") +|| dnsDomainIs(host, "www.hohnerusa.com") +|| dnsDomainIs(host, "www.holidaychannel.com") +|| dnsDomainIs(host, "www.holidayfestival.com") +|| dnsDomainIs(host, "www.holidays.net") +|| dnsDomainIs(host, "www.hollywood.com") +|| dnsDomainIs(host, "www.holoworld.com") +|| dnsDomainIs(host, "www.homepagers.com") +|| dnsDomainIs(host, "www.homeschoolzone.com") +|| dnsDomainIs(host, "www.homestead.com") +|| dnsDomainIs(host, "www.homeworkspot.com") +|| dnsDomainIs(host, "www.hompro.com") +|| dnsDomainIs(host, "www.honey.com") +|| dnsDomainIs(host, "www.hooked.net") +|| dnsDomainIs(host, "www.hoophall.com") +|| dnsDomainIs(host, "www.hooverdam.com") +|| dnsDomainIs(host, "www.hopepaul.com") +|| dnsDomainIs(host, "www.horse-country.com") +|| dnsDomainIs(host, "www.horsechat.com") +|| dnsDomainIs(host, "www.horsefun.com") +|| dnsDomainIs(host, "www.horus.ics.org.eg") +|| dnsDomainIs(host, "www.hotbraille.com") +|| dnsDomainIs(host, "www.hotwheels.com") +|| dnsDomainIs(host, "www.howstuffworks.com") +|| dnsDomainIs(host, "www.hpdigitalbookclub.com") +|| dnsDomainIs(host, "www.hpj.com") +|| dnsDomainIs(host, "www.hpl.hp.com") +|| dnsDomainIs(host, "www.hpl.lib.tx.us") +|| dnsDomainIs(host, "www.hpnetwork.f2s.com") +|| dnsDomainIs(host, "www.hsswp.com") +|| dnsDomainIs(host, "www.hsx.com") +|| dnsDomainIs(host, "www.humboldt1.com") +|| dnsDomainIs(host, "www.humongous.com") +|| dnsDomainIs(host, "www.humph3.freeserve.co.uk") +|| dnsDomainIs(host, "www.humphreybear.com ") +|| dnsDomainIs(host, "www.hurricanehunters.com") +|| dnsDomainIs(host, "www.hyperhistory.com") +|| dnsDomainIs(host, "www.i2k.com") +|| dnsDomainIs(host, "www.ibhof.com") +|| dnsDomainIs(host, "www.ibiscom.com") +|| dnsDomainIs(host, "www.ibm.com") +|| dnsDomainIs(host, "www.icangarden.com") +|| dnsDomainIs(host, "www.icecreamusa.com") +|| dnsDomainIs(host, "www.icn.co.uk") +|| dnsDomainIs(host, "www.icomm.ca") +|| dnsDomainIs(host, "www.idfishnhunt.com") +|| dnsDomainIs(host, "www.iditarod.com") +|| dnsDomainIs(host, "www.iei.net") +|| dnsDomainIs(host, "www.iemily.com") +|| dnsDomainIs(host, "www.iir.com") +|| dnsDomainIs(host, "www.ika.com") +|| dnsDomainIs(host, "www.ikoala.com") +|| dnsDomainIs(host, "www.iln.net") +|| dnsDomainIs(host, "www.imagine5.com") +|| dnsDomainIs(host, "www.imes.boj.or.jp") +|| dnsDomainIs(host, "www.inch.com") +|| dnsDomainIs(host, "www.incwell.com") +|| dnsDomainIs(host, "www.indian-river.fl.us") +|| dnsDomainIs(host, "www.indians.com") +|| dnsDomainIs(host, "www.indo.com") +|| dnsDomainIs(host, "www.indyracingleague.com") +|| dnsDomainIs(host, "www.indyzoo.com") +|| dnsDomainIs(host, "www.info-canada.com") +|| dnsDomainIs(host, "www.infomagic.net") +|| dnsDomainIs(host, "www.infoplease.com") +|| dnsDomainIs(host, "www.infoporium.com") +|| dnsDomainIs(host, "www.infostuff.com") +|| dnsDomainIs(host, "www.inhandmuseum.com") +|| dnsDomainIs(host, "www.inil.com") +|| dnsDomainIs(host, "www.inkspot.com") +|| dnsDomainIs(host, "www.inkyfingers.com") +|| dnsDomainIs(host, "www.innerauto.com") +|| dnsDomainIs(host, "www.innerbody.com") +|| dnsDomainIs(host, "www.inqpub.com") +|| dnsDomainIs(host, "www.insecta-inspecta.com") +|| dnsDomainIs(host, "www.insectclopedia.com") +|| dnsDomainIs(host, "www.inside-mexico.com") +|| dnsDomainIs(host, "www.insiders.com") +|| dnsDomainIs(host, "www.insteam.com") +|| dnsDomainIs(host, "www.intel.com") +|| dnsDomainIs(host, "www.intellicast.com") +|| dnsDomainIs(host, "www.interads.co.uk") +|| dnsDomainIs(host, "www.intercot.com") +|| dnsDomainIs(host, "www.intergraffix.com") +|| dnsDomainIs(host, "www.interknowledge.com") +|| dnsDomainIs(host, "www.interlog.com") +|| dnsDomainIs(host, "www.internet4kids.com") +|| dnsDomainIs(host, "www.intersurf.com") +|| dnsDomainIs(host, "www.inthe80s.com") +|| dnsDomainIs(host, "www.inventorsmuseum.com") +|| dnsDomainIs(host, "www.inwap.com") +|| dnsDomainIs(host, "www.ioa.com") +|| dnsDomainIs(host, "www.ionet.net") +|| dnsDomainIs(host, "www.iowacity.com") +|| dnsDomainIs(host, "www.ireland-now.com") +|| dnsDomainIs(host, "www.ireland.com") +|| dnsDomainIs(host, "www.irelandseye.com") +|| dnsDomainIs(host, "www.irlgov.ie") +|| dnsDomainIs(host, "www.isd.net") +|| dnsDomainIs(host, "www.islandnet.com") +|| dnsDomainIs(host, "www.isomedia.com") +|| dnsDomainIs(host, "www.itftennis.com") +|| dnsDomainIs(host, "www.itpi.dpi.state.nc.us") +|| dnsDomainIs(host, "www.itskwanzaatime.com") +|| dnsDomainIs(host, "www.itss.raytheon.com") +|| dnsDomainIs(host, "www.iuma.com") +|| dnsDomainIs(host, "www.iwaynet.net") +|| dnsDomainIs(host, "www.iwc.com") +|| dnsDomainIs(host, "www.iwight.gov.uk") +|| dnsDomainIs(host, "www.ixpres.com") +|| dnsDomainIs(host, "www.j.b.allen.btinternet.co.uk") +|| dnsDomainIs(host, "www.jabuti.com") +|| dnsDomainIs(host, "www.jackinthebox.com") +|| dnsDomainIs(host, "www.jaffebros.com") +|| dnsDomainIs(host, "www.jaguars.com") +|| dnsDomainIs(host, "www.jamaica-gleaner.com") +|| dnsDomainIs(host, "www.jamm.com") +|| dnsDomainIs(host, "www.janbrett.com") +|| dnsDomainIs(host, "www.janetstevens.com") +|| dnsDomainIs(host, "www.japan-guide.com") +|| dnsDomainIs(host, "www.jargon.net") +|| dnsDomainIs(host, "www.javelinamx.com") +|| dnsDomainIs(host, "www.jayjay.com") +|| dnsDomainIs(host, "www.jazclass.aust.com") +|| dnsDomainIs(host, "www.jedinet.com") +|| dnsDomainIs(host, "www.jenniferlopez.com") +|| dnsDomainIs(host, "www.jlpanagopoulos.com") +|| dnsDomainIs(host, "www.jmarshall.com") +|| dnsDomainIs(host, "www.jmccall.demon.co.uk") +|| dnsDomainIs(host, "www.jmts.com") +|| dnsDomainIs(host, "www.joesherlock.com") +|| dnsDomainIs(host, "www.jorvik-viking-centre.co.uk") +|| dnsDomainIs(host, "www.joycecarolthomas.com") +|| dnsDomainIs(host, "www.joycone.com") +|| dnsDomainIs(host, "www.joyrides.com") +|| dnsDomainIs(host, "www.jps.net") +|| dnsDomainIs(host, "www.jspub.com") +|| dnsDomainIs(host, "www.judaica.com") +|| dnsDomainIs(host, "www.judyblume.com") +|| dnsDomainIs(host, "www.julen.net") +|| dnsDomainIs(host, "www.june29.com") +|| dnsDomainIs(host, "www.juneteenth.com") +|| dnsDomainIs(host, "www.justuskidz.com") +|| dnsDomainIs(host, "www.justwomen.com") +|| dnsDomainIs(host, "www.jwindow.net") +|| dnsDomainIs(host, "www.k9web.com") +|| dnsDomainIs(host, "www.kaercher.de") +|| dnsDomainIs(host, "www.kaleidoscapes.com") +|| dnsDomainIs(host, "www.kapili.com") +|| dnsDomainIs(host, "www.kcchiefs.com") +|| dnsDomainIs(host, "www.kcpl.lib.mo.us") +|| dnsDomainIs(host, "www.kcroyals.com") +|| dnsDomainIs(host, "www.kcsd.k12.pa.us") +|| dnsDomainIs(host, "www.kdu.com") +|| dnsDomainIs(host, "www.kelloggs.com") +|| dnsDomainIs(host, "www.kentuckyfriedchicken.com") +|| dnsDomainIs(host, "www.kenyaweb.com") +|| dnsDomainIs(host, "www.keypals.com") +|| dnsDomainIs(host, "www.kfn.com") +|| dnsDomainIs(host, "www.kid-at-art.com") +|| dnsDomainIs(host, "www.kid-channel.com") +|| dnsDomainIs(host, "www.kidallergy.com") +|| dnsDomainIs(host, "www.kidbibs.com") +|| dnsDomainIs(host, "www.kidcomics.com") +|| dnsDomainIs(host, "www.kiddesafety.com") +|| dnsDomainIs(host, "www.kiddiecampus.com") +|| dnsDomainIs(host, "www.kididdles.com") +|| dnsDomainIs(host, "www.kidnews.com") +|| dnsDomainIs(host, "www.kidocracy.com") +|| dnsDomainIs(host, "www.kidport.com") +|| dnsDomainIs(host, "www.kids-channel.co.uk") +|| dnsDomainIs(host, "www.kids-drawings.com") +|| dnsDomainIs(host, "www.kids-in-mind.com") +|| dnsDomainIs(host, "www.kids4peace.com") +|| dnsDomainIs(host, "www.kidsandcomputers.com") +|| dnsDomainIs(host, "www.kidsart.co.uk") +|| dnsDomainIs(host, "www.kidsastronomy.com") +|| dnsDomainIs(host, "www.kidsbank.com") +|| dnsDomainIs(host, "www.kidsbookshelf.com") +|| dnsDomainIs(host, "www.kidsclick.com") +|| dnsDomainIs(host, "www.kidscom.com") +|| dnsDomainIs(host, "www.kidscook.com") +|| dnsDomainIs(host, "www.kidsdoctor.com") +|| dnsDomainIs(host, "www.kidsdomain.com") +|| dnsDomainIs(host, "www.kidsfarm.com") +|| dnsDomainIs(host, "www.kidsfreeware.com") +|| dnsDomainIs(host, "www.kidsfun.tv") +|| dnsDomainIs(host, "www.kidsgolf.com") +|| dnsDomainIs(host, "www.kidsgowild.com") +|| dnsDomainIs(host, "www.kidsjokes.com") +|| dnsDomainIs(host, "www.kidsloveamystery.com") +|| dnsDomainIs(host, "www.kidsmoneycents.com") +|| dnsDomainIs(host, "www.kidsnewsroom.com") +|| dnsDomainIs(host, "www.kidsource.com") +|| dnsDomainIs(host, "www.kidsparties.com") +|| dnsDomainIs(host, "www.kidsplaytown.com") +|| dnsDomainIs(host, "www.kidsreads.com") +|| dnsDomainIs(host, "www.kidsreport.com") +|| dnsDomainIs(host, "www.kidsrunning.com") +|| dnsDomainIs(host, "www.kidstamps.com") +|| dnsDomainIs(host, "www.kidsvideogames.com") +|| dnsDomainIs(host, "www.kidsway.com") +|| dnsDomainIs(host, "www.kidswithcancer.com") +|| dnsDomainIs(host, "www.kidszone.ourfamily.com") +|| dnsDomainIs(host, "www.kidzup.com") +|| dnsDomainIs(host, "www.kinderart.com") +|| dnsDomainIs(host, "www.kineticcity.com") +|| dnsDomainIs(host, "www.kings.k12.ca.us") +|| dnsDomainIs(host, "www.kiplinger.com") +|| dnsDomainIs(host, "www.kiwirecovery.org.nz") +|| dnsDomainIs(host, "www.klipsan.com") +|| dnsDomainIs(host, "www.klutz.com") +|| dnsDomainIs(host, "www.kn.pacbell.com") +|| dnsDomainIs(host, "www.knex.com") +|| dnsDomainIs(host, "www.knowledgeadventure.com") +|| dnsDomainIs(host, "www.knto.or.kr") +|| dnsDomainIs(host, "www.kodak.com") +|| dnsDomainIs(host, "www.konica.co.jp") +|| dnsDomainIs(host, "www.kraftfoods.com") +|| dnsDomainIs(host, "www.kudzukids.com") +|| dnsDomainIs(host, "www.kulichki.com") +|| dnsDomainIs(host, "www.kuttu.com") +|| dnsDomainIs(host, "www.kv5.com") +|| dnsDomainIs(host, "www.kyes-world.com") +|| dnsDomainIs(host, "www.kyohaku.go.jp") +|| dnsDomainIs(host, "www.kyrene.k12.az.us") +|| dnsDomainIs(host, "www.kz") +|| dnsDomainIs(host, "www.la-hq.org.uk") +|| dnsDomainIs(host, "www.labs.net") +|| dnsDomainIs(host, "www.labyrinth.net.au") +|| dnsDomainIs(host, "www.laffinthedark.com") +|| dnsDomainIs(host, "www.lakhota.com") +|| dnsDomainIs(host, "www.lakings.com") +|| dnsDomainIs(host, "www.lam.mus.ca.us") +|| dnsDomainIs(host, "www.lampstras.k12.pa.us") +|| dnsDomainIs(host, "www.lams.losalamos.k12.nm.us") +|| dnsDomainIs(host, "www.landofcadbury.ca") +|| dnsDomainIs(host, "www.larry-boy.com") +|| dnsDomainIs(host, "www.lasersite.com") +|| dnsDomainIs(host, "www.last-word.com") +|| dnsDomainIs(host, "www.latimes.com") +|| dnsDomainIs(host, "www.laughon.com") +|| dnsDomainIs(host, "www.laurasmidiheaven.com") +|| dnsDomainIs(host, "www.lausd.k12.ca.us") +|| dnsDomainIs(host, "www.learn2.com") +|| dnsDomainIs(host, "www.learn2type.com") +|| dnsDomainIs(host, "www.learnfree-hobbies.com") +|| dnsDomainIs(host, "www.learningkingdom.com") +|| dnsDomainIs(host, "www.learningplanet.com") +|| dnsDomainIs(host, "www.leftjustified.com") +|| dnsDomainIs(host, "www.legalpadjr.com") +|| dnsDomainIs(host, "www.legendarysurfers.com") +|| dnsDomainIs(host, "www.legends.dm.net") +|| dnsDomainIs(host, "www.legis.state.wi.us") +|| dnsDomainIs(host, "www.legis.state.wv.us") +|| dnsDomainIs(host, "www.lego.com") +|| dnsDomainIs(host, "www.leje.com") +|| dnsDomainIs(host, "www.leonardodicaprio.com") +|| dnsDomainIs(host, "www.lessonplanspage.com") +|| dnsDomainIs(host, "www.letour.fr") +|| dnsDomainIs(host, "www.levins.com") +|| dnsDomainIs(host, "www.levistrauss.com") +|| dnsDomainIs(host, "www.libertystatepark.com") +|| dnsDomainIs(host, "www.libraryspot.com") +|| dnsDomainIs(host, "www.lifelong.com") +|| dnsDomainIs(host, "www.lighthouse.cc") +|| dnsDomainIs(host, "www.lightlink.com") +|| dnsDomainIs(host, "www.lightspan.com") +|| dnsDomainIs(host, "www.lil-fingers.com") +|| dnsDomainIs(host, "www.linc.or.jp") +|| dnsDomainIs(host, "www.lindsaysbackyard.com") +|| dnsDomainIs(host, "www.lindtchocolate.com") +|| dnsDomainIs(host, "www.lineone.net") +|| dnsDomainIs(host, "www.lionel.com") +|| dnsDomainIs(host, "www.lisafrank.com") +|| dnsDomainIs(host, "www.lissaexplains.com") +|| dnsDomainIs(host, "www.literacycenter.net") +|| dnsDomainIs(host, "www.littleartist.com") +|| dnsDomainIs(host, "www.littlechiles.com") +|| dnsDomainIs(host, "www.littlecritter.com") +|| dnsDomainIs(host, "www.littlecrowtoys.com") +|| dnsDomainIs(host, "www.littlehousebooks.com") +|| dnsDomainIs(host, "www.littlejason.com") +|| dnsDomainIs(host, "www.littleplanettimes.com") +|| dnsDomainIs(host, "www.liveandlearn.com") +|| dnsDomainIs(host, "www.loadstar.prometeus.net") +|| dnsDomainIs(host, "www.localaccess.com") +|| dnsDomainIs(host, "www.lochness.co.uk") +|| dnsDomainIs(host, "www.lochness.scotland.net") +|| dnsDomainIs(host, "www.logos.it") +|| dnsDomainIs(host, "www.lonelyplanet.com") +|| dnsDomainIs(host, "www.looklearnanddo.com") +|| dnsDomainIs(host, "www.loosejocks.com") +|| dnsDomainIs(host, "www.lost-worlds.com") +|| dnsDomainIs(host, "www.love-story.com") +|| dnsDomainIs(host, "www.lpga.com") +|| dnsDomainIs(host, "www.lsjunction.com") +|| dnsDomainIs(host, "www.lucasarts.com") +|| dnsDomainIs(host, "www.lucent.com") +|| dnsDomainIs(host, "www.lucie.com") +|| dnsDomainIs(host, "www.lunaland.co.za") +|| dnsDomainIs(host, "www.luth.se") +|| dnsDomainIs(host, "www.lyricalworks.com") +|| dnsDomainIs(host, "www.infoporium.com") +|| dnsDomainIs(host, "www.infostuff.com") +|| dnsDomainIs(host, "www.inhandmuseum.com") +|| dnsDomainIs(host, "www.inil.com") +|| dnsDomainIs(host, "www.inkspot.com") +|| dnsDomainIs(host, "www.inkyfingers.com") +|| dnsDomainIs(host, "www.innerauto.com") +|| dnsDomainIs(host, "www.innerbody.com") +|| dnsDomainIs(host, "www.inqpub.com") +|| dnsDomainIs(host, "www.insecta-inspecta.com") +|| dnsDomainIs(host, "www.insectclopedia.com") +|| dnsDomainIs(host, "www.inside-mexico.com") +|| dnsDomainIs(host, "www.insiders.com") +|| dnsDomainIs(host, "www.insteam.com") +|| dnsDomainIs(host, "www.intel.com") +|| dnsDomainIs(host, "www.intellicast.com") +|| dnsDomainIs(host, "www.interads.co.uk") +|| dnsDomainIs(host, "www.intercot.com") +|| dnsDomainIs(host, "www.intergraffix.com") +|| dnsDomainIs(host, "www.interknowledge.com") +|| dnsDomainIs(host, "www.interlog.com") +|| dnsDomainIs(host, "www.internet4kids.com") +|| dnsDomainIs(host, "www.intersurf.com") +|| dnsDomainIs(host, "www.inthe80s.com") +|| dnsDomainIs(host, "www.inventorsmuseum.com") +|| dnsDomainIs(host, "www.inwap.com") +|| dnsDomainIs(host, "www.ioa.com") +|| dnsDomainIs(host, "www.ionet.net") +|| dnsDomainIs(host, "www.iowacity.com") +|| dnsDomainIs(host, "www.ireland-now.com") +|| dnsDomainIs(host, "www.ireland.com") +|| dnsDomainIs(host, "www.irelandseye.com") +|| dnsDomainIs(host, "www.irlgov.ie") +|| dnsDomainIs(host, "www.isd.net") +|| dnsDomainIs(host, "www.islandnet.com") +|| dnsDomainIs(host, "www.isomedia.com") +|| dnsDomainIs(host, "www.itftennis.com") +|| dnsDomainIs(host, "www.itpi.dpi.state.nc.us") +|| dnsDomainIs(host, "www.itskwanzaatime.com") +|| dnsDomainIs(host, "www.itss.raytheon.com") +|| dnsDomainIs(host, "www.iuma.com") +|| dnsDomainIs(host, "www.iwaynet.net") +|| dnsDomainIs(host, "www.iwc.com") +|| dnsDomainIs(host, "www.iwight.gov.uk") +|| dnsDomainIs(host, "www.ixpres.com") +|| dnsDomainIs(host, "www.j.b.allen.btinternet.co.uk") +|| dnsDomainIs(host, "www.jabuti.com") +|| dnsDomainIs(host, "www.jackinthebox.com") +|| dnsDomainIs(host, "www.jaffebros.com") +|| dnsDomainIs(host, "www.jaguars.com") +|| dnsDomainIs(host, "www.jamaica-gleaner.com") +|| dnsDomainIs(host, "www.jamm.com") +|| dnsDomainIs(host, "www.janbrett.com") +|| dnsDomainIs(host, "www.janetstevens.com") +|| dnsDomainIs(host, "www.japan-guide.com") +|| dnsDomainIs(host, "www.jargon.net") +|| dnsDomainIs(host, "www.javelinamx.com") +|| dnsDomainIs(host, "www.jayjay.com") +|| dnsDomainIs(host, "www.jazclass.aust.com") + +) +return "PROXY proxy.hclib.org:80"; +else +return "PROXY 172.16.100.20:8080"; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js new file mode 100644 index 0000000..4ed9f67 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js @@ -0,0 +1,62 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributors:darren.deridder@icarusproject.com, +* pschwartau@netscape.com +* Date: 07 July 2001 +* +* SUMMARY: Regression test for Bugzilla bug 89474 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=89474 +* +* This test used to crash the JS shell. This was discovered +* by Darren DeRidder <darren.deridder@icarusproject.com +*/ +//------------------------------------------------------------------------------------------------- +var bug = 89474; +var summary = "Testing the JS shell doesn't crash on it.item()"; +var cnTest = 'it.item()'; + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + tryThis(cnTest); // Just testing that we don't crash on this + + exitFunc ('test'); +} + + +function tryThis(sEval) +{ + try + { + eval(sEval); + } + catch(e) + { + // If we get here, we didn't crash. + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js new file mode 100644 index 0000000..d628ce9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js @@ -0,0 +1,306 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-12 +* +* SUMMARY: Regression test for bug 90445 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=90445 +* +* Just seeing if this script will compile without crashing. +*/ +//------------------------------------------------------------------------------------------------- +var bug = 90445; +var summary = 'Testing this script will compile without crashing'; + +printBugNumber (bug); +printStatus (summary); + + +// The big function - +function compte() { + var mois = getValueFromOption(document.formtest.mois); + var region = document.formtest.region.options.selectedIndex; + var confort = document.formtest.confort.options.selectedIndex; + var encadrement = document.formtest.encadrement.options.selectedIndex; + var typeVillage = document.formtest.type_village.options.selectedIndex; + var budget = document.formtest.budget.value; + var sport1 = document.formtest.sport1.options.selectedIndex; + var sport2 = document.formtest.sport2.options.selectedIndex; + var sport3 = document.formtest.sport3.options.selectedIndex; + var activite1 = document.formtest.activite1.options.selectedIndex; + var activite2 = document.formtest.activite2.options.selectedIndex; + var activite3 = document.formtest.activite3.options.selectedIndex; + + var ret = 0; + var liste; + var taille; + var bl; + var i; + var j; + V=[ + [1,14,19,1,3,3,3,0,[10,13,17,18,22,23,26,27,29,9],[13,17,18,20,4,5,6,7,8]], + [1,14,18,1,1,3,3,0,[1,11,13,22,23,26,27,28,29,3,4,9],[13,17,18,20,6]], + [1,14,19,1,3,4,3,0,[13,17,18,22,23,25,26,27,4,9],[11,17,12,2,20,3,21,9,6]], + [1,14,19,1,1,3,3,0,[1,10,13,22,23,24,25,26,27,28,4,8,9],[13,17,6,9]], + [1,14,18,1,3,4,3,0,[12,13,22,23,27,28,7,9],[13,17,2,20,6,7,9]], + [1,14,19,5,4,2,3,0,[12,13,17,18,2,21,22,23,24,26,27,28,3,5,8,9],[1,10,13,17,18,19,20,5,21,7,8,9]], + [1,14,20,6,2,2,3,0,[11,13,2,22,23,26,27,3,4,5,8,9],[13,17,18,20,6,9]], + [1,14,19,6,3,4,3,0,[10,13,2,22,23,26,27,3,4,5,8,9],[13,17,18,19,20,21,9,6,5]], + [1,14,19,4,2,4,3,0,[13,17,2,22,26,28,3,5,6,7,8,9],[10,13,15,17,19,2,20,3,5,6,9]], + [1,14,19,8,4,4,3,0,[13,2,22,26,3,28,4,5,6,8,9],[14,15,17,18,19,2,20,21,9,7]], + [1,15,18,6,1,4,3,0,[10,11,13,14,15,2,23,26,27,5,8,9,6],[13,17,2,20,6,9]], + [1,14,19,2,3,5,3,0,[10,13,17,2,22,26,27,28,3,5,6,7,8,9],[1,10,13,15,17,18,19,20,6,7,9,22]], + [1,15,18,6,1,3,3,0,[12,13,15,2,22,23,26,4,5,9],[13,15,6,17,2,21,9]], + [1,19,21,1,4,4,3,0,[11,13,18,22,23,27,28,4],[17,2,20,21,9]], + [1,14,19,4,3,3,3,0,[10,13,17,2,22,23,24,26,27,3,4,6,8,9],[10,13,17,19,20,3,5,6,7,9]], + [1,13,19,6,3,3,3,0,[11,13,15,2,22,23,26,27,28,3,4,8,9],[1,13,17,18,20,6,9,22]], + [1,15,19,6,1,5,3,0,[10,13,2,22,23,26,27,4,5,8,11],[10,13,17,20,5,6,9]], + [1,15,18,6,3,2,1,0,[10,17,21,22,23,25,26,9],[13,16,17,20,21,8,9]], + [1,14,19,8,2,2,3,0,[13,16,21,22,23,24,26,27,3,4,5,6,8,9],[15,17,20,3,6,9]], + [1,14,19,5,3,2,3,0,[10,11,13,16,17,2,21,22,23,24,26,27,3,4,8,9],[1,10,13,17,18,19,20,5,6,7,9]], + [1,14,19,4,4,4,3,0,[10,13,2,22,23,26,27,3,4,5,6,7,8,9],[13,14,17,19,20,21,7,9]], + [1,14,19,1,3,2,3,0,[10,13,22,23,26,27,28,3,4,5,6,8,9],[15,17,18,2,20,6,8,9]], + [1,14,19,6,1,5,3,0,[10,11,13,22,25,26,4,5,7,8,9],[10,13,17,2,20,5,6,9]], + [1,14,19,6,4,4,3,0,[10,13,17,18,22,23,26,27,4,9,5],[1,13,14,17,18,20,3,21,7,8,9]], + [1,12,20,6,3,4,2,0,[10,13,14,17,18,22,23,25,26,27,29,9],[13,14,16,17,20,3,8,7,9]], + [1,14,19,1,3,3,3,0,[10,11,13,17,2,22,23,26,27,29,3,4,8,9],[1,10,13,14,15,17,18,20,5,21,7,8,9,25]], + [1,14,20,1,2,5,3,0,[12,13,17,22,23,26,28,3,4,8,9,27],[10,13,17,18,20,5,6,9,22]], + [1,14,19,1,2,3,3,0,[13,17,22,23,26,27,28,29,3,4,8,19],[13,17,18,20,6,7,8,9]], + [1,14,18,6,1,3,3,0,[12,13,15,2,22,23,26,27,28,4,9],[13,17,6,9]], + [1,14,19,5,3,4,3,0,[13,2,26,27,28,3,4,5,6],[1,10,13,15,17,18,2,20,3,21,7]], + [1,14,18,6,3,3,3,0,[13,2,22,23,26,27,8,3,4,5,9],[1,13,17,18,19,2,20,6,8,9,22]], + [1,14,19,6,4,3,2,0,[10,13,17,18,22,23,25,26,27,29],[13,14,16,17,3,7,8]], + [1,14,18,6,3,3,3,0,[13,22,23,26,27,28,3,4,5,7,8,9],[13,17,18,2,20,3,5,6,9]], + [1,14,20,1,3,2,3,0,[10,13,15,17,19,2,22,23,24,26,27,3,4,8,9],[13,17,18,20,6,7,8,9]], + [1,14,20,6,3,1,3,0,[10,13,16,2,22,23,26,27,3,4,6,8,9],[13,17,20,5,6,9]], + [1,14,19,3,3,3,3,0,[10,12,13,18,21,22,23,24,26,27,29,3,4,8,9],[1,10,17,20,6,8,9]], + [1,14,19,2,3,1,3,0,[12,13,17,2,22,23,24,26,27,28,4,8,9,19],[1,13,17,18,19,20,6,9]], + [1,14,19,5,4,2,3,0,[10,11,13,17,2,21,3,22,23,24,25,26,27,5,6,8,9],[13,17,20,3,21,9]], + [1,14,19,6,2,3,3,0,[13,22,23,26,27,28,3,4,5,7,8,9],[13,17,18,20,5,6,9]], + [1,14,20,6,3,2,3,0,[10,12,13,19,2,22,23,24,25,1,26,27,28,3,4,8,9],[10,13,17,18,20,3,5,6,7,8,9]], + [1,14,19,5,3,4,3,0,[12,13,2,26,27,28,3,4,5,6,8,9],[10,13,17,18,2,20,3,21,7]], + [1,14,19,6,3,4,3,0,[13,16,22,23,26,27,28,3,5,7,8,9],[10,13,17,18,19,2,20,5,6,7,8,9]], + [1,14,19,6,3,2,3,0,[10,13,22,23,24,25,26,27,3,4,7,8,9],[1,13,17,20,5,21,9,23]], + [1,14,18,6,2,2,3,0,[11,13,2,22,23,26,27,3,4,8,9],[1,13,14,15,17,18,19,2,20,6,7,8,5]], + [1,14,19,6,2,3,3,0,[13,17,2,22,23,26,27,4,5,7,9],[13,14,16,17,9,22]], + [1,14,19,8,3,2,3,0,[13,18,22,23,24,27,28,3,4,5,8,9],[15,16,17,18,19,2,20,6,9]], + [1,14,19,1,3,4,2,0,[13,17,18,22,23,26,27,29,9,11,8],[13,17,20,3,21,7,8,9,6]], + [1,15,18,6,4,4,1,0,[13,17,22,25,27,29],[14,16,3,7,8]], + [1,14,18,6,3,1,3,0,[12,13,16,17,18,19,2,22,23,26,27,3,4,9],[13,17,20,3,6,9]], + [1,14,19,6,2,3,2,0,[13,2,22,23,26,27,9],[13,16,17,9]], + [1,14,19,8,3,4,3,0,[13,22,26,5,6,7,8,9],[13,15,17,18,19,2,20,6,9]], + [1,14,20,1,2,2,3,0,[11,13,22,23,26,27,28,29,3,4,9],[13,17,18,20,6,9]], + [1,14,19,6,3,2,2,0,[10,13,17,18,22,23,24,25,26,27,9],[1,13,14,16,17,20,3,6,7,8,9]], + [1,14,18,6,3,5,3,0,[11,13,18,22,23,26,27,4,5,2],[1,10,13,17,2,20,5,6,9,22]], + [1,14,19,1,3,4,2,0,[17,22,23,26,27,13],[13,16,17,18,2,20,11,6,7,8,9]], + [1,15,18,6,1,2,3,0,[13,15,2,22,23,26,3,4,5,6,9],[1,13,17,20,6,9,5]], + [1,14,20,6,3,2,3,0,[10,11,24,13,2,22,23,26,27,3,4,5,7,8,9],[1,10,13,17,18,19,2,20,5,6,7,8,9,23]], + [1,14,19,4,4,4,3,0,[10,13,17,18,2,22,26,27,28,3,4,5,6,8,9,23],[14,15,17,19,2,20,3,21,7,9,10]], + [1,14,19,5,4,3,3,0,[10,13,17,21,22,23,26,27,5,8,9],[10,13,17,18,19,2,20,21,7,9]], + [1,14,19,7,4,4,3,0,[13,17,2,22,23,26,27,18,28,3,4,5,7,9],[10,13,17,18,19,2,20,3,21,9]], + [1,12,20,6,2,2,2,0,[10,11,13,17,18,22,23,25,26,27,29,8,9],[1,13,16,17,3,6,8,9,24]], + [1,14,18,6,3,3,1,0,[13,16,17,22,25,26,27,9],[13,16,17,20,21,8]], + [1,14,19,6,2,5,3,0,[13,17,2,22,23,26,27,4,5,9],[10,13,17,2,20,5,6,9]], + [1,14,19,6,2,3,3,0,[1,13,17,22,23,26,27,28,4,6,9],[13,17,18,20,6,9]], + [1,14,19,4,3,2,3,0,[12,13,17,19,2,22,23,24,26,27,28,3,4,5,8,9],[13,15,17,19,20,21,9,5]], + [1,14,19,5,4,2,3,0,[10,17,2,21,22,23,24,26,27,28,3,4,6,8,9],[1,10,13,14,17,19,20,3,21,7,8,9]], + [1,14,19,3,4,3,3,0,[10,12,13,2,21,22,23,26,27,4,7,8,9],[1,13,17,20,6,8,9]], + [1,14,19,5,3,2,1,0,[13,17,19,21,22,23,24,25,26,27,8,9],[1,14,17,3,6,8,13]], + [1,14,19,2,3,1,3,0,[10,11,13,17,18,19,22,24,26,27,4,7,8,9],[13,17,19,20,3,6,9]], + [1,14,19,6,2,3,3,0,[13,2,22,23,26,27,4,5,9],[1,13,17,18,20,6,9,24]], + [1,14,18,6,2,2,3,0,[11,13,22,23,24,25,26,27,3,4,5,6,8,9],[1,13,17,20,3,5,6,9]], + [1,14,18,1,2,2,3,0,[1,11,13,15,17,2,22,23,26,27,4,9],[1,13,17,18,20,6,9]], + [1,14,19,2,3,4,3,0,[10,13,22,26,27,28,29,3,4,5,6,7,8,9,36],[1,13,15,17,18,19,20,5,6,7,8,9]], + [1,14,19,6,2,1,2,0,[13,17,21,22,26,27,3,8,9],[13,17,20,6]], + [1,15,18,6,4,3,1,0,[10,13,16,17,20,22,25,27],[16,17,3,6,7,8,9]], + [1,14,19,4,3,5,3,0,[10,11,13,17,22,24,26,27,28,3,4,5,6,7,8,9],[10,13,15,17,2,20,3,6,7,9]], + [1,14,20,6,3,1,2,0,[10,11,17,18,19,22,23,25,26,27,29,8,9],[1,10,13,14,16,17,3,4,6,7,8,9]], + [1,15,18,6,3,3,1,0,[13,16,22,26,27,9,23],[13,16,17,20,21,6]], + [1,15,18,1,3,4,3,0,[10,13,17,2,22,23,25,26,27,28,29,4,9,12],[13,17,18,20,6,9,5]], + [1,21,25,6,2,1,4,0,[30,31,34,35],[6,3]], + [1,21,25,6,3,4,4,0,[30,31,34,35],[6,3]], + [1,20,25,1,3,3,3,0,[9,10,13,17,18,22,23,26,27,29],[20,18,17,13,8,7,6,5,4]], + [1,21,25,6,2,5,4,0,[30,31,34,35],[6,3]], + [1,21,25,6,3,3,4,0,[30,31,96,79,34,35],[6,7]], + [1,21,25,1,3,4,3,0,[4,9,13,17,18,22,23,25,26,27],[21,20,17,12,11,9,3,2]], + [1,21,25,6,2,3,4,0,[30,34],[6,3]], + [1,22,25,1,3,4,3,0,[7,9,12,13,22,23,27,28],[20,17,13,9,7,6,2]], + [1,21,25,6,3,3,4,0,[30,31,34,35],[6]], + [1,20,25,5,4,2,3,0,[2,3,5,8,9,12,13,17,18,21,22,23,24,26,27,28],[21,20,19,18,17,13,10,9,8,7,5,1]], + [1,20,25,8,4,4,3,0,[2,3,4,5,6,9,13,22,26,28],[21,20,19,18,17,15,9]], + [1,24,25,6,2,2,3,0,[2,3,4,5,6,8,9,11,13,22,23,26,27,29],[20,18,17,13,9,8,7,6]], + [1,20,25,4,2,4,3,0,[2,3,5,6,7,8,9,12,13,17,22,26,28],[20,19,17,15,13,10,9,6,5,3,2]], + [1,20,25,2,3,5,3,0,[2,3,5,6,7,8,9,10,13,17,22,26,27,28],[20,19,18,17,13,10,9,7,6,1]], + [1,20,25,4,3,3,3,0,[2,3,4,6,8,9,13,17,22,23,24,26,27],[20,19,17,13,10,9,7,6,5,3]], + [1,20,25,1,3,2,3,0,[3,4,5,6,8,9,10,13,22,23,26,27,28],[20,18,17,15,9,8,6,2]], + [1,21,25,2,3,3,4,0,[30,31,34,35],[6,3,7]], + [1,21,25,6,3,2,4,0,[30,34],[6,3]], + [1,20,25,5,3,2,3,0,[8,9,10,11,13,16,17,21,22,23,24,26,27],[20,19,18,17,13,10,9,7,6,5,1]], + [1,20,25,2,2,5,4,0,[30,31,34],[6,3,7]], + [1,20,25,4,4,4,3,0,[2,3,4,5,6,8,9,10,13,22,23,26,27],[21,20,19,17,14,13,9,7]], + [1,24,25,6,3,3,3,0,[2,3,4,8,9,11,13,15,22,23,26,27,28],[20,18,17,13,9,6,1]], + [1,22,25,1,4,4,3,0,[4,11,13,18,22,23,27,28],[21,20,17,9]], + [1,21,25,6,2,1,4,0,[30,34,35],[6,3]], + [1,20,25,6,4,4,3,0,[9,10,13,17,18,22,23,26,27],[21,20,18,17,14,13,9,8,7,3,1]], + [1,24,25,6,3,4,2,0,[9,10,13,17,18,22,23,25,26,27,29],[20,17,16,14,13,9,8,7,3]], + [1,20,25,1,3,3,3,0,[2,3,4,8,9,10,11,13,17,22,23,26,27,29],[21,20,18,17,15,14,13,10,9,8,7,5,1]], + [1,20,25,1,2,3,3,0,[3,4,8,11,13,17,22,23,26,27,28,29],[20,18,17,13,9,8,7,6]], + [1,20,25,5,3,4,3,0,[2,3,4,5,6,13,26,27,28],[21,20,18,17,15,13,10,3,2,1]], + [1,20,25,6,4,3,2,0,[10,13,17,18,22,23,25,26,27,29],[17,16,14,13,8,7,3]], + [1,21,25,6,2,1,4,0,[30,34,35],[6,3]], + [1,21,25,1,3,2,3,0,[2,3,4,8,9,10,13,15,17,19,22,23,24,26,27],[20,18,17,13,8,9,7,6]], + [1,20,25,2,3,3,3,0,[11,13,2,21,22,23,24,26,27,28,29,3,4,5,8,9],[1,13,17,18,19,2,20,3,6,7,9]], + [1,24,25,6,3,1,3,0,[2,3,4,6,8,9,10,13,16,22,23,26,27],[20,17,13,9,6,5]], + [1,20,25,3,3,3,3,0,[3,4,8,9,10,12,13,18,21,22,23,24,26,27,29],[20,17,10,9,8,6,1]], + [1,20,25,2,3,1,3,0,[2,4,8,9,12,13,17,22,23,24,26,27,28],[20,19,18,17,13,9,6,1]], + [1,20,25,5,4,2,3,0,[2,3,5,6,8,9,10,11,13,17,21,22,23,24,25,26,27],[21,20,17,13,9,3]], + [1,24,25,6,3,2,3,0,[2,3,4,8,9,10,13,19,22,23,24,25,26,27,28],[20,18,17,13,10,9,8,7,6,5,3]], + [1,21,25,6,2,1,4,0,[30,31,33,34],[6]], + [1,20,25,8,3,2,3,0,[3,4,5,8,9,13,17,18,22,23,24,27,28],[20,19,18,17,15,9,6]], + [1,21,25,6,4,4,4,0,[30,31,27,10,34],[6,3,7]], + [1,21,25,6,4,4,4,0,[30,31,34],[6,3,7]], + [1,20,25,1,3,4,2,0,[9,13,17,18,22,23,26,27,29],[20,17,13,9,8,7,6,3]], + [1,20,25,7,4,4,3,0,[2,3,4,5,7,9,13,17,18,22,23,26,27,28],[21,20,19,18,17,13,10,9,3,2]], + [1,21,25,6,4,4,4,0,[30,31,34],[6,7]], + [1,21,25,6,3,3,4,0,[30,31,35],[6,3]], + [1,20,25,8,3,4,3,0,[5,6,7,8,9,13,22,26,28],[20,19,18,17,15,13,9,6,2]], + [1,21,25,1,2,2,3,0,[3,4,9,11,13,22,23,26,27,28,29],[20,18,17,13,9,6]], + [1,20,25,6,3,2,2,0,[9,10,13,17,18,22,23,25,26,27],[20,17,16,14,13,9,8,7,6,3,1]], + [1,24,25,6,3,2,3,0,[2,3,4,5,7,8,9,10,11,13,22,23,24,26,27],[20,19,18,17,13,10,9,8,7,6,5,2,1]], + [1,20,25,2,3,5,3,0,[29,24,13,4,5,22,23,16,2,28,9,10],[7,13,5,1,15,3,9,6,17]], + [1,20,25,4,3,2,3,0,[2,3,4,5,6,8,9,12,13,17,19,22,23,24,26,27,28],[20,19,17,13,9]], + [1,20,25,5,4,3,3,0,[3,4,5,8,9,10,13,17,21,22,23,26,27],[21,20,19,18,17,13,10,9,7,2]], + [1,20,25,4,4,4,3,0,[2,3,4,5,6,8,9,10,13,17,18,22,23,26,27,28],[21,20,19,17,15,14,9,7,3,2]], + [1,21,25,6,3,3,4,0,[30,31,10,34],[6,3,7]], + [1,20,25,6,2,3,3,0,[1,4,6,9,13,17,22,23,26,27,28],[20,18,17,13,9,6]], + [1,21,25,6,2,2,2,0,[8,9,10,11,13,17,18,22,23,25,26,27,29],[17,16,13,9,8,6,3,1]], + [1,21,25,6,3,4,4,0,[30,32,33,27,34],[6,7]], + [1,20,25,3,4,3,3,0,[2,4,7,8,9,10,12,13,21,22,23,26,27],[20,17,13,9,8,6,1]], + [1,20,25,6,2,3,3,0,[],[20,18,17,13,9,6,1]], + [1,20,25,2,3,1,3,0,[4,7,8,9,10,11,13,17,18,19,22,24,26,27],[20,19,17,13,9,6,3]], + [1,20,25,5,3,2,4,0,[30,31,96],[6,3,7]], + [1,20,25,2,3,4,3,0,[3,4,5,6,7,8,9,10,13,22,26,27,28,29],[20,19,18,17,13,9,8,7,6,5,1]], + [1,21,25,6,3,3,4,0,[30,31,27,10,34],[6,7]], + [1,21,25,4,3,2,3,0,[3,4,5,6,8,9,10,11,13,18,19,22,23,26,27],[20,17,13,9]], + [1,21,25,6,4,3,4,0,[30,31,27,10,35],[6,7]], + [1,21,25,6,2,2,4,0,[30,34],[6,3]], + [1,24,25,6,2,1,2,0,[3,8,9,13,17,21,22,26,27],[20,17,13,6]], + [1,20,25,4,3,5,3,0,[3,4,5,6,7,8,9,10,11,13,17,22,24,26,27,28],[20,17,15,13,10,9,7,6,3,2]], + [1,20,26,6,4,3,4,0,[30,31,27,10,34,35],[6,3,7]], + [1,21,25,6,2,3,4,0,[30,33,34],[6]], + [1,21,25,6,3,1,2,0,[8,9,10,11,17,18,19,22,23,25,26,27,29],[17,16,14,13,10,9,8,7,6,4,3,1]], + [1,21,25,6,4,4,4,0,[30,31,10,34,35],[6,7]], + [1,21,25,6,3,2,4,0,[30,31,33,34],[6,3]], + [1,21,26,6,3,5,4,0,[30,31],[6,3]], + [1,21,25,6,2,1,4,0,[30,34,35],[6,3]], + [1,21,25,6,3,3,4,0,[30,34],[6]], + [1,20,25,8,2,2,3,0,[3,4,5,6,8,9,13,16,21,22,23,24,26,27],[20,17,15,9,6,3]], + [1,20,25,5,3,4,3,0,[2,3,4,5,6,8,9,12,13,26,27,28],[21,20,18,17,13,10,3,2]], + [1,20,25,5,4,2,3,0,[3,4,6,8,9,10,17,21,22,23,24,26,27,28],[21,20,19,17,14,13,10,9,8,7,3,1]], + [1,13,19,6,2,3,3,0,[2,3,13,22,19,8,9,12,27],[9,6,17,20]], + [1,15,18,2,3,3,1,0,[25,24,13,16,19,8,9,10,17,22,29,23],[16,8,3,21,17,19]], + [1,14,19,2,3,3,3,0,[13,2,21,22,23,24,26,27,28,29,3,4,5,8,9,17],[1,13,17,18,19,2,20,3,6,7,9]], + [1,15,18,6,4,4,1,0,[29,16,17,22,27,10],[16,8,3,14,7]], + [1,14,20,6,3,4,3,0,[3,4,2,5,13,22,23,27,8,9],[20,7,8,2,9,21,17]], + [1,14,19,2,3,5,3,0,[29,24,13,4,5,22,23,16,2,28,9,10],[7,13,5,1,15,3,9,6,17]], + [1,15,18,6,3,2,1,0,[25,13,22,23,17,29,16,9],[16,21,17,20]], + [1,24,25,6,2,3,3,0,[],[]], + [1,21,25,1,2,5,3,0,[],[]], + [1,21,25,6,3,4,3,0,[],[]] + ]; + + var nbVillages = V.length; + + for (i=0; i<nbVillages; i++) { + if ((((mois == 0) && (1==V[i][0])) || ((mois >= V[i][1]) && (mois <= V[i][2]))) && + ((region == 0) || (region == V[i][3] )) && + ((confort == 0) || (confort == V[i][4] )) && + ((encadrement == 0) || + ((encadrement==3)&&((V[i][5]==1)||(V[i][5]==2)||(V[i][5] == 3))) || + ((encadrement==2)&&((V[i][5]==1)||(V[i][5]==2) )) || + ((encadrement==1)&&(encadrement==V[i][5]) ) || + ((encadrement>3)&&(encadrement==V[i][5]) )) && + ((typeVillage == 0) || (typeVillage == V[i][6] )) && + ((budget == 0) || (budget == V[i][7] ))) { + + bl = 1; + if ((sport1 != 0) || (sport2 != 0) || (sport3 != 0)) { + bl = 0; + liste = V[i][8]; + taille = liste.length; + for (j=0; j<taille; j++) { + if ((sport1 == 0) || ((sport1 != 0) && (sport1 == liste[j]))) { + bl = 1; + break; + } + } + if (bl == 1) { + bl = 0; + for (j=0; j<taille; j++) { + if ((sport2 == 0) || ((sport2 != 0) && (sport2 == liste[j]))) { + bl = 1; + break; + } + } + } + if (bl == 1) { + bl = 0; + for (j=0; j<taille; j++) { + if ((sport3 == 0) || ((sport3 != 0) && (sport3 == liste[j]))) { + bl = 1; + break; + } + } + } + } + if ((bl==1) && ((activite1 != 0) || (activite2 != 0) || (activite3 != 0))) { + bl = 0; + liste = V[i][9]; + taille = liste.length; + for (j=0; j<taille; j++) { + if ((activite1 == 0) || ((activite1 != 0) && (activite1 == liste[j]))) { + bl = 1; + break; + } + } + if (bl == 1) { + bl = 0; + for (j=0; j<taille; j++) { + if ((activite2 == 0) || ((activite2 != 0) && (activite2 == liste[j]))) { + bl = 1; + break; + } + } + } + if (bl == 1) { + bl = 0; + for (j=0; j<taille; j++) { + if ((activite3 == 0) || ((activite3 != 0) && (activite3 == liste[j]))) { + bl = 1; + break; + } + } + } + } + if (1 == bl) { + ret++; + } + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js new file mode 100644 index 0000000..76987c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js @@ -0,0 +1,64 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): jband@netscape.com, pschwartau@netscape.com +* Date: 29 Aug 2001 +* +* SUMMARY: Negative test that JS infinite recursion protection works. +* We expect the code here to fail (i.e. exit code 3), but NOT crash. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96128 +*/ +//----------------------------------------------------------------------------- +var bug = 96128; +var summary = 'Testing that JS infinite recursion protection works'; + + +function objRecurse() +{ + /* + * jband: + * + * Causes a stack overflow crash in debug builds of both the browser + * and the shell. In the release builds this is safely caught by the + * "too much recursion" mechanism. If I remove the 'new' from the code below + * this is safely caught in both debug and release builds. The 'new' causes a + * lookup for the Constructor name and seems to (at least) double the number + * of items on the C stack for the given interpLevel depth. + */ + return new objRecurse(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + // we expect this to fail (exit code 3), but NOT crash. - + var obj = new objRecurse(); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js new file mode 100644 index 0000000..8e8549b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js @@ -0,0 +1,530 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 04 Sep 2002 +* SUMMARY: Just seeing that we don't crash when compiling this script - +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526 +* +*/ +//----------------------------------------------------------------------------- +printBugNumber(96526); +printStatus("Just seeing that we don't crash when compiling this script -"); + + +/* + * Function definition with lots of branches, from http://www.newyankee.com + */ +function setaction(jumpto) +{ + if (jumpto == 0) window.location = "http://www.newyankee.com/GetYankees2.cgi?1.jpg"; + else if (jumpto == [0]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ImageName"; + else if (jumpto == [1]) window.location = "http://www.newyankee.com/GetYankees2.cgi?1.jpg"; + else if (jumpto == [2]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arsrferguson.jpg"; + else if (jumpto == [3]) window.location = "http://www.newyankee.com/GetYankees2.cgi?akjamesmartin.jpg"; + else if (jumpto == [4]) window.location = "http://www.newyankee.com/GetYankees2.cgi?aldaverackett.jpg"; + else if (jumpto == [5]) window.location = "http://www.newyankee.com/GetYankees2.cgi?alericbrasher.jpg"; + else if (jumpto == [6]) window.location = "http://www.newyankee.com/GetYankees2.cgi?algeorgewatkins.jpg"; + else if (jumpto == [7]) window.location = "http://www.newyankee.com/GetYankees2.cgi?altoddcruise.jpg"; + else if (jumpto == [8]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arkevinc.jpg"; + else if (jumpto == [9]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arpaulmoore.jpg"; + else if (jumpto == [10]) window.location = "http://www.newyankee.com/GetYankees2.cgi?auphillaird.jpg"; + else if (jumpto == [11]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azbillhensley.jpg"; + else if (jumpto == [12]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azcharleshollandjr.jpg"; + else if (jumpto == [13]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdaveholland.jpg"; + else if (jumpto == [14]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdavidholland.jpg"; + else if (jumpto == [15]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdonaldvogt.jpg"; + else if (jumpto == [16]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azernestortega.jpg"; + else if (jumpto == [17]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjeromekeller.jpg"; + else if (jumpto == [18]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjimpegfulton.jpg"; + else if (jumpto == [19]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjohnbelcher.jpg"; + else if (jumpto == [20]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azmikejordan.jpg"; + else if (jumpto == [21]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azrickemry.jpg"; + else if (jumpto == [22]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azstephensavage.jpg"; + else if (jumpto == [23]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azsteveferguson.jpg"; + else if (jumpto == [24]) window.location = "http://www.newyankee.com/GetYankees2.cgi?aztjhorrall.jpg"; + else if (jumpto == [25]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabillmeiners.jpg"; + else if (jumpto == [26]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabobhadley.jpg"; + else if (jumpto == [27]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caboblennox.jpg"; + else if (jumpto == [28]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabryanshurtz.jpg"; + else if (jumpto == [29]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabyroncleveland.jpg"; + else if (jumpto == [30]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cacesarjimenez.jpg"; + else if (jumpto == [31]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadalekirstine.jpg"; + else if (jumpto == [32]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadavidlgoeffrion.jpg"; + else if (jumpto == [33]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadennisnocerini.jpg"; + else if (jumpto == [34]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadianemason.jpg"; + else if (jumpto == [35]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadominicpieranunzio.jpg"; + else if (jumpto == [36]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadonaldmotter.jpg"; + else if (jumpto == [37]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadoncroner.jpg"; + else if (jumpto == [38]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caelizabethwright.jpg"; + else if (jumpto == [39]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caericlew.jpg"; + else if (jumpto == [40]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cafrancissmith.jpg"; + else if (jumpto == [41]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cafranklombano.jpg"; + else if (jumpto == [42]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajaredweaver.jpg"; + else if (jumpto == [43]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajerrythompson.jpg"; + else if (jumpto == [44]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajimjanssen"; + else if (jumpto == [45]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajohncopolillo.jpg"; + else if (jumpto == [46]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajohnmessick.jpg"; + else if (jumpto == [47]) window.location = "http://www.newyankee.com/GetYankees2.cgi?calaynedicker.jpg"; + else if (jumpto == [48]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caleeannrucker.jpg"; + else if (jumpto == [49]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camathewsscharch.jpg"; + else if (jumpto == [50]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikedunn.jpg"; + else if (jumpto == [51]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikeshay.jpg"; + else if (jumpto == [52]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikeshepherd.jpg"; + else if (jumpto == [53]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caphillipfreer.jpg"; + else if (jumpto == [54]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carandy.jpg"; + else if (jumpto == [55]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carichardwilliams.jpg"; + else if (jumpto == [56]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carickgruen.jpg"; + else if (jumpto == [57]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cascottbartsch.jpg"; + else if (jumpto == [58]) window.location = "http://www.newyankee.com/GetYankees2.cgi?castevestrapac.jpg"; + else if (jumpto == [59]) window.location = "http://www.newyankee.com/GetYankees2.cgi?catimwest.jpg"; + else if (jumpto == [60]) window.location = "http://www.newyankee.com/GetYankees2.cgi?catomrietveld.jpg"; + else if (jumpto == [61]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalainpaquette.jpg"; + else if (jumpto == [62]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalanhill.jpg"; + else if (jumpto == [63]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalguerette.jpg"; + else if (jumpto == [64]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnbrianhogg.jpg"; + else if (jumpto == [65]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnbrucebeard.jpg"; + else if (jumpto == [66]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cncraigdavey.jpg"; + else if (jumpto == [67]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cndanielpattison.jpg"; + else if (jumpto == [68]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cndenisstjean.jpg"; + else if (jumpto == [69]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnglenngray.jpg"; + else if (jumpto == [70]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnjeansebastienduguay.jpg"; + else if (jumpto == [71]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnjohnbritz.jpg"; + else if (jumpto == [72]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnkevinmclean.jpg"; + else if (jumpto == [73]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmarcandrecartier.jpg"; + else if (jumpto == [74]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmarcleblanc.jpg"; + else if (jumpto == [75]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmatthewgiles.jpg"; + else if (jumpto == [76]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmichelrauzon.jpg"; + else if (jumpto == [77]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnpierrelalonde.jpg"; + else if (jumpto == [78]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnraytyson.jpg"; + else if (jumpto == [79]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnrichardboucher.jpg"; + else if (jumpto == [80]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnrodbuike.jpg"; + else if (jumpto == [81]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnscottpitkeathly.jpg"; + else if (jumpto == [82]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnshawndavis.jpg"; + else if (jumpto == [83]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnstephanepelletier.jpg"; + else if (jumpto == [84]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cntodddesroches.jpg"; + else if (jumpto == [85]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cntonyharnum.jpg"; + else if (jumpto == [86]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnwayneconabree.jpg"; + else if (jumpto == [87]) window.location = "http://www.newyankee.com/GetYankees2.cgi?codavidjbarber.jpg"; + else if (jumpto == [88]) window.location = "http://www.newyankee.com/GetYankees2.cgi?codonrandquist.jpg"; + else if (jumpto == [89]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cojeffpalese.jpg"; + else if (jumpto == [90]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cojohnlowell.jpg"; + else if (jumpto == [91]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cotroytorgerson.jpg"; + else if (jumpto == [92]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctgerrygranatowski.jpg"; + else if (jumpto == [93]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctjasonklein.jpg"; + else if (jumpto == [94]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctkevinkiss.jpg"; + else if (jumpto == [95]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctmikekennedy.jpg"; + else if (jumpto == [96]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flalancanfield.jpg"; + else if (jumpto == [97]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flalbertgonzalez.jpg"; + else if (jumpto == [98]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flbruceloy.jpg"; + else if (jumpto == [99]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fldandevault.jpg"; + else if (jumpto == [100]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fldonstclair.jpg"; + else if (jumpto == [101]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flernestbonnell.jpg"; + else if (jumpto == [102]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgeorgebarg.jpg"; + else if (jumpto == [103]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgregslavinski.jpg"; + else if (jumpto == [104]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgregwaters.jpg"; + else if (jumpto == [105]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flharoldmiller.jpg"; + else if (jumpto == [106]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fljackwelch.jpg"; + else if (jumpto == [107]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flmichaelostrowski.jpg"; + else if (jumpto == [108]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flpauldoman.jpg"; + else if (jumpto == [109]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flpaulsessions.jpg"; + else if (jumpto == [110]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flrandymys.jpg"; + else if (jumpto == [111]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flraysarnowski.jpg"; + else if (jumpto == [112]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flrobertcahill.jpg"; + else if (jumpto == [113]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flstevemorrison.jpg"; + else if (jumpto == [114]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flstevezellner.jpg"; + else if (jumpto == [115]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flterryjennings.jpg"; + else if (jumpto == [116]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fltimmcwilliams.jpg"; + else if (jumpto == [117]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fltomstellhorn.jpg"; + else if (jumpto == [118]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gabobkoch.jpg"; + else if (jumpto == [119]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gabrucekinney.jpg"; + else if (jumpto == [120]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gadickbesemer.jpg"; + else if (jumpto == [121]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajackclunen.jpg"; + else if (jumpto == [122]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajayhart.jpg"; + else if (jumpto == [123]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajjgeller.jpg"; + else if (jumpto == [124]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gakeithlacey.jpg"; + else if (jumpto == [125]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamargieminutello.jpg"; + else if (jumpto == [126]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamarvinearnest.jpg"; + else if (jumpto == [127]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamikeschwarz.jpg"; + else if (jumpto == [128]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamikeyee.jpg"; + else if (jumpto == [129]) window.location = "http://www.newyankee.com/GetYankees2.cgi?garickdubree.jpg"; + else if (jumpto == [130]) window.location = "http://www.newyankee.com/GetYankees2.cgi?garobimartin.jpg"; + else if (jumpto == [131]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gastevewaddell.jpg"; + else if (jumpto == [132]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gathorwiggins.jpg"; + else if (jumpto == [133]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gawadewylie.jpg"; + else if (jumpto == [134]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gawaynerobinson.jpg"; + else if (jumpto == [135]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gepaulwestbury.jpg"; + else if (jumpto == [136]) window.location = "http://www.newyankee.com/GetYankees2.cgi?grstewartcwolfe.jpg"; + else if (jumpto == [137]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gugregmesa.jpg"; + else if (jumpto == [138]) window.location = "http://www.newyankee.com/GetYankees2.cgi?hibriantokunaga.jpg"; + else if (jumpto == [139]) window.location = "http://www.newyankee.com/GetYankees2.cgi?himatthewgrady.jpg"; + else if (jumpto == [140]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iabobparnell.jpg"; + else if (jumpto == [141]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iadougleonard.jpg"; + else if (jumpto == [142]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iajayharmon.jpg"; + else if (jumpto == [143]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iajohnbevier.jpg"; + else if (jumpto == [144]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iamartywitt.jpg"; + else if (jumpto == [145]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idjasonbartschi.jpg"; + else if (jumpto == [146]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idkellyklaas.jpg"; + else if (jumpto == [147]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idmikegagnon.jpg"; + else if (jumpto == [148]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idrennieheuer.jpg"; + else if (jumpto == [149]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilbenshakman.jpg"; + else if (jumpto == [150]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilcraigstocks.jpg"; + else if (jumpto == [151]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ildaverubini.jpg"; + else if (jumpto == [152]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iledpepin.jpg"; + else if (jumpto == [153]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilfredkirpec.jpg"; + else if (jumpto == [154]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljoecreed.jpg"; + else if (jumpto == [155]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljohnknuth.jpg"; + else if (jumpto == [156]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljoshhill.jpg"; + else if (jumpto == [157]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilkeithrichard.jpg"; + else if (jumpto == [158]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilkrystleweber.jpg"; + else if (jumpto == [159]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilmattmusich.jpg"; + else if (jumpto == [160]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilmichaellane.jpg"; + else if (jumpto == [161]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilrodneyschwandt.jpg"; + else if (jumpto == [162]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilrogeraukerman.jpg"; + else if (jumpto == [163]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilscottbreeden.jpg"; + else if (jumpto == [164]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilscottgerami.jpg"; + else if (jumpto == [165]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilsteveritt.jpg"; + else if (jumpto == [166]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilthomasfollin.jpg"; + else if (jumpto == [167]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilwaynesmith.jpg"; + else if (jumpto == [168]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inallenwimberly.jpg"; + else if (jumpto == [169]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inbutchmyers.jpg"; + else if (jumpto == [170]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inderrickbentley.jpg"; + else if (jumpto == [171]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inedmeissler.jpg"; + else if (jumpto == [172]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ingarymartin.jpg"; + else if (jumpto == [173]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injasondavis.jpg"; + else if (jumpto == [174]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injeffjones.jpg"; + else if (jumpto == [175]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injeffwilliams.jpg"; + else if (jumpto == [176]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injpreslyharrington.jpg"; + else if (jumpto == [177]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inrichardlouden.jpg"; + else if (jumpto == [178]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inronmorrell.jpg"; + else if (jumpto == [179]) window.location = "http://www.newyankee.com/GetYankees2.cgi?insearsweaver.jpg"; + else if (jumpto == [180]) window.location = "http://www.newyankee.com/GetYankees2.cgi?irpaullaverty.jpg"; + else if (jumpto == [181]) window.location = "http://www.newyankee.com/GetYankees2.cgi?irseamusmcbride.jpg"; + else if (jumpto == [182]) window.location = "http://www.newyankee.com/GetYankees2.cgi?isazrielmorag.jpg"; + else if (jumpto == [183]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksalankreifels.jpg"; + else if (jumpto == [184]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksbrianbudden.jpg"; + else if (jumpto == [185]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksgarypahls.jpg"; + else if (jumpto == [186]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksmikefarnet.jpg"; + else if (jumpto == [187]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksmikethomas.jpg"; + else if (jumpto == [188]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kstomzillig.jpg"; + else if (jumpto == [189]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kybillyandrews.jpg"; + else if (jumpto == [190]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kydaveryno.jpg"; + else if (jumpto == [191]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kygreglaramore.jpg"; + else if (jumpto == [192]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kywilliamanderson.jpg"; + else if (jumpto == [193]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kyzachschuyler.jpg"; + else if (jumpto == [194]) window.location = "http://www.newyankee.com/GetYankees2.cgi?laadriankliebert.jpg"; + else if (jumpto == [195]) window.location = "http://www.newyankee.com/GetYankees2.cgi?labarryhumphus.jpg"; + else if (jumpto == [196]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ladennisanders.jpg"; + else if (jumpto == [197]) window.location = "http://www.newyankee.com/GetYankees2.cgi?larichardeckert.jpg"; + else if (jumpto == [198]) window.location = "http://www.newyankee.com/GetYankees2.cgi?laronjames.jpg"; + else if (jumpto == [199]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lasheldonstutes.jpg"; + else if (jumpto == [200]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lastephenstarbuck.jpg"; + else if (jumpto == [201]) window.location = "http://www.newyankee.com/GetYankees2.cgi?latroyestonich.jpg"; + else if (jumpto == [202]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lavaughntrosclair.jpg"; + else if (jumpto == [203]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maalexbrown.jpg"; + else if (jumpto == [204]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maalwencl.jpg"; + else if (jumpto == [205]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mabrentmills.jpg"; + else if (jumpto == [206]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madangodziff.jpg"; + else if (jumpto == [207]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madanielwilusz.jpg"; + else if (jumpto == [208]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madavidreis.jpg"; + else if (jumpto == [209]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madougrecko.jpg"; + else if (jumpto == [210]) window.location = "http://www.newyankee.com/GetYankees2.cgi?majasonhaley.jpg"; + else if (jumpto == [211]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maklausjensen.jpg"; + else if (jumpto == [212]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mamikemarland.jpg"; + else if (jumpto == [213]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mapetersilvestre.jpg"; + else if (jumpto == [214]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maraysweeney.jpg"; + else if (jumpto == [215]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdallenbarnett.jpg"; + else if (jumpto == [216]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdcharleswasson.jpg"; + else if (jumpto == [217]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdedbaranowski.jpg"; + else if (jumpto == [218]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdfranktate.jpg"; + else if (jumpto == [219]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdfredschock.jpg"; + else if (jumpto == [220]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdianstjohn.jpg"; + else if (jumpto == [221]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdjordanevans.jpg"; + else if (jumpto == [222]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdpaulwjones.jpg"; + else if (jumpto == [223]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mestevesandelier.jpg"; + else if (jumpto == [224]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mewilbertrbrown.jpg"; + else if (jumpto == [225]) window.location = "http://www.newyankee.com/GetYankees2.cgi?midavidkeller.jpg"; + else if (jumpto == [226]) window.location = "http://www.newyankee.com/GetYankees2.cgi?migaryvandenberg.jpg"; + else if (jumpto == [227]) window.location = "http://www.newyankee.com/GetYankees2.cgi?migeorgeberlinger.jpg"; + else if (jumpto == [228]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijamesstapleton.jpg"; + else if (jumpto == [229]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijerryhaney.jpg"; + else if (jumpto == [230]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijohnrybarczyk.jpg"; + else if (jumpto == [231]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mikeithvalliere.jpg"; + else if (jumpto == [232]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mikevinpodsiadlik.jpg"; + else if (jumpto == [233]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimarkandrews.jpg"; + else if (jumpto == [234]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimikedecaussin.jpg"; + else if (jumpto == [235]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimikesegorski.jpg"; + else if (jumpto == [236]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mirobertwolgast.jpg"; + else if (jumpto == [237]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mitimothybruner.jpg"; + else if (jumpto == [238]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mitomweaver.jpg"; + else if (jumpto == [239]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnbobgontarek.jpg"; + else if (jumpto == [240]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnbradbuffington.jpg"; + else if (jumpto == [241]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mndavewilson.jpg"; + else if (jumpto == [242]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mngenerajanen.jpg"; + else if (jumpto == [243]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnjohnkempkes.jpg"; + else if (jumpto == [244]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnkevinhurbanis.jpg"; + else if (jumpto == [245]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnmarklansink.jpg"; + else if (jumpto == [246]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnpaulmayer.jpg"; + else if (jumpto == [247]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnpauloman.jpg"; + else if (jumpto == [248]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnwoodylobnitz.jpg"; + else if (jumpto == [249]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mocurtkempf.jpg"; + else if (jumpto == [250]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojerryhenry.jpg"; + else if (jumpto == [251]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojimfinney.jpg"; + else if (jumpto == [252]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojimrecamper.jpg"; + else if (jumpto == [253]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojohntimmons.jpg"; + else if (jumpto == [254]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojohnvaughan.jpg"; + else if (jumpto == [255]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mokenroberts.jpg"; + else if (jumpto == [256]) window.location = "http://www.newyankee.com/GetYankees2.cgi?momacvoss.jpg"; + else if (jumpto == [257]) window.location = "http://www.newyankee.com/GetYankees2.cgi?momarktemmer.jpg"; + else if (jumpto == [258]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mopaulzerjav.jpg"; + else if (jumpto == [259]) window.location = "http://www.newyankee.com/GetYankees2.cgi?morobtigner.jpg"; + else if (jumpto == [260]) window.location = "http://www.newyankee.com/GetYankees2.cgi?motomantrim.jpg"; + else if (jumpto == [261]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mscharleshahn.jpg"; + else if (jumpto == [262]) window.location = "http://www.newyankee.com/GetYankees2.cgi?msjohnjohnson.jpg"; + else if (jumpto == [263]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncandrelopez.jpg"; + else if (jumpto == [264]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncedorisak.jpg"; + else if (jumpto == [265]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncjimisbell.jpg"; + else if (jumpto == [266]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncjohnnydark.jpg"; + else if (jumpto == [267]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nckevinebert.jpg"; + else if (jumpto == [268]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nckevinulmer.jpg"; + else if (jumpto == [269]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncpeteparis.jpg"; + else if (jumpto == [270]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncstevelindsley.jpg"; + else if (jumpto == [271]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nctimsmith.jpg"; + else if (jumpto == [272]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nctonylawrence.jpg"; + else if (jumpto == [273]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncwyneaston.jpg"; + else if (jumpto == [274]) window.location = "http://www.newyankee.com/GetYankees2.cgi?neberniedevlin.jpg"; + else if (jumpto == [275]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nebrentesmoil.jpg"; + else if (jumpto == [276]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nescottmccullough.jpg"; + else if (jumpto == [277]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhalantarring.jpg"; + else if (jumpto == [278]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhbjmolinari.jpg"; + else if (jumpto == [279]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhbrianmolinari.jpg"; + else if (jumpto == [280]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhdanhorning.jpg"; + else if (jumpto == [281]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhdonblackden.jpg"; + else if (jumpto == [282]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjimcalandriello.jpg"; + else if (jumpto == [283]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjohngunterman.jpg"; + else if (jumpto == [284]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjohnmagyar.jpg"; + else if (jumpto == [285]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njbudclarity.jpg"; + else if (jumpto == [286]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njcraigjones.jpg"; + else if (jumpto == [287]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njericrowland.jpg"; + else if (jumpto == [288]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njjimsnyder.jpg"; + else if (jumpto == [289]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njlarrylevinson.jpg"; + else if (jumpto == [290]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njlouisdispensiere.jpg"; + else if (jumpto == [291]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmarksoloff.jpg"; + else if (jumpto == [292]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmichaelhalko.jpg"; + else if (jumpto == [293]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmichaelmalkasian.jpg"; + else if (jumpto == [294]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njnigelmartin.jpg"; + else if (jumpto == [295]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njrjmolinari.jpg"; + else if (jumpto == [296]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njtommurasky.jpg"; + else if (jumpto == [297]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njtomputnam.jpg"; + else if (jumpto == [298]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nmdalepage.jpg"; + else if (jumpto == [299]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nmmikethompson.jpg"; + else if (jumpto == [300]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvclydekemp.jpg"; + else if (jumpto == [301]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvharveyklene.jpg"; + else if (jumpto == [302]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvlonsimons.jpg"; + else if (jumpto == [303]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyabeweisfelner.jpg"; + else if (jumpto == [304]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyanthonygiudice.jpg"; + else if (jumpto == [305]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyaustinpierce.jpg"; + else if (jumpto == [306]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nybrianmonks.jpg"; + else if (jumpto == [307]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nycharlieporter.jpg"; + else if (jumpto == [308]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nycorneliuswoglum.jpg"; + else if (jumpto == [309]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nydennishartwell.jpg"; + else if (jumpto == [310]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nydennissgheerdt.jpg"; + else if (jumpto == [311]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nygeorgepettitt.jpg"; + else if (jumpto == [312]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyjohndrewes.jpg"; + else if (jumpto == [313]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyjohnminichiello.jpg"; + else if (jumpto == [314]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nykevinwoolever.jpg"; + else if (jumpto == [315]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nymartyrubinstein.jpg"; + else if (jumpto == [316]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyraysicina.jpg"; + else if (jumpto == [317]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyrobbartley.jpg"; + else if (jumpto == [318]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyrobertkosty.jpg"; + else if (jumpto == [319]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystephenbagnato.jpg"; + else if (jumpto == [320]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystevegiamundo.jpg"; + else if (jumpto == [321]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystevekelly.jpg"; + else if (jumpto == [322]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nywayneadelkoph.jpg"; + else if (jumpto == [323]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohbriannimmo.jpg"; + else if (jumpto == [324]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdavehyman.jpg"; + else if (jumpto == [325]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdavidconant.jpg"; + else if (jumpto == [326]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdennismantovani.jpg"; + else if (jumpto == [327]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgrahambennett.jpg"; + else if (jumpto == [328]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgregbrunk.jpg"; + else if (jumpto == [329]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgregfilbrun.jpg"; + else if (jumpto == [330]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohjimreutener.jpg"; + else if (jumpto == [331]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohjimrike.jpg"; + else if (jumpto == [332]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohkeithsparks.jpg"; + else if (jumpto == [333]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohkevindrinan.jpg"; + else if (jumpto == [334]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohmichaelhaines.jpg"; + else if (jumpto == [335]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohmichaelsteele.jpg"; + else if (jumpto == [336]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohpatrickguanciale.jpg"; + else if (jumpto == [337]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohscottkelly.jpg"; + else if (jumpto == [338]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohscottthomas.jpg"; + else if (jumpto == [339]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohstevetuckerman.jpg"; + else if (jumpto == [340]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtedfigurski.jpg"; + else if (jumpto == [341]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohterrydonald.jpg"; + else if (jumpto == [342]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtimokeefe.jpg"; + else if (jumpto == [343]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtomhaydock.jpg"; + else if (jumpto == [344]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okbillsneller.jpg"; + else if (jumpto == [345]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okbobbulick.jpg"; + else if (jumpto == [346]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okdaryljones.jpg"; + else if (jumpto == [347]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okstevetarchek.jpg"; + else if (jumpto == [348]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okwoodymcelroy.jpg"; + else if (jumpto == [349]) window.location = "http://www.newyankee.com/GetYankees2.cgi?orcoryeells.jpg"; + else if (jumpto == [350]) window.location = "http://www.newyankee.com/GetYankees2.cgi?oredcavasso.jpg"; + else if (jumpto == [351]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ormarkmcculley.jpg"; + else if (jumpto == [352]) window.location = "http://www.newyankee.com/GetYankees2.cgi?orstevekarthauser.jpg"; + else if (jumpto == [353]) window.location = "http://www.newyankee.com/GetYankees2.cgi?paalanpalmieri.jpg"; + else if (jumpto == [354]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pachriscarr.jpg"; + else if (jumpto == [355]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padansigg.jpg"; + else if (jumpto == [356]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padavecalabretta.jpg"; + else if (jumpto == [357]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padennishoffman.jpg"; + else if (jumpto == [358]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pafrankschlipf.jpg"; + else if (jumpto == [359]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pajamesevanson.jpg"; + else if (jumpto == [360]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pajoekrol.jpg"; + else if (jumpto == [361]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pakatecrimmins.jpg"; + else if (jumpto == [362]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pamarshallkrebs.jpg"; + else if (jumpto == [363]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pascottsheaffer.jpg"; + else if (jumpto == [364]) window.location = "http://www.newyankee.com/GetYankees2.cgi?paterrycrippen.jpg"; + else if (jumpto == [365]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patjpera.jpg"; + else if (jumpto == [366]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patoddpatterson.jpg"; + else if (jumpto == [367]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patomrehm.jpg"; + else if (jumpto == [368]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pavicschreck.jpg"; + else if (jumpto == [369]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pawilliamhowen.jpg"; + else if (jumpto == [370]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ricarlruggieri.jpg"; + else if (jumpto == [371]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ripetermccrea.jpg"; + else if (jumpto == [372]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scbillmovius.jpg"; + else if (jumpto == [373]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scbryanrackley.jpg"; + else if (jumpto == [374]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scchrisgoodman.jpg"; + else if (jumpto == [375]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scdarrellmunn.jpg"; + else if (jumpto == [376]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scdonsandusky.jpg"; + else if (jumpto == [377]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scscotalexander.jpg"; + else if (jumpto == [378]) window.location = "http://www.newyankee.com/GetYankees2.cgi?sctimbajuscik.jpg"; + else if (jumpto == [379]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ststuartcoltart.jpg"; + else if (jumpto == [380]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnbilobautista.jpg"; + else if (jumpto == [381]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnbrucebowman.jpg"; + else if (jumpto == [382]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidchipman.jpg"; + else if (jumpto == [383]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidcizunas.jpg"; + else if (jumpto == [384]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidreed.jpg"; + else if (jumpto == [385]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnhankdunkin.jpg"; + else if (jumpto == [386]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnkenwetherington.jpg"; + else if (jumpto == [387]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnrickgodboldt.jpg"; + else if (jumpto == [388]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnroyowen.jpg"; + else if (jumpto == [389]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnsteve.jpg"; + else if (jumpto == [390]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tntommymercks.jpg"; + else if (jumpto == [391]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnwarrenmonroe.jpg"; + else if (jumpto == [392]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txbillvanpelt.jpg"; + else if (jumpto == [393]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txcarolynmoncivais.jpg"; + else if (jumpto == [394]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txchucksteding.jpg"; + else if (jumpto == [395]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txclintlafont.jpg"; + else if (jumpto == [396]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txcurthackett.jpg"; + else if (jumpto == [397]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txdavidmcneill.jpg"; + else if (jumpto == [398]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txdonowen.jpg"; + else if (jumpto == [399]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txfrankcox.jpg"; + else if (jumpto == [400]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txglenbang.jpg"; + else if (jumpto == [401]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txhowardlaunius.jpg"; + else if (jumpto == [402]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjamienorwood.jpg"; + else if (jumpto == [403]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjimmarkle.jpg"; + else if (jumpto == [404]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjimmcnamara.jpg"; + else if (jumpto == [405]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjoelgulker.jpg"; + else if (jumpto == [406]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjoeveillon.jpg"; + else if (jumpto == [407]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjohnburns.jpg"; + else if (jumpto == [408]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkeithmartin.jpg"; + else if (jumpto == [409]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkennymiller.jpg"; + else if (jumpto == [410]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkirkconstable.jpg"; + else if (jumpto == [411]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkylekelley.jpg"; + else if (jumpto == [412]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txlesjones.jpg"; + else if (jumpto == [413]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txlynnlacey.jpg"; + else if (jumpto == [414]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmarksimmons.jpg"; + else if (jumpto == [415]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmauriceharris.jpg"; + else if (jumpto == [416]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmichaelbrown.jpg"; + else if (jumpto == [417]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txrichardthomas.jpg"; + else if (jumpto == [418]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txrickent.jpg"; + else if (jumpto == [419]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txtomlovelace.jpg"; + else if (jumpto == [420]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txvareckwalla.jpg"; + else if (jumpto == [421]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukbrianstainton.jpg"; + else if (jumpto == [422]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukdavegrimwood.jpg"; + else if (jumpto == [423]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukdavidevans.jpg"; + else if (jumpto == [424]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukgeoffbogg.jpg"; + else if (jumpto == [425]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukgordondale.jpg"; + else if (jumpto == [426]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukharborne.jpg"; + else if (jumpto == [427]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjamesobrian.jpg"; + else if (jumpto == [428]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjeffjones.jpg"; + else if (jumpto == [429]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjohnworthington.jpg"; + else if (jumpto == [430]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukkeithrobinson.jpg"; + else if (jumpto == [431]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukkoojanzen.jpg"; + else if (jumpto == [432]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukleewebster.jpg"; + else if (jumpto == [433]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukpaultebbutt.jpg"; + else if (jumpto == [434]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukriaanstrydom.jpg"; + else if (jumpto == [435]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukrickdare.jpg"; + else if (jumpto == [436]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukterrychadwick.jpg"; + else if (jumpto == [437]) window.location = "http://www.newyankee.com/GetYankees2.cgi?utbobcanestrini.jpg"; + else if (jumpto == [438]) window.location = "http://www.newyankee.com/GetYankees2.cgi?utdonthornock.jpg"; + else if (jumpto == [439]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaartgreen.jpg"; + else if (jumpto == [440]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vabobheller.jpg"; + else if (jumpto == [441]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaclintadkins.jpg"; + else if (jumpto == [442]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadanieltepe.jpg"; + else if (jumpto == [443]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadanmeier.jpg"; + else if (jumpto == [444]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadavidminnix.jpg"; + else if (jumpto == [445]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadavidyoho.jpg"; + else if (jumpto == [446]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadickthornsberry.jpg"; + else if (jumpto == [447]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamarksimonds.jpg"; + else if (jumpto == [448]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamichaelkoch.jpg"; + else if (jumpto == [449]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamikeperozziello.jpg"; + else if (jumpto == [450]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamikepingrey.jpg"; + else if (jumpto == [451]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vapatrickkearney.jpg"; + else if (jumpto == [452]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vapaulstreet.jpg"; + else if (jumpto == [453]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatonydemasi.jpg"; + else if (jumpto == [454]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatroylong.jpg"; + else if (jumpto == [455]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatroylong2.jpg"; + else if (jumpto == [456]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaweslyon.jpg"; + else if (jumpto == [457]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wabryanthomas.jpg"; + else if (jumpto == [458]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wageorgebryan.jpg"; + else if (jumpto == [459]) window.location = "http://www.newyankee.com/GetYankees2.cgi?waglennpiersall.jpg"; + else if (jumpto == [460]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajoewanjohi.jpg"; + else if (jumpto == [461]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohndrapala.jpg"; + else if (jumpto == [462]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohnfernstrom.jpg"; + else if (jumpto == [463]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohnmickelson.jpg"; + else if (jumpto == [464]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wakeithjohnson.jpg"; + else if (jumpto == [465]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wamarkdenman.jpg"; + else if (jumpto == [466]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wamiketaylor.jpg"; + else if (jumpto == [467]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wascottboyd.jpg"; + else if (jumpto == [468]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wibryanschappel.jpg"; + else if (jumpto == [469]) window.location = "http://www.newyankee.com/GetYankees2.cgi?widenniszuber.jpg"; + else if (jumpto == [470]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wigeorgebregar.jpg"; + else if (jumpto == [471]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wikevinwarren.jpg"; + else if (jumpto == [472]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wirichorde.jpg"; + else if (jumpto == [473]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wistevenricks.jpg"; + else if (jumpto == [474]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wiweswolfrom.jpg"; + else if (jumpto == [475]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wvdannorby.jpg"; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js new file mode 100644 index 0000000..902e062 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js @@ -0,0 +1,56 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, Georgi Guninski +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 04 Sep 2002 +* SUMMARY: Just seeing that we don't crash when compiling this script - +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526 +* +*/ +//----------------------------------------------------------------------------- +printBugNumber(96526); +printStatus("Just seeing that we don't crash when compiling this script -"); + + +/* + * Tail recursion test by Georgi Guninski + */ +a="[\"b\"]"; +s="g"; +for(i=0;i<20000;i++) + s += a; +try {eval(s);} +catch (e) {}; diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js new file mode 100644 index 0000000..0cc33b9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js @@ -0,0 +1,4431 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 04 Sep 2002 +* SUMMARY: Just seeing that we don't crash when compiling this script - +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=133897 +*/ +//----------------------------------------------------------------------------- +printBugNumber(96526); +printStatus("Just seeing that we don't crash when compiling this script -"); + + +/* + * This function comes from http://bugzilla.mozilla.org/show_bug.cgi?id=133897 + */ +function validId(IDtext) +{ +var res = ""; + +if(IDText.value==""){ + print("You must enter a valid battery #") + return false +} +else if(IDText.value=="x522"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm" + return true +} +else if(IDText.value=="x91"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm" + return true +} +else if(IDText.value=="x92"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm" + return true +} +else if(IDText.value=="x93"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm" + return true +} +else if(IDText.value=="x95"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm" + return true +} +else if(IDText.value=="521"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="522"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="528"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="529"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="539"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="e90"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="e91"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="e92"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="e93"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="e95"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm" + return true + } +else if(IDText.value=="e96"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm" + return true + } + else if(IDText.value=="en6"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en22"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en90"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en91"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en92"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en93"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en95"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en529"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en539"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="en715"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="edl4a"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="edl4as"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="edl4ac"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } + else if(IDText.value=="edl6a"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm" + return true + } +else if(IDText.value=="3-0316"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } +else if(IDText.value=="3-0316i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } +else if(IDText.value=="3-00411"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } +else if(IDText.value=="3-0411i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-312"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } +else if(IDText.value=="3-312i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-315"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-315i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-315innc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-315iwc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-315wc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-335"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-335i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-335wc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-335nnci"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-350"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-350i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-3501wc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-350wc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-350nnci"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-361"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + +else if(IDText.value=="3-361i"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm" + return true + } + + else if(IDText.value=="a522"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/eveready/value.htm" + return true + } + else if(IDText.value=="a91"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/eveready/value.htm" + return true + } + else if(IDText.value=="a92"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/eveready/value.htm" + return true + } + else if(IDText.value=="a93"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/eveready/value.htm" + return true + } + else if(IDText.value=="a95"){ + //Checks for id entry + res="../batteryinfo/product_offerings/alkaline/eveready/value.htm" + return true + } + +else if(IDText.value=="510s"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + +else if(IDText.value=="1209"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + +else if(IDText.value=="1212"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + +else if(IDText.value=="1215"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + +else if(IDText.value=="1222"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + +else if(IDText.value=="1235"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + +else if(IDText.value=="1250"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm" + return true + } + else if(IDText.value=="206"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="246"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="266"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="276"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="411"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + + else if(IDText.value=="412"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="413"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="415"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="416"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="455"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="467"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="489"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="493"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="497"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="504"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="505"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="711"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="732"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="763"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="ev190"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="ev115"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="ev122"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="ev131"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="ev135"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="ev150"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + + else if(IDText.value=="hs14196"){ + //Checks for id entry + res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm" + return true + } + +else if(IDText.value=="2l76"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } +else if(IDText.value=="el1cr2"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } +else if(IDText.value=="crv3"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="el2cr5"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="el123ap"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="el223ap"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="l91"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="l522"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="l544"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithium.htm" + return true + } + +else if(IDText.value=="cr1025"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr1216"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr1220"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr1225"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr1616"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr1620"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr1632"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2012"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2016"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2025"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2032"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2320"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2430"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + +else if(IDText.value=="cr2450"){ + //Checks for id entry + res="../batteryinfo/product_offerings/lithium/lithiummin.htm" + return true + } + else if(IDText.value=="186"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="189"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="191"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="192"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="193"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="a23"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="a27"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="a76"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="a544"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="e11a"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + + else if(IDText.value=="e625g"){ + //Checks for id entry + res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm" + return true + } + +else if(IDText.value=="301"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="303"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="309"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="315"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="317"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="319"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="321"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="329"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } +else if(IDText.value=="333"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } +else if(IDText.value=="335"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="337"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="339"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="341"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="344"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="346"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="350"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="357"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="361"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="362"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="364"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="365"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="366"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="370"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="371"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="373"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="376"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="377"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="379"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="381"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="384"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="386"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="387s"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="389"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="390"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="391"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="392"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="393"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="394"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="395"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="396"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="397"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + +else if(IDText.value=="399"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + + +else if(IDText.value=="epx76"){ + //Checks for id entry + res="../batteryinfo/product_offerings/silver/silver_oxide.htm" + return true + } + + else if(IDText.value=="ac5"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + + else if(IDText.value=="ac10/230"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + else if(IDText.value=="ac10"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + else if(IDText.value=="ac13"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + + else if(IDText.value=="ac146x"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + + else if(IDText.value=="ac312"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + + else if(IDText.value=="ac675"){ + //Checks for id entry + res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm" + return true + } + +else if(IDText.value=="chm24"){ + //Checks for id entry + res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm" + return true + } + +else if(IDText.value=="chm4aa"){ + //Checks for id entry + res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm" + return true + } + +else if(IDText.value=="chsm"){ + //Checks for id entry + res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm" + return true + } + +else if(IDText.value=="chm4fc"){ + //Checks for id entry + res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm" + return true + } + +else if(IDText.value=="cxl1000"){ + //Checks for id entry + res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm" + return true + } + else if(IDText.value=="nh12"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm" + return true + } + else if(IDText.value=="nh15"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm" + return true + } + + else if(IDText.value=="nh22"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm" + return true + } + + else if(IDText.value=="nh35"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm" + return true + } + else if(IDText.value=="nh50"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm" + return true + } + + +else if(IDText.value=="ccm5060"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="ccm5260"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="cm1060h"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="cm1360"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="cm2560"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="cm6136"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="cv3010"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="cv3012"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="cv3112"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="erc510"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc5160"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc520"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc525"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc530"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc545"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc560"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc570"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="erc580"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc590"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc600"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc610"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc620"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="erc630"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + +else if(IDText.value=="erc640"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc650"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc660"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc670"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc680"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } +else if(IDText.value=="erc700"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm" + return true + } + + else if(IDText.value=="cp2360"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp3036"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + + else if(IDText.value=="cp3136"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp3336"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp5136"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp5648"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp5748"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp8049"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + else if(IDText.value=="cp8648"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + + else if(IDText.value=="cpv5136"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + + else if(IDText.value=="acp5036"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + + else if(IDText.value=="acp5136"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + + + else if(IDText.value=="acp7160"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw120"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw210"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw220"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw230"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw240"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw305"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw310"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw320"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw400"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw500"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw510"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw520"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw530"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw600"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw610"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw700"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw720"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } + else if(IDText.value=="erw800"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm" + return true + } +else if(IDText.value=="erp107"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp110"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp240"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp268"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp275"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp290"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp450"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp506"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp509"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp730"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erp9116"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p2312"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p2322m"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p2331"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p3201"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p3301"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p3302"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p3303"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p3306"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p3391"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p5256"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p7300"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p7301"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="7302"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="7310"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p7320"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p7330"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p7340"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p7350"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } + +else if(IDText.value=="p7360"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p7400"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="p7501"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm" + return true + } +else if(IDText.value=="erd100"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm" + return true + } +else if(IDText.value=="erd110"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm" + return true + } +else if(IDText.value=="erd200"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm" + return true + } +else if(IDText.value=="erd300"){ + //Checks for id entry + res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm" + return true + } + + + + + + + + + + + + + +else if(IDText.value=="164"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="201"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="216"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="226"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="228"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="311"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="314"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } + +else if(IDText.value=="313"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="323"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="325"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="333cz"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="343"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="354"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="355"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="387"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="388"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="417"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="420"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="457"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="460"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="477"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="479"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="482"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="484"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="487"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="490"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="491"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="496"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="509"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="510f"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="520"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="523"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="531"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="532"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="537"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="538"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="544"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="560"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="561"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="563"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="564"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="565"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="646"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="703"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="706"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="714"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="715"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="716"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="717"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="724"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="731"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="735"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="736"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="738"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="742"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="744"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="750"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="762s"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="773"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="778"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="781"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="812"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="815"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="835"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="850"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="904"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="912"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="915"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="935"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="950"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1015"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1035"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1050"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1150"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1231"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1461"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1463"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1562"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="1862"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="2356n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="2709n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="2744n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="2745n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="2746n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="2780n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ac41e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cc1096"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ccm1460"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ccm2460"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ccm4060a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ccm4060m"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cdc100"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch12"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch15"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch2aa"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch22"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch35"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch4"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ch50"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm1060"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm1560"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm2360"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm4160"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm6036"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm9072"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cm9172"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp2360"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp3336"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp3536"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp3736"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp5036"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp5160"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp5648"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp5960"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp6072"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp6172"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7049"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7072"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7148"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7149"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7160"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7172"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7248"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7261"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7348"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7548"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7661"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp7960"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8049"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8136"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8160"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8172"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8248"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8661"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8748"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } + +else if(IDText.value=="cp8948"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp8960"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp9061"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp9148"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp9161"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cp9360"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs3336"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs5036"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs5460"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7048"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7072"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7148"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7149"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7160"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7248"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7261"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7348"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7448"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7548"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs7661"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs8136"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs8648"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs9061"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs9148"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cs9161"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv2012"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv2096"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv3010s"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv3012"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv3060"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv3112"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="cv3212"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e1"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e1n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e3"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e4"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e9"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e12"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e12n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e13e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e41e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e42"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e42n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e89"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e115"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e115n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e126"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e132"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e132n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e133"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e133n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e134"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e134n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e135"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e135n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e136"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e137"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e137n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e146x"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e152"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e163"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e164"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e164n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e165"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e169"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e177"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e233"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e233n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e235n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e236n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e286"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e289"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e312e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e340e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e400"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e400n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e401e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e401n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e450"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e502"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e601"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e625"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e630"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e640"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e640n"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e675e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302157"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302250"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302358"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302435"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302462"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302465"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302478"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302642"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302651"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302702"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302904"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302905"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e302908"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e303145"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e303236"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e303314"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e303394"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e303496"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="e303996"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ea6"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ea6f"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ea6ft"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ea6st"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en1a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en132a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en133a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en134a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en135a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en136a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en164a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en165a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en175a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en177a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="en640a"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ep175"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ep401e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ep675e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx1"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx4"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx13"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx14"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx23"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx25"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx27"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx29"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx30"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx625"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx640"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx675"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="epx825"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev6"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev9"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev10s"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev15"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev22"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev31"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev35"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev50"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev90"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="ev90hp"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="fcc2"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs6"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs10s"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs15"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs31"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs35"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs50"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs90"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs95"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs150"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="hs6571"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="if6"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="is6"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="is6t"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="p2321m"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="p2322"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="p2326m"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="p7307"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="p7507"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="qcc4"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="s13e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="s312e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="s41e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="s76e"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="t35"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="t50"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="w353"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/contents/discontinued_battery_index.htm" + return true + } +else if(IDText.value=="3251"){ + //Checks for id entry + res="../datasheets/flashlights/eveready.htm" + return true + } +else if(IDText.value=="4212"){ + //Checks for id entry + res="../datasheets/flashlights/eveready.htm" + return true + } +else if(IDText.value=="4251"){ + //Checks for id entry + res="../datasheets/flashlights/eveready.htm" + return true + } +else if(IDText.value=="5109"){ + //Checks for id entry + res="../datasheets/flashlights/eveready.htm" + return true + } +else if(IDText.value=="2251"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="e220"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="e250"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="e251"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="e251rc210"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="erg2c1"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="glo4aa1"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="rc220"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="rc250"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="x112"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="x215"){ + //Checks for id entry + res="../datasheets/flashlights/home.htm" + return true + } +else if(IDText.value=="4215"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="5215"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="6212"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="bas24a"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="db24a1"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="kcbg"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="kccl"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="kcdl"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="kcl2bu1"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="kcwl"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="ltcr"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="lteb"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="ltpt"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="sl240"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="v220"){ + //Checks for id entry + res="../datasheets/flashlights/novelty.htm" + return true + } +else if(IDText.value=="5100"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="8209"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="8215"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="9450"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="f101"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="f220"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="f420"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="fab4dcm"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="fl450"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="k221"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="k251"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="led4aa1"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="sp220"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="tw420"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="tw450"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="wp220"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="wp250"){ + //Checks for id entry + res="../datasheets/flashlights/outdoor.htm" + return true + } +else if(IDText.value=="cfl420"){ + //Checks for id entry + res="../datasheets/flashlights/premium.htm" + return true + } +else if(IDText.value=="d410"){ + //Checks for id entry + res="../datasheets/flashlights/premium.htm" + return true + } +else if(IDText.value=="d420"){ + //Checks for id entry + res="../datasheets/flashlights/premium.htm" + return true + } +else if(IDText.value=="fn450"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="in215"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="in251"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="in351"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="in421"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="k220"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="k250"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="r215"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="r250"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="r450"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="tuf4d1"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="v109"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="v115"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="v215"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="v250"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } +else if(IDText.value=="val2dl1"){ + //Checks for id entry + res="../datasheets/flashlights/work.htm" + return true + } + +else if(IDText.value=="459"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="208ind"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="231ind"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="1151"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="1251"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="1259"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="1351"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="1359"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="3251r"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="3251wh"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="4212wh"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="4250ind"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="5109ind"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="6212wh"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="9101ind"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="e250y"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="e251y"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="in220"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="in253"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="in420"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="in450"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="indwandr"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="indwandy"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="r215ind"){ + //Checks for id entry + res="../datasheets/flashlights/industrial.htm" + return true + } +else if(IDText.value=="pr2"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr3"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr4"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr6"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr7"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr12"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr13"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="pr35"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="112"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="222"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="243"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="258"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="407"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="425"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="1156"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="1651"){ + //Checks for id entry + res="../datasheets/flashlights/standard.htm" + return true + } +else if(IDText.value=="kpr102"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="kpr103"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="kpr104"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="kpr113"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="kpr116"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="kpr802"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="skpr823"){ + //Checks for id entry + res="../datasheets/flashlights/krypton.htm" + return true + } +else if(IDText.value=="hpr50"){ + //Checks for id entry + res="../datasheets/flashlights/halogenbulb.htm" + return true + } +else if(IDText.value=="hpr51"){ + //Checks for id entry + res="../datasheets/flashlights/halogenbulb.htm" + return true + } +else if(IDText.value=="hpr52"){ + //Checks for id entry + res="../datasheets/flashlights/halogenbulb.htm" + return true + } +else if(IDText.value=="hpr53"){ + //Checks for id entry + res="../datasheets/flashlights/halogenbulb.htm" + return true + } +else if(IDText.value=="f4t5"){ + //Checks for id entry + res="../datasheets/flashlights/fluorescent.htm" + return true + } +else if(IDText.value=="f6t5"){ + //Checks for id entry + res="../datasheets/flashlights/fluorescent.htm" + return true + } +else if(IDText.value=="t1-1"){ + //Checks for id entry + res="../datasheets/flashlights/highintensity.htm" + return true + } +else if(IDText.value=="t1-2"){ + //Checks for id entry + res="../datasheets/flashlights/highintensity.htm" + return true + } +else if(IDText.value=="t2-2"){ + //Checks for id entry + res="../datasheets/flashlights/halogenxenon.htm" + return true + } +else if(IDText.value=="t2-3"){ + //Checks for id entry + res="../datasheets/flashlights/halogenxenon.htm" + return true + } +else if(IDText.value=="t2-4"){ + //Checks for id entry + res="../datasheets/flashlights/halogenxenon.htm" + return true + } +else if(IDText.value=="tx15-2"){ + //Checks for id entry + res="../datasheets/flashlights/halogenxenon.htm" + return true + } +else if(IDText.value=="4546ib"){ + //Checks for id entry + res="../datasheets/flashlights/industrialbulb.htm" + return true + } +else if(IDText.value=="LED"){ + //Checks for id entry + res="../datasheets/flashlights/led.htm" + return true + } + + + +else if(IDText.value=="108"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="209"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="330"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="330y"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="331"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="331y"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="1251bk"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="2253"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="3233"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="3253"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="3415"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="3452"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="4220"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="4453"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="5154"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="5251"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="7369"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="8115"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="8415"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="b170"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="bkc1"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="d620"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="d820"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="e100"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="e252"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="e350"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="e420"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="em290"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="em420"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="f100"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="f215"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="f250"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="f415"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="h100"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="h250"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="h350"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="in25t"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="kcdb"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="kcsg"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="kctw"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="rc100"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="rc251"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="rc290"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="t430"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="v235"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="x250"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } +else if(IDText.value=="x350"){ + //Checks for id entry + print("You have entered a Discontinued Product Number") + res="../datasheets/flashlights/discontinued_flashlight_index.htm" + return true + } + + + +else { + print("You have entered an Invalid Product Number...Please try 'Select Product Group' search.") + return false + } + +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js new file mode 100644 index 0000000..cb946aa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js @@ -0,0 +1,96 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no; pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 Nov 2002 +* SUMMARY: Testing scope +* See http://bugzilla.mozilla.org/show_bug.cgi?id=154693 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 154693; +var summary = 'Testing scope'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f() +{ + function nested() {} + return nested; +} +var f1 = f(); +var f2 = f(); + +status = inSection(1); +actual = (f1 != f2); +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js new file mode 100644 index 0000000..50e9d5e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js @@ -0,0 +1,178 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): felix.meschberger@day.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 25 November 2002 +* SUMMARY: Testing scope +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181834 +* +* This bug only bit in Rhino interpreted mode, when the +* 'compile functions with dynamic scope' feature was set. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 181834; +var summary = 'Testing scope'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * If N<=0, |outer_d| just gets incremented once, + * so the return value should be 1 in this case. + * + * If N>0, we end up calling inner() N+1 times: + * inner(N), inner(N-1), ... , inner(0). + * + * Each call to inner() increments |outer_d| by 1. + * The last call, inner(0), returns the final value + * of |outer_d|, which should be N+1. + */ +function outer(N) +{ + var outer_d = 0; + return inner(N); + + function inner(level) + { + outer_d++; + + if (level > 0) + return inner(level - 1); + else + return outer_d; + } +} + + +/* + * This only has meaning in Rhino - + */ +setDynamicScope(true); + +/* + * Recompile the function |outer| via eval() in order to + * feel the effect of the dynamic scope mode we have set. + */ +var s = outer.toString(); +eval(s); + +status = inSection(1); +actual = outer(-5); +expect = 1; +addThis(); + +status = inSection(2); +actual = outer(0); +expect = 1; +addThis(); + +status = inSection(3); +actual = outer(5); +expect = 6; +addThis(); + + +/* + * Sanity check: do same steps with the dynamic flag off + */ +setDynamicScope(false); + +/* + * Recompile the function |outer| via eval() in order to + * feel the effect of the dynamic scope mode we have set. + */ +eval(s); + +status = inSection(4); +actual = outer(-5); +expect = 1; +addThis(); + +status = inSection(5); +actual = outer(0); +expect = 1; +addThis(); + +status = inSection(6); +actual = outer(5); +expect = 6; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function setDynamicScope(flag) +{ + if (this.Packages) + { + var cx = this.Packages.org.mozilla.javascript.Context.getCurrentContext(); + cx.setCompileFunctionsWithDynamicScope(flag); + } +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js new file mode 100644 index 0000000..23ec234 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js @@ -0,0 +1,124 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 December 2002 +* SUMMARY: with(...) { function f ...} should set f in the global scope +* See http://bugzilla.mozilla.org/show_bug.cgi?id=184107 +* +* In fact, any variable defined in a with-block should be created +* in global scope, i.e. should be a property of the global object. +* +* The with-block syntax allows existing local variables to be SET, +* but does not allow new local variables to be CREATED. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=159849#c11 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 184107; +var summary = 'with(...) { function f ...} should set f in the global scope'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +y = 1; +var obj = {y:10}; +with (obj) +{ + // function statement + function f() + { + return y; + } + + // function expression + g = function() {return y;} +} + +status = inSection(1); +actual = obj.f; +expect = undefined; +addThis(); + +status = inSection(2); +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = obj.y; +expect = y; +addThis(); + +status = inSection(3); +actual = obj.g; +expect = undefined; +addThis(); + +status = inSection(4); +actual = g(); +expect = obj.y; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js new file mode 100644 index 0000000..a940b55 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js @@ -0,0 +1,158 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 16 Dec 2002 +* SUMMARY: Testing |with (x) {function f() {}}| when |x.f| already exists +* See http://bugzilla.mozilla.org/show_bug.cgi?id=185485 +* +* The idea is this: if |x| does not already have a property named |f|, +* a |with| statement cannot be used to define one. See, for example, +* +* http://bugzilla.mozilla.org/show_bug.cgi?id=159849#c11 +* http://bugzilla.mozilla.org/show_bug.cgi?id=184107 +* +* +* However, if |x| already has a property |f|, a |with| statement can be +* used to modify the value it contains: +* +* with (x) {f = 1;} +* +* This should work even if we use a |var| statement, like this: +* +* with (x) {var f = 1;} +* +* However, it should NOT work if we use a |function| statement, like this: +* +* with (x) {function f() {}} +* +* Instead, this should newly define a function f in global scope. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=185485 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 185485; +var summary = 'Testing |with (x) {function f() {}}| when |x.f| already exists'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var x = { f:0, g:0 }; + +with (x) +{ + f = 1; +} +status = inSection(1); +actual = x.f; +expect = 1; +addThis(); + +with (x) +{ + var f = 2; +} +status = inSection(2); +actual = x.f; +expect = 2; +addThis(); + +/* + * Use of a function statement under the with-block should not affect + * the local property |f|, but define a function |f| in global scope - + */ +with (x) +{ + function f() {} +} +status = inSection(3); +actual = x.f; +expect = 2; +addThis(); + +status = inSection(4); +actual = typeof this.f; +expect = 'function'; +addThis(); + + +/* + * Compare use of function expression instead of function statement. + * Note it is important that |x.g| already exists. Otherwise, this + * would newly define |g| in global scope - + */ +with (x) +{ + var g = function() {} +} +status = inSection(5); +actual = x.g.toString(); +expect = (function () {}).toString(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js new file mode 100644 index 0000000..14ff779 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js @@ -0,0 +1,123 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 30 January 2003 +* SUMMARY: Testing |this[name]| via Function.prototype.call(), apply() +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=191276 +* +* Igor: "This script fails when run in Rhino compiled mode, but passes in +* interpreted mode. Note that presence of the never-called |unused_function| +* with |f('a')| line is essential; the script works OK without it." +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 191276; +var summary = 'Testing |this[name]| via Function.prototype.call(), apply()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function F(name) +{ + return this[name]; +} + +function unused_function() +{ + F('a'); +} + +status = inSection(1); +actual = F.call({a: 'aaa'}, 'a'); +expect = 'aaa'; +addThis(); + +status = inSection(2); +actual = F.apply({a: 'aaa'}, ['a']); +expect = 'aaa'; +addThis(); + +/* + * Try the same things with an object variable instead of a literal + */ +var obj = {a: 'aaa'}; + +status = inSection(3); +actual = F.call(obj, 'a'); +expect = 'aaa'; +addThis(); + +status = inSection(4); +actual = F.apply(obj, ['a']); +expect = 'aaa'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js new file mode 100644 index 0000000..b898573 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 07 February 2003 +* SUMMARY: Testing a nested function call under |with| or |catch| +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=192226 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 192226; +var summary = 'Testing a nested function call under |with| or |catch|'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var counter = 0; + + +function f() +{ + try + { + with (Math) + { + test0(); + test1(sin); + } + throw 1; + } + catch (e) + { + test0(); + test1(e); + } +} + +function test0() +{ + ++counter; +} + +function test1(arg) +{ + ++counter; +} + + +status = inSection(1); +f(); // sets |counter| +actual = counter; +expect = 4; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js new file mode 100644 index 0000000..51e80e2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js @@ -0,0 +1,131 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): svendtofte@svendtofte.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 April 2003 +* SUMMARY: Testing nested function scope capture +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=202678 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 202678; +var summary = 'Testing nested function scope capture'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var self = this; + + +function myFunc() +{ + var hidden = 'aaa'; + insideFunc(); + + if (!self.runOnce) + { + var hidden = 'bbb'; + self.outSideFunc = insideFunc; + self.runOnce = true; + } + else + { + var hidden = 'ccc'; + } + + + function insideFunc() + { + actual = hidden; + } +} + + + +status = inSection(1); +myFunc(); // this sets |actual| +expect = 'aaa'; +addThis(); + +status = inSection(2); +outSideFunc(); // sets |actual| +expect = 'bbb'; +addThis(); + +status = inSection(3); +myFunc(); // sets |actual| +expect = 'aaa'; +addThis(); + +status = inSection(4); +outSideFunc(); // sets |actual| +expect = 'bbb'; // NOT 'ccc' +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js new file mode 100644 index 0000000..15a027a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js @@ -0,0 +1,132 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): svendtofte@svendtofte.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 April 2003 +* SUMMARY: Testing nested function scope capture +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=202678 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 202678; +var summary = 'Testing nested function scope capture'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var self = this; + + +function myFunc() +{ + var hidden = 'aaa'; + insideFunc(); + + if (!self.runOnce) + { + var hidden = 'bbb'; + self.outSideFunc = insideFunc; + self.runOnce = true; + } + else + { + var hidden = 'ccc'; + self.outSideFunc = insideFunc; + } + + + function insideFunc() + { + actual = hidden; + } +} + + + +status = inSection(1); +myFunc(); // this sets |actual| +expect = 'aaa'; +addThis(); + +status = inSection(2); +outSideFunc(); // sets |actual| +expect = 'bbb'; +addThis(); + +status = inSection(3); +myFunc(); // sets |actual| +expect = 'aaa'; +addThis(); + +status = inSection(4); +outSideFunc(); // sets |actual| +expect = 'ccc'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js new file mode 100644 index 0000000..61ac4cd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js @@ -0,0 +1,169 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): myngs@hotmail.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 05 June 2003 +* SUMMARY: Testing |with (f)| inside the definition of |function f()| +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=208496 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 208496; +var summary = 'Testing |with (f)| inside the definition of |function f()|'; +var status = ''; +var statusitems = []; +var actual = '(TEST FAILURE)'; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * GLOBAL SCOPE + */ +function f(par) +{ + var a = par; + + with(f) + { + var b = par; + actual = b; + } +} + +status = inSection(1); +f('abc'); // this sets |actual| +expect = 'abc'; +addThis(); + +status = inSection(2); +f(111 + 222); // sets |actual| +expect = 333; +addThis(); + + +/* + * EVAL SCOPE + */ +var s = ''; +s += 'function F(par)'; +s += '{'; +s += ' var a = par;'; + +s += ' with(F)'; +s += ' {'; +s += ' var b = par;'; +s += ' actual = b;'; +s += ' }'; +s += '}'; + +s += 'status = inSection(3);'; +s += 'F("abc");'; // sets |actual| +s += 'expect = "abc";'; +s += 'addThis();'; + +s += 'status = inSection(4);'; +s += 'F(111 + 222);'; // sets |actual| +s += 'expect = 333;'; +s += 'addThis();'; +eval(s); + + +/* + * FUNCTION SCOPE + */ +function g(par) +{ + // Add outer variables to complicate the scope chain - + var a = '(TEST FAILURE)'; + var b = '(TEST FAILURE)'; + h(par); + + function h(par) + { + var a = par; + + with(h) + { + var b = par; + actual = b; + } + } +} + +status = inSection(5); +g('abc'); // sets |actual| +expect = 'abc'; +addThis(); + +status = inSection(6); +g(111 + 222); // sets |actual| +expect = 333; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js new file mode 100644 index 0000000..75ac242 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js @@ -0,0 +1,161 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): myngs@hotmail.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 05 June 2003 +* SUMMARY: Testing |with (f)| inside the definition of |function f()| +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=208496 +* +* In this test, we check that static function properties of +* of |f| are read correctly from within the |with(f)| block. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 208496; +var summary = 'Testing |with (f)| inside the definition of |function f()|'; +var STATIC_VALUE = 'read the static property'; +var status = ''; +var statusitems = []; +var actual = '(TEST FAILURE)'; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f(par) +{ + with(f) + { + actual = par; + } + + return par; +} +f.par = STATIC_VALUE; + + +status = inSection(1); +f('abc'); // this sets |actual| inside |f| +expect = STATIC_VALUE; +addThis(); + +// test the return: should be the dynamic value +status = inSection(2); +actual = f('abc'); +expect = 'abc'; +addThis(); + +status = inSection(3); +f(111 + 222); // sets |actual| inside |f| +expect = STATIC_VALUE; +addThis(); + +// test the return: should be the dynamic value +status = inSection(4); +actual = f(111 + 222); +expect = 333; +addThis(); + + +/* + * Add a level of indirection via |x| + */ +function g(par) +{ + with(g) + { + var x = par; + actual = x; + } + + return par; +} +g.par = STATIC_VALUE; + + +status = inSection(5); +g('abc'); // this sets |actual| inside |g| +expect = STATIC_VALUE; +addThis(); + +// test the return: should be the dynamic value +status = inSection(6); +actual = g('abc'); +expect = 'abc'; +addThis(); + +status = inSection(7); +g(111 + 222); // sets |actual| inside |g| +expect = STATIC_VALUE; +addThis(); + +// test the return: should be the dynamic value +status = inSection(8); +actual = g(111 + 222); +expect = 333; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js new file mode 100644 index 0000000..ef65023 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js @@ -0,0 +1,111 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): hannes@helma.at, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 27 Sep 2003 +* SUMMARY: Calling a local function from global scope +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220362 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 220362; +var summary = 'Calling a local function from global scope'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// creates a local function and calls it immediately +function a() +{ + var x = 'A'; + var f = function() {return x;}; + return f(); +} + +// creates and returns a local function +function b() +{ + var x = 'B'; + var f = function() {return x;}; + return f; +} + + +status = inSection(1); +actual = a(); +expect = 'A'; +addThis(); + +status = inSection(2); +var f = b(); +actual = f(); +expect = 'B'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js new file mode 100644 index 0000000..c0feae2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js @@ -0,0 +1,132 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 29 Sep 2003 +* SUMMARY: Testing __parent__ and __proto__ of Script object +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220584 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 220584; +var summary = 'Testing __parent__ and __proto__ of Script object'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var s; + + +// invoke |Script| as a function +s = Script('1;'); + +status = inSection(1); +actual = s instanceof Object; +expect = true; +addThis(); + +status = inSection(2); +actual = (s.__parent__ == undefined) || (s.__parent__ == null); +expect = false; +addThis(); + +status = inSection(3); +actual = (s.__proto__ == undefined) || (s.__proto__ == null); +expect = false; +addThis(); + +status = inSection(4); +actual = (s + '').length > 0; +expect = true; +addThis(); + + +// invoke |Script| as a constructor +s = new Script('1;'); + +status = inSection(5); +actual = s instanceof Object; +expect = true; +addThis(); + +status = inSection(6); +actual = (s.__parent__ == undefined) || (s.__parent__ == null); +expect = false; +addThis(); + +status = inSection(7); +actual = (s.__proto__ == undefined) || (s.__proto__ == null); +expect = false; +addThis(); + +status = inSection(8); +actual = (s + '').length > 0; +expect = true; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js new file mode 100644 index 0000000..f508251 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js @@ -0,0 +1,154 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): jrgm@netscape.com, pschwartau@netscape.com +* Date: 2001-07-11 +* +* SUMMARY: Testing eval scope inside a function. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=77578 +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 77578; +var summary = 'Testing eval scope inside a function'; +var cnEquals = '='; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// various versions of JavaScript - +var JS_VER = [100, 110, 120, 130, 140, 150]; + +// Note contrast with local variables i,j,k defined below - +var i = 999; +var j = 999; +var k = 999; + + +//-------------------------------------------------- +test(); +//-------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + // Run tests A,B,C on each version of JS and store results + for (var n=0; n!=JS_VER.length; n++) + { + testA(JS_VER[n]); + } + for (var n=0; n!=JS_VER.length; n++) + { + testB(JS_VER[n]); + } + for (var n=0; n!=JS_VER.length; n++) + { + testC(JS_VER[n]); + } + + + // Compare actual values to expected values - + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function testA(ver) +{ + // Set the version of JS to test - + version(ver); + + // eval the test, so it compiles AFTER version() has executed - + var sTestScript = ""; + + // Define a local variable i + sTestScript += "status = 'Section A of test; JS ' + ver/100;"; + sTestScript += "var i=1;"; + sTestScript += "actual = eval('i');"; + sTestScript += "expect = 1;"; + sTestScript += "captureThis('i');"; + + eval(sTestScript); +} + + +function testB(ver) +{ + // Set the version of JS to test - + version(ver); + + // eval the test, so it compiles AFTER version() has executed - + var sTestScript = ""; + + // Define a local for-loop iterator j + sTestScript += "status = 'Section B of test; JS ' + ver/100;"; + sTestScript += "for(var j=1; j<2; j++)"; + sTestScript += "{"; + sTestScript += " actual = eval('j');"; + sTestScript += "};"; + sTestScript += "expect = 1;"; + sTestScript += "captureThis('j');"; + + eval(sTestScript); +} + + +function testC(ver) +{ + // Set the version of JS to test - + version(ver); + + // eval the test, so it compiles AFTER version() has executed - + var sTestScript = ""; + + // Define a local variable k in a try-catch block - + sTestScript += "status = 'Section C of test; JS ' + ver/100;"; + sTestScript += "try"; + sTestScript += "{"; + sTestScript += " var k=1;"; + sTestScript += " actual = eval('k');"; + sTestScript += "}"; + sTestScript += "catch(e)"; + sTestScript += "{"; + sTestScript += "};"; + sTestScript += "expect = 1;"; + sTestScript += "captureThis('k');"; + + eval(sTestScript); +} + + +function captureThis(varName) +{ + statusitems[UBound] = status; + actualvalues[UBound] = varName + cnEquals + actual; + expectedvalues[UBound] = varName + cnEquals + expect; + UBound++; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js new file mode 100644 index 0000000..7b3cb02 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js @@ -0,0 +1,110 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* +* The idea behind bug 53268 is as follows. The item 'five' below is defined +* as const, hence is a read-only property of the global object. So if we set +* obj.__proto__ = this, 'five' should become a read-only propery of obj. +* +* If we then change obj.__proto__ to null, obj.five should initially be +* undefined. We should be able to define obj.five to whatever we want, +* and be able to access this value as obj.five. +* +* Bug 53268 was filed because obj.five could not be set or accessed after +* obj.__proto__ had been set to the global object and then to null. +*/ +//----------------------------------------------------------------------------- +var bug = '53268'; +var status = 'Testing scope after changing obj.__proto__'; +var expect= ''; +var actual = ''; +var obj = {}; +const five = 5; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + enterFunc ("test"); + printBugNumber (bug); + printStatus (status); + + + status= 'Step 1: setting obj.__proto__ = global object'; + obj.__proto__ = this; + + actual = obj.five; + expect=5; + reportCompare (expect, actual, status); + + obj.five=1; + actual = obj.five; + expect=5; + reportCompare (expect, actual, status); + + + + status= 'Step 2: setting obj.__proto__ = null'; + obj.__proto__ = null; + + actual = obj.five; + expect=undefined; + reportCompare (expect, actual, status); + + obj.five=2; + actual = obj.five; + expect=2; + reportCompare (expect, actual, status); + + + + status= 'Step 3: setting obj.__proto__ to global object again'; + obj.__proto__ = this; + + actual = obj.five; + expect=2; //<--- (FROM STEP 2 ABOVE) + reportCompare (expect, actual, status); + + obj.five=3; + actual = obj.five; + expect=3; + reportCompare (expect, actual, status); + + + + status= 'Step 4: setting obj.__proto__ to null again'; + obj.__proto__ = null; + + actual = obj.five; + expect=3; //<--- (FROM STEP 3 ABOVE) + reportCompare (expect, actual, status); + + obj.five=4; + actual = obj.five; + expect=4; + reportCompare (expect, actual, status); + + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js new file mode 100644 index 0000000..6493822 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js @@ -0,0 +1,121 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, crock@veilnetworks.com +* Date: 2001-07-02 +* +* SUMMARY: Testing visibility of outer function from inner function. +* +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing visibility of outer function from inner function'; +var cnCousin = 'Fred'; +var cnColor = 'red'; +var cnMake = 'Toyota'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// TEST 1 +function Outer() +{ + + function inner() + { + Outer.cousin = cnCousin; + return Outer.cousin; + } + + status = 'Section 1 of test'; + actual = inner(); + expect = cnCousin; + addThis(); +} + + +Outer(); +status = 'Section 2 of test'; +actual = Outer.cousin; +expect = cnCousin; +addThis(); + + + +// TEST 2 +function Car(make) +{ + this.make = make; + Car.prototype.paint = paint; + + function paint() + { + Car.color = cnColor; + Car.prototype.color = Car.color; + } +} + + +var myCar = new Car(cnMake); +status = 'Section 3 of test'; +actual = myCar.make; +expect = cnMake; +addThis(); + + +myCar.paint(); +status = 'Section 4 of test'; +actual = myCar.color; +expect = cnColor; +addThis(); + + + +//-------------------------------------------------- +test(); +//-------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js new file mode 100644 index 0000000..0cb23df --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js @@ -0,0 +1,122 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): coliver@mminternet.com, pschwartau@netscape.com +* Date: 2001-07-03 +* +* SUMMARY: Testing scope with nested functions +* +* From correspondence with Christopher Oliver <coliver@mminternet.com>: +* +* > Running this test with Rhino produces the following exception: +* > +* > uncaught JavaScript exception: undefined: Cannot find default value for +* > object. (line 3) +* > +* > This is due to a bug in org.mozilla.javascript.NativeCall which doesn't +* > implement toString or valueOf or override getDefaultValue. +* > However, even after I hacked in an implementation of getDefaultValue in +* > NativeCall, Rhino still produces a different result then SpiderMonkey: +* > +* > [object Call] +* > [object Object] +* > [object Call] +* +* Note the results should be: +* +* [object global] +* [object Object] +* [object global] +* +* This is what we are checking for in this testcase - +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing scope with nested functions'; +var statprefix = 'Section '; +var statsuffix = ' of test -'; +var self = this; // capture a reference to the global object; +var cnGlobal = self.toString(); +var cnObject = (new Object).toString(); +var statusitems = []; +var actualvalues = []; +var expectedvalues = []; + + +function a() +{ + function b() + { + capture(this.toString()); + } + + this.c = function() + { + capture(this.toString()); + b(); + } + + b(); +} + + +var obj = new a(); // captures actualvalues[0] +obj.c(); // captures actualvalues[1], actualvalues[2] + + +// The values we expect - see introduction above - +expectedvalues[0] = cnGlobal; +expectedvalues[1] = cnObject; +expectedvalues[2] = cnGlobal; + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function capture(val) +{ + actualvalues[UBound] = val; + statusitems[UBound] = getStatus(UBound); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + i + statsuffix; +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js new file mode 100644 index 0000000..532ed9a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js @@ -0,0 +1,204 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an +* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed +* or implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* Date: 2001-07-16 +* +* SUMMARY: Testing visiblity of variables from within a with block. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=90325 +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 90325; +var summary = 'Testing visiblity of variables from within a with block'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +// (compare local definitions which follow) - +var A = 'global A'; +var B = 'global B'; +var C = 'global C'; +var D = 'global D'; + +// an object with 'C' and 'D' properties - +var objTEST = new Object(); +objTEST.C = C; +objTEST.D = D; + + +status = 'Section 1 of test'; +with (new Object()) +{ + actual = A; + expect = 'global A'; +} +addThis(); + + +status = 'Section 2 of test'; +with (Function) +{ + actual = B; + expect = 'global B'; +} +addThis(); + + +status = 'Section 3 of test'; +with (this) +{ + actual = C; + expect = 'global C'; +} +addThis(); + + +status = 'Section 4 of test'; +localA(); +addThis(); + +status = 'Section 5 of test'; +localB(); +addThis(); + +status = 'Section 6 of test'; +localC(); +addThis(); + +status = 'Section 7 of test'; +localC(new Object()); +addThis(); + +status = 'Section 8 of test'; +localC.apply(new Object()); +addThis(); + +status = 'Section 9 of test'; +localC.apply(new Object(), [objTEST]); +addThis(); + +status = 'Section 10 of test'; +localC.apply(objTEST, [objTEST]); +addThis(); + +status = 'Section 11 of test'; +localD(new Object()); +addThis(); + +status = 'Section 12 of test'; +localD.apply(new Object(), [objTEST]); +addThis(); + +status = 'Section 13 of test'; +localD.apply(objTEST, [objTEST]); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +// contains a with(new Object()) block - +function localA() +{ + var A = 'local A'; + + with(new Object()) + { + actual = A; + expect = 'local A'; + } +} + + +// contains a with(Number) block - +function localB() +{ + var B = 'local B'; + + with(Number) + { + actual = B; + expect = 'local B'; + } +} + + +// contains a with(this) block - +function localC(obj) +{ + var C = 'local C'; + + with(this) + { + actual = C; + } + + if ('C' in this) + expect = this.C; + else + expect = 'local C'; +} + + +// contains a with(obj) block - +function localD(obj) +{ + var D = 'local D'; + + with(obj) + { + actual = D; + } + + if ('D' in obj) + expect = obj.D; + else + expect = 'local D'; +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js new file mode 100644 index 0000000..3a0b211 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js @@ -0,0 +1,104 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. +* All Rights Reserved. +* +* Contributor(s): ajvincent@hotmail.com, pschwartau@netscape.com +* Date: 31 October 2001 +* +* SUMMARY: Regression test for bug 107771 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=107771 +* +* The bug: Section 1 passed, but Sections 2-5 all failed with |actual| == 12 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 107771; +var summary = "Regression test for bug 107771"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var str = ''; +var k = -9999; + + +status = inSection(1); +str = "AAA//BBB/CCC/"; +k = str.lastIndexOf('/'); +actual = k; +expect = 12; + +status = inSection(2); +str = str.substring(0, k); +k = str.lastIndexOf('/'); +actual = k; +expect = 8; +addThis(); + +status = inSection(3); +str = str.substring(0, k); +k = str.lastIndexOf('/'); +actual = k; +expect = 4; +addThis(); + +status = inSection(4); +str = str.substring(0, k); +k = str.lastIndexOf('/'); +actual = k; +expect = 3; +addThis(); + +status = inSection(5); +str = str.substring(0, k); +k = str.lastIndexOf('/'); +actual = k; +expect = -1; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js new file mode 100644 index 0000000..c45f885 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js @@ -0,0 +1,154 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 November 2002 +* SUMMARY: Test that interpreter can handle string literals exceeding 64K +* See http://bugzilla.mozilla.org/show_bug.cgi?id=179068 +* +* Test that the interpreter can handle string literals exceeding 64K limit. +* For that the script passes to eval() "str ='LONG_STRING_LITERAL';" where +* LONG_STRING_LITERAL is a string with 200K chars. +* +* Igor Bukanov explains the technique used below: +* +* > Philip Schwartau wrote: +* >... +* > Here is the heart of the testcase: +* > +* > // Generate 200K long string +* > var long_str = duplicate(LONG_STR_SEED, N); +* > var str = ""; +* > eval("str='".concat(long_str, "';")); +* > var test_is_ok = (str.length == LONG_STR_SEED.length * N); +* > +* > +* > The testcase creates two identical strings, |long_str| and |str|. It +* > uses eval() simply to assign the value of |long_str| to |str|. Why is +* > it necessary to have the variable |str|, then? Why not just create +* > |long_str| and test it? Wouldn't this be enough: +* > +* > // Generate 200K long string +* > var long_str = duplicate(LONG_STR_SEED, N); +* > var test_is_ok = (long_str.length == LONG_STR_SEED.length * N); +* > +* > Or do we specifically need to test eval() to exercise the interpreter? +* +* The reason for eval is to test string literals like in 'a string literal +* with 100 000 characters...', Rhino deals fine with strings generated at +* run time where lengths > 64K. Without eval it would be necessary to have +* a test file excedding 64K which is not that polite for CVS and then a +* special treatment for the compiled mode in Rhino should be added. +* +* +* > +* > If so, is it important to use the concat() method in the assignment, as +* > you have done: |eval("str='".concat(long_str, "';"))|, or can we simply +* > do |eval("str = long_str;")| ? +* +* The concat is a replacement for eval("str='"+long_str+"';"), but as +* long_str is huge, this leads to constructing first a new string via +* "str='"+long_str and then another one via ("str='"+long_str) + "';" +* which takes time under JDK 1.1 on a something like StrongArm 200MHz. +* Calling concat makes less copies, that is why it is used in the +* duplicate function and this is faster then doing recursion like in the +* test case to test that 64K different string literals can be handled. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 179068; +var summary = 'Test that interpreter can handle string literals exceeding 64K'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var LONG_STR_SEED = "0123456789"; +var N = 20 * 1024; +var str = ""; + + +// Generate 200K long string and assign it to |str| via eval() +var long_str = duplicate(LONG_STR_SEED, N); +eval("str='".concat(long_str, "';")); + +status = inSection(1); +actual = str.length == LONG_STR_SEED.length * N +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function duplicate(str, count) +{ + var tmp = new Array(count); + + while (count != 0) + tmp[--count] = str; + + return String.prototype.concat.apply("", tmp); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_5/shell.js new file mode 100644 index 0000000..5f7f27d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_5/shell.js @@ -0,0 +1,180 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + */ + +var FAILED = "FAILED!: "; +var STATUS = "STATUS: "; +var BUGNUMBER = "BUGNUMBER: "; +var VERBOSE = false; +var SECT_PREFIX = 'Section '; +var SECT_SUFFIX = ' of test -'; +var callStack = new Array(); + +/* + * The test driver searches for such a phrase in the test output. + * If such phrase exists, it will set n as the expected exit code. + */ +function expectExitCode(n) +{ + + print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---'); + +} + +/* + * Statuses current section of a test + */ +function inSection(x) +{ + + return SECT_PREFIX + x + SECT_SUFFIX; + +} + +/* + * Some tests need to know if we are in Rhino as opposed to SpiderMonkey + */ +function inRhino() +{ + return (typeof defineClass == "function"); +} + +/* + * Report a failure in the 'accepted' manner + */ +function reportFailure (msg) +{ + var lines = msg.split ("\n"); + var l; + var funcName = currentFunc(); + var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; + + for (var i=0; i<lines.length; i++) + print (FAILED + prefix + lines[i]); + +} + +/* + * Print a non-failure message. + */ +function printStatus (msg) +{ + var lines = msg.split ("\n"); + var l; + + for (var i=0; i<lines.length; i++) + print (STATUS + lines[i]); + +} + +/* + * Print a bugnumber message. + */ +function printBugNumber (num) +{ + + print (BUGNUMBER + num); + +} + +/* + * Compare expected result to actual result, if they differ (in value and/or + * type) report a failure. If description is provided, include it in the + * failure report. + */ +function reportCompare (expected, actual, description) +{ + var expected_t = typeof expected; + var actual_t = typeof actual; + var output = ""; + + if ((VERBOSE) && (typeof description != "undefined")) + printStatus ("Comparing '" + description + "'"); + + if (expected_t != actual_t) + output += "Type mismatch, expected type " + expected_t + + ", actual type " + actual_t + "\n"; + else if (VERBOSE) + printStatus ("Expected type '" + actual_t + "' matched actual " + + "type '" + expected_t + "'"); + + if (expected != actual) + output += "Expected value '" + expected + "', Actual value '" + actual + + "'\n"; + else if (VERBOSE) + printStatus ("Expected value '" + actual + "' matched actual " + + "value '" + expected + "'"); + + if (output != "") + { + if (typeof description != "undefined") + reportFailure (description); + reportFailure (output); + } + +} + +/* + * Puts funcName at the top of the call stack. This stack is used to show + * a function-reported-from field when reporting failures. + */ +function enterFunc (funcName) +{ + + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + callStack.push(funcName); + +} + +/* + * Pops the top funcName off the call stack. funcName is optional, and can be + * used to check push-pop balance. + */ +function exitFunc (funcName) +{ + var lastFunc = callStack.pop(); + + if (funcName) + { + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + if (lastFunc != funcName) + reportFailure ("Test driver failure, expected to exit function '" + + funcName + "' but '" + lastFunc + "' came off " + + "the stack"); + } + +} + +/* + * Peeks at the top of the call stack. + */ +function currentFunc() +{ + + return callStack[callStack.length - 1]; + +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js @@ -0,0 +1 @@ + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js new file mode 100644 index 0000000..a0c53ca --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js @@ -0,0 +1,693 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Mike Shaver + * Bob Clary + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 290592; +var summary = 'Array extras: forEach, indexOf, filter, map'; +var actual = ''; +var expect = ''; + +printBugNumber (bug); +printStatus (summary); + +// Utility functions + +function identity(v, index, array) +{ + reportCompare(v, array[index], 'identity: check callback argument consistency'); + return v; +} + +function mutate(v, index, array) +{ + reportCompare(v, array[index], 'mutate: check callback argument consistency'); + if (index == 0) + { + array[1] = 'mutated'; + delete array[2]; + array.push('not visited'); + } + return v; +} + +function mutateForEach(v, index, array) +{ + reportCompare(v, array[index], 'mutateForEach: check callback argument consistency'); + if (index == 0) + { + array[1] = 'mutated'; + delete array[2]; + array.push('not visited'); + } + actual += v + ','; +} + +function makeUpperCase(v, index, array) +{ + reportCompare(v, array[index], 'makeUpperCase: check callback argument consistency'); + try + { + return v.toUpperCase(); + } + catch(e) + { + } + return v; +} + + +function concat(v, index, array) +{ + reportCompare(v, array[index], 'concat: check callback argument consistency'); + actual += v + ','; +} + + +function isUpperCase(v, index, array) +{ + reportCompare(v, array[index], 'isUpperCase: check callback argument consistency'); + try + { + return v == v.toUpperCase(); + } + catch(e) + { + } + return false; +} + +function isString(v, index, array) +{ + reportCompare(v, array[index], 'isString: check callback argument consistency'); + return typeof v == 'string'; +} + + +// callback object. +function ArrayCallback(state) +{ + this.state = state; +} + +ArrayCallback.prototype.makeUpperCase = function (v, index, array) +{ + reportCompare(v, array[index], 'ArrayCallback.prototype.makeUpperCase: check callback argument consistency'); + try + { + return this.state ? v.toUpperCase() : v.toLowerCase(); + } + catch(e) + { + } + return v; +}; + +ArrayCallback.prototype.concat = function(v, index, array) +{ + reportCompare(v, array[index], 'ArrayCallback.prototype.concat: check callback argument consistency'); + actual += v + ','; +}; + +ArrayCallback.prototype.isUpperCase = function(v, index, array) +{ + reportCompare(v, array[index], 'ArrayCallback.prototype.isUpperCase: check callback argument consistency'); + try + { + return this.state ? true : (v == v.toUpperCase()); + } + catch(e) + { + } + return false; +}; + +ArrayCallback.prototype.isString = function(v, index, array) +{ + reportCompare(v, array[index], 'ArrayCallback.prototype.isString: check callback argument consistency'); + return this.state ? true : (typeof v == 'string'); +}; + +function dumpError(e) +{ + var s = e.name + ': ' + e.message + + ' File: ' + e.fileName + + ', Line: ' + e.lineNumber + + ', Stack: ' + e.stack; + return s; +} + +var obj; +var strings = ['hello', 'Array', 'WORLD']; +var mixed = [0, '0', 0]; +var sparsestrings = new Array(); +sparsestrings[2] = 'sparse'; + +if ('map' in Array.prototype) +{ +// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:map + + // test Array.map + + // map has 1 required argument + expect = 1; + actual = Array.prototype.map.length; + reportCompare(expect, actual, 'Array.prototype.map.length == 1'); + + // throw TypeError if no callback function specified + expect = 'TypeError'; + try + { + strings.map(); + actual = 'no error'; + } + catch(e) + { + actual = e.name; + } + reportCompare(expect, actual, 'Array.map(undefined) throws TypeError'); + + try + { + // identity map + expect = 'hello,Array,WORLD'; + actual = strings.map(identity).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.map: identity'); + + + try + { + expect = 'hello,mutated,'; + actual = strings.map(mutate).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.map: mutate'); + + strings = ['hello', 'Array', 'WORLD']; + + try + { + // general map + expect = 'HELLO,ARRAY,WORLD'; + actual = strings.map(makeUpperCase).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.map: uppercase'); + + try + { + // pass object method as map callback + expect = 'HELLO,ARRAY,WORLD'; + var obj = new ArrayCallback(true); + actual = strings.map(obj.makeUpperCase, obj).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.map: uppercase with object callback'); + + try + { + expect = 'hello,array,world'; + obj = new ArrayCallback(false); + actual = strings.map(obj.makeUpperCase, obj).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.map: lowercase with object callback'); + + try + { + // map on sparse arrays + expect = ',,SPARSE'; + actual = sparsestrings.map(makeUpperCase).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.map: uppercase on sparse array'); +} + +if ('forEach' in Array.prototype) +{ +// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach + + // test Array.forEach + + // forEach has 1 required argument + expect = 1; + actual = Array.prototype.forEach.length; + reportCompare(expect, actual, 'Array.prototype.forEach.length == 1'); + + // throw TypeError if no callback function specified + expect = 'TypeError'; + try + { + strings.forEach(); + actual = 'no error'; + } + catch(e) + { + actual = e.name; + } + reportCompare(expect, actual, 'Array.forEach(undefined) throws TypeError'); + + try + { + // general forEach + expect = 'hello,Array,WORLD,'; + actual = ''; + strings.forEach(concat); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.forEach'); + + try + { + expect = 'hello,mutated,'; + actual = ''; + strings.forEach(mutateForEach); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.forEach: mutate'); + + strings = ['hello', 'Array', 'WORLD']; + + + + try + { + // pass object method as forEach callback + expect = 'hello,Array,WORLD,'; + actual = ''; + obj = new ArrayCallback(true); + strings.forEach(obj.concat, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.forEach with object callback 1'); + + try + { + expect = 'hello,Array,WORLD,'; + actual = ''; + obj = new ArrayCallback(false); + strings.forEach(obj.concat, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.forEach with object callback 2'); + + try + { + // test forEach on sparse arrays + // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082 + expect = 'sparse,'; + actual = ''; + sparsestrings.forEach(concat); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.forEach on sparse array'); +} + +if ('filter' in Array.prototype) +{ +// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:filter + + // test Array.filter + + // filter has 1 required argument + expect = 1; + actual = Array.prototype.filter.length; + reportCompare(expect, actual, 'Array.prototype.filter.length == 1'); + + // throw TypeError if no callback function specified + expect = 'TypeError'; + try + { + strings.filter(); + actual = 'no error'; + } + catch(e) + { + actual = e.name; + } + reportCompare(expect, actual, 'Array.filter(undefined) throws TypeError'); + + try + { + // test general filter + expect = 'WORLD'; + actual = strings.filter(isUpperCase).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.filter'); + + try + { + expect = 'WORLD'; + obj = new ArrayCallback(false); + actual = strings.filter(obj.isUpperCase, obj).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.filter object callback 1'); + + try + { + expect = 'hello,Array,WORLD'; + obj = new ArrayCallback(true); + actual = strings.filter(obj.isUpperCase, obj).toString(); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'Array.filter object callback 2'); +} + +if ('every' in Array.prototype) +{ +// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:every + + // test Array.every + + // every has 1 required argument + + expect = 1; + actual = Array.prototype.every.length; + reportCompare(expect, actual, 'Array.prototype.every.length == 1'); + + // throw TypeError if no every callback function specified + expect = 'TypeError'; + try + { + strings.every(); + actual = 'no error'; + } + catch(e) + { + actual = e.name; + } + reportCompare(expect, actual, 'Array.every(undefined) throws TypeError'); + + // test general every + + try + { + expect = true; + actual = strings.every(isString); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'strings: every element is a string'); + + try + { + expect = false; + actual = mixed.every(isString); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'mixed: every element is a string'); + + try + { + // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082 + expect = true; + actual = sparsestrings.every(isString); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'sparsestrings: every element is a string'); + + // pass object method as map callback + + obj = new ArrayCallback(false); + + try + { + expect = true; + actual = strings.every(obj.isString, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'strings: every element is a string, via object callback'); + + try + { + expect = false; + actual = mixed.every(obj.isString, obj); + } + catch(e) + { + actual = dumpError(e) ; + } + reportCompare(expect, actual, 'mixed: every element is a string, via object callback'); + + try + { + // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082 + expect = true; + actual = sparsestrings.every(obj.isString, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'sparsestrings: every element is a string, via object callback'); + +} + +if ('some' in Array.prototype) +{ +// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:some + + // test Array.some + + // some has 1 required argument + + expect = 1; + actual = Array.prototype.some.length; + reportCompare(expect, actual, 'Array.prototype.some.length == 1'); + + // throw TypeError if no some callback function specified + expect = 'TypeError'; + try + { + strings.some(); + actual = 'no error'; + } + catch(e) + { + actual = e.name; + } + reportCompare(expect, actual, 'Array.some(undefined) throws TypeError'); + + // test general some + + try + { + expect = true; + actual = strings.some(isString); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'strings: some element is a string'); + + try + { + expect = true; + actual = mixed.some(isString); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'mixed: some element is a string'); + + try + { + expect = true; + actual = sparsestrings.some(isString); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'sparsestrings: some element is a string'); + + // pass object method as map callback + + obj = new ArrayCallback(false); + + try + { + expect = true; + actual = strings.some(obj.isString, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'strings: some element is a string, via object callback'); + + try + { + expect = true; + actual = mixed.some(obj.isString, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'mixed: some element is a string, via object callback'); + + try + { + expect = true; + actual = sparsestrings.some(obj.isString, obj); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'sparsestrings: some element is a string, via object callback'); + +} + +if ('indexOf' in Array.prototype) +{ +// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:indexOf + + // test Array.indexOf + + // indexOf has 1 required argument + + expect = 1; + actual = Array.prototype.indexOf.length; + reportCompare(expect, actual, 'Array.prototype.indexOf.length == 1'); + + // test general indexOf + + try + { + expect = -1; + actual = mixed.indexOf('not found'); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'indexOf returns -1 if value not found'); + + try + { + expect = 0; + actual = mixed.indexOf(0); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'indexOf matches using strict equality'); + + try + { + expect = 1; + actual = mixed.indexOf('0'); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'indexOf matches using strict equality'); + + try + { + expect = 2; + actual = mixed.indexOf(0, 1); + } + catch(e) + { + actual = dumpError(e); + } + reportCompare(expect, actual, 'indexOf begins searching at fromIndex'); +} + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js new file mode 100644 index 0000000..5cab4a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js @@ -0,0 +1,270 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 304828; +var summary = 'Array Generic Methods'; +var actual = ''; +var expect = ''; +printBugNumber (bug); +printStatus (summary); + +var value; + +// use Array methods on a String +// join +value = '123'; +expect = '1,2,3'; +try +{ + actual = Array.prototype.join.call(value); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': join'); + +// reverse +value = '123'; +expect = '123'; +try +{ + actual = Array.prototype.reverse.call(value) + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': reverse'); + +// sort +value = 'cba'; +expect = 'cba'; +try +{ + actual = Array.prototype.sort.call(value) + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': sort'); + +// push +value = 'abc'; +expect = 6; +try +{ + actual = Array.prototype.push.call(value, 'd', 'e', 'f'); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': push'); +reportCompare('abc', value, summary + ': push'); + +// pop +value = 'abc'; +expect = 'c'; +try +{ + actual = Array.prototype.pop.call(value); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': pop'); +reportCompare('abc', value, summary + ': pop'); + +// unshift +value = 'def'; +expect = 6; +try +{ + actual = Array.prototype.unshift.call(value, 'a', 'b', 'c'); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': unshift'); +reportCompare('def', value, summary + ': unshift'); + +// shift +value = 'abc'; +expect = 'a'; +try +{ + actual = Array.prototype.shift.call(value); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': shift'); +reportCompare('abc', value, summary + ': shift'); + +// splice +value = 'abc'; +expect = 'b'; +try +{ + actual = Array.prototype.splice.call(value, 1, 1) + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': splice'); + +// concat +value = 'abc'; +expect = 'abc,d,e,f'; +try +{ + actual = Array.prototype.concat.call(value, 'd', 'e', 'f') + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': concat'); + +// slice +value = 'abc'; +expect = 'b'; +try +{ + actual = Array.prototype.slice.call(value, 1, 2) + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': slice'); + +// indexOf +value = 'abc'; +expect = 1; +try +{ + actual = Array.prototype.indexOf.call(value, 'b'); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': indexOf'); + +// lastIndexOf +value = 'abcabc'; +expect = 4; +try +{ + actual = Array.prototype.lastIndexOf.call(value, 'b'); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': lastIndexOf'); + +// forEach +value = 'abc'; +expect = 'ABC'; +actual = ''; +try +{ + Array.prototype.forEach.call(value, + function (v, index, array) + {actual += array[index].toUpperCase();}); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': forEach'); + +// map +value = 'abc'; +expect = 'A,B,C'; +try +{ + actual = Array.prototype.map.call(value, + function (v, index, array) + {return v.toUpperCase();}) + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': map'); + +// filter +value = '1234567890'; +expect = '2,4,6,8,0'; +try +{ + actual = Array.prototype.filter.call(value, + function (v, index, array) + {return array[index] % 2 == 0;}) + ''; +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': filter'); + +// every +value = '1234567890'; +expect = false; +try +{ + actual = Array.prototype.every.call(value, + function (v, index, array) + {return array[index] % 2 == 0;}); +} +catch(e) +{ + actual = e + ''; +} +reportCompare(expect, actual, summary + ': every'); + + + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js new file mode 100644 index 0000000..d2c316a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Hans-Andreas Engel + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 305002; +var summary = '[].every(f) == true'; +var actual = ''; +var expect = ''; + +printBugNumber (bug); +printStatus (summary); + +var notcalled = true; + +function callback() +{ + notcalled = false; +} + +expect = true; +actual = [].every(callback) && notcalled; + +reportCompare(expect, actual, summary); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js new file mode 100644 index 0000000..64f543f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Igor Bukanov + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 310425; +var summary = 'Array.indexOf/lastIndexOf edge cases'; +var actual = ''; +var expect = ''; + +printBugNumber (bug); +printStatus (summary); + +expect = -1; +actual = [].lastIndexOf(undefined, -1); +reportCompare(expect, actual, summary); + +expect = -1; +actual = [].indexOf(undefined, -1); +reportCompare(expect, actual, summary); + +var x = []; +x[1 << 30] = 1; +expect = (1 << 30); +actual = x.lastIndexOf(1); +reportCompare(expect, actual, summary); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js new file mode 100644 index 0000000..f0309a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Igor Bukanov + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 310425; +var summary = 'Array.indexOf/lastIndexOf edge cases'; +var actual = ''; +var expect = ''; + +printBugNumber (bug); +printStatus (summary); + +expect = -1; +actual = Array(1).indexOf(1); +reportCompare(expect, actual, summary); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js new file mode 100644 index 0000000..323bc3c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Blake Kaplan + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 320887; +var summary = 'var x should not throw a ReferenceError'; +var actual = 'No error'; +var expect = 'No error'; + +printBugNumber (bug); +printStatus (summary); + +try +{ + (function xxx() { ["var x"].map(eval); })() +} +catch(ex) +{ + actual = ex + ''; +} + +reportCompare(expect, actual, summary); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js @@ -0,0 +1 @@ + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/README b/Source/JavaScriptCore/tests/mozilla/js1_6/README new file mode 100644 index 0000000..7a3c7a0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/README @@ -0,0 +1 @@ +JavaScript 1.6 diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js new file mode 100644 index 0000000..b262fa1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js @@ -0,0 +1 @@ +// dummy file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js new file mode 100644 index 0000000..28b1d1a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Wladimir Palant + * shutdown + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 301574; +var summary = 'E4X should be enabled even when e4x=1 not specified'; +var actual = 'No error'; +var expect = 'No error'; + +printBugNumber (bug); +printStatus (summary); + +try +{ + var xml = XML('<xml/>'); +} +catch(e) +{ + actual = 'error: ' + e; +} + +reportCompare(expect, actual, summary + ': XML()'); + +try +{ + var xml = XML('<p>text</p>'); +} +catch(e) +{ + actual = 'error: ' + e; +} + +reportCompare(expect, actual, summary + ': XMLList()'); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js new file mode 100644 index 0000000..a97bede --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 309242; +var summary = 'E4X should be on by default while preserving comment hack'; +var actual = ''; +var expect = ''; + +printBugNumber (bug); +printStatus (summary); + +/* + E4X should be available regardless of script type + <!-- and --> should begin comment to end of line + unless type=text/javascript;e4x=1 +*/ + +expect = true; +actual = true; +// the next line will be ignored when e4x is not requested +<!-- comment -->; actual = false; + +reportCompare(expect, actual, summary + ': <!-- is comment to end of line'); + +expect = true; +actual = false; +// the next line will be ignored when e4x is not requested +<!-- +actual = true; +// --> + +reportCompare(expect, actual, summary + ': comment hack works inside script'); + +// E4X is available always + +var x = <foo/>; + +expect = 'element'; +actual = x.nodeKind(); + +reportCompare(expect, actual, summary + ': E4X is available'); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js new file mode 100644 index 0000000..46af70c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js @@ -0,0 +1,55 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Brendan Eich + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var bug = 311157; +var summary = 'Comment-hiding compromise left E4X parsing/scanning inconsistent'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber (bug); +printStatus (summary); + +try +{ + eval('var x = <hi> <!-- duh -->\n there </hi>'); +} +catch(e) +{ +} + +reportCompare(expect, actual, summary); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js new file mode 100644 index 0000000..a7ef464 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js @@ -0,0 +1,55 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Brendan Eich + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var bug = 311157; +var summary = 'Comment-hiding compromise left E4X parsing/scanning inconsistent'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber (bug); +printStatus (summary); + +try +{ + eval('var x = <hi> <![CDATA[ duh ]]>\n there </hi>'); +} +catch(e) +{ +} + +reportCompare(expect, actual, summary); + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js new file mode 100644 index 0000000..61cb87a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 314887; +var summary = 'Do not crash when morons embed script tags in external script files'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber (bug); +printStatus (summary); + +<script language="JavaScript" type="text/JavaScript"> +<!-- +//--> +</script> + +reportCompare(expect, actual, summary); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js new file mode 100644 index 0000000..badd987 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): shutdown@flashmail.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 320172; +var summary = 'Regression from bug 285219'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +enterFunc ('test'); +printBugNumber (bug); +printStatus (summary); + +try +{ + (function xxx(){ ["var x"].forEach(eval); })(); +} +catch(ex) +{ +} + +printStatus('No Crash'); +reportCompare(expect, actual, summary); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js new file mode 100644 index 0000000..b262fa1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js @@ -0,0 +1 @@ +// dummy file diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js @@ -0,0 +1 @@ + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js b/Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js new file mode 100644 index 0000000..df498c3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): nanto_vi + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 306591; +var summary = 'String static methods'; +var actual = ''; +var expect = ''; + +printBugNumber (bug); +printStatus (summary); +printStatus ('See https://bugzilla.mozilla.org/show_bug.cgi?id=304828'); + +expect = ['a', 'b', 'c'].toString(); +actual = String.split(new String('abc'), '').toString(); +reportCompare(expect, actual, summary + + " String.split(new String('abc'), '')"); + +expect = '2'; +actual = String.substring(new Number(123), 1, 2); +reportCompare(expect, actual, summary + + " String.substring(new Number(123), 1, 2)"); + +expect = 'TRUE'; +actual = String.toUpperCase(new Boolean(true)); +reportCompare(expect, actual, summary + + " String.toUpperCase(new Boolean(true))"); + +expect = 2; +actual = String.indexOf(null, 'l'); +reportCompare(expect, actual, summary + + " String.indexOf(null, 'l')"); + +expect = 2; +actual = String.indexOf(String(null), 'l'); +reportCompare(expect, actual, summary + + " String.indexOf(String(null), 'l')"); + +expect = ['a', 'b', 'c'].toString(); +actual = String.split('abc', '').toString(); +reportCompare(expect, actual, summary + + " String.split('abc', '')"); + +expect = '2'; +actual = String.substring(123, 1, 2); +reportCompare(expect, actual, summary + + " String.substring(123, 1, 2)"); + +expect = 'TRUE'; +actual = String.toUpperCase(true); +reportCompare(expect, actual, summary + + " String.toUpperCase(true)"); + +expect = 2; +actual = String.indexOf(undefined, 'd'); +reportCompare(expect, actual, summary + + " String.indexOf(undefined, 'd')"); + +expect = 2; +actual = String.indexOf(String(undefined), 'd'); +reportCompare(expect, actual, summary + + " String.indexOf(String(undefined), 'd')"); diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js @@ -0,0 +1 @@ + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/browser.js new file mode 100644 index 0000000..c11f6c6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/browser.js @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * JavaScript test library shared functions file for running the tests + * in the browser. Overrides the shell's print function with document.write + * and make everything HTML pretty. + * + * To run the tests in the browser, use the mkhtml.pl script to generate + * html pages that include the shell.js, browser.js (this file), and the + * test js file in script tags. + * + * The source of the page that is generated should look something like this: + * <script src="./../shell.js"></script> + * <script src="./../browser.js"></script> + * <script src="./mytest.js"></script> + */ +function writeLineToLog( string ) { + document.write( string + "<br>\n"); +} + +var testcases = new Array(); +var tc = testcases.length; +var bug = ''; +var summary = ''; +var description = ''; +var expected = ''; +var actual = ''; +var msg = ''; + + +function TestCase(n, d, e, a) +{ + this.path = (typeof gTestPath == 'undefined') ? '' : gTestPath; + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = ( e == a ); + this.reason = ''; + this.bugnumber = typeof(bug) != 'undefined' ? bug : ''; + testcases[tc++] = this; +} + +var gInReportCompare = false; + +var _reportCompare = reportCompare; + +reportCompare = function(expected, actual, description) +{ + gInReportCompare = true; + + var testcase = new TestCase(gTestName, description, expected, actual); + testcase.passed = _reportCompare(expected, actual, description); + + gInReportCompare = false; +}; + +var _reportFailure = reportFailure; +reportFailure = function (msg, page, line) +{ + var testcase; + + if (gInReportCompare) + { + testcase = testcases[tc - 1]; + testcase.passed = false; + } + else + { + if (typeof DESCRIPTION == 'undefined') + { + DESCRIPTION = 'Unknown'; + } + if (typeof EXPECTED == 'undefined') + { + EXPECTED = 'Unknown'; + } + testcase = new TestCase(gTestName, DESCRIPTION, EXPECTED, "error"); + if (document.location.href.indexOf('-n.js') != -1) + { + // negative test + testcase.passed = true; + } + } + + testcase.reason += msg; + + if (typeof(page) != 'undefined') + { + testcase.reason += ' Page: ' + page; + } + if (typeof(line) != 'undefined') + { + testcase.reason += ' Line: ' + line; + } + if (!testcase.passed) + { + _reportFailure(msg); + } + +}; + +function gc() +{ +} + +function quit() +{ +} + +window.onerror = reportFailure; + diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/shell.js new file mode 100644 index 0000000..a1c08c0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/shell.js @@ -0,0 +1,477 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Rob Ginda rginda@netscape.com + * Bob Clary bob@bclary.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var FAILED = "FAILED!: "; +var STATUS = "STATUS: "; +var BUGNUMBER = "BUGNUMBER: "; +var VERBOSE = false; +var SECT_PREFIX = 'Section '; +var SECT_SUFFIX = ' of test -'; +var callStack = new Array(); + +function writeLineToLog( string ) { + print( string + "\n"); +} +/* + * The test driver searches for such a phrase in the test output. + * If such phrase exists, it will set n as the expected exit code. + */ +function expectExitCode(n) +{ + + writeLineToLog('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---'); + +} + +/* + * Statuses current section of a test + */ +function inSection(x) +{ + + return SECT_PREFIX + x + SECT_SUFFIX; + +} + +/* + * Some tests need to know if we are in Rhino as opposed to SpiderMonkey + */ +function inRhino() +{ + return (typeof defineClass == "function"); +} + +/* + * Report a failure in the 'accepted' manner + */ +function reportFailure (msg) +{ + var lines = msg.split ("\n"); + var l; + var funcName = currentFunc(); + var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; + + for (var i=0; i<lines.length; i++) + writeLineToLog (FAILED + prefix + lines[i]); + +} + +/* + * Print a non-failure message. + */ +function printStatus (msg) +{ + msg = String(msg); + msg = msg.toString(); + var lines = msg.split ("\n"); + var l; + + for (var i=0; i<lines.length; i++) + writeLineToLog (STATUS + lines[i]); + +} + +/* + * Print a bugnumber message. + */ +function printBugNumber (num) +{ + + writeLineToLog (BUGNUMBER + num); + +} + +/* + * Compare expected result to actual result, if they differ (in value and/or + * type) report a failure. If description is provided, include it in the + * failure report. + */ +function reportCompare (expected, actual, description) +{ + var expected_t = typeof expected; + var actual_t = typeof actual; + var output = ""; + + if ((VERBOSE) && (typeof description != "undefined")) + printStatus ("Comparing '" + description + "'"); + + if (expected_t != actual_t) + output += "Type mismatch, expected type " + expected_t + + ", actual type " + actual_t + "\n"; + else if (VERBOSE) + printStatus ("Expected type '" + actual_t + "' matched actual " + + "type '" + expected_t + "'"); + + if (expected != actual) + output += "Expected value '" + expected + "', Actual value '" + actual + + "'\n"; + else if (VERBOSE) + printStatus ("Expected value '" + actual + "' matched actual " + + "value '" + expected + "'"); + + if (output != "") + { + if (typeof description != "undefined") + reportFailure (description); + reportFailure (output); + } + return (output == ""); // true if passed +} + +/* + * Puts funcName at the top of the call stack. This stack is used to show + * a function-reported-from field when reporting failures. + */ +function enterFunc (funcName) +{ + + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + callStack.push(funcName); + +} + +/* + * Pops the top funcName off the call stack. funcName is optional, and can be + * used to check push-pop balance. + */ +function exitFunc (funcName) +{ + var lastFunc = callStack.pop(); + + if (funcName) + { + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + if (lastFunc != funcName) + reportFailure ("Test driver failure, expected to exit function '" + + funcName + "' but '" + lastFunc + "' came off " + + "the stack"); + } + +} + +/* + * Peeks at the top of the call stack. + */ +function currentFunc() +{ + + return callStack[callStack.length - 1]; + +} + +/* + Calculate the "order" of a set of data points {X: [], Y: []} + by computing successive "derivatives" of the data until + the data is exhausted or the derivative is linear. +*/ +function BigO(data) +{ + var order = 0; + var origLength = data.X.length; + + while (data.X.length > 2) + { + var lr = new LinearRegression(data); + if (lr.b > 1e-6) + { + // only increase the order if the slope + // is "great" enough + order++; + } + + if (lr.r > 0.98 || lr.Syx < 1 || lr.b < 1e-6) + { + // terminate if close to a line lr.r + // small error lr.Syx + // small slope lr.b + break; + } + data = dataDeriv(data); + } + + if (2 == origLength - order) + { + order = Number.POSITIVE_INFINITY; + } + return order; + + function LinearRegression(data) + { + /* + y = a + bx + for data points (Xi, Yi); 0 <= i < n + + b = (n*SUM(XiYi) - SUM(Xi)*SUM(Yi))/(n*SUM(Xi*Xi) - SUM(Xi)*SUM(Xi)) + a = (SUM(Yi) - b*SUM(Xi))/n + */ + var i; + + if (data.X.length != data.Y.length) + { + throw 'LinearRegression: data point length mismatch'; + } + if (data.X.length < 3) + { + throw 'LinearRegression: data point length < 2'; + } + var n = data.X.length; + var X = data.X; + var Y = data.Y; + + this.Xavg = 0; + this.Yavg = 0; + + var SUM_X = 0; + var SUM_XY = 0; + var SUM_XX = 0; + var SUM_Y = 0; + var SUM_YY = 0; + + for (i = 0; i < n; i++) + { + SUM_X += X[i]; + SUM_XY += X[i]*Y[i]; + SUM_XX += X[i]*X[i]; + SUM_Y += Y[i]; + SUM_YY += Y[i]*Y[i]; + } + + this.b = (n * SUM_XY - SUM_X * SUM_Y)/(n * SUM_XX - SUM_X * SUM_X); + this.a = (SUM_Y - this.b * SUM_X)/n; + + this.Xavg = SUM_X/n; + this.Yavg = SUM_Y/n; + + var SUM_Ydiff2 = 0; + var SUM_Xdiff2 = 0; + var SUM_XdiffYdiff = 0; + + for (i = 0; i < n; i++) + { + var Ydiff = Y[i] - this.Yavg; + var Xdiff = X[i] - this.Xavg; + + SUM_Ydiff2 += Ydiff * Ydiff; + SUM_Xdiff2 += Xdiff * Xdiff; + SUM_XdiffYdiff += Xdiff * Ydiff; + } + + var Syx2 = (SUM_Ydiff2 - Math.pow(SUM_XdiffYdiff/SUM_Xdiff2, 2))/(n - 2); + var r2 = Math.pow((n*SUM_XY - SUM_X * SUM_Y), 2) / + ((n*SUM_XX - SUM_X*SUM_X)*(n*SUM_YY-SUM_Y*SUM_Y)); + + this.Syx = Math.sqrt(Syx2); + this.r = Math.sqrt(r2); + + } + + function dataDeriv(data) + { + if (data.X.length != data.Y.length) + { + throw 'length mismatch'; + } + var length = data.X.length; + + if (length < 2) + { + throw 'length ' + length + ' must be >= 2'; + } + var X = data.X; + var Y = data.Y; + + var deriv = {X: [], Y: [] }; + + for (var i = 0; i < length - 1; i++) + { + deriv.X[i] = (X[i] + X[i+1])/2; + deriv.Y[i] = (Y[i+1] - Y[i])/(X[i+1] - X[i]); + } + return deriv; + } + +} + +/* JavaScriptOptions + encapsulate the logic for setting and retrieving the values + of the javascript options. + + Note: in shell, options() takes an optional comma delimited list + of option names, toggles the values for each option and returns the + list of option names which were set before the call. + If no argument is passed to options(), it returns the current + options with value true. + + Usage; + + // create and initialize object. + jsOptions = new JavaScriptOptions(); + + // set a particular option + jsOptions.setOption(name, boolean); + + // reset all options to their original values. + jsOptions.reset(); +*/ + +function JavaScriptOptions() +{ + this.orig = {}; + this.orig.strict = this.strict = false; + this.orig.werror = this.werror = false; + + this.privileges = 'UniversalXPConnect'; + + if (typeof options == 'function') + { + // shell + var optString = options(); + if (optString) + { + var optList = optString.split(','); + for (iOpt = 0; i < optList.length; iOpt++) + { + optName = optList[iOpt]; + this[optName] = true; + } + } + } + else if (typeof document != 'undefined') + { + // browser + netscape.security.PrivilegeManager.enablePrivilege(this.privileges); + + var preferences = Components.classes['@mozilla.org/preferences;1']; + if (!preferences) + { + throw 'JavaScriptOptions: unable to get @mozilla.org/preference;1'; + } + + var prefService = preferences. + getService(Components.interfaces.nsIPrefService); + + if (!prefService) + { + throw 'JavaScriptOptions: unable to get nsIPrefService'; + } + + var pref = prefService.getBranch(''); + + if (!pref) + { + throw 'JavaScriptOptions: unable to get prefService branch'; + } + + try + { + this.orig.strict = this.strict = + pref.getBoolPref('javascript.options.strict'); + } + catch(e) + { + } + + try + { + this.orig.werror = this.werror = + pref.getBoolPref('javascript.options.werror'); + } + catch(e) + { + } + } +} + +JavaScriptOptions.prototype.setOption = +function (optionName, optionValue) +{ + if (typeof options == 'function') + { + // shell + if (this[optionName] != optionValue) + { + options(optionName); + } + } + else if (typeof document != 'undefined') + { + // browser + netscape.security.PrivilegeManager.enablePrivilege(this.privileges); + + var preferences = Components.classes['@mozilla.org/preferences;1']; + if (!preferences) + { + throw 'setOption: unable to get @mozilla.org/preference;1'; + } + + var prefService = preferences. + getService(Components.interfaces.nsIPrefService); + + if (!prefService) + { + throw 'setOption: unable to get nsIPrefService'; + } + + var pref = prefService.getBranch(''); + + if (!pref) + { + throw 'setOption: unable to get prefService branch'; + } + + pref.setBoolPref('javascript.options.' + optionName, optionValue); + } + + this[optionName] = optionValue; + + return; +} + + +JavaScriptOptions.prototype.reset = function () +{ + this.setOption('strict', this.orig.strict); + this.setOption('werror', this.orig.werror); +} diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/template.js b/Source/JavaScriptCore/tests/mozilla/js1_6/template.js new file mode 100644 index 0000000..dede379 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/js1_6/template.js @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +//----------------------------------------------------------------------------- +var bug = 99999; +var summary = ''; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/jsDriver.pl b/Source/JavaScriptCore/tests/mozilla/jsDriver.pl new file mode 100644 index 0000000..d1c18ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/jsDriver.pl @@ -0,0 +1,1335 @@ +#!/usr/bin/perl +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is JavaScript Core Tests. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1997-1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Alternatively, the contents of this file may be used under the +# terms of the GNU Public License (the "GPL"), in which case the +# provisions of the GPL are applicable instead of those above. +# If you wish to allow use of your version of this file only +# under the terms of the GPL and not to allow others to use your +# version of this file under the NPL, indicate your decision by +# deleting the provisions above and replace them with the notice +# and other provisions required by the GPL. If you do not delete +# the provisions above, a recipient may use your version of this +# file under either the NPL or the GPL. +# +# Contributers: +# Robert Ginda <rginda@netscape.com> +# +# Second cut at runtests.pl script originally by +# Christine Begle (cbegle@netscape.com) +# Branched 11/01/99 +# + +use strict; +use Getopt::Mixed "nextOption"; + +my $os_type = &get_os_type; +my $unixish = (($os_type ne "WIN") && ($os_type ne "MAC")); +my $path_sep = ($os_type eq "MAC") ? ":" : "/"; +my $win_sep = ($os_type eq "WIN")? &get_win_sep : ""; +my $redirect_command = ($os_type ne "MAC") ? " 2>&1" : ""; + +# command line option defaults +my $opt_suite_path; +my $opt_trace = 0; +my $opt_classpath = ""; +my $opt_rhino_opt = 0; +my $opt_rhino_ms = 0; +my @opt_engine_list; +my $opt_engine_type = ""; +my $opt_engine_params = ""; +my $opt_user_output_file = 0; +my $opt_output_file = ""; +my @opt_test_list_files; +my @opt_neg_list_files; +my $opt_shell_path = ""; +my $opt_java_path = ""; +my $opt_bug_url = "http://bugzilla.mozilla.org/show_bug.cgi?id="; +my $opt_console_failures = 0; +my $opt_lxr_url = "./"; # "http://lxr.mozilla.org/mozilla/source/js/tests/"; +my $opt_exit_munge = ($os_type ne "MAC") ? 1 : 0; +my $opt_arch= ""; + +# command line option definition +my $options = "a=s arch>a b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " . +"h help>h i j=s javapath>j k confail>k l=s list>l L=s neglist>L " . +"o=s opt>o p=s testpath>p s=s shellpath>s t trace>t u=s lxrurl>u " . +"x noexitmunge>x"; + +if ($os_type eq "MAC") { + $opt_suite_path = `directory`; + $opt_suite_path =~ s/[\n\r]//g; + $opt_suite_path .= ":"; +} else { + $opt_suite_path = "./"; +} + +&parse_args; + +my $user_exit = 0; +my ($engine_command, $html, $failures_reported, $tests_completed, + $exec_time_string); +my @failed_tests; +my @test_list = &get_test_list; + +if ($#test_list == -1) { + die ("Nothing to test.\n"); +} + +if ($unixish) { +# on unix, ^C pauses the tests, and gives the user a chance to quit but +# report on what has been done, to just quit, or to continue (the +# interrupted test will still be skipped.) +# windows doesn't handle the int handler they way we want it to, +# so don't even pretend to let the user continue. + $SIG{INT} = 'int_handler'; +} + +&main; + +#End. + +sub main { + my $start_time; + + while ($opt_engine_type = pop (@opt_engine_list)) { + dd ("Testing engine '$opt_engine_type'"); + + $engine_command = &get_engine_command; + $html = ""; + @failed_tests = (); + $failures_reported = 0; + $tests_completed = 0; + $start_time = time; + + + &execute_tests (@test_list); + + my $exec_time = (time - $start_time); + my $exec_hours = int($exec_time / 60 / 60); + $exec_time -= $exec_hours * 60 * 60; + my $exec_mins = int($exec_time / 60); + $exec_time -= $exec_mins * 60; + my $exec_secs = ($exec_time % 60); + + if ($exec_hours > 0) { + $exec_time_string = "$exec_hours hours, $exec_mins minutes, " . + "$exec_secs seconds"; + } elsif ($exec_mins > 0) { + $exec_time_string = "$exec_mins minutes, $exec_secs seconds"; + } else { + $exec_time_string = "$exec_secs seconds"; + } + + if (!$opt_user_output_file) { + $opt_output_file = &get_tempfile_name; + } + + &write_results; + + } +} + +sub execute_tests { + my (@test_list) = @_; + my ($test, $shell_command, $line, @output, $path); + my $file_param = " -f "; + my ($last_suite, $last_test_dir); + +# Don't run any shell.js files as tests; they are only utility files + @test_list = grep (!/shell\.js$/, @test_list); + + &status ("Executing " . ($#test_list + 1) . " test(s)."); + foreach $test (@test_list) { + my ($suite, $test_dir, $test_file) = split($path_sep, $test); +# *-n.js is a negative test, expect exit code 3 (runtime error) + my $expected_exit = ($test =~ /\-n\.js$/) ? 3 : 0; + my ($got_exit, $exit_signal); + my $failure_lines; + my $bug_number; + my $status_lines; + +# user selected [Q]uit from ^C handler. + if ($user_exit) { + return; + } + +# Append the shell.js files to the shell_command if they're there. +# (only check for their existance if the suite or test_dir has changed +# since the last time we looked.) + if ($last_suite ne $suite || $last_test_dir ne $test_dir) { + $shell_command = $opt_arch . " "; + + $shell_command .= &xp_path($engine_command) . " -s "; + + $path = &xp_path($opt_suite_path . $suite . "/shell.js"); + if (-f $path) { + $shell_command .= $file_param . $path; + } + + $path = &xp_path($opt_suite_path . $suite . "/" . + $test_dir . "/shell.js"); + if (-f $path) { + $shell_command .= $file_param . $path; + } + + $last_suite = $suite; + $last_test_dir = $test_dir; + } + + $path = &xp_path($opt_suite_path . $test); + + print ($shell_command . $file_param . $path . "\n"); + &dd ("executing: " . $shell_command . $file_param . $path); + + open (OUTPUT, $shell_command . $file_param . $path . + $redirect_command . " |"); + @output = <OUTPUT>; + close (OUTPUT); + + @output = grep (!/js\>/, @output); + + if ($opt_exit_munge == 1) { +# signal information in the lower 8 bits, exit code above that + $got_exit = ($? >> 8); + $exit_signal = ($? & 255); + } else { +# user says not to munge the exit code + $got_exit = $?; + $exit_signal = 0; + } + + $failure_lines = ""; + $bug_number = ""; + $status_lines = ""; + + foreach $line (@output) { + +# watch for testcase to proclaim what exit code it expects to +# produce (0 by default) + if ($line =~ /expect(ed)?\s*exit\s*code\s*\:?\s*(\d+)/i) { + $expected_exit = $2; + &dd ("Test case expects exit code $expected_exit"); + } + +# watch for failures + if ($line =~ /failed!/i) { + $failure_lines .= $line; + } + +# and watch for bugnumbers +# XXX This only allows 1 bugnumber per testfile, should be +# XXX modified to allow for multiple. + if ($line =~ /bugnumber\s*\:?\s*(.*)/i) { + $1 =~ /(\n+)/; + $bug_number = $1; + } + +# and watch for status + if ($line =~ /status/i) { + $status_lines .= $line; + } + + } + + if (!@output) { + @output = ("Testcase produced no output!"); + } + + if ($got_exit != $expected_exit) { +# full testcase output dumped on mismatched exit codes, + &report_failure ($test, "Expected exit code " . + "$expected_exit, got $got_exit\n" . + "Testcase terminated with signal $exit_signal\n" . + "Complete testcase output was:\n" . + join ("\n",@output), $bug_number); + } elsif ($failure_lines) { +# only offending lines if exit codes matched + &report_failure ($test, "$status_lines\n". + "Failure messages were:\n$failure_lines", + $bug_number); + } + + &dd ("exit code $got_exit, exit signal $exit_signal."); + + $tests_completed++; + } +} + +sub write_results { + my ($list_name, $neglist_name); + my $completion_date = localtime; + my $failure_pct = int(($failures_reported / $tests_completed) * 10000) / + 100; + &dd ("Writing output to $opt_output_file."); + + if ($#opt_test_list_files == -1) { + $list_name = "All tests"; + } elsif ($#opt_test_list_files < 10) { + $list_name = join (", ", @opt_test_list_files); + } else { + $list_name = "($#opt_test_list_files test files specified)"; + } + + if ($#opt_neg_list_files == -1) { + $neglist_name = "(none)"; + } elsif ($#opt_test_list_files < 10) { + $neglist_name = join (", ", @opt_neg_list_files); + } else { + $neglist_name = "($#opt_neg_list_files skip files specified)"; + } + + open (OUTPUT, "> $opt_output_file") || + die ("Could not create output file $opt_output_file"); + + print OUTPUT + ("<html><head>\n" . + "<title>Test results, $opt_engine_type</title>\n" . + "</head>\n" . + "<body bgcolor='white'>\n" . + "<a name='tippy_top'></a>\n" . + "<h2>Test results, $opt_engine_type</h2><br>\n" . + "<p class='results_summary'>\n" . + "Test List: $list_name<br>\n" . + "Skip List: $neglist_name<br>\n" . + ($#test_list + 1) . " test(s) selected, $tests_completed test(s) " . + "completed, $failures_reported failures reported " . + "($failure_pct% failed)<br>\n" . + "Engine command line: $engine_command<br>\n" . + "OS type: $os_type<br>\n"); + + if ($opt_engine_type =~ /^rhino/) { + open (JAVAOUTPUT, $opt_java_path . "java -fullversion " . + $redirect_command . " |"); + print OUTPUT <JAVAOUTPUT>; + print OUTPUT "<BR>"; + close (JAVAOUTPUT); + } + + print OUTPUT + ("Testcase execution time: $exec_time_string.<br>\n" . + "Tests completed on $completion_date.<br><br>\n"); + + if ($failures_reported > 0) { + print OUTPUT + ("[ <a href='#fail_detail'>Failure Details</a> | " . + "<a href='#retest_list'>Retest List</a> | " . + "<a href='menu.html'>Test Selection Page</a> ]<br>\n" . + "<hr>\n" . + "<a name='fail_detail'></a>\n" . + "<h2>Failure Details</h2><br>\n<dl>" . + $html . + "</dl>\n[ <a href='#tippy_top'>Top of Page</a> | " . + "<a href='#fail_detail'>Top of Failures</a> ]<br>\n" . + "<hr>\n<pre>\n" . + "<a name='retest_list'></a>\n" . + "<h2>Retest List</h2><br>\n" . + "# Retest List, $opt_engine_type, " . + "generated $completion_date.\n" . + "# Original test base was: $list_name.\n" . + "# $tests_completed of " . ($#test_list + 1) . + " test(s) were completed, " . + "$failures_reported failures reported.\n" . + join ("\n", @failed_tests) ); +#"</pre>\n" . +# "[ <a href='#tippy_top'>Top of Page</a> | " . +# "<a href='#retest_list'>Top of Retest List</a> ]<br>\n"); + } else { + print OUTPUT + ("<h1>Whoop-de-doo, nothing failed!</h1>\n"); + } + +#print OUTPUT "</body>"; + +close (OUTPUT); + +&status ("Wrote results to '$opt_output_file'."); + +if ($opt_console_failures) { + &status ("$failures_reported test(s) failed"); +} + +} + +sub parse_args { + my ($option, $value, $lastopt); + + &dd ("checking command line options."); + + Getopt::Mixed::init ($options); + $Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER; + + while (($option, $value) = nextOption()) { + + if ($option eq "a") { + &dd ("opt: running with architecture $value."); + $value =~ s/^ //; + $opt_arch = "arch -$value"; + + } elsif ($option eq "b") { + &dd ("opt: setting bugurl to '$value'."); + $opt_bug_url = $value; + + } elsif ($option eq "c") { + &dd ("opt: setting classpath to '$value'."); + $opt_classpath = $value; + + } elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) { + &dd ("opt: adding engine $value."); + push (@opt_engine_list, $value); + + } elsif ($option eq "f") { + if (!$value) { + die ("Output file cannot be null.\n"); + } + &dd ("opt: setting output file to '$value'."); + $opt_user_output_file = 1; + $opt_output_file = $value; + + } elsif ($option eq "h") { + &usage; + + } elsif ($option eq "j") { + if (!($value =~ /[\/\\]$/)) { + $value .= "/"; + } + &dd ("opt: setting java path to '$value'."); + $opt_java_path = $value; + + } elsif ($option eq "k") { + &dd ("opt: displaying failures on console."); + $opt_console_failures=1; + + } elsif ($option eq "l" || (($option eq "") && ($lastopt eq "l"))) { + $option = "l"; + &dd ("opt: adding test list '$value'."); + push (@opt_test_list_files, $value); + + } elsif ($option eq "L" || (($option eq "") && ($lastopt eq "L"))) { + $option = "L"; + &dd ("opt: adding negative list '$value'."); + push (@opt_neg_list_files, $value); + + } elsif ($option eq "o") { + $opt_engine_params = $value; + &dd ("opt: setting engine params to '$opt_engine_params'."); + + } elsif ($option eq "p") { + $opt_suite_path = $value; + + if ($os_type eq "MAC") { + if (!($opt_suite_path =~ /\:$/)) { + $opt_suite_path .= ":"; + } + } else { + if (!($opt_suite_path =~ /[\/\\]$/)) { + $opt_suite_path .= "/"; + } + } + + &dd ("opt: setting suite path to '$opt_suite_path'."); + + } elsif ($option eq "s") { + $opt_shell_path = $value; + &dd ("opt: setting shell path to '$opt_shell_path'."); + + } elsif ($option eq "t") { + &dd ("opt: tracing output. (console failures at no extra charge.)"); + $opt_console_failures = 1; + $opt_trace = 1; + + } elsif ($option eq "u") { + &dd ("opt: setting lxr url to '$value'."); + $opt_lxr_url = $value; + + } elsif ($option eq "x") { + &dd ("opt: turning off exit munging."); + $opt_exit_munge = 0; + + } else { + &usage; + } + + $lastopt = $option; + + } + + Getopt::Mixed::cleanup(); + + if ($#opt_engine_list == -1) { + die "You must select a shell to test in.\n"; + } + +} + +# +# print the arguments that this script expects +# +sub usage { + print STDERR + ("\nusage: $0 [<options>] \n" . + "(-a|--arch) <arch> run with a specific architecture on mac\n" . + "(-b|--bugurl) Bugzilla URL.\n" . + " (default is $opt_bug_url)\n" . + "(-c|--classpath) Classpath (Rhino only.)\n" . + "(-e|--engine) <type> ... Specify the type of engine(s) to test.\n" . + " <type> is one or more of\n" . + " (squirrelfish|smopt|smdebug|lcopt|lcdebug|xpcshell|" . + "rhino|rhinoi|rhinoms|rhinomsi|rhino9|rhinoms9).\n" . + "(-f|--file) <file> Redirect output to file named <file>.\n" . + " (default is " . + "results-<engine-type>-<date-stamp>.html)\n" . + "(-h|--help) Print this message.\n" . + "(-j|--javapath) Location of java executable.\n" . + "(-k|--confail) Log failures to console (also.)\n" . + "(-l|--list) <file> ... List of tests to execute.\n" . + "(-L|--neglist) <file> ... List of tests to skip.\n" . + "(-o|--opt) <options> Options to pass to the JavaScript engine.\n" . + " (Make sure to quote them!)\n" . + "(-p|--testpath) <path> Root of the test suite. (default is ./)\n" . + "(-s|--shellpath) <path> Location of JavaScript shell.\n" . + "(-t|--trace) Trace script execution.\n" . + "(-u|--lxrurl) <url> Complete URL to tests subdirectory on lxr.\n" . + " (default is $opt_lxr_url)\n" . + "(-x|--noexitmunge) Don't do exit code munging (try this if it\n" . + " seems like your exit codes are turning up\n" . + " as exit signals.)\n"); + exit (1); + +} + +# +# get the shell command used to start the (either) engine +# +sub get_engine_command { + + my $retval; + + if ($opt_engine_type eq "rhino") { + &dd ("getting rhino engine command."); + $opt_rhino_opt = 0; + $opt_rhino_ms = 0; + $retval = &get_rhino_engine_command; + } elsif ($opt_engine_type eq "rhinoi") { + &dd ("getting rhinoi engine command."); + $opt_rhino_opt = -1; + $opt_rhino_ms = 0; + $retval = &get_rhino_engine_command; + } elsif ($opt_engine_type eq "rhino9") { + &dd ("getting rhino engine command."); + $opt_rhino_opt = 9; + $opt_rhino_ms = 0; + $retval = &get_rhino_engine_command; + } elsif ($opt_engine_type eq "rhinoms") { + &dd ("getting rhinoms engine command."); + $opt_rhino_opt = 0; + $opt_rhino_ms = 1; + $retval = &get_rhino_engine_command; + } elsif ($opt_engine_type eq "rhinomsi") { + &dd ("getting rhinomsi engine command."); + $opt_rhino_opt = -1; + $opt_rhino_ms = 1; + $retval = &get_rhino_engine_command; + } elsif ($opt_engine_type eq "rhinoms9") { + &dd ("getting rhinomsi engine command."); + $opt_rhino_opt = 9; + $opt_rhino_ms = 1; + $retval = &get_rhino_engine_command; + } elsif ($opt_engine_type eq "xpcshell") { + &dd ("getting xpcshell engine command."); + $retval = &get_xpc_engine_command; + } elsif ($opt_engine_type =~ /^lc(opt|debug)$/) { + &dd ("getting liveconnect engine command."); + $retval = &get_lc_engine_command; + } elsif ($opt_engine_type =~ /^sm(opt|debug)$/) { + &dd ("getting spidermonkey engine command."); + $retval = &get_sm_engine_command; + } elsif ($opt_engine_type =~ /^ep(opt|debug)$/) { + &dd ("getting epimetheus engine command."); + $retval = &get_ep_engine_command; + } elsif ($opt_engine_type eq "squirrelfish") { + &dd ("getting squirrelfish engine command."); + $retval = &get_squirrelfish_engine_command; + } else { + die ("Unknown engine type selected, '$opt_engine_type'.\n"); + } + + $retval .= " $opt_engine_params"; + + &dd ("got '$retval'"); + + return $retval; + +} + +# +# get the shell command used to run rhino +# +sub get_rhino_engine_command { + my $retval = $opt_java_path . ($opt_rhino_ms ? "jview " : "java "); + + if ($opt_shell_path) { + $opt_classpath = ($opt_classpath) ? + $opt_classpath . ":" . $opt_shell_path : + $opt_shell_path; + } + + if ($opt_classpath) { + $retval .= ($opt_rhino_ms ? "/cp:p" : "-classpath") . " $opt_classpath "; + } + + $retval .= "org.mozilla.javascript.tools.shell.Main"; + + if ($opt_rhino_opt) { + $retval .= " -opt $opt_rhino_opt"; + } + + return $retval; + +} + +# +# get the shell command used to run xpcshell +# +sub get_xpc_engine_command { + my $retval; + my $m5_home = @ENV{"MOZILLA_FIVE_HOME"} || + die ("You must set MOZILLA_FIVE_HOME to use the xpcshell" , + (!$unixish) ? "." : ", also " . + "setting LD_LIBRARY_PATH to the same directory may get rid of " . + "any 'library not found' errors.\n"); + + if (($unixish) && (!@ENV{"LD_LIBRARY_PATH"})) { + print STDERR "-#- WARNING: LD_LIBRARY_PATH is not set, xpcshell may " . + "not be able to find the required components.\n"; + } + + if (!($m5_home =~ /[\/\\]$/)) { + $m5_home .= "/"; + } + + $retval = $m5_home . "xpcshell"; + + if ($os_type eq "WIN") { + $retval .= ".exe"; + } + + $retval = &xp_path($retval); + + if (($os_type ne "MAC") && !(-x $retval)) { +# mac doesn't seem to deal with -x correctly + die ($retval . " is not a valid executable on this system.\n"); + } + + return $retval; + +} + +# +# get the shell command used to run squirrelfish +# +sub get_squirrelfish_engine_command { + my $retval; + + if ($opt_shell_path) { + # FIXME: Quoting the path this way won't work with paths with quotes in + # them. A better fix would be to use the multi-parameter version of + # open(), but that doesn't work on ActiveState Perl. + $retval = "\"" . $opt_shell_path . "\""; + } else { + die "Please specify a full path to the squirrelfish testing engine"; + } + + return $retval; +} + +# +# get the shell command used to run spidermonkey +# +sub get_sm_engine_command { + my $retval; + +# Look for Makefile.ref style make first. +# (On Windows, spidermonkey can be made by two makefiles, each putting the +# executable in a diferent directory, under a different name.) + + if ($opt_shell_path) { +# if the user provided a path to the shell, return that. + $retval = $opt_shell_path; + + } else { + + if ($os_type eq "MAC") { + $retval = $opt_suite_path . ":src:macbuild:JS"; + } else { + $retval = $opt_suite_path . "../src/"; + opendir (SRC_DIR_FILES, $retval); + my @src_dir_files = readdir(SRC_DIR_FILES); + closedir (SRC_DIR_FILES); + + my ($dir, $object_dir); + my $pattern = ($opt_engine_type eq "smdebug") ? + 'DBG.OBJ' : 'OPT.OBJ'; + +# scan for the first directory matching +# the pattern expected to hold this type (debug or opt) of engine + foreach $dir (@src_dir_files) { + if ($dir =~ $pattern) { + $object_dir = $dir; + last; + } + } + + if (!$object_dir && $os_type ne "WIN") { + die ("Could not locate an object directory in $retval " . + "matching the pattern *$pattern. Have you built the " . + "engine?\n"); + } + + if (!(-x $retval . $object_dir . "/js.exe") && ($os_type eq "WIN")) { +# On windows, you can build with js.mak as well as Makefile.ref +# (Can you say WTF boys and girls? I knew you could.) +# So, if the exe the would have been built by Makefile.ref isn't +# here, check for the js.mak version before dying. + if ($opt_shell_path) { + $retval = $opt_shell_path; + if (!($retval =~ /[\/\\]$/)) { + $retval .= "/"; + } + } else { + if ($opt_engine_type eq "smopt") { + $retval = "../src/Release/"; + } else { + $retval = "../src/Debug/"; + } + } + + $retval .= "jsshell.exe"; + + } else { + $retval .= $object_dir . "/js"; + if ($os_type eq "WIN") { + $retval .= ".exe"; + } + } + } # mac/ not mac + + $retval = &xp_path($retval); + + } # (user provided a path) + + + if (($os_type ne "MAC") && !(-x $retval)) { +# mac doesn't seem to deal with -x correctly + die ($retval . " is not a valid executable on this system.\n"); + } + + return $retval; + +} + +# +# get the shell command used to run epimetheus +# +sub get_ep_engine_command { + my $retval; + + if ($opt_shell_path) { +# if the user provided a path to the shell, return that - + $retval = $opt_shell_path; + + } else { + my $dir; + my $os; + my $debug; + my $opt; + my $exe; + + $dir = $opt_suite_path . "../../js2/src/"; + + if ($os_type eq "MAC") { +# +# On the Mac, the debug and opt builds lie in the same directory - +# + $os = "macbuild:"; + $debug = ""; + $opt = ""; + $exe = "JS2"; + } elsif ($os_type eq "WIN") { + $os = "winbuild/Epimetheus/"; + $debug = "Debug/"; + $opt = "Release/"; + $exe = "Epimetheus.exe"; + } else { + $os = ""; + $debug = ""; + $opt = ""; # <<<----- XXX THIS IS NOT RIGHT! CHANGE IT! + $exe = "epimetheus"; + } + + + if ($opt_engine_type eq "epdebug") { + $retval = $dir . $os . $debug . $exe; + } else { + $retval = $dir . $os . $opt . $exe; + } + + $retval = &xp_path($retval); + + }# (user provided a path) + + + if (($os_type ne "MAC") && !(-x $retval)) { +# mac doesn't seem to deal with -x correctly + die ($retval . " is not a valid executable on this system.\n"); + } + + return $retval; +} + +# +# get the shell command used to run the liveconnect shell +# +sub get_lc_engine_command { + my $retval; + + if ($opt_shell_path) { + $retval = $opt_shell_path; + } else { + if ($os_type eq "MAC") { + die "Don't know how to run the lc shell on the mac yet.\n"; + } else { + $retval = $opt_suite_path . "../src/liveconnect/"; + opendir (SRC_DIR_FILES, $retval); + my @src_dir_files = readdir(SRC_DIR_FILES); + closedir (SRC_DIR_FILES); + + my ($dir, $object_dir); + my $pattern = ($opt_engine_type eq "lcdebug") ? + 'DBG.OBJ' : 'OPT.OBJ'; + + foreach $dir (@src_dir_files) { + if ($dir =~ $pattern) { + $object_dir = $dir; + last; + } + } + + if (!$object_dir) { + die ("Could not locate an object directory in $retval " . + "matching the pattern *$pattern. Have you built the " . + "engine?\n"); + } + + $retval .= $object_dir . "/"; + + if ($os_type eq "WIN") { + $retval .= "lcshell.exe"; + } else { + $retval .= "lcshell"; + } + } # mac/ not mac + + $retval = &xp_path($retval); + + } # (user provided a path) + + + if (($os_type ne "MAC") && !(-x $retval)) { +# mac doesn't seem to deal with -x correctly + die ("$retval is not a valid executable on this system.\n"); + } + + return $retval; + +} + +sub get_os_type { + + if ("\n" eq "\015") { + return "MAC"; + } + + my $uname = `uname -a`; + + if ($uname =~ /WIN/) { + $uname = "WIN"; + } else { + chop $uname; + } + + &dd ("get_os_type returning '$uname'."); + return $uname; + +} + +sub get_test_list { + my @test_list; + my @neg_list; + + if ($#opt_test_list_files > -1) { + my $list_file; + + &dd ("getting test list from user specified source."); + + foreach $list_file (@opt_test_list_files) { + push (@test_list, &expand_user_test_list($list_file)); + } + } else { + &dd ("no list file, groveling in '$opt_suite_path'."); + + @test_list = &get_default_test_list($opt_suite_path); + } + + if ($#opt_neg_list_files > -1) { + my $list_file; + my $orig_size = $#test_list + 1; + my $actually_skipped; + + &dd ("getting negative list from user specified source."); + + foreach $list_file (@opt_neg_list_files) { + push (@neg_list, &expand_user_test_list($list_file)); + } + + @test_list = &subtract_arrays (\@test_list, \@neg_list); + + $actually_skipped = $orig_size - ($#test_list + 1); + + &dd ($actually_skipped . " of " . $orig_size . + " tests will be skipped."); + &dd ((($#neg_list + 1) - $actually_skipped) . " skip tests were " . + "not actually part of the test list."); + + + } + + return @test_list; + +} + +# +# reads $list_file, storing non-comment lines into an array. +# lines in the form suite_dir/[*] or suite_dir/test_dir/[*] are expanded +# to include all test files under the specified directory +# +sub expand_user_test_list { + my ($list_file) = @_; + my @retval = (); + +# +# Trim off the leading path separator that begins relative paths on the Mac. +# Each path will get concatenated with $opt_suite_path, which ends in one. +# +# Also note: +# +# We will call expand_test_list_entry(), which does pattern-matching on $list_file. +# This will make the pattern-matching the same as it would be on Linux/Windows - +# + if ($os_type eq "MAC") { + $list_file =~ s/^$path_sep//; + } + + if ($list_file =~ /\.js$/ || -d $opt_suite_path . $list_file) { + + push (@retval, &expand_test_list_entry($list_file)); + + } else { + + open (TESTLIST, $list_file) || + die("Error opening test list file '$list_file': $!\n"); + + while (<TESTLIST>) { + s/\r*\n*$//; + if (!(/\s*\#/)) { +# It's not a comment, so process it + push (@retval, &expand_test_list_entry($_)); + } + } + + close (TESTLIST); + + } + + return @retval; + +} + + +# +# Currently expect all paths to be RELATIVE to the top-level tests directory. +# One day, this should be improved to allow absolute paths as well - +# +sub expand_test_list_entry { + my ($entry) = @_; + my @retval; + + if ($entry =~ /\.js$/) { +# it's a regular entry, add it to the list + if (-f $opt_suite_path . $entry) { + push (@retval, $entry); + } else { + status ("testcase '$entry' not found."); + } + } elsif ($entry =~ /(.*$path_sep[^\*][^$path_sep]*)$path_sep?\*?$/) { +# Entry is in the form suite_dir/test_dir[/*] +# so iterate all tests under it + my $suite_and_test_dir = $1; + my @test_files = &get_js_files ($opt_suite_path . + $suite_and_test_dir); + my $i; + + foreach $i (0 .. $#test_files) { + $test_files[$i] = $suite_and_test_dir . $path_sep . + $test_files[$i]; + } + + splice (@retval, $#retval + 1, 0, @test_files); + + } elsif ($entry =~ /([^\*][^$path_sep]*)$path_sep?\*?$/) { +# Entry is in the form suite_dir[/*] +# so iterate all test dirs and tests under it + my $suite = $1; + my @test_dirs = &get_subdirs ($opt_suite_path . $suite); + my $test_dir; + + foreach $test_dir (@test_dirs) { + my @test_files = &get_js_files ($opt_suite_path . $suite . + $path_sep . $test_dir); + my $i; + + foreach $i (0 .. $#test_files) { + $test_files[$i] = $suite . $path_sep . $test_dir . $path_sep . + $test_files[$i]; + } + + splice (@retval, $#retval + 1, 0, @test_files); + } + + } else { + die ("Dont know what to do with list entry '$entry'.\n"); + } + + return @retval; + +} + +# +# Grovels through $suite_path, searching for *all* test files. Used when the +# user doesn't supply a test list. +# +sub get_default_test_list { + my ($suite_path) = @_; + my @suite_list = &get_subdirs($suite_path); + my $suite; + my @retval; + + foreach $suite (@suite_list) { + my @test_dir_list = get_subdirs ($suite_path . $suite); + my $test_dir; + + foreach $test_dir (@test_dir_list) { + my @test_list = get_js_files ($suite_path . $suite . $path_sep . + $test_dir); + my $test; + + foreach $test (@test_list) { + $retval[$#retval + 1] = $suite . $path_sep . $test_dir . + $path_sep . $test; + } + } + } + + return @retval; + +} + +# +# generate an output file name based on the date +# +sub get_tempfile_name { + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = + &get_padded_time (localtime); + my $rv; + + if ($os_type ne "MAC") { + $rv = "results-" . $year . "-" . $mon . "-" . $mday . "-" . $hour . + $min . $sec . "-" . $opt_engine_type; + } else { + $rv = "res-" . $year . $mon . $mday . $hour . $min . $sec . "-" . + $opt_engine_type + } + + return $rv . ".html"; +} + +sub get_padded_time { + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @_; + + $mon++; + $mon = &zero_pad($mon); + $year += 1900; + $mday= &zero_pad($mday); + $sec = &zero_pad($sec); + $min = &zero_pad($min); + $hour = &zero_pad($hour); + + return ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); + +} + +sub zero_pad { + my ($string) = @_; + + $string = ($string < 10) ? "0" . $string : $string; + return $string; +} + +sub subtract_arrays { + my ($whole_ref, $part_ref) = @_; + my @whole = @$whole_ref; + my @part = @$part_ref; + my $line; + + foreach $line (@part) { + @whole = grep (!/$line/, @whole); + } + + return @whole; + +} + +# +# Convert unix path to mac style. +# +sub unix_to_mac { + my ($path) = @_; + my @path_elements = split ("/", $path); + my $rv = ""; + my $i; + + foreach $i (0 .. $#path_elements) { + if ($path_elements[$i] eq ".") { + if (!($rv =~ /\:$/)) { + $rv .= ":"; + } + } elsif ($path_elements[$i] eq "..") { + if (!($rv =~ /\:$/)) { + $rv .= "::"; + } else { + $rv .= ":"; + } + } elsif ($path_elements[$i] ne "") { + $rv .= $path_elements[$i] . ":"; + } + + } + + $rv =~ s/\:$//; + + return $rv; +} + +# +# Convert unix path to win style. +# +sub unix_to_win { + my ($path) = @_; + + if ($path_sep ne $win_sep) { + $path =~ s/$path_sep/$win_sep/g; + } + + return $path; +} + +# +# Windows shells require "/" or "\" as path separator. +# Find out the one used in the current Windows shell. +# +sub get_win_sep { + my $path = $ENV{"PATH"} || $ENV{"Path"} || $ENV{"path"}; + $path =~ /\\|\//; + return $&; +} + +# +# Convert unix path to correct style based on platform. +# +sub xp_path { + my ($path) = @_; + + if ($os_type eq "MAC") { + return &unix_to_mac($path); + } elsif($os_type eq "WIN") { + return &unix_to_win($path); + } else { + return $path; + } +} + +sub numericcmp($$) +{ + my ($aa, $bb) = @_; + + my @a = split /(\d+)/, $aa; + my @b = split /(\d+)/, $bb; + + while (@a && @b) { + my $a = shift @a; + my $b = shift @b; + return $a <=> $b if $a =~ /^\d/ && $b =~ /^\d/ && $a != $b; + return $a cmp $b if $a ne $b; + } + + return @a <=> @b; +} + +# +# given a directory, return an array of all subdirectories +# +sub get_subdirs { + my ($dir) = @_; + my @subdirs; + + if ($os_type ne "MAC") { + if (!($dir =~ /\/$/)) { + $dir = $dir . "/"; + } + } else { + if (!($dir =~ /\:$/)) { + $dir = $dir . ":"; + } + } + opendir (DIR, $dir) || die ("couldn't open directory $dir: $!"); + my @testdir_contents = sort numericcmp readdir(DIR); + closedir(DIR); + + foreach (@testdir_contents) { + if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) { + @subdirs[$#subdirs + 1] = $_; + } + } + + return @subdirs; +} + +# +# given a directory, return an array of all the js files that are in it. +# +sub get_js_files { + my ($test_subdir) = @_; + my (@js_file_array, @subdir_files); + + opendir (TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " . + "$test_subdir: $!"); + @subdir_files = sort numericcmp readdir(TEST_SUBDIR); + closedir( TEST_SUBDIR ); + + foreach (@subdir_files) { + if ($_ =~ /\.js$/) { + $js_file_array[$#js_file_array+1] = $_; + } + } + + return @js_file_array; +} + +sub report_failure { + my ($test, $message, $bug_number) = @_; + my $bug_line = ""; + + $failures_reported++; + + $message =~ s/\n+/\n/g; + $test =~ s/\:/\//g; + + if ($opt_console_failures) { + if($bug_number) { + print STDERR ("*-* Testcase $test failed:\nBug Number $bug_number". + "\n$message\n"); + } else { + print STDERR ("*-* Testcase $test failed:\n$message\n"); + } + } + + $message =~ s/\n/<br>\n/g; + $html .= "<a name='failure$failures_reported'></a>"; + + if ($bug_number) { + $bug_line = "<a href='$opt_bug_url$bug_number' target='other_window'>". + "Bug Number $bug_number</a>"; + } + + if ($opt_lxr_url) { + $test =~ /\/?([^\/]+\/[^\/]+\/[^\/]+)$/; + $test = $1; + $html .= "<dd><b>". + "Testcase <a target='other_window' href='$opt_lxr_url$test'>$1</a> " . + "failed</b> $bug_line<br>\n"; + } else { + $html .= "<dd><b>". + "Testcase $test failed</b> $bug_line<br>\n"; + } + + $html .= " [ "; + if ($failures_reported > 1) { + $html .= "<a href='#failure" . ($failures_reported - 1) . "'>" . + "Previous Failure</a> | "; + } + + $html .= "<a href='#failure" . ($failures_reported + 1) . "'>" . + "Next Failure</a> | " . + "<a href='#tippy_top'>Top of Page</a> ]<br>\n" . + "<tt>$message</tt><br>\n"; + + @failed_tests[$#failed_tests + 1] = $test; + +} + +sub dd { + + if ($opt_trace) { + print ("-*- ", @_ , "\n"); + } + +} + +sub status { + + print ("-#- ", @_ , "\n"); + +} + +sub int_handler { + my $resp; + + do { + print ("\n*** User Break: Just [Q]uit, Quit and [R]eport, [C]ontinue ?"); + $resp = <STDIN>; + } until ($resp =~ /[QqRrCc]/); + + if ($resp =~ /[Qq]/) { + print ("User Exit. No results were generated.\n"); + exit 1; + } elsif ($resp =~ /[Rr]/) { + $user_exit = 1; + } + +} diff --git a/Source/JavaScriptCore/tests/mozilla/menufoot.html b/Source/JavaScriptCore/tests/mozilla/menufoot.html new file mode 100644 index 0000000..da7902e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/menufoot.html @@ -0,0 +1,8 @@ + + </form> + + <hr> + <address><a href="mailto:rginda@netscape.com"></a></address> +<!-- Created: Fri Oct 29 21:32:20 PDT 1999 --> + </body> +</html> diff --git a/Source/JavaScriptCore/tests/mozilla/menuhead.html b/Source/JavaScriptCore/tests/mozilla/menuhead.html new file mode 100644 index 0000000..827dc43 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/menuhead.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Core JavaScript Tests</title> + + <script language="JavaScript"> + function selectAll (suite, testDir) + { + if (typeof suite == "undefined") + for (var suite in suites) + setAllDirs (suite, true); + else if (typeof testDir == "undefined") + setAllDirs (suite, true); + else + setAllTests (suite, testDir, true); + updateTotals(); + } + + function selectNone (suite, testDir) + { + + if (typeof suite == "undefined") + for (var suite in suites) + setAllDirs (suite, false); + else if (typeof testDir == "undefined") + setAllDirs (suite, false); + else + setAllTests (suite, testDir, false); + updateTotals(); + } + + function setAllDirs (suite, value) + { + var dir; + for (dir in suites[suite].testDirs) + setAllTests (suite, dir, value); + + } + + function setAllTests (suite, testDir, value) + { + var test, radioName; + + for (test in suites[suite].testDirs[testDir].tests) + { + radioName = suites[suite].testDirs[testDir].tests[test]; + document.forms["testCases"].elements[radioName].checked = value; + } + + } + + function createList () + { + var suite, testDir, test, radioName; + var elements = document.forms["testCases"].elements; + + var win = window.open ("about:blank", "other_window"); + win.document.open(); + win.document.write ("<pre>\n"); + + win.document.write ("# Created " + new Date() + "\n"); + + for (suite in suites) + win.document.write ("# " + suite + ": " + + elements["SUMMARY_" + suite].value + "\n"); + win.document.write ("# TOTAL: " + elements["TOTAL"].value + "\n"); + + for (suite in suites) + for (testDir in suites[suite].testDirs) + for (test in suites[suite].testDirs[testDir].tests) + { + radioName = suites[suite].testDirs[testDir].tests[test]; + if (elements[radioName].checked) + win.document.write (suite + "/" + testDir + "/" + + elements[radioName].value + "\n"); + } + + win.document.close(); + + } + + function onRadioClick (name) + { + var radio = document.forms["testCases"].elements[name]; + radio.checked = !radio.checked; + setTimeout ("updateTotals();", 100); + return false; + } + + function updateTotals() + { + var suite, testDir, test, radioName, selected, available, pct; + var totalAvailable = 0, totalSelected = 0; + + var elements = document.forms["testCases"].elements; + + for (suite in suites) + { + selected = available = 0; + for (testDir in suites[suite].testDirs) + for (test in suites[suite].testDirs[testDir].tests) + { + available++ + radioName = suites[suite].testDirs[testDir].tests[test]; + if (elements[radioName].checked) + selected++; + } + totalSelected += selected; + totalAvailable += available; + pct = parseInt((selected / available) * 100); + if (isNaN(pct)) + pct = 0; + + elements["SUMMARY_" + suite].value = selected + "/" + available + + " (" + pct + "%) selected"; + } + + pct = parseInt((totalSelected / totalAvailable) * 100); + if (isNaN(pct)) + pct = 0; + + elements["TOTAL"].value = totalSelected + "/" + totalAvailable + " (" + + pct + "%) selected"; + + } + + </script> + + </head> + + <body bgcolor="white" onLoad="updateTotals()"> + <a name='top_of_page'></a> + <h1>Core JavaScript Tests</h1> + + <form name="testCases"> + <input type='button' value='Export Test List' onClick='createList();'> + <input type='button' value='Import Test List' + onClick='window.open("importList.html", "other_window");'> diff --git a/Source/JavaScriptCore/tests/mozilla/mkhtml.pl b/Source/JavaScriptCore/tests/mozilla/mkhtml.pl new file mode 100644 index 0000000..99cb2c5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/mkhtml.pl @@ -0,0 +1,84 @@ +#!/ns/tools/bin/perl5 + +# mkhtml.pl cruises through your $MOZ_SRC/mozilla/js/tests/ subdirectories, +# and for any .js file it finds, creates an HTML file that includes: +# $MOZ_SRC/mozilla/js/tests/$suite/shell.js, $ +# MOZ_SRC/mozilla/js/tests/$suite/browser.js, +# and the test.js file. +# +# + +$moz_src = $ENV{"MOZ_SRC"} || + die ("You need to set your MOZ_SRC environment variable.\n"); + +$test_home = $moz_src ."/js/tests/"; + +opendir (TEST_HOME, $test_home); +@__suites = readdir (TEST_HOME); +closedir TEST_HOME; + +foreach (@__suites ) { + if ( -d $_ && $_ !~ /\./ && $_ !~ 'CVS' ) { + $suites[$#suites+1] = $_; + } +} +if ( ! $ARGV[0] ) { + die ( "Specify a directory: ". join(" ", @suites) ."\n" ); +} + +$js_test_dir = $moz_src . "/js/tests/" . $ARGV[0] ."/"; + +print "Generating html files for the tests in $js_test_dir\n"; + +$shell_js = $js_test_dir . "shell.js"; +$browser_js = $js_test_dir . "browser.js"; + +# cd to the test directory +chdir $js_test_dir || + die "Couldn't chdir to js_test_dir, which is $js_test_dir\n"; + +print ( "js_test_dir is $js_test_dir\n" ); + +# read the test directory +opendir ( JS_TEST_DIR, $js_test_dir ); +# || die "Couldn't open js_test_dir, which is $js_test_dir\n"; +@js_test_dir_items = readdir( JS_TEST_DIR ); +# || die "Couldn't read js_test_dir, which is $js_test_dir\n"; +closedir( JS_TEST_DIR ); + +print ("The js_test_dir_items are: " . join( ",", @js_test_dir_items ) . "\n"); + +# figure out which of the items are directories +foreach $js_test_subdir ( @js_test_dir_items ) { + if ( -d $js_test_subdir ) { + + $js_test_subdir = $js_test_dir ."/" . $js_test_subdir; + chdir $js_test_subdir + || die "Couldn't chdir to js_test_subdir $js_test_subdir\n"; + print "Just chdir'd to $js_test_subdir \n"; + + opendir( JS_TEST_SUBDIR, $js_test_subdir ); + @subdir_tests = readdir( JS_TEST_SUBDIR ); + closedir( JS_TEST_SUBDIR ); + + foreach ( @subdir_tests ) { + $js_test = $_; + + if ( $_ =~ /\.js$/ ) { + s/\.js$/\.html/; + print $_ ."\n"; + open( HTML_TEST, "> $_") + || die "Can't open html file $test_html\n"; + print HTML_TEST + '<script src=./../shell.js></script>'; + print HTML_TEST + '<script src=./../browser.js></script>'; + print HTML_TEST + '<script src=./' . $js_test. '></script>'; + close HTML_TEST; + } + } + } + chdir $js_test_dir; +} + diff --git a/Source/JavaScriptCore/tests/mozilla/mklistpage.pl b/Source/JavaScriptCore/tests/mozilla/mklistpage.pl new file mode 100644 index 0000000..9479abf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/mklistpage.pl @@ -0,0 +1,261 @@ +#!/usr/bin/perl +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is JavaScript Core Tests. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1997-1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Alternatively, the contents of this file may be used under the +# terms of the GNU Public License (the "GPL"), in which case the +# provisions of the GPL are applicable instead of those above. +# If you wish to allow use of your version of this file only +# under the terms of the GPL and not to allow others to use your +# version of this file under the NPL, indicate your decision by +# deleting the provisions above and replace them with the notice +# and other provisions required by the GPL. If you do not delete +# the provisions above, a recipient may use your version of this +# file under either the NPL or the GPL. +# +# Contributers: +# Robert Ginda +# +# Creates the meat of a test suite manager page, requites menuhead.html and menufoot.html +# to create the complete page. The test suite manager lets you choose a subset of tests +# to run under the runtests2.pl script. +# + +local $lxr_url = "http://lxr.mozilla.org/mozilla/source/js/tests/"; +local $suite_path = $ARGV[0] || "./"; +local $uid = 0; # radio button unique ID +local $html = ""; # html output +local $javascript = ""; # script output + +&main; + +print (&scriptTag($javascript) . "\n"); +print ($html); + +sub main { + local $i, @suite_list; + + if (!($suite_path =~ /\/$/)) { + $suite_path = $suite_path . "/"; + } + + @suite_list = sort(&get_subdirs ($suite_path)); + + $javascript .= "suites = new Object();\n"; + + $html .= "<h3>Test Suites:</h3>\n"; + $html .= "<center>\n"; + $html .= " <input type='button' value='Select All' " . + "onclick='selectAll();'> "; + $html .= " <input type='button' value='Select None' " . + "onclick='selectNone();'> "; + + # suite menu + $html .= "<table border='1'>\n"; + foreach $suite (@suite_list) { + local @readme_text = ("No description available."); + if (open (README, $suite_path . $suite . "/README")) { + @readme_text = <README>; + close (README); + } + $html .= "<tr><td><a href='\#SUITE_$suite'>$suite</a></td>" . + "<td>@readme_text</td>"; + $html .= "<td><input type='button' value='Select All' " . + "onclick='selectAll(\"$suite\");'> "; + $html .= "<input type='button' value='Select None' " . + "onclick='selectNone(\"$suite\");'></td>"; + $html .= "<td><input readonly name='SUMMARY_$suite'></td>"; + $html .= "</tr>"; + } + $html .= "</table>\n"; + $html .= "<td><input readonly name='TOTAL'></td>"; + $html .= "</center>"; + $html .= "<dl>\n"; + + foreach $i (0 .. $#suite_list) { + local $prev_href = ($i > 0) ? "\#SUITE_" . $suite_list[$i - 1] : ""; + local $next_href = ($i < $#suite_list) ? "\#SUITE_" . $suite_list[$i + 1] : ""; + &process_suite ($suite_path, $suite_list[$i], $prev_href, $next_href); + } + + $html .= "</dl>\n"; + +} + +# +# Append detail from a 'suite' directory (eg: ecma, ecma_2, js1_1, etc.), calling +# process_test_dir for subordinate categories. +# +sub process_suite { + local ($suite_path, $suite, $prev_href, $next_href) = @_; + local $i, @test_dir_list; + + # suite js object + $javascript .= "suites[\"$suite\"] = {testDirs: {}};\n"; + + @test_dir_list = sort(&get_subdirs ($test_home . $suite)); + + # suite header + $html .= " <a name='SUITE_$suite'></a><hr><dt><big><big><b>$suite " . + "(" . ($#test_dir_list + 1) . " Sub-Categories)</b></big></big><br>\n"; + $html .= " <input type='button' value='Select All' " . + "onclick='selectAll(\"$suite\");'>\n"; + $html .= " <input type='button' value='Select None' " . + "onclick='selectNone(\"$suite\");'> " . + "[ <a href='\#top_of_page'>Top of page</a> "; + if ($prev_href) { + $html .= " | <a href='$prev_href'>Previous Suite</a> "; + } + if ($next_href) { + $html .= " | <a href='$next_href'>Next Suite</a> "; + } + $html .= "]\n"; + + $html .= " <dd>\n <dl>\n"; + + foreach $i (0 .. $#test_dir_list) { + local $prev_href = ($i > 0) ? "\#TESTDIR_" . $suite . $test_dir_list[$i - 1] : + ""; + local $next_href = ($i < $#test_dir_list) ? + "\#TESTDIR_" . $suite . $test_dir_list[$i + 1] : ""; + &process_test_dir ($suite_path . $suite . "/", $test_dir_list[$i], $suite, + $prev_href, $next_href); + } + + $html .= " </dl>\n"; + +} + +# +# Append detail from a test directory, calling process_test for subordinate js files +# +sub process_test_dir { + local ($test_dir_path, $test_dir, $suite, $prev_href, $next_href) = @_; + + @test_list = sort(&get_js_files ($test_dir_path . $test_dir)); + + $javascript .= "suites[\"$suite\"].testDirs[\"$test_dir\"] = {tests: {}};\n"; + + $html .= " <a name='TESTDIR_$suite$test_dir'></a>\n"; + $html .= " <dt><big><b>$test_dir (" . ($#test_list + 1) . + " tests)</b></big><br>\n"; + $html .= " <input type='button' value='Select All' " . + "onclick='selectAll(\"$suite\", \"$test_dir\");'>\n"; + $html .= " <input type='button' value='Select None' " . + "onclick='selectNone(\"$suite\", \"$test_dir\");'> "; + $html .= "[ <a href='\#SUITE_$suite'>Top of $suite Suite</a> "; + if ($prev_href) { + $html .= "| <a href='$prev_href'>Previous Category</a> "; + } + if ($next_href) { + $html .= " | <a href='$next_href'>Next Category</a> "; + } + $html .= "]<br>\n"; + $html .= " </dt>\n"; + + $html .= " <dl>\n"; + + foreach $test (@test_list) { + &process_test ($test_dir_path . $test_dir, $test); + } + + $html .= " </dl>\n"; +} + + +# +# Append detail from a single JavaScript file. +# +sub process_test { + local ($test_dir_path, $test) = @_; + local $title = ""; + + $uid++; + + open (TESTCASE, $test_dir_path . "/" . $test) || + die ("Error opening " . $test_dir_path . "/" . $test); + + while (<TESTCASE>) { + if (/.*TITLE\s+\=\s+\"(.*)\"/) { + $title = $1; + break; + } + } + close (TESTCASE); + + $javascript .= "suites[\"$suite\"].testDirs[\"$test_dir\"].tests" . + "[\"$test\"] = \"radio$uid\"\n"; + $html .= " <input type='radio' value='$test' name='radio$uid' ". + "onclick='return onRadioClick(\"radio$uid\");'>" . + "<a href='$lxr_url$suite/$test_dir/$test' target='other_window'>" . + "$test</a> $title<br>\n"; + +} + +sub scriptTag { + + return ("<script langugage='JavaScript'>@_</script>"); + +} + +# +# given a directory, return an array of all subdirectories +# +sub get_subdirs { + local ($dir) = @_; + local @subdirs; + + if (!($dir =~ /\/$/)) { + $dir = $dir . "/"; + } + + opendir (DIR, $dir) || die ("couldn't open directory $dir: $!"); + local @testdir_contents = readdir(DIR); + closedir(DIR); + + foreach (@testdir_contents) { + if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) { + @subdirs[$#subdirs + 1] = $_; + } + } + + return @subdirs; +} + +# +# given a directory, return an array of all the js files that are in it. +# +sub get_js_files { + local ($test_subdir) = @_; + local @js_file_array; + + opendir ( TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " . + "$test_subdir: $!"); + @subdir_files = readdir( TEST_SUBDIR ); + closedir( TEST_SUBDIR ); + + foreach ( @subdir_files ) { + if ( $_ =~ /\.js$/ ) { + $js_file_array[$#js_file_array+1] = $_; + } + } + + return @js_file_array; +} + + diff --git a/Source/JavaScriptCore/tests/mozilla/runtests.pl b/Source/JavaScriptCore/tests/mozilla/runtests.pl new file mode 100644 index 0000000..f6f05fb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/runtests.pl @@ -0,0 +1,495 @@ +#!/tools/ns/bin/perl5 +# +# simple script that executes JavaScript tests. you have to build the +# stand-alone, js shell executable (which is not the same as the dll that gets +# built for mozilla). see the readme at +# http://lxr.mozilla.org/mozilla/source/js/src/README.html for instructions on +# how to build the jsshell. +# +# this is just a quick-n-dirty script. for full reporting, you need to run +# the test driver, which requires java and is currently not available on +# mozilla.org. +# +# this test looks for an executable JavaScript shell in +# %MOZ_SRC/mozilla/js/src/[platform]-[platform-version]-OPT.OBJ/js, +# which is the default build location when you build using the instructions +# at http://lxr.mozilla.org/mozilla/source/js/src/README.html +# +# +# christine@netscape.com +# + +&parse_args; +&setup_env; +&main_test_loop; +&cleanup_env; + +# +# given a main directory, assume that there is a file called 'shell.js' +# in it. then, open all the subdirectories, and look for js files. +# for each test.js that is found, execute the shell, and pass shell.js +# and the test.js as file arguments. redirect all process output to a +# file. +# +sub main_test_loop { + foreach $suite ( &get_subdirs( $test_dir )) { + foreach $subdir (&get_subdirs( $suite, $test_dir )) { + @jsfiles = &get_js_files($subdir); + execute_js_tests(@jsfiles); + } + } +} + +# +# given a directory, return an array of all subdirectories +# +sub get_subdirs{ + local ($dir, $path) = @_; + local @subdirs; + + local $dir_path = $path . $dir; + chdir $dir_path; + + opendir ( DIR, ${dir_path} ); + local @testdir_contents = readdir( DIR ); + closedir( DIR ); + + foreach (@testdir_contents) { + if ( (-d $_) && ($_ !~ 'CVS') && ( $_ ne '.') && ($_ ne '..')) { + @subdirs[$#subdirs+1] = $_; + } + } + chdir $path; + return @subdirs; +} + +# +# given a directory, return an array of all the js files that are in it. +# +sub get_js_files { + ( $test_subdir ) = @_; + local @js_file_array; + + $current_test_dir = $test_dir ."/". $suite . "/" .$test_subdir; + chdir $current_test_dir; + + opendir ( TEST_SUBDIR, ${current_test_dir} ); + @subdir_files = readdir( TEST_SUBDIR ); + closedir( TOP_LEVEL_BUILD_DIR ); + + foreach ( @subdir_files ) { + if ( $_ =~ /\.js$/ ) { + $js_file_array[$#js_file_array+1] = $_; + } + } + + return @js_file_array; +} + +# +# given an array of test.js files, execute the shell command and pass +# the shell.js and test.js files as file arguments. redirect process +# output to a file. if $js_verbose is set (not recommended), write all +# testcase output to the output file. if $js_quiet is set, only write +# failed test case information to the output file. the default setting +# is to write a line for each test file, and whether each file passed +# or failed. +# +sub execute_js_tests { + (@js_file_array) = @_; + + $js_printed_suitename = 0; + if ( !$js_quiet ) { + &js_print_suitename; + } + + foreach $js_test (@js_file_array) { + $js_printed_filename = 0; + $js_test_bugnumber = 0; + $runtime_error = ""; + + local $passed = -1; + + # create the test command + $test_command = + $shell_command . + " -f $test_dir/$suite/shell.js " . + " -f $test_dir/$suite/$subdir/$js_test"; + + if ( !$js_quiet ) { + &js_print_filename; + } else { + print '.'; + } + + $test_path = $test_dir ."/" . $suite ."/". $test_subdir ."/". $js_test; + + + if ( !-e $test_path ) { + &js_print( " FAILED! file not found\n", + "<font color=#990000>", "</font><br>\n"); + } else { + open( RUNNING_TEST, "$test_command" . ' 2>&1 |'); + + + # this is where we want the tests to provide a lot more information + # that this script must parse so that we can + + while( <RUNNING_TEST> ){ + if ( $js_verbose && !$js_quiet ) { + &js_print ($_ ."\n", "", "<br>\n"); + } + if ( $_ =~ /BUGNUMBER/ ) { + $js_test_bugnumber = $_; + } + if ( $_ =~ /PASSED/ && $passed == -1 ) { + $passed = 1; + } + if ( $_ =~ /FAILED/ && $_ =~ /expected/) { + &js_print_suitename; + &js_print_filename; + &js_print_bugnumber; + + local @msg = split ( "FAILED", $_ ); + &js_print ( $passed ? "\n" : "" ); + &js_print( " " . $msg[0], " <tt>" ); + &js_print( "FAILED", "<font color=#990000>", "</font>"); + &js_print( $msg[1], "", "</tt><br>\n" ); + $passed = 0; + } + if ( $_ =~ /$js_test/ ) { + $runtime_error .= $_; + } + } + close( RUNNING_TEST ); + + # + # figure out whether the test passed or failed. print out an + # appropriate level of output based on the value of $js_quiet + # + if ( $js_test =~ /-n\.js$/ ) { + if ( $runtime_error ) { + if ( !$js_quiet ) { + &js_print( " PASSED!\n ", + "<font color=#009900>  ", + "</font><br>" ); + if ( $js_errors ) { + &js_print( $runtime_error, "<pre>", "</pre>"); + } + } + } else { + &js_print_suitename; + &js_print_filename; + &js_print_bugnumber; + &js_print( " FAILED! ", " <font color=#990000>", + "</font>"); + &js_print( " Should have resulted in an error\n", + "","<br>" ); + } + } else { + if ( $passed == 1 && !$js_quiet) { + &js_print( " PASSED!\n " , " <font color=#009900>", + "</font><br>" ); + } else { + if ($passed == -1) { + &js_print_suitename; + &js_print_filename; + &js_print_bugnumber; + &js_print( " FAILED!\n " , " <font color=#990000>", + "</font><br>" ); + &js_print( " Missing 'PASSED' in output\n", "","<br>" ); + &js_print( $log, "output:<br><pre>", "</pre>" ); + } + } + + } + } + } +} + +# +# figure out what os we're on, the default name of the object directory +# +sub setup_env { + # MOZ_SRC must be set, so we can figure out where the + # JavaScript executable is + $moz_src = $ENV{"MOZ_SRC"} + || die( "You need to set your MOZ_SRC environment variable.\n" ); + $src_dir = $moz_src . '/mozilla/js/src/'; + + # JS_TEST_DIR must be set so we can figure out where the tests are. + $test_dir = $ENV{"JS_TEST_DIR"}; + + # if it's not set, look for it relative to $moz_src + if ( !$test_dir ) { + $test_dir = $moz_src . '/mozilla/js/tests/'; + } + + # make sure that the test dir exists + if ( ! -e $test_dir ) { + die "The JavaScript Test Library could not be found at $test_dir.\n" . + "Check the tests out from /mozilla/js/tests or\n" . + "Set the value of your JS_TEST_DIR environment variable\n " . + "to the location of the test library.\n"; + } + + # make sure that the test dir ends with a trailing slash + $test_dir .= '/'; + + chdir $src_dir; + + # figure out which platform we're on, and figure out where the object + # directory is + + $machine_os = `uname -s`; + + if ( $machine_os =~ /WIN/ ) { + $machine_os = 'WIN'; + $object_dir = ($js_debug) ? 'Debug' : 'Release'; + $js_exe = 'jsshell.exe'; + } else { + chop $machine_os; + $js_exe = 'js'; + + # figure out what the object directory is. on all platforms, + # it's the directory that ends in OBJ. if $js_debug is set, + # look the directory that ends with or DBG.OBJ; otherwise + # look for the directory that ends with OPT.OBJ + + opendir ( SRC_DIR_FILES, $src_dir ); + @src_dir_files = readdir( SRC_DIR_FILES ); + closedir ( SRC_DIR_FILES ); + + $object_pattern = $js_debug ? 'DBG.OBJ' : 'OPT.OBJ'; + + foreach (@src_dir_files) { + if ( $_ =~ /$object_pattern/ && $_ =~ $machine_os) { + $object_dir = $_; + } + } + } + if ( ! $object_dir ) { + die( "Couldn't find an object directory in $src_dir.\n" ); + } + + # figure out what the name of the javascript executable should be, and + # make sure it's there. if it's not there, give a helpful message so + # the user can figure out what they need to do next. + + + if ( ! $js_exe_full_path ) { + $shell_command = $src_dir . $object_dir .'/'. $js_exe; + } else { + $shell_command = $js_exe_full_path; + } + + if ( !-e $shell_command ) { + die ("Could not find JavaScript shell executable $shell_command.\n" . + "Check the value of your MOZ_SRC environment variable.\n" . + "Currently, MOZ_SRC is set to $ENV{\"MOZ_SRC\"}\n". + "See the readme at http://lxr.mozilla.org/mozilla/src/js/src/ " . + "for instructions on building the JavaScript shell.\n" ); + } + + # set the output file name. let's base its name on the date and platform, + # and give it a sequence number. + + if ( $get_output ) { + $js_output = &get_output; + } + if ($js_output) { + print( "Writing results to $js_output\n" ); + chdir $test_dir; + open( JS_OUTPUT, "> ${js_output}" ) || + die "Can't open log file $js_output\n"; + close JS_OUTPUT; + } + + # get the start time + $start_time = time; + + # print out some nice stuff + $start_date = &get_date; + &js_print( "JavaScript tests started: " . $start_date, "<p><tt>", "</tt></p>" ); + + &js_print ("Executing all the tests under $test_dir\n against " . + "$shell_command\n", "<p><tt>", "</tt></p>" ); +} + +# +# parse arguments. see usage for what arguments are expected. +# +sub parse_args { + $i = 0; + while( $i < @ARGV ){ + if ( $ARGV[$i] eq '--threaded' ) { + $js_threaded = 1; + } elsif ( $ARGV[$i] eq '--d' ) { + $js_debug = 1; + } elsif ( $ARGV[$i] eq '--14' ) { + $js_version = '14'; + } elsif ( $ARGV[$i] eq '--v' ) { + $js_verbose = 1; + } elsif ( $ARGV[$i] eq '-f' ) { + $js_output = $ARGV[++$i]; + } elsif ( $ARGV[$i] eq '--o' ) { + $get_output = 1; + } elsif ($ARGV[$i] eq '--e' ) { + $js_errors = 1; + } elsif ($ARGV[$i] eq '--q' ) { + $js_quiet = 1; + } elsif ($ARGV[$i] eq '--h' ) { + die &usage; + } elsif ( $ARGV[$i] eq '-E' ) { + $js_exe_full_path = $ARGV[$i+1]; + $i++; + } else { + die &usage; + } + $i++; + } + + # + # if no output options are provided, show some output and write to file + # + if ( !$js_verbose && !$js_output && !$get_output ) { + $get_output = 1; + } +} + +# +# print the arguments that this script expects +# +sub usage { + die ("usage: $0\n" . + "--q Quiet mode -- only show information for tests that failed\n". + "--e Show runtime error messages for negative tests\n" . + "--v Verbose output -- show all test cases (not recommended)\n" . + "--o Send output to file whose generated name is based on date\n". + "--d Look for a debug JavaScript executable (default is optimized)\n" . + "-f <file> Redirect output to file named <file>\n" + ); +} + +# +# if $js_output is set, print to file as well as stdout +# +sub js_print { + ($string, $start_tag, $end_tag) = @_; + + if ($js_output) { + open( JS_OUTPUT, ">> ${js_output}" ) || + die "Can't open log file $js_output\n"; + + print JS_OUTPUT "$start_tag $string $end_tag"; + close JS_OUTPUT; + } + print $string; +} + +# +# close open files +# +sub cleanup_env { + # print out some nice stuff + $end_date = &get_date; + &js_print( "\nTests complete at $end_date", "<hr><tt>", "</tt>" ); + + # print out how long it took to complete + $end_time = time; + + $test_seconds = ( $end_time - $start_time ); + + &js_print( "Start Date: $start_date\n", "<tt><br>" ); + &js_print( "End Date: $end_date\n", "<br>" ); + &js_print( "Test Time: $test_seconds seconds\n", "<br>" ); + + if ($js_output ) { + if ( !$js_verbose) { + &js_print( "Results were written to " . $js_output ."\n", + "<br>", "</tt>" ); + } + close JS_OUTPUT; + } +} + + +# +# get the current date and time +# +sub get_date { + &get_localtime; + $now = $year ."/". $mon ."/". $mday ." ". $hour .":". + $min .":". $sec ."\n"; + return $now; + +} +sub get_localtime { + ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = + localtime; + $mon++; + $mon = &zero_pad($mon); + $year= ($year < 2000) ? "19" . $year : $year; + $mday= &zero_pad($mday); + $sec = &zero_pad($sec); + $min = &zero_pad($min); + $hour = &zero_pad($hour); +} +sub zero_pad { + local ($string) = @_; + $string = ($string < 10) ? "0" . $string : $string; + return $string; +} + +# +# generate an output file name based on the date +# +sub get_output { + &get_localtime; + + chdir $test_dir; + + $js_output = $test_dir ."/". $year .'-'. $mon .'-'. $mday ."\.1.html"; + + $output_file_found = 0; + + while ( !$output_file_found ) { + if ( -e $js_output ) { + # get the last sequence number - everything after the dot + @seq_no = split( /\./, $js_output, 2 ); + $js_output = $seq_no[0] .".". (++$seq_no[1]) . "\.html"; + } else { + $output_file_found = 1; + } + } + return $js_output; +} + +sub js_print_suitename { + if ( !$js_printed_suitename ) { + &js_print( "$suite\\$subdir\n", "<hr><font size+=1><b>", + "</font></b><br>" ); + } + $js_printed_suitename = 1; +} + +sub js_print_filename { + if ( !$js_printed_filename ) { + &js_print( "$js_test\n", "<b>", "</b><br>" ); + $js_printed_filename = 1; + } +} + +sub js_print_bugnumber { + if ( !$js_printed_bugnumber ) { + if ( $js_bugnumber =~ /^http/ ) { + &js_print( "$js_bugnumber", "<a href=$js_bugnumber>", "</a>" ); + } else { + &js_print( "$js_bugnumber", + "<a href=http://scopus.mcom.com/bugsplat/show_bug.cgi?id=" . + $js_bugnumber .">", + "</a>" ); + } + $js_printed_bugnumber = 1; + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/template.js b/Source/JavaScriptCore/tests/mozilla/template.js new file mode 100644 index 0000000..e953183 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/template.js @@ -0,0 +1,55 @@ +/* +* The contents of this file are subject to the Netscape Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/NPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is mozilla.org code. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 1998 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +*/ + +/** + * File Name: template.js + * Reference: ** replace with bugzilla URL or document reference ** + * Description: ** replace with description of test ** + * Author: ** replace with your e-mail address ** + */ + + var SECTION = ""; // provide a document reference (ie, ECMA section) + var VERSION = "ECMA_2"; // Version of JavaScript or ECMA + var TITLE = ""; // Provide ECMA section title or a description + var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report + + startTest(); // leave this alone + + /* + * Calls to AddTestCase here. AddTestCase is a function that is defined + * in shell.js and takes three arguments: + * - a string representation of what is being tested + * - the expected result + * - the actual result + * + * For example, a test might look like this: + * + * var zip = /[\d]{5}$/; + * + * AddTestCase( + * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test + * "02134", // expected result + * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result + * + */ + + test(); // leave this alone. this executes the test cases and + // displays results. diff --git a/Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js b/Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js new file mode 100644 index 0000000..d493416 --- /dev/null +++ b/Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js @@ -0,0 +1,6 @@ +(function () { + for (var i = 0; i < 500; ++i) { + for (var j = 0; j < 100000; ++j) + var a = {}; + } +})(); diff --git a/Source/JavaScriptCore/tests/perf/bench-allocate-retained.js b/Source/JavaScriptCore/tests/perf/bench-allocate-retained.js new file mode 100644 index 0000000..4e6a4bd --- /dev/null +++ b/Source/JavaScriptCore/tests/perf/bench-allocate-retained.js @@ -0,0 +1,10 @@ +(function () { + var a = new Array(100000); + for (var i = 0; i < 100000; ++i) + a[i] = {}; + + for (var i = 0; i < 500; ++i) { + for (var j = 0; j < 100000; ++j) + var b = {}; + } +})(); |