From eae5cac4b54ca4497110413f361e0425e8eb6f5b Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 5 Nov 2015 17:00:41 +0200 Subject: [PATCH] check returns on tests --- test/compiler/fragments/helper.rb | 5 +++++ test/compiler/fragments/test_functions.rb | 8 ++++---- test/compiler/fragments/test_if.rb | 12 ++++++------ test/compiler/fragments/test_recursive_fibo.rb | 9 ++++----- test/compiler/fragments/test_return.rb | 5 ----- test/compiler/fragments/test_while_fibo.rb | 4 +--- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/test/compiler/fragments/helper.rb b/test/compiler/fragments/helper.rb index 4d5316dc..0548822a 100644 --- a/test/compiler/fragments/helper.rb +++ b/test/compiler/fragments/helper.rb @@ -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 diff --git a/test/compiler/fragments/test_functions.rb b/test/compiler/fragments/test_functions.rb index cac6f8d8..e9e2b69e 100644 --- a/test/compiler/fragments/test_functions.rb +++ b/test/compiler/fragments/test_functions.rb @@ -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 diff --git a/test/compiler/fragments/test_if.rb b/test/compiler/fragments/test_if.rb index ec6a8efd..43e008a9 100644 --- a/test/compiler/fragments/test_if.rb +++ b/test/compiler/fragments/test_if.rb @@ -3,7 +3,7 @@ require_relative 'helper' class TestIf < MiniTest::Test include Fragments - def test_if_basic + def test_if_plus @string_input = <