still finding index errors

This commit is contained in:
Torsten Ruger 2015-10-27 18:45:56 +02:00
parent 444ad75e1e
commit 79cf59c4e2
3 changed files with 7 additions and 2 deletions

View File

@ -166,7 +166,7 @@ module Parfait
grow_to(index) grow_to(index)
end end
# start one higher than offset, which is where the length is # start one higher than offset, which is where the length is
internal_object_set( index + 1 + offset, value) internal_object_set( index + offset, value)
end end
# set the value at index. # set the value at index.
@ -176,7 +176,7 @@ module Parfait
ret = nil ret = nil
if(index <= self.get_length) if(index <= self.get_length)
# start one higher than offset, which is where the length is # start one higher than offset, which is where the length is
ret = internal_object_get(index + offset + 1) ret = internal_object_get(index + offset )
end end
ret ret
end end

View File

@ -23,6 +23,7 @@ module Register
@array = array @array = array
@index = index @index = index
@register = register @register = register
raise "index 0 " if index == 0
raise "not integer #{index}" unless index.is_a? Numeric raise "not integer #{index}" unless index.is_a? Numeric
raise "Not register #{register}" unless RegisterValue.look_like_reg(register) raise "Not register #{register}" unless RegisterValue.look_like_reg(register)
raise "Not register #{array}" unless RegisterValue.look_like_reg(array) raise "Not register #{array}" unless RegisterValue.look_like_reg(array)

View File

@ -31,6 +31,10 @@ class TestMessage < MiniTest::Test
@mess.push :name @mess.push :name
assert_equal 1 , @mess.internal_object_get(9) assert_equal 1 , @mess.internal_object_get(9)
end end
def test_get_internal
@mess.push :name
assert_equal :name , @mess.internal_object_get(10)
end
def test_get def test_get
index = @mess.push :name index = @mess.push :name