2016-12-31 20:05:19 +01:00
|
|
|
require_relative "../helper"
|
|
|
|
|
2017-01-19 08:02:29 +01:00
|
|
|
module Risc
|
2016-12-31 20:05:19 +01:00
|
|
|
class TestCollector < MiniTest::Test
|
2018-03-26 18:43:03 +02:00
|
|
|
|
|
|
|
def setup
|
|
|
|
@machine = Risc.machine.boot
|
|
|
|
end
|
|
|
|
|
2016-12-31 20:05:19 +01:00
|
|
|
def test_simple_collect
|
2017-01-19 08:02:29 +01:00
|
|
|
objects = Risc::Collector.collect_space
|
2018-03-27 18:06:16 +02:00
|
|
|
assert ((400 < objects.length) or (450 > objects.length)) , objects.length.to_s
|
2016-12-31 20:05:19 +01:00
|
|
|
end
|
2018-03-26 18:43:03 +02:00
|
|
|
|
|
|
|
def test_collect_all_types
|
2018-03-27 18:06:16 +02:00
|
|
|
Risc::Collector.collect_space.each do |id, objekt|
|
2018-03-26 18:43:03 +02:00
|
|
|
next unless objekt.is_a?( Parfait::Type )
|
|
|
|
assert Parfait.object_space.get_type_for( objekt.hash ) , objekt.hash
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-27 18:06:16 +02:00
|
|
|
def test_allowed_types
|
|
|
|
Risc::Collector.collect_space.each do |id, objekt|
|
|
|
|
next if objekt.is_a?( Parfait::Object )
|
|
|
|
next if objekt.is_a?( Symbol )
|
|
|
|
assert_equal 1 , objekt.class
|
|
|
|
end
|
|
|
|
end
|
2016-12-31 20:05:19 +01:00
|
|
|
end
|
|
|
|
end
|