2014-05-25 07:43:07 +02:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
class TestFunctions < MiniTest::Test
|
|
|
|
include Fragments
|
|
|
|
|
2014-05-28 13:27:18 +02:00
|
|
|
def test_functions
|
2014-05-25 07:43:07 +02:00
|
|
|
@string_input = <<HERE
|
2014-05-30 09:42:43 +02:00
|
|
|
def minus(a,b)
|
2014-05-25 07:43:07 +02:00
|
|
|
a - b
|
2014-05-30 09:42:43 +02:00
|
|
|
end
|
2015-07-19 10:15:38 +02:00
|
|
|
def plus(a, b)
|
|
|
|
a + b
|
|
|
|
end
|
|
|
|
def times(a, b)
|
|
|
|
if( b == 0 )
|
|
|
|
a = 0
|
|
|
|
else
|
|
|
|
m = minus(b, 1)
|
|
|
|
t = times(a, m)
|
|
|
|
a = plus(a,t)
|
|
|
|
end
|
|
|
|
end
|
2014-06-07 22:22:32 +02:00
|
|
|
def t_seven()
|
|
|
|
tim = times(7,6)
|
|
|
|
tim.putint()
|
|
|
|
end
|
|
|
|
|
|
|
|
t_seven()
|
2014-05-25 07:43:07 +02:00
|
|
|
HERE
|
2015-07-19 10:15:38 +02:00
|
|
|
@expect = [Virtual::Return ]
|
|
|
|
check
|
|
|
|
|
2014-05-25 07:43:07 +02:00
|
|
|
end
|
|
|
|
end
|