2018-06-01 19:13:53 +03:00
|
|
|
require_relative "helper"
|
2018-05-08 19:59:43 +03:00
|
|
|
|
|
|
|
module Risc
|
2018-05-25 19:04:48 +03:00
|
|
|
class TestPositionTranslated < MiniTest::Test
|
|
|
|
def setup
|
2019-02-08 23:03:23 +02:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-07-04 09:18:55 +03:00
|
|
|
Risc.boot!
|
2018-05-25 19:04:48 +03:00
|
|
|
@binary = Parfait::BinaryCode.new(1)
|
|
|
|
@method = Parfait.object_space.types.values.first.methods
|
2018-05-29 20:26:00 +03:00
|
|
|
@label = Risc.label("hi","ho")
|
2018-05-25 19:04:48 +03:00
|
|
|
end
|
|
|
|
|
2018-05-09 20:36:49 +03:00
|
|
|
def test_bin_propagates_existing
|
2018-05-08 19:59:43 +03:00
|
|
|
@binary.extend_to(16)
|
2018-07-02 17:01:07 +03:00
|
|
|
CodeListener.init( @binary , :interpreter).set(0)
|
2018-08-12 13:10:44 +03:00
|
|
|
assert_equal @binary.padded_length , Position.get(@binary.next_code).at
|
2018-05-08 19:59:43 +03:00
|
|
|
end
|
2018-05-09 20:36:49 +03:00
|
|
|
def test_bin_propagates_after
|
2018-07-02 17:01:07 +03:00
|
|
|
CodeListener.init( @binary , :interpreter).set(0)
|
2018-05-09 20:36:49 +03:00
|
|
|
@binary.extend_to(16)
|
2018-08-12 13:10:44 +03:00
|
|
|
assert_equal @binary.padded_length , Position.get(@binary.next_code).at
|
2018-05-09 20:36:49 +03:00
|
|
|
end
|
2018-05-08 19:59:43 +03:00
|
|
|
end
|
|
|
|
end
|