rubyx/test/mom/instruction/helper.rb
Torsten Rüger 6f108f67d7 Starting to build detailed mom to risc test
so we can get rid of brittle risc folder tests
All of those tests rely on many many implementation details
should just test result through interpreter, no chain.
2019-09-15 17:44:35 +03:00

37 lines
710 B
Ruby

require_relative '../helper'
module Mom
class InstructionMock < Instruction
def initialize
super("mocking")
end
end
class MomInstructionTest < MiniTest::Test
include Output
def setup
Parfait.boot!(Parfait.default_test_options)
@instruction = instruction
@compiler = Risc::MethodCompiler.new(FakeCallable.new , Label.new("source","start"))
@instruction.to_risc(@compiler)
@risc = @compiler.risc_instructions
end
def risc(at)
return @risc if at == 0
@risc.next( at )
end
def all
ret = []
@risc.each {|i| ret << i}
ret
end
def all_str
class_list(all.collect{|i|i.class})
end
end
end