rubyx/test/compiler/code_checker.rb
Torsten Ruger f4a4ccb98e several larger changes came together, bit of cleaning too
- all code must be in functions (which must be in classes).
— changes a fair few tests
— also changes api, as method is not recursive, not passed around
- all state in instance vars in compiler (no accessors)
- class is another such variable, surely more coming
all green again
2015-10-06 00:27:13 +03:00

17 lines
594 B
Ruby

module CodeChecker
def check
Virtual.machine.boot.parse_and_compile @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