2015-11-07 11:18:08 +01:00
|
|
|
require_relative "helper"
|
2015-10-14 12:48:21 +02:00
|
|
|
|
2015-10-22 17:16:29 +02:00
|
|
|
module Register
|
2015-10-14 14:17:33 +02:00
|
|
|
class TestCall < MiniTest::Test
|
2015-11-07 11:18:08 +01:00
|
|
|
include ExpressionHelper
|
2015-10-14 12:48:21 +02:00
|
|
|
|
|
|
|
def setup
|
2015-10-22 17:16:29 +02:00
|
|
|
Register.machine.boot
|
2015-10-14 20:57:37 +02:00
|
|
|
@root = :call_site
|
|
|
|
@output = Register::RegisterValue
|
2015-10-14 12:48:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_call_main_plain
|
2015-10-14 15:16:03 +02:00
|
|
|
@string_input = 'main()'
|
2015-10-14 12:48:21 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_call_main_int
|
2015-10-14 15:16:03 +02:00
|
|
|
@string_input = 'main(1)'
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2015-10-14 12:48:21 +02:00
|
|
|
def test_call_main_string
|
2015-10-14 15:16:03 +02:00
|
|
|
@string_input = 'main("1")'
|
2015-10-14 12:48:21 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2015-10-14 20:34:18 +02:00
|
|
|
def test_call_main_op
|
2015-10-22 17:16:29 +02:00
|
|
|
Register.machine.space.get_main.ensure_local(:bar , :Integer)
|
2015-10-14 15:16:03 +02:00
|
|
|
@string_input = 'main( bar )'
|
2015-10-14 12:48:21 +02:00
|
|
|
check
|
|
|
|
end
|
2015-10-14 15:16:03 +02:00
|
|
|
|
|
|
|
def test_call_string_put
|
|
|
|
@string_input = '"Hello Raisa, I am salama".putstring()'
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2015-10-14 12:48:21 +02:00
|
|
|
end
|
|
|
|
end
|