rubyx/test/slot_machine/instructions/test_slot_load2.rb

32 lines
914 B
Ruby
Raw Normal View History

require_relative "helper"
module SlotMachine
class TestSlotLoad2 < MiniTest::Test
def setup
2019-02-08 22:03:23 +01:00
Parfait.boot!(Parfait.default_test_options)
compiler = Risc.test_compiler
load = SlotLoad.new( "test",[:message, :caller, :type] , [:message, :caller , :type] )
load.to_risc(compiler)
@instructions = compiler.risc_instructions.next
end
2020-03-08 17:49:55 +01:00
def risc(i)
return @instructions if i == 0
@instructions.next(i)
end
def test_ins
2020-03-08 17:49:55 +01:00
assert_slot_to_reg 0 ,:message , 6 , "message.caller"
end
def test_ins_next
2020-03-08 17:49:55 +01:00
assert_slot_to_reg 1 ,"message.caller" , 0 , "message.caller.type"
end
def test_ins_next_2
2020-03-08 17:49:55 +01:00
assert_slot_to_reg 2 , :message , 6 , "message.caller"
end
def test_ins_next_3
2020-03-08 17:49:55 +01:00
assert_reg_to_slot 3 ,"message.caller.type" , "message.caller" , 0
assert_equal NilClass , @instructions.next(4).class
end
end
end