rename word_length to padded length
with word_length i was never sure if it was the padded version or not
This commit is contained in:
parent
6ada815735
commit
5bddbfbb62
@ -99,8 +99,8 @@ module Parfait
|
|||||||
# This is off course 0 for a list, unless someone squeezed an instance variable in
|
# This is off course 0 for a list, unless someone squeezed an instance variable in
|
||||||
# but additionally, the amount of data comes on top.
|
# but additionally, the amount of data comes on top.
|
||||||
# unfortuntely we can't just use super because of the Padding
|
# unfortuntely we can't just use super because of the Padding
|
||||||
def word_length
|
def padded_length
|
||||||
padded_words( get_layout().get_length() + get_length() )
|
padded_words( get_layout().instance_length + get_length() )
|
||||||
end
|
end
|
||||||
|
|
||||||
def each
|
def each
|
||||||
|
@ -92,8 +92,8 @@ module Parfait
|
|||||||
get_layout().variable_index(name)
|
get_layout().variable_index(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def word_length
|
def padded_length
|
||||||
padded_words( get_layout().get_length() )
|
padded_words( get_layout().instance_length )
|
||||||
end
|
end
|
||||||
|
|
||||||
# Object
|
# Object
|
||||||
|
@ -28,8 +28,8 @@ class Symbol
|
|||||||
#puts "LL #{l.class}"
|
#puts "LL #{l.class}"
|
||||||
l
|
l
|
||||||
end
|
end
|
||||||
def word_length
|
def padded_length
|
||||||
padded to_s.length
|
padded to_s.length + 4
|
||||||
end
|
end
|
||||||
# not the prettiest addition to the game, but it wasn't me who decided symbols are frozen in 2.x
|
# not the prettiest addition to the game, but it wasn't me who decided symbols are frozen in 2.x
|
||||||
def cache_positions
|
def cache_positions
|
||||||
|
@ -7,21 +7,21 @@ class TestPositioning < MiniTest::Test
|
|||||||
def test_list1
|
def test_list1
|
||||||
list = Register.new_list([1])
|
list = Register.new_list([1])
|
||||||
list.set_layout( Parfait::Layout.new Object)
|
list.set_layout( Parfait::Layout.new Object)
|
||||||
assert_equal 32 , list.word_length
|
assert_equal 32 , list.padded_length
|
||||||
end
|
end
|
||||||
def test_list5
|
def test_list5
|
||||||
list = Register.new_list([1,2,3,4,5])
|
list = Register.new_list([1,2,3,4,5])
|
||||||
list.set_layout( Parfait::Layout.new Object)
|
list.set_layout( Parfait::Layout.new Object)
|
||||||
assert_equal 32 , list.word_length
|
assert_equal 32 , list.padded_length
|
||||||
end
|
end
|
||||||
def test_layout
|
def test_layout
|
||||||
layout = Parfait::Layout.new Object
|
layout = Parfait::Layout.new Object
|
||||||
layout.set_layout( Parfait::Layout.new Object)
|
layout.set_layout( Parfait::Layout.new Object)
|
||||||
layout.push 5
|
layout.push 5
|
||||||
assert_equal 32 , layout.word_length
|
assert_equal 32 , layout.padded_length
|
||||||
end
|
end
|
||||||
def test_word
|
def test_word
|
||||||
word = Parfait::Word.new(12)
|
word = Parfait::Word.new(12)
|
||||||
assert_equal 32 , word.word_length
|
assert_equal 32 , word.padded_length
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user