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 )
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),

View File

@ -16,22 +16,6 @@ class HelloTest < MiniTest::Test
writer.save "hello.o"
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
@string_input = <<HERE
class Object

View File

@ -70,48 +70,32 @@ HERE
assert cla.get_instance_method( :times )
end
def ttest_function_ops
def test_function_ops
@string_input = <<HERE
def foo(x)
class Object
int foo(int abba)
abba = 5
2 + 5
end
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
def test_function_if
@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)
class Object
int ofthen(int n)
if(0)
isit = 42
int isit = 42
else
maybenot = 667
int maybenot = 667
end
end
end
HERE
@output = nil
@output = [[Virtual::MethodEnter] , [Virtual::MethodReturn]]
check
end
@ -129,73 +113,83 @@ HERE
check
end
def ttest_function_while
def test_function_while
@string_input = <<HERE
def fibonaccit(n)
a = 0
while (n) do
some = 43
other = some * 4
class Object
int fibonaccit(int n)
int a = 0
while(n)
int some = 43
int other = some * 4
end
end
end
HERE
@output = nil
@output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check
end
def pest_function_return
def test_function_return
@string_input = <<HERE
def retvar(n)
i = 5
class Object
int retvar(int n)
int i = 5
return i
end
end
HERE
@output = ""
@output = [[Virtual::MethodEnter],[Virtual::MethodReturn]]
check
end
def pest_function_return_if
def test_function_return_if
@string_input = <<HERE
def retvar(n)
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 = <<HERE
def retvar(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 = <<HERE
def fibonaccit(n)
a = 0
b = 1
class Object
int fibonaccit(int n)
int a = 0
int b = 1
while( n > 1 ) do
tmp = a
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