fixing the tests from all the previous changes

This commit is contained in:
Torsten Ruger
2016-12-29 18:50:10 +02:00
parent 25f44949e4
commit e3de4efe02
7 changed files with 50 additions and 72 deletions

View File

@ -12,8 +12,8 @@ class TestAttributes < MiniTest::Test
end
def test_message_name_nil
last = @type.instance_names.last
assert_equal :arguments , last , @type.instance_names.inspect
last = @type.names.last
assert_equal :arguments , last , @type.names.inspect
assert_nil @mess.name
end
def test_message_next_set
@ -21,21 +21,14 @@ class TestAttributes < MiniTest::Test
assert_equal :next_message , @mess.next_message
end
def test_message_type_set
@mess.set_type :type
assert_equal :type , @mess.get_type
@mess.set_type @type
assert_equal @type , @mess.get_type
end
def test_attribute_index
@mess.next_message = :message
assert_equal Parfait::Type , @mess.get_type.class
end
def test_type_attribute
@type.object_class = :message
assert_equal :message , @type.object_class
end
def test_type_attribute_check
@type.object_class = :message
assert_equal Parfait::Type , @type.get_type.class
end
def test_type_type
assert_equal Parfait::Type , @type.get_type.get_type.class
end

View File

@ -60,4 +60,11 @@ class TestDictionary < MiniTest::Test
assert_equal v , shouldda[k]
end
end
def test_values
assert @lookup.values
end
def test_keys
assert @lookup.keys
end
end

View File

@ -34,7 +34,7 @@ class TestList < MiniTest::Test
def test_length0
assert_equal 0 , @list.get_length
assert_nil @list.indexed_length
assert_equal 0, @list.indexed_length
end
def test_offset
assert_equal 2 , @list.get_offset

View File

@ -6,44 +6,12 @@ class TestObject < MiniTest::Test
@object = ::Parfait::Object.new
end
def test_object_create
# another test sometime adds a field variable. Maybe should reboot ?
res = 1
[:boo1 , :boo2 , :bro , :runner].each { |v| res += 1 if @object.get_type.variable_index(v) }
assert_equal res , @object.get_type.instance_length , @object.get_type.inspect
end
def test_empty_object_doesnt_return
assert_nil @object.get_internal_word(3)
assert_nil @object.get_internal_word(3)
end
def test_one_set1
assert_equal 1 , @object.set_internal_word(1,1)
assert_equal @object.get_type , @object.set_internal_word(1, @object.get_type)
end
def test_one_set2
assert_equal :some , @object.set_internal_word(2,:some)
end
def test_two_sets
assert_equal 1 , @object.set_internal_word(1,1)
assert_equal :some , @object.set_internal_word(1,:some)
end
def test_one_get1
test_one_set1
assert_equal 1 , @object.get_internal_word(1)
end
def test_one_get2
test_one_set2
assert_equal :some , @object.get_internal_word(2)
end
def test_many_get
shouldda = { 1 => :one , 2 => :two , 3 => :three}
shouldda.each do |k,v|
@object.set_internal_word(k,v)
end
shouldda.each do |k,v|
assert_equal v , @object.get_internal_word(k)
end
end
end