fix object grow

and write a test (and another one …)
This commit is contained in:
Torsten Ruger 2015-05-17 14:44:48 +03:00
parent 1114f06921
commit 701b0bc011
3 changed files with 7 additions and 2 deletions

View File

@ -58,8 +58,7 @@ module Parfait
old_length = internal_object_length() old_length = internal_object_length()
while( old_length < length ) while( old_length < length )
internal_object_set( old_length + 1, nil) internal_object_set( old_length + 1, nil)
old_length = old_length + 1
end end
end end
end end

View File

@ -1,3 +1,4 @@
require_relative "test_object"
require_relative "test_list" require_relative "test_list"
require_relative "test_word" require_relative "test_word"
require_relative "test_dictionary" require_relative "test_dictionary"

View File

@ -10,6 +10,11 @@ class TestObject < MiniTest::Test
assert_equal 0 , @object.internal_object_length assert_equal 0 , @object.internal_object_length
end end
def test_list_grow
@object.internal_object_grow( 2 )
assert_equal 2 , @object.internal_object_length
end
def test_empty_list_doesnt_return def test_empty_list_doesnt_return
assert_equal nil , @object.internal_object_get(3) assert_equal nil , @object.internal_object_get(3)
end end