Fixing tests for implicit return

previous commit affected rather many test, as the implicit returns add extra instructions
Also added some explicit returns, so as not to test the return logic too much. return (ie return nl) is a knonwn 3 risc operation.
This commit is contained in:
Torsten Rüger 2019-08-17 23:29:42 +03:00
parent 32f908c127
commit 5a43cbff15
43 changed files with 152 additions and 107 deletions

View File

@ -73,7 +73,7 @@
def self.padded( len )
a = 32 * (1 + ((len + 3)/32).floor )
#puts "#{a} for #{len}"
a
return a
end
def self.padded_words( words )

View File

@ -6,8 +6,8 @@ module Risc
def setup
super
@input = "arg = 5"
@expect = [LoadConstant, SlotToReg, RegToSlot]
@input = "arg = 5;return"
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, RegToSlot, Branch]
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg

View File

@ -6,8 +6,8 @@ module Risc
def setup
super
@input = "@ivar = 5"
@expect = [LoadConstant, SlotToReg, RegToSlot]
@input = "@ivar = 5;return"
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, RegToSlot, Branch]
end
def test_local_assign_instructions

View File

@ -6,8 +6,9 @@ module Risc
def setup
super
@input = "local = arg"
@expect = [SlotToReg, SlotToReg, SlotToReg, RegToSlot]
@input = "local = arg; return local"
@expect = [SlotToReg, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #4
SlotToReg, RegToSlot, Branch] #9
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg

View File

@ -6,8 +6,8 @@ module Risc
def setup
super
@input = "r = false"
@expect = [LoadConstant,SlotToReg, RegToSlot]
@input = "r = false;return"
@expect = [LoadConstant,SlotToReg, RegToSlot,LoadConstant, RegToSlot, Branch]
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg

View File

@ -6,8 +6,8 @@ module Risc
def setup
super
@input = "r = 5"
@expect = [LoadConstant,SlotToReg, RegToSlot]
@input = "r = 5;return"
@expect = [LoadConstant,SlotToReg, RegToSlot, LoadConstant, RegToSlot, Branch]
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg

View File

@ -6,9 +6,9 @@ module Risc
def setup
super
@input = "@ivar = 5 ; r = @ivar"
@input = "@ivar = 5 ; r = @ivar;return"
@expect = [LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg ,
RegToSlot]
RegToSlot, LoadConstant, RegToSlot, Branch]
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg

View File

@ -6,11 +6,12 @@ module Risc
def setup
super
@input = "r = 5.div4"
@input = "r = 5.div4;return"
@expect = [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
FunctionCall, Label, SlotToReg, SlotToReg, RegToSlot]
FunctionCall, Label, SlotToReg, SlotToReg, RegToSlot,
LoadConstant, RegToSlot, Branch]
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg

View File

@ -12,7 +12,7 @@ module Risc
RegToSlot, RegToSlot, RegToSlot, RegToSlot, SlotToReg, #14
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #19
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #24
SlotToReg, FunctionCall, Label]
SlotToReg, FunctionCall, Label] #29
end
def test_send_instructions

View File

@ -18,7 +18,7 @@ module Risc
SlotToReg, SlotToReg, RegToSlot, RegToSlot, RegToSlot, #44
RegToSlot, SlotToReg, SlotToReg, SlotToReg, RegToSlot, #49
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #54
SlotToReg, DynamicJump, Label]
SlotToReg, DynamicJump, Label, SlotToReg, RegToSlot, Branch]
end
def test_send_instructions

View File

@ -10,7 +10,7 @@ module Risc
@expect = [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
FunctionCall, Label]
FunctionCall, Label, SlotToReg, RegToSlot, Branch]
end
def test_send_instructions

View File

@ -11,7 +11,7 @@ module Risc
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall,
Label]
Label, SlotToReg, RegToSlot, Branch]
end
def test_send_instructions

View File

@ -6,11 +6,11 @@ module Risc
def setup
super
@input = "5.div4"
@input = "return 5.div4"
@expect = [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
FunctionCall, Label]
FunctionCall, Label, SlotToReg, RegToSlot, Branch]
@produced = produce_body
end
@ -51,7 +51,7 @@ module Risc
assert_reg_to_slot( sl , :r1 , :r3 , 7 )
end
def test_label
sl = @produced.next( 17 )
sl = @produced.next( 20 )
assert_equal Risc::Label , sl.class
assert_equal "return_label" , sl.name
end

View File

