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
abba = 5 int foo(int abba)
2 + 5 abba = 5
end 2 + 5
HERE
@output = nil
check
end
def ttest_function_ops_simple
@string_input = <<HERE
def foo()
2 + 5
end
HERE
@output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check
end
def ttest_ops_simple
#TODO ops still botched
@string_input = <<HERE
2 + 5
HERE
@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)
isit = 42
else
maybenot = 667
end end
end end
HERE HERE
@output = nil @output = [[Virtual::MethodEnter] , [Virtual::MethodReturn]]
check
end
def test_function_if
@string_input = <<HERE
class Object
int ofthen(int n)
if(0)
int isit = 42
else
int maybenot = 667
end
end
end
HERE
@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)
return i int i = 5
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
if( n > 5) int retvar(int n)
return 10 if( n > 5)
else return 10
return 20 else
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
while( n > 5) do int retvar(int n)
n = n + 1 while( n > 5) do
return n n = n + 1
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
while( n > 1 ) do int b = 1
tmp = a while( n > 1 ) do
a = b int tmp = a
b = tmp + b a = b
puts(b) b = tmp + b
n = n - 1 puts(b)
n = n - 1
end
end end
end end
HERE HERE
@output = "" @output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check check
end end
end end