check returns on tests

This commit is contained in:
Torsten Ruger 2015-11-05 17:00:41 +02:00
parent 4eb3d9029a
commit eae5cac4b5
6 changed files with 20 additions and 23 deletions

View File

@ -28,4 +28,9 @@ module Fragments
assert_equal @stdout , @interpreter.stdout
end
def check_return val
check
assert_equal Parfait::Message , @interpreter.get_register(:r1).class
assert_equal val , @interpreter.get_register(:r1).return_value
end
end

View File

@ -19,8 +19,9 @@ class Object
end
int t_seven()
int tim = times(5,3)
int tim = times(8,10)
tim.putint()
return tim
end
int main()
@ -28,8 +29,7 @@ class Object
end
end
HERE
@length = 203
check
@length = 486
check_return 80
end
end

View File

@ -3,7 +3,7 @@ require_relative 'helper'
class TestIf < MiniTest::Test
include Fragments
def test_if_basic
def test_if_plus
@string_input = <<HERE
class Object
int main()
@ -16,11 +16,11 @@ class Object
end
end
HERE
@length = 28
check
@length = 28
check_return 4
end
def test_if_small
def test_if_zero
@string_input = <<HERE
class Object
int main()
@ -37,11 +37,11 @@ HERE
end
def test_if_puts
def test_if_minus
@string_input = <<HERE
class Object
int itest(int n)
if_zero( n - 12)
if_minus( n - 12)
"then".putstring()
else
"else".putstring()

View File

@ -21,15 +21,14 @@ class Object
int fib_print(int n)
int fib = fibonaccir( n )
fib.putint()
return fib
end
int main()
fib_print(10)
return fib_print(10)
end
end
HERE
@length = 6594
check
assert_equal Parfait::Message , @interpreter.get_register(:r1).class
#TODO, works in the gui?? assert_equal 55 , @interpreter.get_register(:r1).return_value
@length = 6598
check_return 55
end
end

View File

@ -3,11 +3,6 @@ require_relative 'helper'
class TestReturn < MiniTest::Test
include Fragments
def check_return val
check
assert_equal Parfait::Message , @interpreter.get_register(:r1).class
assert_equal val , @interpreter.get_register(:r1).return_value
end
def test_return1
@string_input = <<HERE
class Object

View File

@ -26,9 +26,7 @@ class Object
end
HERE
@length = 278
check
assert_equal Parfait::Message , @interpreter.get_register(:r1).class
assert_equal 55 , @interpreter.get_register(:r1).return_value
check_return 55
end
end