seperate different Position classes into own files
also tests and have Position module keep all positions (singletons should be at module, not class level)
This commit is contained in:
26
test/risc/position/test_code_position.rb
Normal file
26
test/risc/position/test_code_position.rb
Normal file
@ -0,0 +1,26 @@
|
||||
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)
|
||||
assert_equal Position::CodePosition , pos.class
|
||||
end
|
||||
def test_bin_propagates_existing
|
||||
@binary.extend_to(16)
|
||||
Position.set( @binary , 0 , Parfait.object_space.get_main)
|
||||
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
|
Reference in New Issue
Block a user