diff --git a/test/compiler/test_compiler.rb b/test/compiler/test_compiler.rb index 4fe9a875..d0652543 100644 --- a/test/compiler/test_compiler.rb +++ b/test/compiler/test_compiler.rb @@ -10,16 +10,6 @@ class CompilerTest < MiniTest::Test res = Bosl::Compiler.compile( @expression ) assert res.is_a?(Virtual::Slot) , "compiler must compile to slot, not #{res.inspect}" end - def ttest_if_expression -#TODO review constant : all expressions return a slot - @expression = s(:if, - s(:condition, - s(:int, 0)), - s(:if_true, - s(:int, 42)), - s(:if_false, nil)) - check - end def test_function_expression @expression = s(:class, :Foo, s(:derives, :Object), diff --git a/test/compiler/test_hello.rb b/test/compiler/test_hello.rb index 78f20abf..c149665f 100644 --- a/test/compiler/test_hello.rb +++ b/test/compiler/test_hello.rb @@ -16,22 +16,6 @@ class HelloTest < MiniTest::Test writer.save "hello.o" end - def qtest_simplest_function - @string_input = < 5) - return 10 - else - return 20 +class Object + int retvar(int n) + if( n > 5) + return 10 + else + return 20 + end end end HERE - @output = "" + @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]] check end - def est_function_return_while + def test_function_return_while @string_input = < 5) do - n = n + 1 - return n +class Object + int retvar(int n) + while( n > 5) do + n = n + 1 + return n + end end end HERE - @output = "" + @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]] check end - def pest_function_big_while + def test_function_big_while @string_input = < 1 ) do - tmp = a - a = b - b = tmp + b - puts(b) - n = n - 1 +class Object + int fibonaccit(int n) + int a = 0 + int b = 1 + while( n > 1 ) do + int tmp = a + a = b + b = tmp + b + puts(b) + n = n - 1 + end end end HERE - @output = "" + @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]] check end end