fix some pesty errors
need to fix instruction overlap beofre interpreter starts again
This commit is contained in:
@ -41,24 +41,13 @@ module Risc
|
||||
Position.get(label).set(10)
|
||||
assert_equal 10 , Position.get(@instruction).at
|
||||
end
|
||||
def pest_label_at
|
||||
def test_label_at
|
||||
branch = Branch.new("b" , @label)
|
||||
Position.set(@label , 8 , @binary)
|
||||
Position.set(branch , 8 , @binary)
|
||||
at_4 = Position.at(8)
|
||||
assert_equal InstructionPosition , at_4.class
|
||||
assert_equal Branch , at_4.instruction.class
|
||||
end
|
||||
def pest_label_at_reverse
|
||||
branch = Branch.new("b" , @label)
|
||||
Position.set(branch , 8 , @binary)
|
||||
Position.set(@label , 8 , @binary)
|
||||
at_4 = Position.at(8)
|
||||
assert_equal InstructionPosition , at_4.class
|
||||
assert_equal Branch , at_4.instruction.class
|
||||
end
|
||||
def pest_reset_false_type
|
||||
assert_raises {Position.set(@label , 0 , @binary)}
|
||||
Position.new(@label , 8 )
|
||||
Position.new(branch , 8 )
|
||||
at_8 = Position.at(8)
|
||||
assert_equal Position , at_8.class
|
||||
assert_equal Branch , at_8.object.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -76,16 +76,17 @@ module Risc
|
||||
assert @position.position_listener(listener)
|
||||
assert @position.unregister_event(:position_changed ,listener)
|
||||
end
|
||||
def pest_fires
|
||||
def test_fires
|
||||
@object = @instruction
|
||||
@position.position_listener(self)
|
||||
@position.register_event(:position_changed , self)
|
||||
@position.trigger(:position_changed , @position)
|
||||
assert_equal @position , @trigger
|
||||
end
|
||||
def pest_no_fire_after_unregister
|
||||
listener = PositionListener.new(self)
|
||||
assert @position.position_listener( listener)
|
||||
assert @position.unregister_event(:position_changed ,listener)
|
||||
def test_no_fire_after_unregister
|
||||
@object = @instruction
|
||||
Position.new(self, 10)
|
||||
assert @position.register_event(:position_changed , self)
|
||||
assert @position.unregister_event(:position_changed ,self)
|
||||
@position.trigger(:position_changed , @position)
|
||||
assert_nil @trigger
|
||||
end
|
||||
@ -100,25 +101,25 @@ module Risc
|
||||
def setup
|
||||
@machine = Risc.machine.boot
|
||||
end
|
||||
def pest_cpu_init
|
||||
def test_cpu_init
|
||||
@machine.translate(:interpreter)
|
||||
@machine.position_all
|
||||
assert Position.get @machine.cpu_init
|
||||
end
|
||||
def pest_cpu_label
|
||||
def test_cpu_label
|
||||
@machine.translate(:interpreter)
|
||||
@machine.position_all
|
||||
assert Position.get( @machine.cpu_init.label )
|
||||
end
|
||||
def pest_cpu_first_arm
|
||||
def test_cpu_first_arm
|
||||
@machine.translate(:arm)
|
||||
@machine.position_all
|
||||
assert Position.get( @machine.cpu_init.first )
|
||||
end
|
||||
def pest_has_arm_pos
|
||||
def test_has_arm_pos
|
||||
has_positions(:arm)
|
||||
end
|
||||
def pest_has_int_pos
|
||||
def test_has_int_pos
|
||||
has_positions(:interpreter)
|
||||
end
|
||||
def has_positions(platform)
|
||||
@ -128,10 +129,10 @@ module Risc
|
||||
assert Position.get(obj)
|
||||
end
|
||||
end
|
||||
def pest_has_arm_meth
|
||||
def test_has_arm_meth
|
||||
meth_positions(:arm)
|
||||
end
|
||||
def pest_has_int_meth
|
||||
def test_has_int_meth
|
||||
meth_positions(:interpreter)
|
||||
end
|
||||
def meth_positions(platform)
|
||||
|
Reference in New Issue
Block a user