Booting functions again and send test

both class and normal sending tests at vool / mom level
This commit is contained in:
2019-08-12 11:57:32 +03:00
parent 2326081161
commit a4b6f29834
10 changed files with 36 additions and 41 deletions

View File

@ -4,12 +4,13 @@ module Vool
# relies on @ins and receiver_type method
module ClassHarness
include MomCompile
include VoolCompile
def setup
Parfait.boot!(Parfait.default_test_options)
#Risc::Builtin.boot_functions
@ins = compile_first_method( send_method )
Risc.boot!
@compiler = compile_first_method( send_method )
@ins = @compiler.mom_instructions.next
end
def test_first_not_array
@ -19,7 +20,7 @@ module Vool
assert_equal Mom::MessageSetup , @ins.class , @ins
end
def test_two_instructions_are_returned
assert_equal 3 , @ins.length , @ins
assert_equal 6 , @ins.length , @ins
end
def test_receiver_move_class
assert_equal Mom::ArgumentTransfer, @ins.next(1).class
@ -37,7 +38,8 @@ module Vool
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
end
def test_array
check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label,
ReturnSequence , Label] , @ins
end
end

View File

@ -17,16 +17,8 @@ module Vool
end
def setup
statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(class_main)
assert_equal Vool::ClassStatement, statements.class
ret = statements.to_mom(nil)
assert_equal Parfait::Class , statements.clazz.class , statements
@method = statements.clazz.get_method(:main)
assert_equal Parfait::VoolMethod , @method.class
assert_equal Mom::MomCompiler , ret.class
compiler = ret.method_compilers.find{|c| c.get_method.name == :main }
assert_equal Risc::MethodCompiler , compiler.class
@ins = @method.source.to_mom( compiler )
ret = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(class_main)
@ins = ret.compilers.first.mom_instructions.next
end
def test_any
@ -35,7 +27,7 @@ module Vool
def test_no_arg
assert_equal Mom::ArgumentTransfer, @ins.next(1).class
assert_equal 0, @ins.next(1).arguments.length
assert_equal 1, @ins.next(1).arguments.length
end
def test_call_two
assert_equal SimpleCall, @ins.next(2).class

View File

@ -2,7 +2,6 @@ require_relative "helper"
module Vool
class ClassSendHarness < MiniTest::Test
include MomCompile
include ClassHarness
def send_method

View File

@ -3,7 +3,6 @@ require_relative "helper"
module Vool
class TestSendClassMom < MiniTest::Test
include ClassHarness
include Mom
def send_method
"Object.get_internal_word(0)"