remove function test from here and use setup
function definition is a statement, goes there
This commit is contained in:
parent
2094101bb2
commit
300ce24739
@ -1,4 +1,3 @@
|
|||||||
require_relative "test_basic"
|
require_relative "test_basic"
|
||||||
require_relative "test_call"
|
require_relative "test_call"
|
||||||
require_relative "test_field_access"
|
require_relative "test_field_access"
|
||||||
require_relative "test_function"
|
|
||||||
|
@ -6,48 +6,38 @@ module Virtual
|
|||||||
|
|
||||||
def setup
|
def setup
|
||||||
Virtual.machine.boot
|
Virtual.machine.boot
|
||||||
|
@root = :call_site
|
||||||
|
@output = Register::RegisterValue
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_call_main_plain
|
def test_call_main_plain
|
||||||
@root = :call_site
|
|
||||||
@string_input = 'main()'
|
@string_input = 'main()'
|
||||||
@output = Register::RegisterValue
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_call_main_int
|
def test_call_main_int
|
||||||
@root = :call_site
|
|
||||||
@string_input = 'main(1)'
|
@string_input = 'main(1)'
|
||||||
@output = Register::RegisterValue
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
def ttest_call_self_main
|
def test_call_self_main
|
||||||
@root = :call_site
|
|
||||||
@string_input = 'self.main()'
|
@string_input = 'self.main()'
|
||||||
@output = Register::RegisterValue
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_call_main_string
|
def test_call_main_string
|
||||||
@root = :call_site
|
|
||||||
@string_input = 'main("1")'
|
@string_input = 'main("1")'
|
||||||
@output = Register::RegisterValue
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_call_main_op
|
def test_call_main_op
|
||||||
Virtual.machine.space.get_main.ensure_local(:bar , :Integer)
|
Virtual.machine.space.get_main.ensure_local(:bar , :Integer)
|
||||||
@root = :call_site
|
|
||||||
@string_input = 'main( bar )'
|
@string_input = 'main( bar )'
|
||||||
@output = Register::RegisterValue
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_call_string_put
|
def test_call_string_put
|
||||||
@root = :call_site
|
|
||||||
@string_input = '"Hello Raisa, I am salama".putstring()'
|
@string_input = '"Hello Raisa, I am salama".putstring()'
|
||||||
@output = Register::RegisterValue
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
require_relative "compiler_helper"
|
|
||||||
|
|
||||||
module Virtual
|
|
||||||
class TestFunctions < MiniTest::Test
|
|
||||||
include CompilerHelper
|
|
||||||
|
|
||||||
def setup
|
|
||||||
Virtual.machine.boot
|
|
||||||
end
|
|
||||||
|
|
||||||
#reset the compiler (other than other tests that need to fake their inside a method)
|
|
||||||
def set_main compiler
|
|
||||||
compiler.set_main(nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_puts
|
|
||||||
@root = :function_definition
|
|
||||||
@string_input = <<HERE
|
|
||||||
int puts(Word str)
|
|
||||||
main()
|
|
||||||
end
|
|
||||||
HERE
|
|
||||||
@output = AST::Node
|
|
||||||
check
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user