objects didn't get positions

positions.empty? was wrong check
This commit is contained in:
Torsten Ruger
2018-06-16 10:58:54 +03:00
parent 698c845297
commit 7543236f4f
9 changed files with 17 additions and 28 deletions

View File

@ -15,7 +15,7 @@ module Risc
end
def test_no_fire
@pos.position_listener(self)
Position.set_to(@pos,0)
@pos.set(0)
assert_equal 0 , Position.get(@object).at
end
def test_at

View File

@ -33,6 +33,7 @@ module Risc
sorted_objects = @text_writer.sorted_objects
sorted_objects.each_slice(2) do |l,r|
next unless r
next if l.is_a?(Label) or r.is_a?(Label)
assert Position.get(l).at < Position.get(r).at , "#{Position.get(l)} < #{Position.get(r)} , #{l.object_id.to_s(16)}, #{r.object_id.to_s(16)}"
end
end
@ -41,6 +42,7 @@ module Risc
sorted_objects.shift
sorted_objects.each_slice(2) do |l,r|
next unless r
next if l.is_a?(Label) or r.is_a?(Label)
assert Position.get(l).at < Position.get(r).at , "#{Position.get(l)} < #{Position.get(r)} , #{l.object_id.to_s(16)}, #{r.object_id.to_s(16)}"
end
end

View File

@ -30,7 +30,7 @@ module Risc
def test_no_risc #by assembling, risc doesnt have assemble method
@machine.translate(:arm)
@machine.position_all
@machine.object_positions.each do |method , position|
@machine.object_positions.keys.each do |method|
next unless method.is_a? Parfait::TypedMethod
method.cpu_instructions.each do |ins|
ins.assemble(DevNull.new)