misc fixes and (finally, sigh) green again
deeeep dive, almost 40 commits
This commit is contained in:
@ -14,7 +14,7 @@ module Mom
|
||||
assert_equal :caller , slot.slots.first
|
||||
end
|
||||
def test_to_s
|
||||
assert_equal "[message,caller]" , slot.to_s
|
||||
assert_equal "[message, caller]" , slot.to_s
|
||||
end
|
||||
def test_create_fail_none
|
||||
assert_raises {slot(nil)}
|
||||
|
@ -45,7 +45,7 @@ module Risc
|
||||
ret = main_ticks(63)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal :r1 , ret.register.symbol
|
||||
assert_equal 20996 , @interpreter.get_register(ret.register)
|
||||
assert_equal 21924 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
def test_sys
|
||||
sys = main_ticks(68)
|
||||
|
@ -5,6 +5,7 @@ module Risc
|
||||
class TestBranchListenerBooted < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Risc.boot!
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@bin_pos = CodeListener.init(@binary,:interpreter).set(0)
|
||||
@label = Label.new("HI","ho" , FakeAddress.new(2))
|
||||
|
@ -4,6 +4,7 @@ module Risc
|
||||
class TestPositionTranslated < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Risc.boot!
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@method = Parfait.object_space.types.values.first.methods
|
||||
@label = Risc.label("hi","ho")
|
||||
|
@ -19,17 +19,13 @@ module Risc
|
||||
end
|
||||
class TestLinkerInit < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:arm)
|
||||
@linker.position_all
|
||||
@linker.create_binary
|
||||
@linker = RubyX::RubyXCompiler.new("class Space;def main;return 1;end;end").ruby_to_binary(:arm)
|
||||
end
|
||||
def test_pos_cpu
|
||||
assert_equal 0 , Position.get(@linker.cpu_init).at
|
||||
end
|
||||
def test_cpu_at
|
||||
assert_equal "0x624c" , Position.get(@linker.cpu_init.first).to_s
|
||||
assert_equal "0x626c" , Position.get(@linker.cpu_init.first).to_s
|
||||
end
|
||||
def test_cpu_label
|
||||
assert_equal Position , Position.get(@linker.cpu_init.first).class
|
||||
@ -44,7 +40,7 @@ module Risc
|
||||
end
|
||||
def test_positions_set
|
||||
@linker.object_positions.each do |obj,position|
|
||||
assert position.valid? , "#{position} , #{obj.object_id.to_s(16)}"
|
||||
assert position.valid? , "#{position} #{position.object.class}, #{obj.object_id.to_s(16)}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ module Risc
|
||||
input = in_Test("def meth; return 'Hi';end")
|
||||
mom = RubyX::RubyXCompiler.new(input).ruby_to_mom
|
||||
assert_equal Mom::MomCompiler , mom.class
|
||||
compiler = mom.method_compilers.last
|
||||
compiler = mom.method_compilers.first
|
||||
assert_equal MethodCompiler , compiler.class
|
||||
assert compiler.constants.include?("Hi")
|
||||
end
|
||||
|
@ -5,38 +5,18 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
@machine = Risc.machine.boot
|
||||
@translator = Arm::Translator.new
|
||||
end
|
||||
|
||||
def test_has_translate
|
||||
assert @translator.respond_to?(:translate)
|
||||
end
|
||||
def test_no_translate_junk
|
||||
assert_raises {@translator.translate( "Hi there")}
|
||||
end
|
||||
def test_translate_label
|
||||
label = Parfait.object_space.get_main.risc_instructions
|
||||
assert_equal "Space_Type.main" ,label.to_cpu(@translator).name , label
|
||||
end
|
||||
|
||||
def test_translate_space
|
||||
assert @machine.translate(:arm)
|
||||
end
|
||||
|
||||
def test_no_loops_in_chain
|
||||
@machine.translate(:arm)
|
||||
@machine.position_all
|
||||
init = Parfait.object_space.get_init
|
||||
all = []
|
||||
init.cpu_instructions.each do |ins|
|
||||
assert !all.include?(ins)
|
||||
all << ins
|
||||
end
|
||||
end
|
||||
def test_no_risc #by assembling, risc doesnt have assemble method
|
||||
@machine.translate(:arm)
|
||||
@machine.position_all
|
||||
@machine.object_positions.keys.each do |method|
|
||||
next unless method.is_a? Parfait::TypedMethod
|
||||
method.cpu_instructions.each do |ins|
|
||||
ins.assemble(Util::DevNull.new)
|
||||
end
|
||||
end
|
||||
label = Risc::Label.new("HI","ho" , FakeAddress.new(0))
|
||||
assert_equal "ho" ,label.to_cpu(@translator).name , label
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,6 +39,7 @@ module MomCompile
|
||||
end
|
||||
|
||||
def compile_mom(input)
|
||||
Risc.boot!
|
||||
RubyX::RubyXCompiler.new(input).ruby_to_mom
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user