2015-07-19 09:54:36 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
2017-01-01 23:53:28 +01:00
|
|
|
class TestPositioned < MiniTest::Test
|
2015-10-16 16:13:08 +02:00
|
|
|
def setup
|
2017-01-19 08:02:29 +01:00
|
|
|
Risc.machine.boot unless Risc.machine.booted
|
2015-10-16 16:13:08 +02:00
|
|
|
end
|
2015-07-19 09:54:36 +02:00
|
|
|
def test_list1
|
2015-11-18 10:55:29 +01:00
|
|
|
list = Parfait.new_list([1])
|
2015-11-04 09:33:10 +01:00
|
|
|
assert_equal 32 , list.padded_length
|
2015-07-19 09:54:36 +02:00
|
|
|
end
|
|
|
|
def test_list5
|
2015-11-18 10:55:29 +01:00
|
|
|
list = Parfait.new_list([1,2,3,4,5])
|
2015-11-04 09:33:10 +01:00
|
|
|
assert_equal 32 , list.padded_length
|
2015-07-19 09:54:36 +02:00
|
|
|
end
|
2016-02-25 20:50:10 +01:00
|
|
|
def test_type
|
2016-12-30 17:39:49 +01:00
|
|
|
type = Parfait::Type.for_hash Parfait.object_space.get_class_by_name(:Object) , {}
|
2016-12-29 17:45:32 +01:00
|
|
|
type.set_type( type )
|
2016-02-25 20:50:10 +01:00
|
|
|
assert_equal 32 , type.padded_length
|
2015-07-19 09:54:36 +02:00
|
|
|
end
|
2015-11-03 15:21:50 +01:00
|
|
|
def test_word
|
|
|
|
word = Parfait::Word.new(12)
|
2015-11-04 09:33:10 +01:00
|
|
|
assert_equal 32 , word.padded_length
|
2015-11-03 15:21:50 +01:00
|
|
|
end
|
2016-12-15 21:15:20 +01:00
|
|
|
def test_raises_no_init
|
2017-01-01 23:53:28 +01:00
|
|
|
assert_raises { Positioned.position(self)}
|
2016-12-15 21:15:20 +01:00
|
|
|
end
|
|
|
|
def test_raises_set_nil
|
2017-01-01 23:53:28 +01:00
|
|
|
assert_raises { Positioned.set_position(self,nil)}
|
2016-12-15 21:15:20 +01:00
|
|
|
end
|
|
|
|
def test_raises_reset_far
|
|
|
|
assert_raises do
|
|
|
|
test = TestPosition.new
|
2016-12-28 20:40:06 +01:00
|
|
|
test.set_position 0
|
|
|
|
test.set_position 12000
|
2016-12-15 21:15:20 +01:00
|
|
|
end
|
|
|
|
end
|
2017-01-01 20:52:35 +01:00
|
|
|
|
|
|
|
def test_pos_arm
|
|
|
|
mov = Arm::ArmMachine.mov :r1, 128
|
|
|
|
mov.set_position(0)
|
|
|
|
end
|
2015-07-19 09:54:36 +02:00
|
|
|
end
|