fix object grow
and write a test (and another one …)
This commit is contained in:
parent
1114f06921
commit
701b0bc011
@ -58,8 +58,7 @@ module Parfait
|
||||
old_length = internal_object_length()
|
||||
while( old_length < length )
|
||||
internal_object_set( old_length + 1, nil)
|
||||
|
||||
|
||||
old_length = old_length + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
require_relative "test_object"
|
||||
require_relative "test_list"
|
||||
require_relative "test_word"
|
||||
require_relative "test_dictionary"
|
||||
|
@ -10,6 +10,11 @@ class TestObject < MiniTest::Test
|
||||
assert_equal 0 , @object.internal_object_length
|
||||
end
|
||||
|
||||
def test_list_grow
|
||||
@object.internal_object_grow( 2 )
|
||||
assert_equal 2 , @object.internal_object_length
|
||||
end
|
||||
|
||||
def test_empty_list_doesnt_return
|
||||
assert_equal nil , @object.internal_object_get(3)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user