diff --git a/test/risc/position/helper.rb b/test/risc/position/helper.rb index 4978ff98..f08c549f 100644 --- a/test/risc/position/helper.rb +++ b/test/risc/position/helper.rb @@ -9,6 +9,34 @@ module Risc 4 end end + class Machine + def set_platform(plat) + @platform = plat + end + def set_translated + @translated = true + translate_methods( @platform.translator ) + @cpu_init = risc_init.to_cpu(@platform.translator) + end + end + class DummyPlatform + def self.boot + machine = Risc.machine.boot + machine.set_platform( self.new ) + machine + end + def translator + DummyTranslator.new + end + def padding + 0 + end + end + class DummyTranslator + def translate(arg) + DummyInstruction.new + end + end class DummyInstruction < Dummy include Util::List def initialize(nekst = nil) @@ -19,5 +47,11 @@ module Risc Position.get(self).trigger_inserted if Position.set?(self) ret end + def assemble(io) + io.write_unsigned_int_32(0) + end + def total_byte_length + 4 + end end end diff --git a/test/risc/position/test_code_listener1.rb b/test/risc/position/test_code_listener1.rb index c1c0e556..97bd8c2a 100644 --- a/test/risc/position/test_code_listener1.rb +++ b/test/risc/position/test_code_listener1.rb @@ -4,11 +4,13 @@ module Risc # tests that require a boot and test propagation class TestCodeListenerFull < MiniTest::Test def setup - Risc.machine.boot + #@machine = DummyPlatform.boot + @machine = Risc.machine.boot @binary = Parfait::BinaryCode.new(1) @method = Parfait.object_space.types.values.first.methods @label = Risc.label("hi","ho") - @machine.translate(:arm) + #@machine.set_translated + @machine.translate(:interpreter) @machine.position_all end def test_listener_after_extend diff --git a/test/risc/position/test_instruction_listener1.rb b/test/risc/position/test_instruction_listener1.rb index c9906a45..8272135f 100644 --- a/test/risc/position/test_instruction_listener1.rb +++ b/test/risc/position/test_instruction_listener1.rb @@ -3,9 +3,9 @@ require_relative "helper" module Risc class TestInstructionListenerBig < MiniTest::Test def setup - Risc.machine.boot + DummyPlatform.boot @binary = Parfait::BinaryCode.new(1) - @bin_pos = CodeListener.init(@binary,0) + @bin_pos = CodeListener.init(@binary).set(0) @instruction = DummyInstruction.new 13.times {@instruction.last.insert(DummyInstruction.new) } @position = InstructionListener.init(@instruction , @binary)