almost rewritten the call site

statements resolve to nothing and use all registers
expressions return register and allocate those with use_reg
This commit is contained in:
Torsten Ruger
2015-10-14 13:48:21 +03:00
parent 82d6ebf392
commit 5b95319191
3 changed files with 84 additions and 23 deletions

View File

@ -0,0 +1,48 @@
require_relative "compiler_helper"
module Virtual
class TestFields < MiniTest::Test
include CompilerHelper
def setup
Virtual.machine.boot
end
def test_call_main_plain
@root = :call_site
@string_input = <<HERE
main()
HERE
@output = Register::RegisterValue
check
end
def test_call_main_int
@root = :call_site
@string_input = <<HERE
main(1)
HERE
@output = Register::RegisterValue
check
end
def test_call_main_string
@root = :call_site
@string_input = <<HERE
main("1")
HERE
@output = Register::RegisterValue
check
end
def ttest_call_main_op
Virtual.machine.space.get_main.ensure_local(:bar , :int)
@root = :call_site
@string_input = <<HERE
main( bar )
HERE
@output = Register::RegisterValue
check
end
end
end