fix return statement to actually return
fix a million tests
This commit is contained in:
@ -17,7 +17,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@length = 16
|
||||
@length = 17
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@length = 38
|
||||
@length = 39
|
||||
check
|
||||
end
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@length = 191
|
||||
@length = 196
|
||||
check
|
||||
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@length = 26
|
||||
@length = 27
|
||||
check
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@length = 32
|
||||
@length = 33
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -27,7 +27,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@length = 77
|
||||
@length = 78
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,GetSlot,SetSlot,GetSlot,GetSlot ,
|
||||
@expect = [Label, SaveReturn,LoadConstant,GetSlot,SetSlot,GetSlot,GetSlot ,SetSlot,
|
||||
Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
was = check
|
||||
get = was.next(6)
|
||||
@ -118,7 +118,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot , Label , RegisterTransfer,GetSlot,FunctionReturn]
|
||||
@expect = [Label, SaveReturn,GetSlot , SetSlot,Label , RegisterTransfer,GetSlot,FunctionReturn]
|
||||
was = check
|
||||
get = was.next(2)
|
||||
assert_equal GetSlot , get.class
|
||||
|
@ -4,7 +4,7 @@ module Register
|
||||
class TestClassStatements < MiniTest::Test
|
||||
include Statements
|
||||
|
||||
def test_class_def
|
||||
def test_class_defs
|
||||
@string_input = <<HERE
|
||||
class Bar
|
||||
int self.buh()
|
||||
@ -17,7 +17,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
@expect = [Label, SaveReturn,LoadConstant,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
||||
@ -35,7 +35,7 @@ class Object
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot,LoadConstant,SetSlot,LoadConstant,SetSlot,LoadConstant,SetSlot,
|
||||
RegisterTransfer,FunctionCall,GetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
RegisterTransfer,FunctionCall,GetSlot,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
||||
@ -48,7 +48,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
@expect = [Label, SaveReturn,LoadConstant,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
assert_raises{check}
|
||||
end
|
||||
|
||||
@ -61,7 +61,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ module Register
|
||||
class TestIfStatement < MiniTest::Test
|
||||
include Statements
|
||||
|
||||
def test_if_basic
|
||||
def test_if_basicr
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
int main()
|
||||
@ -17,7 +17,7 @@ class Object
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,LoadConstant, OperatorInstruction,IsPlus ,
|
||||
LoadConstant,Branch , Label , LoadConstant ,
|
||||
LoadConstant,SetSlot,Branch , Label , LoadConstant ,SetSlot,
|
||||
Label,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
@ -34,7 +34,7 @@ class Object
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,LoadConstant, OperatorInstruction,IsMinus ,
|
||||
Branch ,Label , LoadConstant ,
|
||||
Branch ,Label , LoadConstant ,SetSlot,
|
||||
Label,Label , RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
@ -51,7 +51,7 @@ class Object
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,LoadConstant,OperatorInstruction,IsZero ,
|
||||
Branch , Label , LoadConstant ,
|
||||
Branch , Label , LoadConstant ,SetSlot,
|
||||
Label,Label, RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
@ -13,8 +13,12 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant ,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
@expect = [Label, SaveReturn,LoadConstant ,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
was = check
|
||||
set = was.next(3)
|
||||
assert_equal SetSlot , set.class
|
||||
should = Register.machine.space.first_message.get_layout.variable_index(:return_value)
|
||||
assert_equal should, set.index , "Set to message must got to return_value(#{should}), not #{set.index}"
|
||||
end
|
||||
|
||||
def test_return_local
|
||||
@ -26,7 +30,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot ,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot ,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
||||
@ -39,7 +43,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,GetSlot,SetSlot,GetSlot,GetSlot ,
|
||||
@expect = [Label, SaveReturn,LoadConstant,GetSlot,SetSlot,GetSlot,GetSlot ,SetSlot,
|
||||
Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
@ -53,7 +57,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot ,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot ,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
||||
@ -66,7 +70,7 @@ class Object
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot,SetSlot, LoadConstant,
|
||||
SetSlot,LoadConstant,SetSlot,RegisterTransfer,FunctionCall,GetSlot ,Label,
|
||||
SetSlot,LoadConstant,SetSlot,RegisterTransfer,FunctionCall,GetSlot ,SetSlot,Label,
|
||||
RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ class Object
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,Label,LoadConstant,IsPlus,LoadConstant,Branch,
|
||||
@expect = [Label, SaveReturn,Label,LoadConstant,IsPlus,LoadConstant,SetSlot,Branch,
|
||||
Label,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
@ -34,7 +34,7 @@ end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,GetSlot,SetSlot,Label,GetSlot,GetSlot, IsPlus,GetSlot,
|
||||
GetSlot,LoadConstant,OperatorInstruction,GetSlot,SetSlot,Branch,
|
||||
Label,GetSlot,GetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
Label,GetSlot,GetSlot,SetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
||||
@ -54,7 +54,7 @@ HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,GetSlot,SetSlot,Label,
|
||||
GetSlot,GetSlot,LoadConstant,OperatorInstruction,IsPlus,
|
||||
GetSlot, GetSlot,LoadConstant,OperatorInstruction, GetSlot,
|
||||
SetSlot,GetSlot, GetSlot,Branch , Label ,
|
||||
SetSlot,GetSlot, GetSlot,SetSlot,Branch , Label ,
|
||||
Label , RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
Reference in New Issue
Block a user