@ -6,11 +6,12 @@ module Risc
def setup
super
@input = "if(@a) ; arg = 5 ; else; arg = 6; end"
@input = "if(@a) ; arg = 5 ; else; arg = 6; end;return"
@expect = [SlotToReg, SlotToReg, LoadConstant, OperatorInstruction, IsZero,
LoadConstant, OperatorInstruction, IsZero, Label, LoadConstant,
SlotToReg, RegToSlot, Branch, Label, LoadConstant,
SlotToReg, RegToSlot, Label]
SlotToReg, RegToSlot, Label, LoadConstant, #34
RegToSlot, Branch]
end
def test_if_instructions

View File

@ -6,10 +6,11 @@ module Risc
def setup
super
@input = "if(@a) ; arg = 5 ; end"
@input = "if(@a) ; arg = 5 ; end;return"
@expect = [SlotToReg, SlotToReg, LoadConstant, OperatorInstruction, IsZero,
LoadConstant, OperatorInstruction, IsZero, Label, LoadConstant,
SlotToReg, RegToSlot, Label]
SlotToReg, RegToSlot, Label, LoadConstant, #34
RegToSlot, Branch]
end
def test_if_instructions

View File

@ -6,10 +6,11 @@ module Risc
def setup
super
@input = "unless(@a) ; arg = 5 ; end"
@input = "unless(@a) ; arg = 5 ; end;return"
@expect = [SlotToReg, SlotToReg, LoadConstant, OperatorInstruction, IsZero, #4
LoadConstant, OperatorInstruction, IsZero, Label, Branch, #9
Label, LoadConstant, SlotToReg, RegToSlot, Label] #14
Label, LoadConstant, SlotToReg, RegToSlot, Label, LoadConstant, #34
RegToSlot, Branch] #14
end
def test_if_instructions

View File

@ -7,7 +7,7 @@ module Mom
def setup
end
def in_test_vool(body = "@ivar = 5")
def in_test_vool(body = "@ivar = 5;return")
code = in_Test("def meth; #{body};end")
RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(code)
end
@ -30,7 +30,7 @@ module Mom
def test_compiles_all_risc
compiler = in_test_vool().compilers.first.to_risc
assert_equal Risc::LoadConstant , compiler.risc_instructions.next.class
assert_equal 17 , compiler.risc_instructions.length
assert_equal 20 , compiler.risc_instructions.length
end
end
end

View File

@ -6,11 +6,11 @@ module Risc
def setup
super
@input = "5.div4"
@input = "return 5.div4"
@expect = "something"
end
def instruction(num) # 18 is the main, see length in test/mom/send/test_setup_simple.rb
produce_main.next( 18 + num)
def instruction(num) # 21 is the main, see length in test/mom/send/test_setup_simple.rb
produce_main.next( 21 + num)
end
def test_postamble_classes
postamble.each_with_index do |ins , index|

View File

@ -6,14 +6,15 @@ module Risc
def setup
super
@input = "while(5 > 0) ; @a = true; end"
@input = "while(5 > 0) ; @a = true; end;return"
@expect = [Label, LoadConstant, LoadConstant, SlotToReg, SlotToReg, #4
RegToSlot, RegToSlot, RegToSlot, RegToSlot, LoadConstant, #9
SlotToReg, RegToSlot, LoadConstant, SlotToReg, SlotToReg, #14
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #19
FunctionCall, Label, SlotToReg, LoadConstant, OperatorInstruction, #24
IsZero, LoadConstant, OperatorInstruction, IsZero, LoadConstant, #29
SlotToReg, RegToSlot, Branch, Label] #34
SlotToReg, RegToSlot, Branch, Label, LoadConstant, #34
RegToSlot, Branch] #34
end
def test_while_instructions

View File

@ -6,10 +6,11 @@ module Risc
def setup
super
@input = "while(@a) ; arg = 5 end"
@expect = [Label, SlotToReg, SlotToReg, LoadConstant, OperatorInstruction,
IsZero, LoadConstant, OperatorInstruction, IsZero, LoadConstant,
SlotToReg, RegToSlot, Branch, Label]
@input = "while(@a) ; arg = 5 end;return"
@expect = [Label, SlotToReg, SlotToReg, LoadConstant, OperatorInstruction, #4
IsZero, LoadConstant, OperatorInstruction, IsZero, LoadConstant, #9
SlotToReg, RegToSlot, Branch, Label, LoadConstant, #14
RegToSlot, Branch] #19
end
def test_while_instructions

View File

