Sha256: 9796fdcc693e150500736a0be5804f9d5af03d6a6ebd4b92d78ba7a602434ef8

Contents?: true

Size: 987 Bytes

Versions: 4

Compression:

Stored size: 987 Bytes

Contents

#    This file is part of Metasm, the Ruby assembly manipulation suite
#    Copyright (C) 2006-2009 Yoann GUILLOT
#
#    Licence is LGPL, see LICENCE in the top-level directory

require 'test/unit'
require 'metasm'

class TestArc < Test::Unit::TestCase
	def test_arc_dec
		hex_stream =  "\x0A\x23\x80\x0F\x80\x0\x60\x0D" # mov r3, 0x800D60
		hex_stream += "\x40\x83"          # ld_s r2, [r3, 0]

		dasm = Metasm::Shellcode.disassemble(Metasm::ARC.new, hex_stream)
		assert_equal(2, dasm.decoded.length)

		assert_equal('mov', dasm.decoded[0].instruction.opname)
		assert_equal('r3', dasm.decoded[0].instruction.args[0].to_s)
		assert_equal(0x800d60, dasm.decoded[0].instruction.args[1].reduce)

		assert_equal('ld_s', dasm.decoded[8].instruction.opname)
		assert_equal('r2', dasm.decoded[8].instruction.args[0].to_s)
		assert_equal('r3', dasm.decoded[8].instruction.args[1].base.to_s)
		assert_equal(0, dasm.decoded[8].instruction.args[1].disp.reduce)
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metasm-1.0.5 tests/arc.rb
metasm-1.0.4 tests/arc.rb
metasm-1.0.3 tests/arc.rb
metasm-1.0.2 tests/arc.rb