another +1 bug
This commit is contained in:
parent
e237bc625a
commit
ab4bc370ed
@ -141,6 +141,7 @@ module Risc
|
|||||||
else
|
else
|
||||||
value = object.get_internal_word( index )
|
value = object.get_internal_word( index )
|
||||||
end
|
end
|
||||||
|
log.debug "#{@instruction} == #{object}(#{object.class}) (#{value}|#{index})"
|
||||||
set_register( @instruction.register , value )
|
set_register( @instruction.register , value )
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
@ -153,7 +154,6 @@ module Risc
|
|||||||
else
|
else
|
||||||
index = get_register(@instruction.index)
|
index = get_register(@instruction.index)
|
||||||
end
|
end
|
||||||
puts "INDEX #{index} #{value}"
|
|
||||||
object.set_internal_word( index , value )
|
object.set_internal_word( index , value )
|
||||||
trigger(:object_changed, @instruction.array , index)
|
trigger(:object_changed, @instruction.array , index)
|
||||||
true
|
true
|
||||||
|
@ -80,8 +80,8 @@ module Vool
|
|||||||
mom_receive = @receiver.slot_definition(in_method)
|
mom_receive = @receiver.slot_definition(in_method)
|
||||||
arg_target = [:message , :next_message , :arguments]
|
arg_target = [:message , :next_message , :arguments]
|
||||||
args = []
|
args = []
|
||||||
@arguments.each_with_index do |arg , index| # +1 because of type, + 1 beacuse 1-indexed
|
@arguments.each_with_index do |arg , index| # +1 because of type
|
||||||
args << Mom::SlotLoad.new( arg_target + [index+1+1] , arg.slot_definition(in_method))
|
args << Mom::SlotLoad.new( arg_target + [index + 1] , arg.slot_definition(in_method))
|
||||||
end
|
end
|
||||||
setup << Mom::ArgumentTransfer.new( mom_receive , args )
|
setup << Mom::ArgumentTransfer.new( mom_receive , args )
|
||||||
end
|
end
|
||||||
|
@ -50,7 +50,7 @@ module Risc
|
|||||||
assert_equal RegToSlot , produced.next(base+3).class
|
assert_equal RegToSlot , produced.next(base+3).class
|
||||||
assert_equal :r1 , produced.next(base+3).register.symbol
|
assert_equal :r1 , produced.next(base+3).register.symbol
|
||||||
assert_equal :r3 , produced.next(base+3).array.symbol
|
assert_equal :r3 , produced.next(base+3).array.symbol
|
||||||
assert_equal 2 , produced.next(base+3).index , "first arg must have index 1"
|
assert_equal 1 , produced.next(base+3).index , "first arg must have index 1"
|
||||||
end
|
end
|
||||||
def test_load_label
|
def test_load_label
|
||||||
produced = produce_body
|
produced = produce_body
|
||||||
|
@ -110,5 +110,19 @@ module Parfait
|
|||||||
two = Parfait.new_word("one")
|
two = Parfait.new_word("one")
|
||||||
assert one.compare(two)
|
assert one.compare(two)
|
||||||
end
|
end
|
||||||
|
def test_first_char
|
||||||
|
one = Parfait.new_word("one")
|
||||||
|
one.set_char(0 , "T".ord)
|
||||||
|
assert_equal "Tne" , one.to_string
|
||||||
|
end
|
||||||
|
def test_sec_char
|
||||||
|
one = Parfait.new_word("one")
|
||||||
|
one.set_char(1 , "m".ord)
|
||||||
|
assert_equal "ome" , one.to_string
|
||||||
|
end
|
||||||
|
def test_more_char
|
||||||
|
one = Parfait.new_word("one")
|
||||||
|
assert_raises {one.set_char(3 , "s".ord)}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,7 +5,7 @@ module Risc
|
|||||||
include Ticker
|
include Ticker
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@string_input = as_main("return 'Hello'.get_internal_byte(1)")
|
@string_input = as_main("return 'Hello'.get_internal_byte(0)")
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
def test_chain
|
def test_chain
|
||||||
|
@ -5,7 +5,7 @@ module Risc
|
|||||||
include Ticker
|
include Ticker
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@string_input = as_main("return 'Hello'.set_internal_byte(1,75)")
|
@string_input = as_main("return 'Hello'.set_internal_byte(0,75)")
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user