@ -12,7 +12,7 @@ module Risc
vool.to_mom(nil)
vool
end
def create_method(body = "@ivar = 5")
def create_method(body = "@ivar = 5;return")
in_test_vool("def meth; #{body};end")
test = Parfait.object_space.get_class_by_name(:Test)
test.get_method(:meth)
@ -20,7 +20,7 @@ module Risc
def test_method_has_source
method = create_method
assert_equal Vool::IvarAssignment , method.source.class
assert_equal Vool::ScopeStatement , method.source.class
end
def test_method_has_no_locals
@ -40,20 +40,20 @@ module Risc
end
def test_creates_method_statement_in_class
clazz = in_test_vool("def meth; @ivar = 5 ;end")
clazz = in_test_vool("def meth; @ivar = 5 ;return;end")
assert_equal Vool::Statements , clazz.body.class
assert_equal Vool::MethodStatement , clazz.body.first.class
end
def test_callable_method_instance_type
in_test_vool("def meth; @ivar = 5; @ibar = 4;end")
in_test_vool("def meth; @ivar = 5; @ibar = 4;return;end")
test = Parfait.object_space.get_class_by_name(:Test)
method = test.instance_type.get_method(:meth)
assert_equal 1, method.self_type.variable_index(:ivar)
assert_equal 2, method.self_type.variable_index(:ibar)
end
def test_callable_method_has_one_local
in_test_vool("def meth; local = 5 ; a = 6;end")
in_test_vool("def meth; local = 5 ; a = 6;return;end")
test = Parfait.object_space.get_class_by_name(:Test)
method = test.get_method(:meth)
assert_equal 3 , method.frame_type.instance_length

View File

@ -36,21 +36,4 @@ module Ruby
assert_equal LocalAssignment , lst.body.class
end
end
class TestMethodStatementTrans < MiniTest::Test
include RubyTests
def setup()
input = "def tryout(arg1, arg2) ; a = arg1 ; end "
@lst = compile( input ).to_vool
end
def test_method
assert_equal Vool::MethodStatement , @lst.class
end
def test_method_args
assert_equal [:arg1, :arg2] , @lst.args
end
def test_body_is_scope_zero_statement
assert_equal Vool::LocalAssignment , @lst.body.class
end
end
end

View File

@ -0,0 +1,53 @@
require_relative "helper"
module Ruby
# other Return tests (standalone?) only test the statement
# But to get the implicit return, we test the method, as it inserts
# the implicit return
class TestMethodStatementRet < MiniTest::Test
include RubyTests
def test_single_const
@lst = compile( "def tryout(arg1, arg2) ; true ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.class
end
def test_single_instance
@lst = compile( "def tryout(arg1, arg2) ; @a ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.class
end
def test_single_call
@lst = compile( "def tryout(arg1, arg2) ; is_true() ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.class
end
def test_multi_const
@lst = compile( "def tryout(arg1, arg2) ; @a = some_call(); true ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.last.class
end
def test_multi_instance
@lst = compile( "def tryout(arg1, arg2) ; @a = some_call(); @a ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.last.class
end
def test_multi_call
@lst = compile( "def tryout(arg1, arg2) ; is_true() ; some_call() ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.last.class
end
def test_return
@lst = compile( "def tryout(arg1, arg2) ; return 1 ; end " ).to_vool
assert_equal Vool::ReturnStatement , @lst.body.class
assert_equal Vool::IntegerConstant , @lst.body.return_value.class
end
def test_local_assign
@lst = compile( "def tryout(arg1, arg2) ; a = 1 ; end " ).to_vool
assert_equal Vool::Statements , @lst.body.class
assert_equal Vool::ReturnStatement , @lst.body.last.class
assert_equal Vool::LocalVariable , @lst.body.last.return_value.class
end
def test_local_assign
@lst = compile( "def tryout(arg1, arg2) ; @a = 1 ; end " ).to_vool
assert_equal Vool::Statements , @lst.body.class
assert_equal Vool::ReturnStatement , @lst.body.last.class
assert_equal Vool::InstanceVariable , @lst.body.last.return_value.class
end
end
end

View File

@ -5,21 +5,20 @@ module RubyX
class TestObjecCompile < MiniTest::Test
include ParfaitHelper
def source
load_parfait(:object2)
load_parfait(:object)
end
def test_load
assert source.include?("class Object")
assert source.length > 2000
end
def est_vool
def test_vool
vool = compiler.ruby_to_vool source
assert_equal Vool::ClassStatement , vool.class
assert_equal :Object , vool.name
end
def est_mom
def test_mom
vool = compiler.ruby_to_mom source
assert_equal Vool::ClassStatement , vool.class
assert_equal :Object , vool.name
assert_equal Mom::MomCollection , vool.class
end
end
end

View File

@ -26,7 +26,6 @@ module VoolCompile
include ScopeHelper
include Mom
def compile_first_method( input )
input = as_test_main( input )
collection = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)

View File

@ -20,7 +20,7 @@ module Vool
assert_equal Mom::MessageSetup , @ins.class , @ins
end
def test_two_instructions_are_returned
assert_equal 6 , @ins.length , @ins
assert_equal 8 , @ins.length , @ins
end
def test_receiver_move_class
assert_equal Mom::ArgumentTransfer, @ins.next(1).class
@ -38,8 +38,8 @@ module Vool
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
end
def test_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label,
ReturnSequence , Label] , @ins
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,
ReturnJump,Label, ReturnSequence , Label] , @ins
end
end

View File

@ -20,7 +20,7 @@ module Vool
assert_equal MessageSetup , @ins.class , @ins
end
def test_two_instructions_are_returned
assert_equal 6 , @ins.length , @ins
assert_equal 8 , @ins.length , @ins
end
def test_receiver_move_class
assert_equal ArgumentTransfer, @ins.next(1).class
@ -40,7 +40,8 @@ module Vool
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
end
def test_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label, ReturnSequence ,
check_array [MessageSetup,ArgumentTransfer,SimpleCall,
SlotLoad, ReturnJump, Label, ReturnSequence ,
Label] , @ins
end
end

View File

@ -21,7 +21,8 @@ module Vool
def test_array
check_array [NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup ,
ArgumentTransfer, DynamicCall, Label, ReturnSequence, Label] , @ins
ArgumentTransfer, DynamicCall, SlotLoad, ReturnJump,
Label, ReturnSequence, Label] , @ins
end
end

View File

@ -7,14 +7,14 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
Risc.boot!
@compiler = compile_first_method( "a = main(1 + 2)" )
@compiler = compile_first_method( "a = main(1 + 2);return a" )
@ins = @compiler.mom_instructions.next
end
def test_array
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, MessageSetup ,
ArgumentTransfer, SimpleCall, SlotLoad ,Label, ReturnSequence ,
Label] , @ins
ArgumentTransfer, SimpleCall, SlotLoad ,SlotLoad, ReturnJump,
Label, ReturnSequence , Label] , @ins
end
def test_one_call

