fixed the old list tests for hash, and fixed hash to pass them

This commit is contained in:
Torsten Ruger 2014-08-28 16:28:25 +03:00
parent d3c4087871
commit da3cd69a5c
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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?