From 2c5541fb195c8392d24dca2278e4d5890f7d1d12 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 13 Dec 2016 18:48:42 +0200 Subject: [PATCH] small test improvement --- test/typed/parfait/test_dictionary.rb | 12 ++++++++++++ test/typed/statements/test_fields.rb | 10 ++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/typed/parfait/test_dictionary.rb b/test/typed/parfait/test_dictionary.rb index 92808ef0..2000815b 100644 --- a/test/typed/parfait/test_dictionary.rb +++ b/test/typed/parfait/test_dictionary.rb @@ -6,6 +6,7 @@ class TestDictionary < MiniTest::Test @lookup = ::Parfait::Dictionary.new end def test_dict_create + assert_equal 0 , @lookup.length assert @lookup.empty? end def test_empty_dict_doesnt_return @@ -14,6 +15,17 @@ class TestDictionary < MiniTest::Test end def test_one_set1 assert_equal 1 , @lookup.set(1,1) + assert_equal 1 , @lookup.length + end + def test_one_double + assert_equal 1 , @lookup.set(1,1) + assert_equal 3 , @lookup.set(1,3) + assert_equal 1 , @lookup.length + end + def test_one_double2 + assert_equal 1 , @lookup.set(:one,1) + assert_equal 3 , @lookup.set(:one,3) + assert_equal 1 , @lookup.length end def test_one_set2 assert_equal :some , @lookup.set(1,:some) diff --git a/test/typed/statements/test_fields.rb b/test/typed/statements/test_fields.rb index 46da266d..c605cbe8 100644 --- a/test/typed/statements/test_fields.rb +++ b/test/typed/statements/test_fields.rb @@ -6,15 +6,17 @@ module Register include Statements def test_field_frame - @input = s(:statements, s(:field_def, :Message, s(:name, :m)), s(:return, s(:field_access, s(:receiver, s(:name, :m)), s(:field, s(:name, :name))))) - + @input = s(:statements, s(:field_def, :Message, s(:name, :m)), + s(:return, s(:field_access, s(:receiver, s(:name, :m)), s(:field, s(:name, :name))))) @expect = [Label, GetSlot, GetSlot, GetSlot, SetSlot, Label, FunctionReturn] check end def test_field_arg - clean_compile s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :get_name), s(:parameters, s(:parameter, :Message, :main)), s(:statements, s(:return, s(:field_access, s(:receiver, s(:name, :main)), s(:field, s(:name, :name))))))))) - + clean_compile s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, + s(:function, :Integer, s(:name, :get_name), s(:parameters, s(:parameter, :Message, :main)), + s(:statements, s(:return, s(:field_access, + s(:receiver, s(:name, :main)), s(:field, s(:name, :name))))))))) @input =s(:statements, s(:field_def, :Message, s(:name, :m)), s(:return, s(:call, s(:name, :get_name), s(:arguments, s(:name, :m))))) @expect = [Label, GetSlot, GetSlot, SetSlot, LoadConstant, SetSlot, LoadConstant ,