gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/ops....


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/ops....
Date: Wed, 21 Nov 2007 06:56:17 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/11/21 06:56:17

Modified files:
        .              : ChangeLog 
        testsuite/actionscript.all: ops.as 
        testsuite/misc-swfc.all: swf4opcode.sc 

Log message:
        * testsuite/misc-swfc.all/swf4opcode.sc,
        * testsuite/misc-actionsript.all/ops.as: more opcode tests. test that 
to_number() should return zero if failed to convert to a valid number in swf4, 
and return  NaN in swf5~8.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4904&r2=1.4905
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/ops.as?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/swf4opcode.sc?cvsroot=gnash&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4904
retrieving revision 1.4905
diff -u -b -r1.4904 -r1.4905
--- ChangeLog   20 Nov 2007 22:14:47 -0000      1.4904
+++ ChangeLog   21 Nov 2007 06:56:16 -0000      1.4905
@@ -1,3 +1,8 @@
+2007-11-21 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-swfc.all/swf4opcode.sc,
+         testsuite/misc-actionsript.all/ops.as: more opcode tests. 
+         
 2007-11-20 Sandro Santilli <address@hidden>
 
        * server/as_object.cpp, server/asobj/AsBroadcaster.cpp:

Index: testsuite/actionscript.all/ops.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/ops.as,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- testsuite/actionscript.all/ops.as   20 Nov 2007 08:54:33 -0000      1.27
+++ testsuite/actionscript.all/ops.as   21 Nov 2007 06:56:17 -0000      1.28
@@ -20,7 +20,7 @@
  *  Test binary predicates (equal, less_then, greater_then, logical and 
bitwise ops)
  */
 
-rcsid="$Id: ops.as,v 1.27 2007/11/20 08:54:33 zoulunkai Exp $";
+rcsid="$Id: ops.as,v 1.28 2007/11/21 06:56:17 zoulunkai Exp $";
 
 #include "check.as"
 
@@ -70,6 +70,21 @@
 check_equals(false, 0);
 check_equals(false+false, 0);
 
+x = "abc";
+y = 0;
+z = x * y;
+
+// in swf4, z is 0, tested in swf4opcode.sc
+// in swf5~8, z is NaN.
+check(! (z == 0));  
+check(isNaN(z));
+// both EMACS and Moock's book says NaN != NaN, now I believe they are correct.
+// we have enough tests to confirm this.
+xcheck(! (z == NaN)); 
+// Deduction: Flash built-in NaN constant(string) has a special representation.
+// Note: This is the ONLY case where NaN == NaN, IIRC
+check(NaN == NaN);
+
 // for Number
 x = new Number(3);
 y = 3;
@@ -673,7 +688,7 @@
 check(isNaN(y));
 
 #if OUTPUT_VERSION < 7
- totals(201);
+ totals(205);
 #else
- totals(203);
+ totals(207);
 #endif

Index: testsuite/misc-swfc.all/swf4opcode.sc
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-swfc.all/swf4opcode.sc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-swfc.all/swf4opcode.sc       20 Nov 2007 08:54:33 -0000      
1.3
+++ testsuite/misc-swfc.all/swf4opcode.sc       21 Nov 2007 06:56:17 -0000      
1.4
@@ -19,7 +19,12 @@
 /*
  *  Zou Lunkai, address@hidden
  *
- *  test opcodes defined in swf4
+ *  test opcodes defined in swf4.
+ *  
+ *  Deduction:
+ *
+ *     There is no NaN number in swf4 at all, invalid numbers are converted to 
0.
+ *     Fix as_value::to_number() should fix all tests in this file.
  */
 
 //
@@ -43,11 +48,21 @@
         if ( obt == exp ) xpass_check() \
         else xfail_check()
         
+#define check(expr)  \
+    if ( expr ) pass_check() \
+    else fail_check()
+
+#define xcheck(expr)  \
+        if ( expr ) xpass_check() \
+        else xfail_check() 
 
 .flash  bbox=800x600 filename="swf4opcode.swf" background=white version=4 
fps=12
 
 .frame 1
     .action:
+        // 
+        //  test opcode ActionEquals
+        //
         testvar = (uninitialized1 == '');
         xcheck_equals(testvar, 1);
         testvar = ('' == uninitialized2);
@@ -71,7 +86,7 @@
         check_equals(undefined, undefined);
         
         // test 'Infinity' in swf4
-        // there's no 'Infinity' constants in swf4
+        // there's no 'Infinity' constant in swf4
         check_equals(Infinity, undefined);
         check_equals(Infinity, Infinity);
         check_equals(Infinity, -Infinity);
@@ -79,8 +94,50 @@
                // test 'null' in swf4
                // there's no null in swf4
                check_equals(null, undefined);
+        check_equals(null, 0);
+        
+        // test 'NaN' in swf4
+        // there's no 'NaN' constant in swf4
+        check_equals(NaN, 0);
     .end
 
+
+.frame 2
+    .action:
+        //
+        // test ActionLessThan
+        //
+        x = 'ab';
+        y = 'abc';
+        // should return 0(false)
+        // x and y are converted to number 0 before comparision
+        check( ! (x < y) );
+        check( ! (x > y) );
+        xcheck( x == y );
+        xcheck( x == 0);
+        
+        //
+        // test swf4 ActionMultiply, ActionDivide, ActionAdd, ActionSubstract
+        //
+        x = "abc";
+        y = 0;
+        z = x * y;
+        xcheck_equals(z, 0);
+        z = x / 1;
+        xcheck_equals(z, 0);
+        z = x + 1;
+        xcheck_equals(z, 1);
+        z = x - 1;
+        xcheck_equals(z, -1);
+        
+        //
+        // TODO: add tests for ActionStringEq, ActionStringGreater,
+        // ActionStringCompare
+        //
+        // Question: how to generate the above opcodes?
+    .end
+    
+    
 .frame 3
     .action:
         stop();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]