rubyx/test/risc/methods/test_call_simple.rb

34 lines
619 B
Ruby
Raw Normal View History

2018-04-26 11:33:33 +02:00
require_relative 'helper'
module Methods
class TestCallSimple < MethodsTest
def test_simple
2018-04-26 11:33:33 +02:00
run_space <<HERE
def same( n )
2018-04-26 11:33:33 +02:00
return n
end
def main(arg)
return same(8)
2018-04-26 11:33:33 +02:00
end
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 8 , get_return.value
end
def test_call_with_call
run_space <<HERE
def same( n )
return n
end
def main(arg)
a = same(8 - 1)
return a
end
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 7 , get_return.value
end
2018-04-26 11:33:33 +02:00
end
end