rename the XX_slot classes to SlottedXX
move to slotted and slots (wip)
This commit is contained in:
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module SlotMachine
|
||||
class TestArgumentTransfer < SlotMachineInstructionTest
|
||||
def instruction
|
||||
receiver = MessageSlot.new( [:receiver])
|
||||
receiver = SlottedMessage.new( [:receiver])
|
||||
arg = SlotLoad.new("test", [:message, :caller] , [:message,:type] )
|
||||
ArgumentTransfer.new("" , receiver ,[arg])
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module SlotMachine
|
||||
class TestNotSameCheck < SlotMachineInstructionTest
|
||||
def instruction
|
||||
target = Slot.for(:message , :caller)
|
||||
target = Slotted.for(:message , :caller)
|
||||
NotSameCheck.new(target , target , Label.new("ok" , "target"))
|
||||
end
|
||||
def test_len
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module SlotMachine
|
||||
class TestSameCheck < SlotMachineInstructionTest
|
||||
def instruction
|
||||
target = MessageSlot.new( :caller)
|
||||
target = SlottedMessage.new( :caller)
|
||||
TruthCheck.new(target , Label.new("ok" , "target"))
|
||||
end
|
||||
def test_len
|
||||
|
@ -4,7 +4,7 @@ module SlotMachine
|
||||
class TestSlotBasics < MiniTest::Test
|
||||
|
||||
def slot(slot = :caller)
|
||||
MessageSlot.new(slot)
|
||||
SlottedMessage.new(slot)
|
||||
end
|
||||
def test_create_ok1
|
||||
assert_equal :message , slot.known_object
|
||||
|
@ -5,7 +5,7 @@ module SlotMachine
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
@definition = MessageSlot.new( :caller)
|
||||
@definition = SlottedMessage.new( :caller)
|
||||
@register = @definition.to_register(@compiler , "fake source")
|
||||
@instruction = @compiler.instructions.first
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module SlotMachine
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
@definition = Slot.for(StringConstant.new("hi") , [])
|
||||
@definition = Slotted.for(StringConstant.new("hi") , [])
|
||||
@register = @definition.to_register(@compiler , InstructionMock.new)
|
||||
@instruction = @compiler.instructions.first
|
||||
end
|
||||
@ -27,7 +27,7 @@ module SlotMachine
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
@definition = Slot.for(StringConstant.new("hi") , [:type])
|
||||
@definition = Slotted.for(StringConstant.new("hi") , [:type])
|
||||
@register = @definition.to_register(@compiler , InstructionMock.new)
|
||||
@instruction = @compiler.instructions.first
|
||||
end
|
@ -4,7 +4,7 @@ module SlotMachine
|
||||
class TestSlotBasics < MiniTest::Test
|
||||
|
||||
def slot(slot = :caller)
|
||||
MessageSlot.new(slot)
|
||||
SlottedMessage.new(slot)
|
||||
end
|
||||
def test_create_ok1
|
||||
assert_equal :message , slot.known_object
|
@ -53,11 +53,11 @@ module Sol
|
||||
assert_equal SlotLoad, @ins.class
|
||||
end
|
||||
def test_left
|
||||
assert_equal MessageSlot , @ins.left.class
|
||||
assert_equal SlottedMessage , @ins.left.class
|
||||
assert_equal [:return_value] , @ins.left.slots
|
||||
end
|
||||
def test_right
|
||||
assert_equal MessageSlot , @ins.right.class
|
||||
assert_equal SlottedMessage , @ins.right.class
|
||||
assert_equal [:receiver , :inst] , @ins.right.slots
|
||||
end
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ module Sol
|
||||
def test_receiver
|
||||
assert_equal SlotMachine::ArgumentTransfer, @ins.next(1).class
|
||||
assert_equal 0, @ins.next(1).arguments.length
|
||||
assert_equal ObjectSlot, @ins.next(1).receiver.class
|
||||
assert_equal SlottedObject, @ins.next(1).receiver.class
|
||||
assert_equal Parfait::Class, @ins.next(1).receiver.known_object.class
|
||||
assert_equal :Space, @ins.next(1).receiver.known_object.name
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ module Sol
|
||||
assert_equal :Object , @ins.next.receiver.known_object.name
|
||||
end
|
||||
def test_receiver_move
|
||||
assert_equal ObjectSlot, @ins.next.receiver.class
|
||||
assert_equal SlottedObject, @ins.next.receiver.class
|
||||
end
|
||||
def test_receiver
|
||||
assert_equal Parfait::Class, @ins.next.receiver.known_object.class
|
||||
|
@ -73,7 +73,7 @@ module SolBlocks
|
||||
def test_assigns_move
|
||||
@ins = compile_main_block( "@a = arg")
|
||||
assert_equal SlotMachine::SlotLoad , @ins.class , @ins
|
||||
assert_equal SlotMachine::MessageSlot , @ins.right.class , @ins
|
||||
assert_equal SlotMachine::SlottedMessage , @ins.right.class , @ins
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -12,7 +12,7 @@ module SolBlocks
|
||||
assert_equal TruthCheck , @ins.next(3).class
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.next(3).condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.next(3).condition.class , @ins
|
||||
end
|
||||
def test_simple_call
|
||||
assert_equal SimpleCall , @ins.next(2).class
|
||||
|
@ -15,7 +15,7 @@ module SolBlocks
|
||||
assert_equal TruthCheck , @ins.next.class , @ins
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.next.condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.next.condition.class , @ins
|
||||
end
|
||||
def test_array
|
||||
check_array [Label, TruthCheck, SlotLoad, Jump, Label,
|
||||
|
@ -8,7 +8,7 @@ module Sol
|
||||
"self.get_internal_word(0);return"
|
||||
end
|
||||
def test_receiver
|
||||
assert_equal MessageSlot, @ins.next.receiver.class
|
||||
assert_equal SlottedMessage, @ins.next.receiver.class
|
||||
end
|
||||
def test_arg_one
|
||||
assert_equal SlotLoad, @ins.next(1).arguments[0].class
|
||||
@ -23,7 +23,7 @@ module Sol
|
||||
assert_equal :get_internal_word, @ins.next(2).method.name
|
||||
end
|
||||
def test_receiver_move
|
||||
assert_equal MessageSlot, @ins.next.receiver.class
|
||||
assert_equal SlottedMessage, @ins.next.receiver.class
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -14,7 +14,7 @@ module Sol
|
||||
assert_equal :div4, @ins.next(2).method.name
|
||||
end
|
||||
def test_receiver_move
|
||||
assert_equal ConstantSlot, @ins.next.receiver.class
|
||||
assert_equal SlottedConstant, @ins.next.receiver.class
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ module Sol
|
||||
Label, ReturnSequence , Label] , @ins
|
||||
end
|
||||
def test_receiver_move
|
||||
assert_equal ConstantSlot, @ins.next.receiver.class
|
||||
assert_equal SlottedConstant, @ins.next.receiver.class
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -79,7 +79,7 @@ module Sol
|
||||
@compiler = compile_main( "@a = arg;return")
|
||||
@ins = @compiler.slot_instructions.next
|
||||
assert_equal SlotMachine::SlotLoad , @ins.class , @ins
|
||||
assert_equal SlotMachine::MessageSlot , @ins.right.class , @ins
|
||||
assert_equal SlotMachine::SlottedMessage , @ins.right.class , @ins
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.next.class , @ins
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.next.condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.next.condition.class , @ins
|
||||
end
|
||||
def test_label_after_check
|
||||
assert_equal Label , @ins.next(2).class , @ins
|
||||
|
@ -14,7 +14,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.class , @ins
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.condition.class , @ins
|
||||
end
|
||||
def test_label_after_check
|
||||
assert_equal Label , @ins.next.class , @ins
|
||||
|
@ -14,7 +14,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.class , @ins
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.condition.class , @ins
|
||||
end
|
||||
def test_label_after_check
|
||||
assert_equal Label , @ins.next.class , @ins
|
||||
|
@ -14,7 +14,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.class , @ins
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.condition.class , @ins
|
||||
end
|
||||
def test_label_after_check
|
||||
assert_equal Label , @ins.next.class , @ins
|
||||
|
@ -13,7 +13,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.next(3).class
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.next(3).condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.next(3).condition.class , @ins
|
||||
end
|
||||
def test_hoisted_call
|
||||
assert_equal SimpleCall , @ins.next(2).class
|
||||
|
@ -16,7 +16,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.next.class , @ins
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.next.condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.next.condition.class , @ins
|
||||
end
|
||||
def test_array
|
||||
check_array [Label, TruthCheck, SlotLoad, Jump, Label ,
|
||||
|
@ -14,7 +14,7 @@ module Sol
|
||||
assert_equal TruthCheck , @ins.next(4).class
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal MessageSlot , @ins.next(4).condition.class , @ins
|
||||
assert_equal SlottedMessage , @ins.next(4).condition.class , @ins
|
||||
end
|
||||
def test_hoisetd
|
||||
jump = @ins.next(8)
|
||||
|
@ -28,13 +28,13 @@ module Sol
|
||||
assert_equal [:next_message, :arg1], left.slots
|
||||
end
|
||||
def test_check_left
|
||||
assert_equal ObjectSlot, @ins.left.class
|
||||
assert_equal SlottedObject, @ins.left.class
|
||||
assert_equal Parfait::CallableMethod, @ins.left.known_object.class
|
||||
assert_equal :main, @ins.left.known_object.name
|
||||
assert @ins.left.slots.empty?
|
||||
end
|
||||
def test_check_right
|
||||
assert_equal MessageSlot, @ins.right.class
|
||||
assert_equal SlottedMessage, @ins.right.class
|
||||
assert_equal :message, @ins.right.known_object
|
||||
assert_equal [:method] , @ins.right.slots
|
||||
end
|
||||
|
Reference in New Issue
Block a user