diff --git a/lib/parfait/hash.rb b/lib/parfait/hash.rb index d4b1c4ce..43469d08 100644 --- a/lib/parfait/hash.rb +++ b/lib/parfait/hash.rb @@ -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 diff --git a/test/unit/list.rb b/test/unit/hash.rb similarity index 95% rename from test/unit/list.rb rename to test/unit/hash.rb index 8f95ad3f..c15b95e5 100644 --- a/test/unit/list.rb +++ b/test/unit/hash.rb @@ -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?