View File

@ -5,7 +5,7 @@ module Vool
include VoolCompile
def setup
@compiler = compile_first_method( "a = 5; a.div4")
@compiler = compile_first_method( "a = 5; a.div4;return ")
@ins = @compiler.mom_instructions.next
end
def test_check_type
@ -27,7 +27,8 @@ module Vool
def test_array
check_array [SlotLoad, NotSameCheck, SlotLoad, ResolveMethod ,
Label, MessageSetup, ArgumentTransfer, DynamicCall, Label ,
Label, MessageSetup, ArgumentTransfer, DynamicCall,
SlotLoad, ReturnJump, Label ,
ReturnSequence, Label] , @ins
end

View File

@ -5,7 +5,7 @@ module Vool
include SimpleSendHarness
def send_method
"self.get_internal_word(0)"
"self.get_internal_word(0);return"
end
def test_receiver
assert_equal SlotDefinition, @ins.next.receiver.class

View File

@ -5,7 +5,7 @@ module Vool
include SimpleSendHarness
def send_method
"5.div4"
"5.div4;return"
end
def receiver
[Mom::IntegerConstant , 5]

View File

@ -5,7 +5,7 @@ module Vool
include SimpleSendHarness
def send_method
"5.div4(1,2)"
"5.div4(1,2);return"
end
def receiver
@ -20,8 +20,8 @@ module Vool
assert_equal 2, @ins.next(1).arguments[1].right.known_object.value
end
def test_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall, Label, ReturnSequence ,
Label] , @ins
check_array [MessageSetup,ArgumentTransfer,SimpleCall, SlotLoad, ReturnJump,
Label, ReturnSequence , Label] , @ins
end
end
end

View File

@ -5,7 +5,7 @@ module Vool
include SimpleSendHarness
def send_method
"'5'.get_internal_byte(1)"
"'5'.get_internal_byte(1) ; return "
end
def receiver
[Mom::StringConstant , "5"]

View File

