rubyx/test/rubyx/test_rubyx_compiler2.rb
Torsten Rüger d1f8733623 Rename Vool to Sol
Simple is really the descriptive name for the layer
Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified)
Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else
Just cause i was renaming anyway
2019-10-04 00:38:47 +03:00

46 lines
1.4 KiB
Ruby

require_relative "helper"
module RubyX
class TestRubyXCompilerRisc < MiniTest::Test
include ScopeHelper
include RubyXHelper
def setup
super
code = "class Space ; def main(arg);return arg;end; end"
@comp = RubyXCompiler.new(load_parfait: true )
@collection = @comp.ruby_to_risc(code)
end
def test_to_risc
assert_equal Risc::RiscCollection , @collection.class
end
def test_linker
assert_equal Risc::Linker , @collection.translate(:interpreter).class
end
def test_method
linker = @collection.translate(:interpreter)
assert_equal :main , linker.assemblers.first.callable.name
end
def test_asm_len
linker = @collection.translate(:interpreter)
assert_equal 3 , linker.assemblers.length
end
end
class TestRubyXCompilerParfait < MiniTest::Test
include ScopeHelper
include RubyXHelper
def setup
super
code = "class Space ; def self.class_method(); return 1; end;def main(arg);return Space.class_method;end; end"
@comp = RubyXCompiler.ruby_to_binary(code , load_parfait: true , platform: :interpreter)
end
def test_load
object = Parfait.object_space.get_class_by_name(:Object)
assert_equal Parfait::SolMethod , object.get_instance_method(:set_type).class
assert_equal Parfait::CallableMethod , object.instance_type.get_method(:set_type).class
end
end
end