[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/arra...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/arra... |
Date: |
Tue, 18 Mar 2008 15:11:53 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/03/18 15:11:53
Modified files:
. : ChangeLog
testsuite/actionscript.all: array.as
Log message:
* testsuite/actionscript.all/array.cpp: tests for non-integer
and extreme
integer indices.
There's no rounding of integers (so to_int() is irrelevant here);
extremely high or low integers can also be valid indices. One particular number
shows a bug in the pp; not sure if that's the same on all players, but it can't
be something we want to replicate.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5960&r2=1.5961
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/array.as?cvsroot=gnash&r1=1.49&r2=1.50
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5960
retrieving revision 1.5961
diff -u -b -r1.5960 -r1.5961
--- ChangeLog 18 Mar 2008 14:10:39 -0000 1.5960
+++ ChangeLog 18 Mar 2008 15:11:53 -0000 1.5961
@@ -1,5 +1,10 @@
2008-03-18 Benjamin Wolsey <address@hidden>
+ * testsuite/actionscript.all/array.cpp: tests for non-integer and
+ extreme integer indices.
+
+2008-03-18 Benjamin Wolsey <address@hidden>
+
* server/as_value.cpp: minor changes to to_int. It's a bit
complicated but seems to replicate how the pp converts to integers.
Don't need to use fmod().
Index: testsuite/actionscript.all/array.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/array.as,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- testsuite/actionscript.all/array.as 18 Mar 2008 11:26:54 -0000 1.49
+++ testsuite/actionscript.all/array.as 18 Mar 2008 15:11:53 -0000 1.50
@@ -19,7 +19,7 @@
// Initial test written by Mike Carlson
-rcsid="$Id: array.as,v 1.49 2008/03/18 11:26:54 strk Exp $";
+rcsid="$Id: array.as,v 1.50 2008/03/18 15:11:53 bwy Exp $";
#include "check.as"
check_equals(typeof(Array), 'function');
@@ -325,6 +325,89 @@
//-----------------------------------------------------
+// Test non-integer and insane indices.
+//-----------------------------------------------------
+
+c = ["zero", "one", "two", "three"];
+check_equals(typeof(c), "object");
+
+c[1.1] = "one point one";
+c[-3] = "minus three";
+
+check_equals (c[0], "zero");
+xcheck_equals (c[1], "one");
+check_equals (c[1.1], "one point one");
+xcheck_equals (c[1.9], undefined);
+check_equals (c[-3], "minus three");
+check_equals (c[-3.7], undefined);
+
+c[-2147483648] = "lowest int";
+check_equals (c[0], "zero");
+xcheck_equals (c[1], "one");
+
+// This appears to invalidate integer indices, but
+// not non-integer ones.
+c[-2147483649] = "too low";
+xcheck_equals (c[0], undefined);
+xcheck_equals (c[1], undefined);
+xcheck_equals (c[2], undefined);
+xcheck_equals (c[3], undefined);
+check_equals (c[1.1], "one point one");
+check_equals (c[-2147483649], "too low");
+// doesn't set the int(-2147483649) element:
+check_equals (c[int(-2147483649)], undefined);
+
+c[2147483649] = "too high";
+check_equals (c[-2147483649], "too low");
+check_equals (c[2147483649], "too high");
+xcheck_equals (c[1], undefined);
+xcheck_equals (c[2], undefined);
+xcheck_equals (c[3], undefined);
+
+xcheck_equals (c.length, -2147483646);
+
+str = "";
+
+for (i in c)
+{
+ str += i + ": " + c[i] + "; ";
+}
+xcheck_equals(str, "2147483649: too high; -2147483649: too low; -2147483648:
lowest int; -3: minus three; 1.1: one point one; ");
+
+c = ["zero", "one", "two", "three"];
+c[1.1] = "one point one";
+c[-3] = "minus three";
+
+check_equals (c[0], "zero");
+xcheck_equals (c[1], "one");
+
+// No problem...
+c[0xffffffff + 1] = "too high";
+check_equals (c[0], "zero");
+xcheck_equals (c[1], "one");
+check_equals (c[0xffffffff], undefined);
+check_equals (c[0xffffffff + 1], "too high");
+
+c[0xfffffffffffffffff] = "much too high";
+check_equals (c[0xfffffffffffffffff], "much too high");
+
+// Also no problem. Looks like a fairly crappy bug to me.
+c[-2147483650] = "still lower";
+check_equals (c[0], "zero");
+xcheck_equals (c[1], "one");
+
+xcheck_equals (c.length, 2147483647);
+
+str= "";
+
+for (i in c)
+{
+ str += i + ": " + c[i] + "; ";
+}
+
+xcheck_equals(str, "-2147483650: still lower; 2.95147905179353e+20: much too
high; 4294967296: too high; -3: minus three; 1.1: one point one; 3: three; 2:
two; 1: one; 0: zero; ");
+
+//-----------------------------------------------------
// Test Array.pop()
//-----------------------------------------------------
@@ -1124,11 +1207,11 @@
#if OUTPUT_VERSION < 6
- check_totals(404);
+ check_totals(438);
#else
# if OUTPUT_VERSION < 7
- check_totals(440);
+ check_totals(474);
# else
- check_totals(450);
+ check_totals(484);
# endif
#endif