fix binary code set_char bug
This commit is contained in:
parent
e61ef93943
commit
3fcb4b74c7
@ -14,7 +14,7 @@ module Parfait
|
|||||||
if total_size > self.data_length
|
if total_size > self.data_length
|
||||||
@next = BinaryCode.new(total_size - data_length)
|
@next = BinaryCode.new(total_size - data_length)
|
||||||
end
|
end
|
||||||
puts "Init with #{total_size} for #{object_id}"
|
#puts "Init with #{total_size} for #{object_id}"
|
||||||
(1..(data_length+1)).each{ |index| set_word(index , 0) }
|
(1..(data_length+1)).each{ |index| set_word(index , 0) }
|
||||||
end
|
end
|
||||||
def to_s
|
def to_s
|
||||||
@ -45,8 +45,8 @@ module Parfait
|
|||||||
end
|
end
|
||||||
def set_char(index , char)
|
def set_char(index , char)
|
||||||
if index >= byte_length
|
if index >= byte_length
|
||||||
puts "Pass it on #{index} for #{object_id}"
|
#puts "Pass it on #{index} for #{self.object_id}:#{@next.object_id}"
|
||||||
return @next.set_char( char , index - byte_length)
|
return @next.set_char( index - byte_length , char )
|
||||||
end
|
end
|
||||||
word_index = (index - 1) / 4 + 2
|
word_index = (index - 1) / 4 + 2
|
||||||
old = get_internal_word( word_index )
|
old = get_internal_word( word_index )
|
||||||
|
@ -49,7 +49,7 @@ module Parfait
|
|||||||
end
|
end
|
||||||
def test_set_char56_double
|
def test_set_char56_double
|
||||||
@code = BinaryCode.new(16)
|
@code = BinaryCode.new(16)
|
||||||
assert @code.set_char(56 , 1)
|
assert @code.set_char(56 , 120)
|
||||||
end
|
end
|
||||||
def test_nilled
|
def test_nilled
|
||||||
assert_equal 0 , @code.get_word(1)
|
assert_equal 0 , @code.get_word(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user