found bug and more tests

This commit is contained in:
Torsten Ruger
2015-05-21 21:50:39 +03:00
parent 531d3e181a
commit b4eb14e639
2 changed files with 18 additions and 1 deletions

View File

@ -19,11 +19,13 @@ module Parfait
internal_object_length - 1
end
# index of item, remeber first item has index 1
# return nil if no such item
def index_of( item )
max = self.get_length
counter = 1
while( counter < max )
if( get(index) == item)
if( get(counter) == item)
return counter
end
counter = counter + 1
@ -31,6 +33,11 @@ module Parfait
return nil
end
# include? means non nil index
def include? item
return index_of(item) != nil
end
# push means add to the end
# this automatically grows the List
def push value