2019-08-13 18:32:17 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Risc
|
2019-08-13 19:35:27 +02:00
|
|
|
class TestBlockSetupBlock < MiniTest::Test
|
2019-08-13 18:32:17 +02:00
|
|
|
include Statements
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@input = as_block("return 5")
|
2019-09-12 12:10:31 +02:00
|
|
|
@mom = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(as_main)
|
2019-08-13 18:32:17 +02:00
|
|
|
end
|
|
|
|
def main_risc
|
|
|
|
@mom.to_risc.method_compilers.find{|c| c.callable.name == :main }
|
|
|
|
end
|
|
|
|
def test_mom
|
|
|
|
assert_equal Mom::MomCollection , @mom.class
|
|
|
|
end
|
|
|
|
def test_mom_block_comp
|
|
|
|
assert_equal 1 , @mom.method_compilers.first.block_compilers.length
|
|
|
|
end
|
|
|
|
def test_risc
|
|
|
|
assert_equal Risc::RiscCollection , @mom.to_risc.class
|
|
|
|
end
|
|
|
|
def test_risc_comp
|
|
|
|
assert_equal :main , main_risc.callable.name
|
|
|
|
end
|
|
|
|
def test_risc_block_comp
|
|
|
|
assert_equal 1 , main_risc.block_compilers.length
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|