rubyx/test/vm/method_compiler/test_call_expression.rb

44 lines
1.1 KiB
Ruby
Raw Normal View History

2015-11-07 11:18:08 +01:00
require_relative "helper"
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
2016-12-10 14:26:25 +01:00
include AST::Sexp
def setup
2015-10-22 17:16:29 +02:00
Register.machine.boot
@output = Register::RegisterValue
end
def test_call_main_plain
2016-12-10 22:07:04 +01:00
@input = s(:call,s(:name, :main),s(:arguments))
check
end
def test_call_main_int
Parfait.object_space.get_main.add_argument(:blar , :Integer)
2016-12-10 22:07:04 +01:00
@input =s(:call,s(:name, :main),s(:arguments , s(:int, 1)))
check
end
def test_call_main_string
Parfait.object_space.get_main.add_argument(:blar , :Word)
2016-12-10 22:07:04 +01:00
@input =s(:call,s(:name, :main),s(:arguments , s(:string, "1") ))
check
end
2015-10-14 20:34:18 +02:00
def test_call_main_op
Parfait.object_space.get_main.add_local(:bar , :Integer)
Parfait.object_space.get_main.add_argument(:blar , :Integer)
2016-12-10 22:07:04 +01:00
@input =s(:call,s(:name, :main),s(:arguments , s(:name, :bar) ))
check
end
def test_call_string_put
2016-12-10 22:07:04 +01:00
@input = s(:call,s(:name, :putstring),s(:arguments),s(:receiver,s(:string, "Hello Raisa, I am salama")))
check
end
end
end