require_relative "virtual_helper" 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 def test_simplest_function @string_input = < 5) return 10 else return 20 end end HERE @output = "" check end def est_function_return_while @string_input = < 5) do n = n + 1 return n end end HERE @output = "" check end def pest_function_big_while @string_input = < 1 ) do tmp = a a = b b = tmp + b puts(b) n = n - 1 end end HERE @output = "" check end end end