2014-08-21 21:57:20 +02:00
|
|
|
require_relative "virtual_helper"
|
|
|
|
|
|
|
|
class HelloTest < MiniTest::Test
|
|
|
|
include VirtualHelper
|
|
|
|
|
|
|
|
def check
|
|
|
|
machine = Virtual::Machine.boot
|
|
|
|
expressions = machine.compile_main @string_input
|
|
|
|
puts ""
|
2014-08-24 20:32:21 +02:00
|
|
|
Virtual::BootSpace.space.run_passes
|
2014-08-25 16:03:39 +02:00
|
|
|
ass = Register::Assembler.new(Virtual::BootSpace.space)
|
2014-08-26 21:35:56 +02:00
|
|
|
ass.assemble
|
2014-08-22 14:08:46 +02:00
|
|
|
puts Sof::Writer.write(expressions)
|
2014-08-24 20:32:21 +02:00
|
|
|
# puts Sof::Writer.write(Virtual::BootSpace.space)
|
2014-08-21 21:57:20 +02:00
|
|
|
end
|
|
|
|
|
2014-08-22 08:21:59 +02:00
|
|
|
def qtest_simplest_function
|
2014-08-21 21:57:20 +02:00
|
|
|
@string_input = <<HERE
|
|
|
|
def foo(x)
|
|
|
|
5
|
|
|
|
end
|
|
|
|
HERE
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2014-08-22 09:21:12 +02:00
|
|
|
def ttest_puts_string
|
2014-08-21 21:57:20 +02:00
|
|
|
@string_input = <<HERE
|
|
|
|
def foo()
|
|
|
|
puts("Hello")
|
|
|
|
end
|
|
|
|
foo()
|
2014-08-22 09:21:12 +02:00
|
|
|
HERE
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_string_put
|
|
|
|
@string_input = <<HERE
|
|
|
|
def foo()
|
|
|
|
"Hello".puts()
|
|
|
|
end
|
2014-08-21 21:57:20 +02:00
|
|
|
HERE
|
|
|
|
check
|
|
|
|
end
|
|
|
|
end
|