found bug and more tests
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user