split existing type tests

This commit is contained in:
Torsten Ruger 2016-12-06 17:03:15 +02:00
parent 3b4dbd052d
commit fe195df10e
3 changed files with 30 additions and 20 deletions

View File

@ -1 +1,2 @@
require_relative "test_type" require_relative "test_basic"
require_relative "test_message"

View File

@ -1,25 +1,11 @@
require_relative "../helper" require_relative "../helper"
class TestType < MiniTest::Test class BasicType < MiniTest::Test
def setup def setup
@mess = Register.machine.boot.space.first_message @mess = Register.machine.boot.space.first_message
end end
def test_message_type
type = @mess.get_type
assert type
assert @mess.instance_variable_defined :next_message
assert_equal @mess.next_message , @mess.get_instance_variable(:next_message)
end
def test_message_by_index
assert_equal @mess.next_message , @mess.get_instance_variable(:next_message)
index = @mess.get_type.variable_index :next_message
assert_equal 2 , index
assert_equal @mess.next_message , @mess.get_internal_word(index)
end
def test_type_index def test_type_index
assert_equal @mess.get_type , @mess.get_internal_word(Parfait::TYPE_INDEX) , "mess" assert_equal @mess.get_type , @mess.get_internal_word(Parfait::TYPE_INDEX) , "mess"
end end
@ -49,10 +35,6 @@ class TestType < MiniTest::Test
assert_equal 8 , @mess.get_type.get_type.get_internal_word(4) assert_equal 8 , @mess.get_type.get_type.get_internal_word(4)
end end
def test_type_methods
assert_equal 3 , @mess.get_type.get_type.variable_index(:instance_methods)
end
def test_no_index_below_1 def test_no_index_below_1
type = @mess.get_type type = @mess.get_type
names = type.instance_names names = type.instance_names

View File

@ -0,0 +1,27 @@
require_relative "../helper"
class TypeMessages < MiniTest::Test
def setup
@mess = Register.machine.boot.space.first_message
end
def test_message_type
type = @mess.get_type
assert type
assert @mess.instance_variable_defined :next_message
assert_equal @mess.next_message , @mess.get_instance_variable(:next_message)
end
def test_message_by_index
assert_equal @mess.next_message , @mess.get_instance_variable(:next_message)
index = @mess.get_type.variable_index :next_message
assert_equal 2 , index
assert_equal @mess.next_message , @mess.get_internal_word(index)
end
def test_type_methods
assert_equal 3 , @mess.get_type.get_type.variable_index(:instance_methods)
end
end