fixing lengths
This commit is contained in:
parent
c15445a958
commit
6882f39645
@ -78,15 +78,5 @@ module Parfait
|
|||||||
"#{self.for_class.name}:#{name}(#{arguments.inspect})"
|
"#{self.for_class.name}:#{name}(#{arguments.inspect})"
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_byte_length
|
|
||||||
self.instructions.total_byte_length
|
|
||||||
end
|
|
||||||
|
|
||||||
# position of the function is the position of the entry block, is where we call
|
|
||||||
def set_position at
|
|
||||||
at += 8 #for the 2 header words
|
|
||||||
self.instructions.set_position at
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -122,10 +122,6 @@ module Parfait
|
|||||||
"'" + to_s + "'"
|
"'" + to_s + "'"
|
||||||
end
|
end
|
||||||
|
|
||||||
def word_length
|
|
||||||
padded self.length
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def check_length
|
def check_length
|
||||||
raise "Length out of bounds #{self.char_length}" if self.char_length > 32
|
raise "Length out of bounds #{self.char_length}" if self.char_length > 32
|
||||||
|
@ -12,8 +12,7 @@ class TestPositioning < MiniTest::Test
|
|||||||
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)
|
||||||
# TODO check why this is 64 and not 32
|
assert_equal 32 , list.word_length
|
||||||
assert_equal 64 , list.word_length
|
|
||||||
end
|
end
|
||||||
def test_layout
|
def test_layout
|
||||||
layout = Parfait::Layout.new Object
|
layout = Parfait::Layout.new Object
|
||||||
@ -21,4 +20,8 @@ class TestPositioning < MiniTest::Test
|
|||||||
layout.push 5
|
layout.push 5
|
||||||
assert_equal 32 , layout.word_length
|
assert_equal 32 , layout.word_length
|
||||||
end
|
end
|
||||||
|
def test_word
|
||||||
|
word = Parfait::Word.new(12)
|
||||||
|
assert_equal 32 , word.word_length
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user