updated tests

This commit is contained in:
Jindra Petřík
2025-08-31 18:24:29 +02:00
parent d09c96fb43
commit 46b05de1b3
3 changed files with 103 additions and 6 deletions

View File

@@ -141,7 +141,7 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
false);
}
@Test
@Test(enabled = false)
public void testDoubleDup() {
decompileMethod("assembled", "testDoubleDup", "var _loc10_:Rectangle = myprop(_loc5_);\r\n"
+ "_loc10_.mymethod(-_loc10_.width,-_loc10_.height);\r\n",
@@ -325,7 +325,8 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
decompileMethod("assembled", "testPushPlacement", "var a:int = 1;\r\n"
+ "var b:* = 2;\r\n"
+ "§§push(a);\r\n"
+ "if(((a += 1,b)) >= 2)\r\n"
+ "a += 1;\r\n"
+ "if(b >= 2)\r\n"
+ "{\r\n"
+ "b = §§pop() + 7;\r\n"
+ "trace(b);\r\n"
@@ -340,12 +341,12 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
@Test
public void testPushWhile() {
decompileMethod("assembled", "testPushWhile", "var _loc3_:int = 5;\r\n"
+ "var _temp_1:*;\r\n"
+ "var _temp_1:* = \"ByteArray\";\r\n"
+ "§§push(obfuscated[\"xxx\"] = new (getDefinitionByName(\"flash.utils\"+\".\"+_temp_1))());\r\n"
+ "§§push(50);\r\n"
+ "while(true)\r\n"
+ "{\r\n"
+ "var _temp_4:*;\r\n"
+ "var _temp_4:* = §§pop();\r\n"
+ "§§push(_temp_4);\r\n"
+ "if(!_temp_4)\r\n"
+ "{\r\n"

View File

@@ -129,7 +129,55 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
+ "trace(\"ch\");\r\n"
+ "}\r\n",
false);
}
}
@Test
public void testChainedAssignments1() {
decompileMethod("classic_air", "testChainedAssignments1", "trace(\"c = b = a = 5;\");\r\n"
+ "var a:int = 0;\r\n"
+ "var b:int = 0;\r\n"
+ "var c:int = 0;\r\n"
+ "c = b = a = 5;\r\n",
false);
}
@Test
public void testChainedAssignments2() {
decompileMethod("classic_air", "testChainedAssignments2", "trace(\"e.attrib1 = e.attrib2 = e.attrib3 = 10;\");\r\n"
+ "var e:TestClass = new TestClass();\r\n"
+ "e.attrib1 = e.attrib2 = e.attrib3 = 10;\r\n",
false);
}
@Test
public void testChainedAssignments3() {
decompileMethod("classic_air", "testChainedAssignments3", "var a:int = 0;\r\n"
+ "var b:int = 0;\r\n"
+ "prop = a = b = 4;\r\n"
+ "if(a == 2)\r\n"
+ "{\r\n"
+ "trace(\"OK: \" + a);\r\n"
+ "}\r\n",
false);
}
@Test
public void testChainedAssignments4() {
decompileMethod("classic_air", "testChainedAssignments4", "var slota:int;\r\n"
+ "var slotb:int;\r\n"
+ "var slotc:int;\r\n"
+ "var f:Function;\r\n"
+ "trace(\"slotc = slotb = slota = 5;\");\r\n"
+ "slota = 0;\r\n"
+ "slotb = 0;\r\n"
+ "slotc = 0;\r\n"
+ "f = function(n1:int, n2:int):int\r\n"
+ "{\r\n"
+ "return n1 + n2;\r\n"
+ "};\r\n"
+ "slotc = slotb = slota = 5;\r\n",
false);
}
@Test
public void testCollidingTry() {

View File

@@ -129,7 +129,55 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "trace(\"ch\");\r\n"
+ "}\r\n",
false);
}
}
@Test
public void testChainedAssignments1() {
decompileMethod("classic", "testChainedAssignments1", "trace(\"c = b = a = 5;\");\r\n"
+ "var a:int = 0;\r\n"
+ "var b:int = 0;\r\n"
+ "var c:int = 0;\r\n"
+ "c = b = a = 5;\r\n",
false);
}
@Test
public void testChainedAssignments2() {
decompileMethod("classic", "testChainedAssignments2", "trace(\"e.attrib1 = e.attrib2 = e.attrib3 = 10;\");\r\n"
+ "var e:TestClass = new TestClass();\r\n"
+ "e.attrib1 = e.attrib2 = e.attrib3 = 10;\r\n",
false);
}
@Test
public void testChainedAssignments3() {
decompileMethod("classic", "testChainedAssignments3", "var a:int = 0;\r\n"
+ "var b:int = 0;\r\n"
+ "this.prop = a = b = 4;\r\n"
+ "if(a == 2)\r\n"
+ "{\r\n"
+ "trace(\"OK: \" + a);\r\n"
+ "}\r\n",
false);
}
@Test
public void testChainedAssignments4() {
decompileMethod("classic", "testChainedAssignments4", "var slota:int;\r\n"
+ "var slotb:int;\r\n"
+ "var slotc:int;\r\n"
+ "var f:Function;\r\n"
+ "trace(\"slotc = slotb = slota = 5;\");\r\n"
+ "slota = 0;\r\n"
+ "slotb = 0;\r\n"
+ "slotc = 0;\r\n"
+ "f = function(n1:int, n2:int):int\r\n"
+ "{\r\n"
+ "return n1 + n2;\r\n"
+ "};\r\n"
+ "slotc = slotb = slota = 5;\r\n",
false);
}
@Test
public void testCollidingTry() {