fix return statement to actually return

fix a million tests
This commit is contained in:
Torsten Ruger
2015-10-27 21:04:46 +02:00
parent 79cf59c4e2
commit 142c36a374
16 changed files with 61 additions and 59 deletions

View File

@ -48,7 +48,7 @@ class AddTest < MiniTest::Test
assert_equal Fixnum , right.class
assert_equal 7 , right
assert_equal 12 , left
done_tr = ticks(2)
done_tr = ticks(3)
assert_equal Register::RegisterTransfer , done_tr.class
result = @interpreter.get_register(done_op.left)
assert_equal result , 12
@ -58,16 +58,10 @@ class AddTest < MiniTest::Test
#show_ticks # get output of what is
["Branch","Label","LoadConstant","GetSlot","SetSlot",
"RegisterTransfer","FunctionCall","Label","SaveReturn","LoadConstant",
"LoadConstant","OperatorInstruction","Label","RegisterTransfer","GetSlot",
"FunctionReturn","RegisterTransfer","Syscall","NilClass"].each_with_index do |name , index|
"LoadConstant","OperatorInstruction","SetSlot","Label","RegisterTransfer",
"GetSlot","FunctionReturn","RegisterTransfer","Syscall","NilClass"].each_with_index do |name , index|
got = ticks(1)
assert got.class.name.index(name) , "Wrong class for #{index+1}, expect #{name} , got #{got}"
end
end
# def test_exit
# done = ticks(34)
# assert_equal NilClass , done.class
# end
end

View File

@ -1,3 +1,4 @@
require_relative "test_add"
require_relative "test_if"
require_relative "test_puts"
require_relative "test_puti"
require_relative "test_add"

View File

@ -32,17 +32,18 @@ HERE
@interpreter.start Register.machine.init
#show_ticks # get output of what is
["Branch","Label","LoadConstant","GetSlot","SetSlot",
"RegisterTransfer","FunctionCall","Label","SaveReturn","GetSlot",
"GetSlot","SetSlot","LoadConstant","SetSlot","LoadConstant",
"SetSlot","RegisterTransfer","FunctionCall","Label","SaveReturn",
"GetSlot","LoadConstant","OperatorInstruction","IsZero","GetSlot",
"LoadConstant","SetSlot","LoadConstant","SetSlot","RegisterTransfer",
"FunctionCall","Label","SaveReturn","GetSlot","RegisterTransfer",
"Syscall","RegisterTransfer","RegisterTransfer","SetSlot","Label",
"RegisterTransfer","GetSlot","FunctionReturn","GetSlot","Branch",
"Label","Label","RegisterTransfer","GetSlot","FunctionReturn",
"GetSlot","Label","RegisterTransfer","GetSlot","FunctionReturn",
"RegisterTransfer","Syscall","NilClass"].each_with_index do |name , index|
"RegisterTransfer","FunctionCall","Label","SaveReturn","GetSlot",
"GetSlot","SetSlot","LoadConstant","SetSlot","LoadConstant",
"SetSlot","LoadConstant","SetSlot","RegisterTransfer","FunctionCall",
"Label","SaveReturn","GetSlot","LoadConstant","OperatorInstruction",
"IsZero","GetSlot","LoadConstant","SetSlot","LoadConstant",
"SetSlot","LoadConstant","SetSlot","RegisterTransfer","FunctionCall",
"Label","SaveReturn","GetSlot","RegisterTransfer","Syscall",
"RegisterTransfer","RegisterTransfer","SetSlot","Label","RegisterTransfer",
"GetSlot","FunctionReturn","GetSlot","Branch","Label",
"Label","RegisterTransfer","GetSlot","FunctionReturn","GetSlot",
"Label","RegisterTransfer","GetSlot","FunctionReturn","RegisterTransfer",
"Syscall","NilClass"].each_with_index do |name , index|
got = ticks(1)
assert got.class.name.index(name) , "Wrong class for #{index+1}, expect #{name} , got #{got}"
end

View File

@ -74,18 +74,19 @@ HERE
"GetSlot","SetSlot","RegisterTransfer","FunctionCall","Label",
"SaveReturn","GetSlot","LoadConstant","OperatorInstruction","IsZero",
"Branch","Label","GetSlot","LoadConstant","OperatorInstruction",
"IsZero","Label","LoadConstant","Label","GetSlot",
"LoadConstant","OperatorInstruction","IsZero","Label","LoadConstant",
"IsZero","Label","LoadConstant","SetSlot","Label",
"GetSlot","LoadConstant","OperatorInstruction","IsZero","Label",
"LoadConstant","SetSlot","Label","GetSlot","LoadConstant",
"OperatorInstruction","IsZero","Label","LoadConstant","SetSlot",
"Label","GetSlot","LoadConstant","OperatorInstruction","IsZero",
"Label","LoadConstant","Label","GetSlot","LoadConstant",
"OperatorInstruction","IsZero","Label","LoadConstant","Label",
"Label","LoadConstant","SetSlot","Label","Label",
"RegisterTransfer","GetSlot","FunctionReturn","GetSlot","GetSlot",
"SetSlot","GetSlot","GetSlot","GetSlot","OperatorInstruction",
"SetSlot","Label","GetSlot","SetSlot","Label",
"RegisterTransfer","GetSlot","FunctionReturn","GetSlot","SetSlot",
"Label","RegisterTransfer","GetSlot","FunctionReturn","GetSlot",
"GetSlot","SetSlot","GetSlot","GetSlot","GetSlot",
"OperatorInstruction","SetSlot","Label","GetSlot","Label",
"RegisterTransfer","GetSlot","FunctionReturn","GetSlot","Label",
"RegisterTransfer","GetSlot","FunctionReturn","GetSlot","Label",
"RegisterTransfer","GetSlot","FunctionReturn","RegisterTransfer","Syscall",
"NilClass"].each_with_index do |name , index|
"Label","RegisterTransfer","GetSlot","FunctionReturn","RegisterTransfer",
"Syscall","NilClass"].each_with_index do |name , index|
got = ticks(1)
assert got.class.name.index(name) , "Wrong class for #{index+1}, expect #{name} , got #{got}"
end