From 5bddbfbb625854f6b9b2ee5210d9bde775950ff0 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 4 Nov 2015 10:33:10 +0200 Subject: [PATCH] rename word_length to padded length with word_length i was never sure if it was the padded version or not --- lib/parfait/indexed.rb | 4 ++-- lib/parfait/object.rb | 4 ++-- lib/register/parfait_adapter.rb | 4 ++-- test/register/test_positioning.rb | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/parfait/indexed.rb b/lib/parfait/indexed.rb index ed71ac26..7e90678f 100644 --- a/lib/parfait/indexed.rb +++ b/lib/parfait/indexed.rb @@ -99,8 +99,8 @@ module Parfait # This is off course 0 for a list, unless someone squeezed an instance variable in # but additionally, the amount of data comes on top. # unfortuntely we can't just use super because of the Padding - def word_length - padded_words( get_layout().get_length() + get_length() ) + def padded_length + padded_words( get_layout().instance_length + get_length() ) end def each diff --git a/lib/parfait/object.rb b/lib/parfait/object.rb index ff2a7040..dacfaecd 100644 --- a/lib/parfait/object.rb +++ b/lib/parfait/object.rb @@ -92,8 +92,8 @@ module Parfait get_layout().variable_index(name) end - def word_length - padded_words( get_layout().get_length() ) + def padded_length + padded_words( get_layout().instance_length ) end # Object diff --git a/lib/register/parfait_adapter.rb b/lib/register/parfait_adapter.rb index 48cae018..d35e2bc7 100644 --- a/lib/register/parfait_adapter.rb +++ b/lib/register/parfait_adapter.rb @@ -28,8 +28,8 @@ class Symbol #puts "LL #{l.class}" l end - def word_length - padded to_s.length + def padded_length + padded to_s.length + 4 end # not the prettiest addition to the game, but it wasn't me who decided symbols are frozen in 2.x def cache_positions diff --git a/test/register/test_positioning.rb b/test/register/test_positioning.rb index f1648b96..704dafb4 100644 --- a/test/register/test_positioning.rb +++ b/test/register/test_positioning.rb @@ -7,21 +7,21 @@ class TestPositioning < MiniTest::Test def test_list1 list = Register.new_list([1]) list.set_layout( Parfait::Layout.new Object) - assert_equal 32 , list.word_length + assert_equal 32 , list.padded_length end def test_list5 list = Register.new_list([1,2,3,4,5]) list.set_layout( Parfait::Layout.new Object) - assert_equal 32 , list.word_length + assert_equal 32 , list.padded_length end def test_layout layout = Parfait::Layout.new Object layout.set_layout( Parfait::Layout.new Object) layout.push 5 - assert_equal 32 , layout.word_length + assert_equal 32 , layout.padded_length end def test_word word = Parfait::Word.new(12) - assert_equal 32 , word.word_length + assert_equal 32 , word.padded_length end end