add next_value for dictionary
also next for list and add types attributes to space
This commit is contained in:
@ -76,4 +76,22 @@ module Parfait
|
||||
assert @lookup[2] == :two
|
||||
end
|
||||
end
|
||||
class TestDictionaryNextValue < ParfaitTest
|
||||
def setup
|
||||
super
|
||||
@lookup = ::Parfait::Dictionary.new
|
||||
@lookup[:key1] = :value1
|
||||
@lookup[:key2] = :value2
|
||||
@lookup[:key3] = :value3
|
||||
end
|
||||
def test_next_value_ok
|
||||
assert_equal :value2 , @lookup.next_value(:value1)
|
||||
end
|
||||
def test_next_value_end
|
||||
assert_equal :value3 , @lookup.next_value(:value2)
|
||||
end
|
||||
def test_next_value_not
|
||||
assert_nil @lookup.next_value(:value3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -198,4 +198,22 @@ module Parfait
|
||||
assert_nil @list.last
|
||||
end
|
||||
end
|
||||
class TestListContains < ParfaitTest
|
||||
def setup
|
||||
super
|
||||
@list = ::Parfait::List.new
|
||||
@list.push :one
|
||||
@list.push :two
|
||||
end
|
||||
|
||||
def test_next_value_ok
|
||||
assert_equal :two , @list.next_value(:one)
|
||||
end
|
||||
def test_next_value_end
|
||||
assert_nil @list.next_value(:two)
|
||||
end
|
||||
def test_next_value_not_int
|
||||
assert_nil @list.next_value(:three)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -43,6 +43,9 @@ module Parfait
|
||||
def test_types
|
||||
assert @space.instance_variable_ged("@types").is_a? Parfait::Dictionary
|
||||
end
|
||||
def test_types_attr
|
||||
assert @space.types.is_a? Parfait::Dictionary
|
||||
end
|
||||
|
||||
def test_types_each
|
||||
@space.each_type do |type|
|
||||
|
Reference in New Issue
Block a user