cleaning
This commit is contained in:
16
test/compiler/code_checker.rb
Normal file
16
test/compiler/code_checker.rb
Normal file
@ -0,0 +1,16 @@
|
||||
module CodeChecker
|
||||
def check
|
||||
Virtual.machine.boot.compile_main @string_input
|
||||
produced = Virtual.machine.space.get_main.source
|
||||
assert @output , "No output given"
|
||||
assert_equal @output.length , produced.blocks.length , "Block length"
|
||||
produced.blocks.each_with_index do |b,i|
|
||||
codes = @output[i]
|
||||
assert codes , "No codes for block #{i}"
|
||||
assert_equal b.codes.length , codes.length , "Code length for block #{i}"
|
||||
b.codes.each_with_index do |c , ii |
|
||||
assert_equal codes[ii] , c.class , "Block #{i} , code #{ii}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,21 +1,9 @@
|
||||
require_relative "compiler_helper"
|
||||
require_relative "code_checker"
|
||||
|
||||
module Virtual
|
||||
class TestMethods < MiniTest::Test
|
||||
|
||||
def check
|
||||
Virtual.machine.boot.compile_main @string_input
|
||||
produced = Virtual.machine.space.get_main.source
|
||||
assert @output , "No output given"
|
||||
assert_equal @output.length , produced.blocks.length , "Block length"
|
||||
produced.blocks.each_with_index do |b,i|
|
||||
codes = @output[i]
|
||||
assert codes , "No codes for block #{i}"
|
||||
assert_equal b.codes.length , codes.length , "Code length for block #{i}"
|
||||
b.codes.each_with_index do |c , ii |
|
||||
assert_equal codes[ii] , c.class , "Block #{i} , code #{ii}"
|
||||
end
|
||||
end
|
||||
end
|
||||
include CodeChecker
|
||||
|
||||
def test_module
|
||||
@string_input = <<HERE
|
||||
|
Reference in New Issue
Block a user