move the methods test to mains
previous commit made the mains tests more general this joins methods tests here so we can run them on arm too fix #11
This commit is contained in:
9
test/mains/source/call-call__7.rb
Normal file
9
test/mains/source/call-call__7.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class Space
|
||||
def same( n )
|
||||
return n
|
||||
end
|
||||
def main(arg)
|
||||
a = same(8 - 1)
|
||||
return a
|
||||
end
|
||||
end
|
13
test/mains/source/if-false_large_20.rb
Normal file
13
test/mains/source/if-false_large_20.rb
Normal file
@ -0,0 +1,13 @@
|
||||
class Space
|
||||
def if_small( n )
|
||||
if( n < 10)
|
||||
return 10
|
||||
else
|
||||
"large".putstring
|
||||
return 20
|
||||
end
|
||||
end
|
||||
def main(arg)
|
||||
return if_small( 12 )
|
||||
end
|
||||
end
|
13
test/mains/source/if-true_small_10.rb
Normal file
13
test/mains/source/if-true_small_10.rb
Normal file
@ -0,0 +1,13 @@
|
||||
class Space
|
||||
def if_small( n )
|
||||
if( n < 10)
|
||||
"small".putstring
|
||||
return 10
|
||||
else
|
||||
return 20
|
||||
end
|
||||
end
|
||||
def main(arg)
|
||||
return if_small( 8 )
|
||||
end
|
||||
end
|
10
test/mains/source/one-call__8.rb
Normal file
10
test/mains/source/one-call__8.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class Space
|
||||
|
||||
def same( n )
|
||||
return n
|
||||
end
|
||||
def main(arg)
|
||||
return same(8)
|
||||
end
|
||||
|
||||
end
|
16
test/mains/source/recurse-count__1.rb
Normal file
16
test/mains/source/recurse-count__1.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class Space
|
||||
|
||||
def down( n )
|
||||
if( n < 2 )
|
||||
return n
|
||||
else
|
||||
a = down(n - 1)
|
||||
return a
|
||||
end
|
||||
end
|
||||
|
||||
def main(arg)
|
||||
return down(10)
|
||||
end
|
||||
|
||||
end
|
16
test/mains/source/recurse-fibo__5.rb
Normal file
16
test/mains/source/recurse-fibo__5.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class Space
|
||||
|
||||
def fibo_r( n )
|
||||
if( n < 2 )
|
||||
return n
|
||||
else
|
||||
a = fibo_r(n - 1)
|
||||
b = fibo_r(n - 2)
|
||||
return a + b
|
||||
end
|
||||
end
|
||||
|
||||
def main(arg)
|
||||
return fibo_r(5)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user