@ -6,7 +6,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "local = 5")
@compiler = compile_first_method( "local = 5;return")
@ins = @compiler.mom_instructions.next
end
@ -38,7 +38,7 @@ module Vool
include VoolCompile
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "@a = 5 ; local = @a")
@compiler = compile_first_method( "@a = 5 ; local = @a;return")
@ins = @compiler.mom_instructions.next
end
def test_class_compiles
@ -52,7 +52,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "arg = 5")
@compiler = compile_first_method( "arg = 5;return")
@ins = @compiler.mom_instructions.next
end
@ -79,13 +79,13 @@ module Vool
Parfait.boot!(Parfait.default_test_options)
end
def test_assigns_const
@compiler = compile_first_method( "@a = 5")
@compiler = compile_first_method( "@a = 5;return")
@ins = @compiler.mom_instructions.next
assert_equal Mom::SlotLoad , @ins.class , @ins
assert_equal Mom::IntegerConstant , @ins.right.known_object.class , @ins
end
def test_assigns_move
@compiler = compile_first_method( "@a = arg")
@compiler = compile_first_method( "@a = arg;return")
@ins = @compiler.mom_instructions.next
assert_equal Mom::SlotLoad , @ins.class , @ins
assert_equal Mom::SlotDefinition , @ins.right.class , @ins

View File

@ -67,7 +67,7 @@ module Vool
include VoolCompile
def setup
@compiler = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end")
@compiler = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end; return")
@ins = @compiler.mom_instructions
end
@ -89,8 +89,8 @@ module Vool
end
def test_array
check_array [Label, TruthCheck, Label, SlotLoad, Jump ,
Label, SlotLoad, Label, Label, ReturnSequence ,
Label] , @ins
Label, SlotLoad, Label, SlotLoad, ReturnJump ,
Label, ReturnSequence, Label] , @ins
end
end
end

View File

@ -7,7 +7,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "if(@a) ; @a = 5 ; end")
@compiler = compile_first_method( "if(@a) ; @a = 5 ; end;return")
@ins = @compiler.mom_instructions.next
end
@ -24,8 +24,8 @@ module Vool
assert_equal Label , @ins.last.class , @ins
end
def test_array
check_array [TruthCheck, Label, SlotLoad, Label, Label ,
ReturnSequence, Label], @ins
check_array [TruthCheck, Label, SlotLoad, Label, SlotLoad, ReturnJump,
Label ,ReturnSequence, Label], @ins
end
end
end

View File

@ -7,7 +7,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "unless(@a) ; @a = 5 ; end")
@compiler = compile_first_method( "unless(@a) ; @a = 5 ; end;return")
@ins = @compiler.mom_instructions.next
end
@ -25,7 +25,7 @@ module Vool
end
def test_array
check_array [TruthCheck, Label, Jump, Label, SlotLoad ,
Label, Label, ReturnSequence, Label] , @ins
Label, SlotLoad, ReturnJump,Label, ReturnSequence, Label] , @ins
end
end
end

View File

@ -7,7 +7,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end")
@compiler = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end;return")
@ins = @compiler.mom_instructions.next
end
@ -25,7 +25,7 @@ module Vool
end
def test_array
check_array [TruthCheck, Label, SlotLoad, Jump, Label ,
SlotLoad, Label, Label, ReturnSequence, Label], @ins
SlotLoad, Label, SlotLoad, ReturnJump,Label, ReturnSequence, Label], @ins
end
end
end

View File

@ -6,7 +6,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
@compiler = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end;return")
@ins = @compiler.mom_instructions.next
end
@ -23,7 +23,7 @@ module Vool
def test_array
check_array [MessageSetup, ArgumentTransfer, SimpleCall, TruthCheck, Label ,
SlotLoad, Jump, Label, SlotLoad, Label ,
Label, ReturnSequence, Label] , @ins
SlotLoad, ReturnJump,Label, ReturnSequence, Label] , @ins
end
end

View File

@ -6,7 +6,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "while(@a) ; @a = 5 ; end")
@compiler = compile_first_method( "while(@a) ; @a = 5 ; end;return")
@ins = @compiler.mom_instructions.next
end
@ -21,7 +21,7 @@ module Vool
end
def test_array
check_array [Label, TruthCheck, SlotLoad, Jump, Label ,
Label, ReturnSequence, Label], @ins
SlotLoad, ReturnJump,Label, ReturnSequence, Label], @ins
end
end
end

View File

@ -7,7 +7,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = compile_first_method( "while(5.div4) ; 5.div4 ; end")
@compiler = compile_first_method( "while(5.div4) ; 5.div4 ; end;return")
@ins = @compiler.mom_instructions.next
end
@ -30,7 +30,8 @@ module Vool
def test_array
check_array [Label, MessageSetup, ArgumentTransfer, SimpleCall, TruthCheck ,
MessageSetup, ArgumentTransfer, SimpleCall, Jump, Label ,
Label, ReturnSequence, Label] , @ins
SlotLoad, ReturnJump,Label, ReturnSequence, Label ,Label ,
ReturnSequence, Label] , @ins
end
end