each word for binary
This commit is contained in:
parent
7cf253ad9c
commit
00be522419
@ -23,6 +23,13 @@ module Parfait
|
|||||||
def to_s
|
def to_s
|
||||||
"BinaryCode #{}"
|
"BinaryCode #{}"
|
||||||
end
|
end
|
||||||
|
def each_word
|
||||||
|
index = 1
|
||||||
|
while( index <= 14)
|
||||||
|
yield get_internal_word(index)
|
||||||
|
index += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
#16 - 2 -1 , two instance varaibles and one for the jump
|
#16 - 2 -1 , two instance varaibles and one for the jump
|
||||||
def data_length
|
def data_length
|
||||||
13
|
13
|
||||||
|
@ -48,16 +48,25 @@ module Parfait
|
|||||||
def data_length
|
def data_length
|
||||||
1
|
1
|
||||||
end
|
end
|
||||||
|
def padded_length
|
||||||
|
2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Data8 < DataObject
|
class Data8 < DataObject
|
||||||
def data_length
|
def data_length
|
||||||
7
|
7
|
||||||
end
|
end
|
||||||
|
def padded_length
|
||||||
|
8
|
||||||
|
end
|
||||||
end
|
end
|
||||||
class Data16 < DataObject
|
class Data16 < DataObject
|
||||||
def data_length
|
def data_length
|
||||||
15
|
15
|
||||||
end
|
end
|
||||||
|
def padded_length
|
||||||
|
16
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -69,5 +69,10 @@ module Parfait
|
|||||||
assert @code.next
|
assert @code.next
|
||||||
assert_nil @code.next.next
|
assert_nil @code.next.next
|
||||||
end
|
end
|
||||||
|
def test_each
|
||||||
|
len = 0
|
||||||
|
@code.each_word{ len += 1}
|
||||||
|
assert_equal 14 , len
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user