new field def compiles, fix test
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
require_relative "test_foo"
|
||||
require_relative "test_if"
|
||||
#require_relative "test_functions"
|
||||
require_relative "test_functions"
|
||||
#require_relative "test_string_class"
|
||||
#require_relative "test_hello"
|
||||
#require_relative "test_putint"
|
||||
|
@ -5,23 +5,26 @@ class TestFunctions < MiniTest::Test
|
||||
|
||||
def test_functions
|
||||
@string_input = <<HERE
|
||||
def minus(a,b)
|
||||
a - b
|
||||
int minus(int a,int b)
|
||||
return a - b
|
||||
end
|
||||
def plus(a, b)
|
||||
a + b
|
||||
|
||||
int plus(int a, int b)
|
||||
return a + b
|
||||
end
|
||||
def times(a, b)
|
||||
|
||||
int times(int a, int b)
|
||||
if( b == 0 )
|
||||
a = 0
|
||||
else
|
||||
m = minus(b, 1)
|
||||
t = times(a, m)
|
||||
int m = minus(b, 1)
|
||||
int t = times(a, m)
|
||||
a = plus(a,t)
|
||||
end
|
||||
end
|
||||
def t_seven()
|
||||
tim = times(7,6)
|
||||
|
||||
int t_seven()
|
||||
int tim = times(7,6)
|
||||
tim.putint()
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user