fix more disabled tests

This commit is contained in:
Torsten Ruger 2015-10-07 10:19:25 +03:00
parent 83ef902b55
commit 513bc8d7cf
3 changed files with 68 additions and 100 deletions

View File

@ -10,16 +10,6 @@ class CompilerTest < MiniTest::Test
res = Bosl::Compiler.compile( @expression ) res = Bosl::Compiler.compile( @expression )
assert res.is_a?(Virtual::Slot) , "compiler must compile to slot, not #{res.inspect}" assert res.is_a?(Virtual::Slot) , "compiler must compile to slot, not #{res.inspect}"
end 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 def test_function_expression
@expression = s(:class, :Foo, @expression = s(:class, :Foo,
s(:derives, :Object), s(:derives, :Object),

View File

@ -16,22 +16,6 @@ class HelloTest < MiniTest::Test
writer.save "hello.o" writer.save "hello.o"
end end
def qtest_simplest_function
@string_input = <<HERE
def foo(x)
5
end
HERE
check
end
def ttest_puts_string
@string_input = <<HERE
putstring("Hello")
HERE
check
end
def test_string_put def test_string_put
@string_input = <<HERE @string_input = <<HERE
class Object class Object

View File

@ -70,48 +70,32 @@ HERE
assert cla.get_instance_method( :times ) assert cla.get_instance_method( :times )
end end
def ttest_function_ops def test_function_ops
@string_input = <<HERE @string_input = <<HERE
def foo(x) class Object
int foo(int abba)
abba = 5 abba = 5
2 + 5 2 + 5
end end
HERE
@output = nil
check
end
def ttest_function_ops_simple
@string_input = <<HERE
def foo()
2 + 5
end end
HERE HERE
@output = [[Virtual::MethodEnter] , [Virtual::MethodReturn]] @output = [[Virtual::MethodEnter] , [Virtual::MethodReturn]]
check check
end end
def ttest_ops_simple def test_function_if
#TODO ops still botched
@string_input = <<HERE @string_input = <<HERE
2 + 5 class Object
HERE int ofthen(int n)
@output = [[Virtual::MethodEnter , Virtual::Set,Virtual::NewMessage,Virtual::Set,
Virtual::Set ,Virtual::Set,Virtual::Set,Virtual::MessageSend] , [Virtual::MethodReturn]]
check
end
def ttest_function_if
@string_input = <<HERE
def ofthen(n)
if(0) if(0)
isit = 42 int isit = 42
else else
maybenot = 667 int maybenot = 667
end
end end
end end
HERE HERE
@output = nil @output = [[Virtual::MethodEnter] , [Virtual::MethodReturn]]
check check
end end
@ -129,73 +113,83 @@ HERE
check check
end end
def ttest_function_while def test_function_while
@string_input = <<HERE @string_input = <<HERE
def fibonaccit(n) class Object
a = 0 int fibonaccit(int n)
while (n) do int a = 0
some = 43 while(n)
other = some * 4 int some = 43
int other = some * 4
end
end end
end end
HERE HERE
@output = nil @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check check
end end
def pest_function_return def test_function_return
@string_input = <<HERE @string_input = <<HERE
def retvar(n) class Object
i = 5 int retvar(int n)
int i = 5
return i return i
end end
end
HERE HERE
@output = "" @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check check
end end
def pest_function_return_if def test_function_return_if
@string_input = <<HERE @string_input = <<HERE
def retvar(n) class Object
int retvar(int n)
if( n > 5) if( n > 5)
return 10 return 10
else else
return 20 return 20
end end
end end
end
HERE HERE
@output = "" @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check check
end end
def est_function_return_while def test_function_return_while
@string_input = <<HERE @string_input = <<HERE
def retvar(n) class Object
int retvar(int n)
while( n > 5) do while( n > 5) do
n = n + 1 n = n + 1
return n return n
end end
end end
end
HERE HERE
@output = "" @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check check
end end
def pest_function_big_while def test_function_big_while
@string_input = <<HERE @string_input = <<HERE
def fibonaccit(n) class Object
a = 0 int fibonaccit(int n)
b = 1 int a = 0
int b = 1
while( n > 1 ) do while( n > 1 ) do
tmp = a int tmp = a
a = b a = b
b = tmp + b b = tmp + b
puts(b) puts(b)
n = n - 1 n = n - 1
end end
end end
end
HERE HERE
@output = "" @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check check
end end
end end