Search in sources :

Example 1 with Disassembler

use of net.runelite.cache.script.disassembler.Disassembler 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

InputStream (java.io.InputStream)1 ScriptDefinition (net.runelite.cache.definitions.ScriptDefinition)1 Instructions (net.runelite.cache.script.Instructions)1 Disassembler (net.runelite.cache.script.disassembler.Disassembler)1 Test (org.junit.Test)1