fixing tests

This commit is contained in:
Torsten 2020-03-12 22:20:38 +02:00
parent 504fc3509e
commit 126466e9a9
4 changed files with 22 additions and 22 deletions

View File

@ -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
<<GET
class Integer < Data4
@ -31,11 +31,11 @@ GET
end
class TestIntegerLg < TestIntegerSame
def op ; :> ; 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

View File

@ -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

View File

@ -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

View File

@ -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