dragging the extra through resets

as the binary the instruction is in may change when repositioning
This commit is contained in:
Torsten Ruger
2018-05-25 19:04:48 +03:00
parent ddd408e245
commit 6f0fad0957
8 changed files with 45 additions and 26 deletions

View File

@ -13,16 +13,6 @@ module Risc
pos = Position.set( @binary , 0 , @method)
assert_equal Position::CodePosition , pos.class
end
def test_bin_propagates_existing
@binary.extend_to(16)
Position.set( @binary , 0 , @method)
assert_equal @binary.padded_length , Position.get(@binary.next).at
end
def test_bin_propagates_after
Position.set( @binary , 0 , Parfait.object_space.get_main)
@binary.extend_to(16)
assert_equal @binary.padded_length , Position.get(@binary.next).at
end
def test_type
pos = Position.set( @binary , 0 , @method)
assert_equal "Word_Type" , pos.method.for_type.name
@ -33,4 +23,24 @@ module Risc
assert_equal "Integer_Type" , type.name
end
end
class TestPositionTranslated < MiniTest::Test
def setup
machine = Risc.machine.boot
machine.translate(:interpreter)
@binary = Parfait::BinaryCode.new(1)
@method = Parfait.object_space.types.values.first.methods
@label = Label.new("hi","ho")
end
def test_bin_propagates_existing
@binary.extend_to(16)
Position.set( @binary , 0 , @method)
assert_equal @binary.padded_length , Position.get(@binary.next).at
end
def test_bin_propagates_after
Position.set( @binary , 0 , Parfait.object_space.get_main)
@binary.extend_to(16)
assert_equal @binary.padded_length , Position.get(@binary.next).at
end
end
end