Search in sources :

Example 6 with ScriptDefinition

use of net.runelite.cache.definitions.ScriptDefinition in project runelite by runelite.

the class AssemblerTest method testAssemble.

@Test
public void testAssemble() throws Exception {
    InputStream in = AssemblerTest.class.getResourceAsStream(script);
    Assert.assertNotNull(in);
    Instructions instructions = new Instructions();
    instructions.init();
    Assembler assembler = new Assembler(instructions);
    ScriptDefinition script = assembler.assemble(in);
    // compare with disassembler
    Disassembler disassembler = new Disassembler();
    String out = disassembler.disassemble(script);
    in = AssemblerTest.class.getResourceAsStream(this.script);
    Assert.assertNotNull(in);
    String original = new String(IOUtils.toByteArray(in));
    logger.info(original);
    logger.info("-----------------------");
    logger.info(out);
    Assert.assertEquals(original, out);
}
Also used : ScriptDefinition(net.runelite.cache.definitions.ScriptDefinition) InputStream(java.io.InputStream) Disassembler(net.runelite.cache.script.disassembler.Disassembler) Instructions(net.runelite.cache.script.Instructions) Test(org.junit.Test)

Aggregations

ScriptDefinition (net.runelite.cache.definitions.ScriptDefinition)6 Instructions (net.runelite.cache.script.Instructions)3 Test (org.junit.Test)3 File (java.io.File)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ScriptLoader (net.runelite.cache.definitions.loaders.ScriptLoader)2 Assembler (net.runelite.cache.script.assembler.Assembler)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 ScriptSaver (net.runelite.cache.definitions.savers.ScriptSaver)1 Archive (net.runelite.cache.fs.Archive)1 Index (net.runelite.cache.fs.Index)1 Storage (net.runelite.cache.fs.Storage)1 Store (net.runelite.cache.fs.Store)1 InputStream (net.runelite.cache.io.InputStream)1