add reg to slot

This commit is contained in:
Torsten Ruger
2018-04-06 20:21:14 +03:00
parent fe71ddc5ae
commit cae5e323ec
5 changed files with 42 additions and 19 deletions

View File

@ -1,7 +1,7 @@
require_relative "../helper"
module Risc
class TestBuilder < MiniTest::Test
class TestBuilderBoot #< MiniTest::Test
def setup
Risc.machine.boot
@ -9,12 +9,6 @@ module Risc
compiler = Risc::MethodCompiler.new( init )
@builder = Builder.new(compiler)
end
def test_has_build
assert_nil @builder.build{ }
end
def test_has_attribute
assert_nil @builder.built
end
def test_register_alloc_space
reg = @builder.space
assert_equal RiscValue , reg.class
@ -42,4 +36,17 @@ module Risc
assert_equal :r1 , built.array.symbol
end
end
class TestBuilderNoBoot < MiniTest::Test
def setup
@builder = Builder.new(nil)
end
def test_has_build
assert_nil @builder.build{ }
end
def test_has_attribute
assert_nil @builder.built
end
end
end

View File

@ -44,5 +44,12 @@ module Risc
assert_equal @r0 , instr.register
assert_equal 4 , instr.index
end
def test_reg_to_slot
instr = @r0 >> @r1[:first_message]
assert_equal RegToSlot , instr.class
assert_equal @r1 , instr.array
assert_equal @r0 , instr.register
assert_equal 4 , instr.index
end
end
end