insertion pushes, split position tests

This commit is contained in:
Torsten Ruger
2018-06-06 10:19:18 +03:00
parent c22aff4c4f
commit 7fa8397b56
7 changed files with 155 additions and 136 deletions

View File

@ -0,0 +1,36 @@
require_relative "helper"
module Risc
class TestPositionMath < MiniTest::Test
def setup
@pos = Position.new(self , 5)
end
def test_add
res = @pos + 5
assert_equal 10 , res
end
def test_sub
res = @pos - 3
assert_equal 2 , res
end
def test_sub_pos
res = @pos - Position.new(@pos,4)
assert_equal 1 , res
end
def test_lg
assert @pos > Position.new(@pos,4)
end
def test_tos
assert_equal "0x5" , @pos.to_s
end
def test_reset_ok
pos = @pos.set(10)
assert_equal 10 , pos
end
def test_at
pos = Position.at(5)
assert_equal 5 , pos.at
end
end
end