[Scummvm-cvs-logs] SF.net SVN: scummvm:[49300] tools/branches/gsoc2010-decompiler/decompiler/ test
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Fri May 28 23:04:03 CEST 2010
Revision: 49300
http://scummvm.svn.sourceforge.net/scummvm/?rev=49300&view=rev
Author: pidgeot
Date: 2010-05-28 21:04:03 +0000 (Fri, 28 May 2010)
Log Message:
-----------
Added tests for disassembly of sample SCUMM scripts (scripts not included)
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h
tools/branches/gsoc2010-decompiler/decompiler/test/module.mk
Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h 2010-05-28 20:43:26 UTC (rev 49299)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h 2010-05-28 21:04:03 UTC (rev 49300)
@@ -24,6 +24,7 @@
#include "disassembler/pasc.h"
#include "disassembler/subopcode.h"
+#include "decompiler/scummv6/disassembler.h"
class DisassemblerTestSuite : public CxxTest::TestSuite {
public:
@@ -38,10 +39,10 @@
TS_ASSERT(insts[0]._params[0]._type == kInt);
TS_ASSERT(insts[0]._params[0]._uint == 0x60);
} catch (UnknownOpcodeException &uoe) {
- printf("Exception message: %s\n",uoe.what());
+ printf("Exception message: %s\n", uoe.what());
TS_ASSERT(false);
} catch (std::exception &ex) {
- printf("Exception message: %s\n",ex.what());
+ printf("Exception message: %s\n", ex.what());
TS_ASSERT(false);
}
}
@@ -69,4 +70,69 @@
TS_ASSERT(false);
}
}
+
+ //This test requires global script 15 from Sam & Max: Hit The Road.
+ //1ab08298c9c8fb4c77953756989c7449 *script-15.dmp
+ void testScummv6DisassemblerScript15() {
+ try {
+ ScummV6Disassembler s;
+ s.open("decompiler/test/script-15.dmp");
+ std::vector<Instruction> insts = s.disassemble();
+ TS_ASSERT(insts.size() == 11);
+ TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWordVar" && insts[0]._params[0]._ushort == 16384);
+ TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0]._ushort == 197);
+ TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWord" && insts[2]._params[0]._ushort == 0);
+ TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "pushWord" && insts[3]._params[0]._ushort == 11);
+ TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "pushWord" && insts[4]._params[0]._ushort == 0);
+ TS_ASSERT(insts[5]._address == 15 && insts[5]._name == "startScript");
+ TS_ASSERT(insts[6]._address == 16 && insts[6]._name == "pushWord" && insts[6]._params[0]._ushort == 0);
+ TS_ASSERT(insts[7]._address == 19 && insts[7]._name == "pushWord" && insts[7]._params[0]._ushort == 14);
+ TS_ASSERT(insts[8]._address == 22 && insts[8]._name == "pushWord" && insts[8]._params[0]._ushort == 0);
+ TS_ASSERT(insts[9]._address == 25 && insts[9]._name == "startScript");
+ TS_ASSERT(insts[10]._address == 26 && insts[10]._name == "stopObjectCodeB");
+ } catch (...) {
+ TS_ASSERT(false);
+ }
+ }
+
+ //This test requires global script 31 from Sam & Max: Hit The Road.
+ //f75f7ce110f378735d449f8eeb4a68e5 *script-31.dmp
+ void testScummv6DisassemblerScript31() {
+ try {
+ ScummV6Disassembler s;
+ s.open("decompiler/test/script-31.dmp");
+ std::vector<Instruction> insts = s.disassemble();
+ TS_ASSERT(insts.size() == 5);
+ TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWord" && insts[0]._params[0]._ushort == 0);
+ TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0]._ushort == 180);
+ TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWord" && insts[2]._params[0]._ushort == 0);
+ TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "writeWordVar" && insts[3]._params[0]._ushort == 181);
+ TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "stopObjectCodeB");
+ } catch (...) {
+ TS_ASSERT(false);
+ }
+ }
+
+ //This test requires global script 33 from Sam & Max: Hit The Road.
+ //9f09418bf34abbdec0ec54f388d8dca4 *script-33.dmp
+ void testScummv6DisassemblerScript33() {
+ try {
+ ScummV6Disassembler s;
+ s.open("decompiler/test/script-33.dmp");
+ std::vector<Instruction> insts = s.disassemble();
+ TS_ASSERT(insts.size() == 10);
+ TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWord" && insts[0]._params[0]._ushort == 0);
+ TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0]._ushort == 71);
+ TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWordVar" && insts[2]._params[0]._ushort == 177);
+ TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "writeWordVar" && insts[3]._params[0]._ushort == 173);
+ TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "pushWord" && insts[4]._params[0]._ushort == 874);
+ TS_ASSERT(insts[5]._address == 15 && insts[5]._name == "writeWordVar" && insts[5]._params[0]._ushort == 177);
+ TS_ASSERT(insts[6]._address == 18 && insts[6]._name == "pushWordVar" && insts[6]._params[0]._ushort == 177);
+ TS_ASSERT(insts[7]._address == 21 && insts[7]._name == "pushWord" && insts[7]._params[0]._ushort == 93);
+ TS_ASSERT(insts[8]._address == 24 && insts[8]._name == "cursorCmd_Image");
+ TS_ASSERT(insts[9]._address == 26 && insts[9]._name == "stopObjectCodeB");
+ } catch (...) {
+ TS_ASSERT(false);
+ }
+ }
};
Modified: tools/branches/gsoc2010-decompiler/decompiler/test/module.mk
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/module.mk 2010-05-28 20:43:26 UTC (rev 49299)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/module.mk 2010-05-28 21:04:03 UTC (rev 49300)
@@ -10,6 +10,7 @@
common/file.o\
decompiler/disassembler.o \
decompiler/simple_disassembler.o \
+ decompiler/scummv6/disassembler.o \
decompiler/test/disassembler/pasc.o \
decompiler/test/disassembler/subopcode.o \
decompiler/unknown_opcode.o \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list