diff --git a/test/rubyx/macro/test_integer_comparison.rb b/test/rubyx/macro/test_integer_comparison.rb index 82c356ee..fd83ac83 100644 --- a/test/rubyx/macro/test_integer_comparison.rb +++ b/test/rubyx/macro/test_integer_comparison.rb @@ -5,7 +5,7 @@ module RubyX class TestIntegerSame < MiniTest::Test include MacroHelper def op ; :== ; end - def len ; 25 ; end + def len ; 24 ; end def source < ; end - def len ; 26 ; end + def len ; 25 ; end end class TestIntegerSm < TestIntegerSame def op ; :< ; end - def len ; 26 ; end + def len ; 25 ; end end class TestIntegerLe < TestIntegerSame def op ; :>= ; end diff --git a/test/slot_machine/test_mom_collection.rb b/test/slot_machine/test_mom_collection.rb index 20442ef5..3ccf137a 100644 --- a/test/slot_machine/test_mom_collection.rb +++ b/test/slot_machine/test_mom_collection.rb @@ -43,7 +43,7 @@ module SlotMachine end def test_has_risc_instructions assert_equal Risc::Label, compiler.risc_instructions.class - assert_equal 13, compiler.risc_instructions.length + assert_equal 12, compiler.risc_instructions.length end end end diff --git a/test/slot_machine/test_slotted_constant.rb b/test/slot_machine/test_slotted_constant.rb index d63153fb..d586acd9 100644 --- a/test/slot_machine/test_slotted_constant.rb +++ b/test/slot_machine/test_slotted_constant.rb @@ -3,39 +3,39 @@ require_relative "helper" module SlotMachine class TestSlotConstant < MiniTest::Test + include Risc::HasCompiler def setup Parfait.boot!(Parfait.default_test_options) - compiler = Risc.test_compiler + @compiler = Risc.test_compiler @slotted = Slotted.for(StringConstant.new("hi") , nil) - register = @slotted.to_register(compiler , InstructionMock.new) - @instruction = compiler.risc_instructions.next + register = @slotted.to_register(@compiler , InstructionMock.new) end def test_load - assert_load @instruction , Parfait::Word , "id_" + assert_load 1 , Parfait::Word , "id_" end def test_def_const - assert_equal "hi" , @instruction.constant.to_string + assert_equal "hi" , risc(1).constant.to_string end end class TestSlotConstantType < MiniTest::Test + include Risc::HasCompiler def setup Parfait.boot!(Parfait.default_test_options) - compiler = Risc.test_compiler + @compiler = Risc.test_compiler @slotted = Slotted.for(StringConstant.new("hi") , [:type]) - register = @slotted.to_register(compiler , InstructionMock.new) - @instruction = compiler.risc_instructions.next + register = @slotted.to_register(@compiler , InstructionMock.new) end def test_load - assert_load @instruction , Parfait::Word , "id_" + assert_load 1 , Parfait::Word , "id_" end def test_def_const - assert_equal "hi" , @instruction.constant.to_string + assert_equal "hi" , risc(1).constant.to_string end def test_to_s assert_equal "StringConstant.type" , @slotted.to_s end def test_def_register2 - assert_slot_to_reg @instruction.next , "id_" , 0 , "id_.0" + assert_slot_to_reg 2 , "id_" , 0 , "id_.0" end end end diff --git a/test/slot_machine/test_slotted_object.rb b/test/slot_machine/test_slotted_object.rb index 8d37d88d..049088e9 100644 --- a/test/slot_machine/test_slotted_object.rb +++ b/test/slot_machine/test_slotted_object.rb @@ -3,24 +3,24 @@ require_relative "helper" module SlotMachine class TestSlottedObjectType < MiniTest::Test + include Risc::HasCompiler def setup Parfait.boot!(Parfait.default_test_options) - compiler = Risc.test_compiler + @compiler = Risc.test_compiler @slotted = Slotted.for(Parfait.object_space , slot2) - register = @slotted.to_register(compiler , InstructionMock.new) - @instruction = compiler.risc_instructions.next + register = @slotted.to_register(@compiler , InstructionMock.new) end def slot2 [:type] end def test_load - assert_load @instruction , Parfait::Space , "id_" + assert_load 1 , Parfait::Space , "id_" end def test_to_s assert_equal "Space." + slot2.join(".") , @slotted.to_s end def test_def_register2 - assert_slot_to_reg @instruction.next , "id_" , 0 , "id_.type" + assert_slot_to_reg 2 , "id_" , 0 , "id_.type" end end class TestSlottedObjectType2 < TestSlottedObjectType @@ -28,7 +28,7 @@ module SlotMachine [:type , :type] end def test_def_register3 - assert_slot_to_reg @instruction.next(2) , "id_.type" , 0 , "id_.type.type" + assert_slot_to_reg 3 , "id_.type" , 0 , "id_.type.type" end end class TestSlottedObjectType3 < TestSlottedObjectType @@ -36,7 +36,7 @@ module SlotMachine [:type , :type , :type ] end def test_def_register3 - assert_slot_to_reg @instruction.next(3) , "id_.type.type" , 0 , "id_.type.type.type" + assert_slot_to_reg 4 , "id_.type.type" , 0 , "id_.type.type.type" end end end