fixed the old list tests for hash, and fixed hash to pass them
This commit is contained in:
parent
d3c4087871
commit
da3cd69a5c
@ -5,7 +5,7 @@ class Hash
|
||||
@values = Array.new()
|
||||
end
|
||||
def empty?
|
||||
@keys.nil?
|
||||
@keys.empty?
|
||||
end
|
||||
|
||||
def length()
|
||||
@ -15,7 +15,7 @@ class Hash
|
||||
def get(key)
|
||||
index = key_index(key)
|
||||
if( index )
|
||||
@keys[index]
|
||||
@values[index]
|
||||
else
|
||||
nil
|
||||
end
|
||||
@ -41,8 +41,9 @@ class Hash
|
||||
@keys[index] = value
|
||||
else
|
||||
@keys.push(key)
|
||||
@value.push(value)
|
||||
@values.push(value)
|
||||
end
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require "parfait/hash"
|
||||
|
||||
class TestLists < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@list = List.new
|
||||
@list = Hash.new
|
||||
end
|
||||
def test_list_create
|
||||
assert @list.empty?
|
Loading…
Reference in New Issue
Block a user