small test improvement
This commit is contained in:
parent
c346260bde
commit
2c5541fb19
@ -6,6 +6,7 @@ class TestDictionary < MiniTest::Test
|
|||||||
@lookup = ::Parfait::Dictionary.new
|
@lookup = ::Parfait::Dictionary.new
|
||||||
end
|
end
|
||||||
def test_dict_create
|
def test_dict_create
|
||||||
|
assert_equal 0 , @lookup.length
|
||||||
assert @lookup.empty?
|
assert @lookup.empty?
|
||||||
end
|
end
|
||||||
def test_empty_dict_doesnt_return
|
def test_empty_dict_doesnt_return
|
||||||
@ -14,6 +15,17 @@ class TestDictionary < MiniTest::Test
|
|||||||
end
|
end
|
||||||
def test_one_set1
|
def test_one_set1
|
||||||
assert_equal 1 , @lookup.set(1,1)
|
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
|
end
|
||||||
def test_one_set2
|
def test_one_set2
|
||||||
assert_equal :some , @lookup.set(1,:some)
|
assert_equal :some , @lookup.set(1,:some)
|
||||||
|
@ -6,15 +6,17 @@ module Register
|
|||||||
include Statements
|
include Statements
|
||||||
|
|
||||||
def test_field_frame
|
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]
|
@expect = [Label, GetSlot, GetSlot, GetSlot, SetSlot, Label, FunctionReturn]
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_field_arg
|
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)))))
|
@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 ,
|
@expect = [Label, GetSlot, GetSlot, SetSlot, LoadConstant, SetSlot, LoadConstant ,
|
||||||
|
Loading…
Reference in New Issue
Block a user