2018-05-16 11:49:46 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 19:55:41 +02:00
|
|
|
module SlotMachine
|
2018-05-16 11:49:46 +02:00
|
|
|
class TestSlotLoad1 < MiniTest::Test
|
|
|
|
|
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2019-08-12 23:13:29 +02:00
|
|
|
load = SlotLoad.new("test", [:message, :caller] , [:message,:type] )
|
2020-02-28 11:54:17 +01:00
|
|
|
compiler = Risc.test_compiler
|
|
|
|
load.to_risc(compiler)
|
|
|
|
@instructions = compiler.risc_instructions.next
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
2020-03-08 17:49:55 +01:00
|
|
|
def risc(i)
|
|
|
|
return @instructions if i == 0
|
|
|
|
@instructions.next(i)
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
2020-03-08 17:49:55 +01:00
|
|
|
def test_ins_0
|
|
|
|
assert_slot_to_reg 0 , :message , 0 , "message.type"
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
2020-03-08 17:49:55 +01:00
|
|
|
def test_ins_1
|
|
|
|
assert_reg_to_slot 1 , "message.type" , :message , 6
|
|
|
|
assert_nil risc(2)
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|