getter by position

extract and expand position testing
never return labels (that have the same position as their target)
This commit is contained in:
Torsten Ruger
2018-05-17 20:13:33 +03:00
parent 37d62d298e
commit 8966a50a8a
6 changed files with 78 additions and 15 deletions

View File

@ -27,6 +27,14 @@ module Risc
Position.set( @label , 0 , @binary)
assert_equal 0 , Position.get(@label.next).at
end
def test_label_at
branch = Branch.new("b" , @label)
Position.set(@label , 4 , @binary)
Position.set(branch , 4 , @binary)
at_4 = Position.at(4)
assert_equal InstructionPosition , at_4.class
assert_equal Branch , at_4.instruction.class
end
end
end
end