a50368c3aa
with own data objects, we can assemble into them first then write may also store cpu instructions
44 lines
1.2 KiB
Ruby
44 lines
1.2 KiB
Ruby
require_relative "../helper"
|
|
|
|
module Risc
|
|
class TestAssembler < MiniTest::Test
|
|
|
|
def setup
|
|
@machine = Risc.machine.boot
|
|
end
|
|
def test_no_object
|
|
@assembler = Assembler.new(@machine , {})
|
|
assert @machine.translate_arm
|
|
end
|
|
def test_space
|
|
@assembler = Assembler.new(@machine , Collector.collect_space)
|
|
assert @machine.translate_arm
|
|
end
|
|
|
|
def test_write_fails
|
|
@assembler = Assembler.new(@machine , {})
|
|
assert_raises{ @assembler.assemble} #must translate first
|
|
end
|
|
def test_assemble_no_objects
|
|
@assembler = Assembler.new(@machine , {})
|
|
assert @machine.translate_arm
|
|
assert @assembler.assemble
|
|
end
|
|
|
|
def test_translate_space
|
|
@assembler = Assembler.new(@machine , Collector.collect_space)
|
|
assert @machine.translate_arm
|
|
end
|
|
def test_assemble_space
|
|
@assembler = Assembler.new(@machine , Collector.collect_space)
|
|
assert @machine.translate_arm
|
|
assert @assembler.assemble
|
|
end
|
|
def pest_write_space
|
|
@assembler = Assembler.new(@machine , Collector.collect_space)
|
|
assert @machine.translate_arm
|
|
assert @assembler.write_as_string
|
|
end
|
|
end
|
|
end
|