rubyx/test/risc/test_collector.rb
Torsten Rüger 7ca3599c5a Fixed all after changing argument handling
arguments are now fully inlined into the message
locals next
2019-08-22 23:10:29 +03:00

74 lines
2.0 KiB
Ruby

require_relative "../helper"
module Risc
class TestCollector < MiniTest::Test
def setup
Parfait.boot!(Parfait.default_test_options)
Risc.boot!
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
end
def test_simple_collect
objects = Collector.collect_space(@linker)
assert_equal 602 , objects.length , objects.length.to_s
end
def test_collect_all_types
Collector.collect_space(@linker).each do |objekt , position|
next unless objekt.is_a?( Parfait::Type )
assert Parfait.object_space.get_type_for( objekt.hash ) , objekt.hash
end
end
def test_allowed_types
Collector.collect_space(@linker).each do |objekt , position|
next if objekt.is_a?( Parfait::Object )
next if objekt.is_a?( Symbol )
assert false
end
end
def test_positions
Collector.collect_space(@linker).each do |objekt , position|
assert_equal Position , position.class
assert !position.valid?
end
end
def test_integer_positions
objects = Collector.collect_space(@linker)
int = Parfait.object_space.get_next_for(:Integer)
while(int)
assert Position.set?(int) , "INt #{int.object_id}"
int = int.next_integer
end
end
end
class TestBigCollector < MiniTest::Test
def setup
opt = Parfait.default_test_options
opt[:factory] = 400
Parfait.boot!(opt)
Risc.boot!
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
end
def test_simple_collect
objects = Collector.collect_space(@linker)
assert_equal 2402, objects.length , objects.length.to_s
end
def test_integer_positions
objects = Collector.collect_space(@linker)
int = Parfait.object_space.get_next_for(:Integer)
count = 0
while(int)
count += 1
assert Position.set?(int) , "INT #{int.object_id} , count #{count}"
int = int.next_integer
end
end
end
end