seperate different Position classes into own files

also tests
and have Position module keep all positions
(singletons should be at module, not class level)
This commit is contained in:
Torsten Ruger
2018-05-10 20:56:12 +03:00
parent 1169fa7220
commit bc1e29e4f6
9 changed files with 192 additions and 145 deletions

View File

@ -41,5 +41,20 @@ module Risc
def test_has_jump
assert_equal "ea0011f4" , @machine.binary_init.get_word(1).to_s(16)
end
def test_pos_bin
assert_equal "0x0" , Position.get(@machine.binary_init).to_s
end
def test_pos_cpu
assert_equal 12 , Position.get(@machine.cpu_init).at
end
def test_cpu_at
assert_equal 3 , Position.get(@machine.cpu_init.first).at
end
def test_cpu_bin
assert_equal "0x3ed8" , Position.get(Position.get(@machine.cpu_init.first).binary).to_s
end
def test_cpu_label
assert_equal Position::InstructionPosition , Position.get(@machine.cpu_init.first).class
end
end
end