better test for add
This commit is contained in:
parent
bae7f5dcb1
commit
4e56056b62
@ -11,7 +11,7 @@ module Register
|
|||||||
tmp = Register.tmp_reg
|
tmp = Register.tmp_reg
|
||||||
index = Register.arg_index 1
|
index = Register.arg_index 1
|
||||||
plus_function.source.add_code Register.get_slot( plus_function , :message , index , tmp )
|
plus_function.source.add_code Register.get_slot( plus_function , :message , index , tmp )
|
||||||
add = Register::OperatorInstruction.new( plus_function, :add , tmp , Register.self_reg )
|
add = Register::OperatorInstruction.new( plus_function, :add , Register.self_reg , tmp )
|
||||||
plus_function.source.add_code add
|
plus_function.source.add_code add
|
||||||
return plus_function
|
return plus_function
|
||||||
end
|
end
|
||||||
|
@ -47,11 +47,16 @@ class AddTest < MiniTest::Test
|
|||||||
def test_adding
|
def test_adding
|
||||||
done = ticks(23)
|
done = ticks(23)
|
||||||
assert_equal Register::OperatorInstruction , done.class
|
assert_equal Register::OperatorInstruction , done.class
|
||||||
assert @interpreter.get_register done.left.symbol
|
left = @interpreter.get_register(done.left)
|
||||||
puts @interpreter.get_register(done.left.symbol).class
|
rr = done.right
|
||||||
|
right = @interpreter.get_register(rr)
|
||||||
|
assert_equal Fixnum , left.class
|
||||||
|
assert_equal Fixnum , right.class
|
||||||
|
assert_equal 5 , right
|
||||||
done = ticks(1)
|
done = ticks(1)
|
||||||
assert_equal Register::RegisterTransfer , done.class
|
assert_equal Register::RegisterTransfer , done.class
|
||||||
assert @interpreter.get_register done.from.symbol
|
result = @interpreter.get_register(rr)
|
||||||
|
assert_equal result , left + right
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_chain
|
def test_chain
|
||||||
|
Loading…
Reference in New Issue
Block a user