rubyx/test/risc/test_assembler.rb

37 lines
991 B
Ruby
Raw Normal View History

2017-01-01 20:51:23 +01:00
require_relative "../helper"
module Risc
2017-01-01 20:51:23 +01:00
class TestAssembler < MiniTest::Test
def setup
@machine = Risc.machine.boot
2017-01-01 20:51:23 +01:00
end
2018-03-28 12:04:25 +02:00
def test_no_object
2017-01-01 20:51:23 +01:00
@assembler = Assembler.new(@machine , {})
end
2018-03-28 12:04:25 +02:00
def test_space
2017-01-01 20:51:23 +01:00
@assembler = Assembler.new(@machine , Collector.collect_space)
end
2018-03-28 12:04:25 +02:00
def test_write_fails
2017-01-01 20:51:23 +01:00
@assembler = Assembler.new(@machine , {})
2018-03-25 19:02:51 +02:00
assert_raises{ @assembler.write_as_string} #must translate first
2017-01-01 20:51:23 +01:00
end
2018-03-28 12:04:25 +02:00
def test_assemble_no_objects
2017-01-01 20:51:23 +01:00
@assembler = Assembler.new(@machine , {})
assert @machine.translate_arm
2018-03-28 12:04:25 +02:00
assert @machine.position_all
2017-01-01 20:51:23 +01:00
end
2018-03-28 12:04:25 +02:00
def test_assemble_space
2017-01-01 20:51:23 +01:00
@assembler = Assembler.new(@machine , Collector.collect_space)
2018-03-28 12:04:25 +02:00
assert @machine.position_all
2017-01-01 20:51:23 +01:00
end
2018-03-26 12:43:26 +02:00
def test_write_space
assert @machine.translate_arm
assert @machine.position_all
@assembler = Assembler.new(@machine , Collector.collect_space)
#assert @assembler.write_as_string
2017-01-01 20:51:23 +01:00
end
end
end