2018-05-08 18:59:43 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Risc
|
|
|
|
# tests that require a boot and test propagation
|
|
|
|
class TestPositionBasic < MiniTest::Test
|
|
|
|
def setup
|
|
|
|
Risc.machine.boot
|
|
|
|
@binary = Parfait::BinaryCode.new(1)
|
|
|
|
@label = Label.new("hi","ho")
|
|
|
|
end
|
|
|
|
def test_set_bin
|
|
|
|
pos = Position.set( @binary , 0 , Parfait.object_space.get_main)
|
2018-05-10 19:56:12 +02:00
|
|
|
assert_equal Position::CodePosition , pos.class
|
2018-05-08 19:53:48 +02:00
|
|
|
end
|
2018-05-09 19:36:49 +02:00
|
|
|
def test_bin_propagates_existing
|
2018-05-08 18:59:43 +02:00
|
|
|
@binary.extend_to(16)
|
|
|
|
Position.set( @binary , 0 , Parfait.object_space.get_main)
|
|
|
|
assert_equal @binary.padded_length , Position.get(@binary.next).at
|
|
|
|
end
|
2018-05-09 19:36:49 +02:00
|
|
|
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
|
2018-05-08 18:59:43 +02:00
|
|
|
end
|
|
|
|
end
|