2016-12-31 21:05:19 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
2017-01-19 09:02:29 +02:00
|
|
|
module Risc
|
2016-12-31 21:05:19 +02:00
|
|
|
class TestCollector < MiniTest::Test
|
2018-03-26 19:43:03 +03:00
|
|
|
|
|
|
|
def setup
|
2018-06-30 00:39:23 +03:00
|
|
|
Parfait.boot!
|
2018-07-01 14:12:42 +03:00
|
|
|
Risc.boot!
|
2018-07-02 16:19:01 +03:00
|
|
|
@linker = Mom::MomCompiler.new.translate(:arm)
|
2018-03-26 19:43:03 +03:00
|
|
|
end
|
|
|
|
|
2016-12-31 21:05:19 +02:00
|
|
|
def test_simple_collect
|
2018-07-01 14:12:42 +03:00
|
|
|
objects = Collector.collect_space(@linker)
|
2018-03-27 19:06:16 +03:00
|
|
|
assert ((400 < objects.length) or (450 > objects.length)) , objects.length.to_s
|
2016-12-31 21:05:19 +02:00
|
|
|
end
|
2018-03-26 19:43:03 +03:00
|
|
|
|
|
|
|
def test_collect_all_types
|
2018-07-01 14:12:42 +03:00
|
|
|
Collector.collect_space(@linker).each do |objekt , position|
|
2018-03-26 19:43:03 +03:00
|
|
|
next unless objekt.is_a?( Parfait::Type )
|
|
|
|
assert Parfait.object_space.get_type_for( objekt.hash ) , objekt.hash
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:06:16 +03:00
|
|
|
def test_allowed_types
|
2018-07-01 14:12:42 +03:00
|
|
|
Collector.collect_space(@linker).each do |objekt , position|
|
2018-03-27 19:06:16 +03:00
|
|
|
next if objekt.is_a?( Parfait::Object )
|
|
|
|
next if objekt.is_a?( Symbol )
|
2018-06-15 21:54:21 +03:00
|
|
|
assert false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def test_positions
|
2018-07-01 14:12:42 +03:00
|
|
|
Collector.collect_space(@linker).each do |objekt , position|
|
2018-06-15 21:54:21 +03:00
|
|
|
assert_equal Position , position.class
|
|
|
|
assert !position.valid?
|
2018-03-27 19:06:16 +03:00
|
|
|
end
|
|
|
|
end
|
2016-12-31 21:05:19 +02:00
|
|
|
end
|
|
|
|
end
|