start on redoing instruction positions

using insruction listeners (wip)
This commit is contained in:
Torsten Ruger
2018-06-02 21:20:15 +03:00
parent 3bc35c2275
commit 24f6e30b54
7 changed files with 36 additions and 21 deletions

View File

@ -3,7 +3,7 @@ require_relative "helper"
module Risc
module Position
# tests that require a boot and test propagation
class TestInstructionPosition < MiniTest::Test
class TestInstructionListener < MiniTest::Test
def setup
Risc.machine.boot
@binary = Parfait::BinaryCode.new(1)
@ -11,7 +11,7 @@ module Risc
@label = Risc.label("hi","ho")
end
def test_init
assert InstructionPosition.init(@label , nil)
assert InstructionListener.init(@label , @binary)
end
def pest_set_instr
pos = Position.set( @label , 8 , @binary)

View File

@ -3,7 +3,7 @@ require_relative "helper"
module Risc
module Position
# tests that do no require a boot and only test basic positioning
class TestPositionBasic < MiniTest::Test
class TestObjectPosition < MiniTest::Test
def test_init
assert ObjectPosition.init(self , -1)
@ -13,6 +13,9 @@ module Risc
position = ObjectPosition.new(mov , 0)
assert_equal 4, position.next_slot
end
def test_has_get_code
assert_nil ObjectPosition.init(self , -1).get_code
end
def pest_creation_ok
assert ObjectPosition.new(self,0)
end