pass return integer back out through exit
for testing of binaries later (and off course general correctness) Some tests were using the fact that the interpreter was used, changed those to return ints rather than strings
This commit is contained in:
@ -28,10 +28,9 @@ module Risc
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn,
|
||||
SlotToReg, SlotToReg, RegToSlot, Branch, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
Syscall, NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 2 , get_return.value
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, Branch, Transfer, Syscall, NilClass]
|
||||
assert_equal 2 , get_return
|
||||
end
|
||||
|
||||
def test_load_25
|
||||
@ -46,7 +45,7 @@ module Risc
|
||||
assert_equal Fixnum , link.class
|
||||
end
|
||||
def test_sys
|
||||
sys = main_ticks(91)
|
||||
sys = main_ticks(94)
|
||||
assert_equal Syscall , sys.class
|
||||
assert_equal :exit , sys.name
|
||||
end
|
||||
|
@ -22,9 +22,9 @@ module Risc
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
|
||||
Branch, FunctionReturn, Transfer, Syscall, NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal "H".ord , get_return.value
|
||||
Branch, FunctionReturn, SlotToReg, SlotToReg, Branch,
|
||||
Transfer, Syscall, NilClass]
|
||||
assert_equal "H".ord , get_return
|
||||
end
|
||||
def test_byte_to_reg
|
||||
done = main_ticks(34)
|
||||
@ -32,7 +32,7 @@ module Risc
|
||||
assert_equal "H".ord , @interpreter.get_register(done.register)
|
||||
end
|
||||
def test_exit
|
||||
done = main_ticks(64)
|
||||
done = main_ticks(67)
|
||||
assert_equal Syscall , done.class
|
||||
end
|
||||
end
|
||||
|
@ -23,10 +23,9 @@ module Risc
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, Branch, FunctionReturn, Transfer, Syscall,
|
||||
NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 1 , get_return.value
|
||||
SlotToReg, Branch, FunctionReturn, SlotToReg, SlotToReg,
|
||||
Branch, Transfer, Syscall, NilClass]
|
||||
assert_equal 1 , get_return
|
||||
end
|
||||
def test_load_5
|
||||
lod = main_ticks( 20 )
|
||||
@ -49,7 +48,7 @@ module Risc
|
||||
assert_equal 20580 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
def test_sys
|
||||
sys = main_ticks(65)
|
||||
sys = main_ticks(68)
|
||||
assert_equal Syscall , sys.class
|
||||
assert_equal :exit , sys.name
|
||||
end
|
||||
|
@ -22,9 +22,9 @@ module Risc
|
||||
SlotToReg, FunctionReturn, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
|
||||
FunctionReturn, Transfer, Syscall, NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 2 , get_return.value
|
||||
FunctionReturn, SlotToReg, SlotToReg, Branch, Transfer,
|
||||
Syscall, NilClass]
|
||||
assert_equal 2 , get_return
|
||||
end
|
||||
|
||||
def test_load
|
||||
@ -42,7 +42,7 @@ module Risc
|
||||
end
|
||||
|
||||
def test_sys
|
||||
sys = main_ticks(58)
|
||||
sys = main_ticks(61)
|
||||
assert_equal Syscall , sys.class
|
||||
assert_equal :exit , sys.name
|
||||
end
|
||||
|
@ -23,10 +23,9 @@ module Risc
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, Branch, FunctionReturn, Transfer, Syscall,
|
||||
NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 0 , get_return.value
|
||||
SlotToReg, Branch, FunctionReturn, SlotToReg, SlotToReg,
|
||||
Branch, Transfer, Syscall, NilClass]
|
||||
assert_equal 0 , get_return
|
||||
end
|
||||
def test_zero
|
||||
ticks( 12 )
|
||||
|
@ -23,10 +23,9 @@ module Risc
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, Branch, FunctionReturn, Transfer, Syscall,
|
||||
NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 10 , get_return.value
|
||||
SlotToReg, Branch, FunctionReturn, SlotToReg, SlotToReg,
|
||||
Branch, Transfer, Syscall, NilClass]
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
def test_load_5
|
||||
lod = main_ticks( 20 )
|
||||
@ -103,7 +102,7 @@ module Risc
|
||||
assert_equal :r4 , sl.register.symbol
|
||||
end
|
||||
def test_sys
|
||||
sys = main_ticks(65)
|
||||
sys = main_ticks(68)
|
||||
assert_equal Syscall , sys.class
|
||||
assert_equal :exit , sys.name
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, RegToSlot, Branch, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant,
|
||||
@ -22,11 +22,11 @@ module Risc
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, Syscall,
|
||||
NilClass]
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, SlotToReg,
|
||||
Branch, Transfer, Syscall, NilClass]
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 11 , get_return.value #bytes written
|
||||
assert_equal Fixnum , get_return.class
|
||||
assert_equal 11 , get_return #bytes written
|
||||
end
|
||||
def test_call
|
||||
cal = main_ticks(24)
|
||||
|
@ -19,14 +19,15 @@ module Risc
|
||||
SlotToReg, RegToSlot, Branch, LoadConstant, SlotToReg,
|
||||
RegToSlot, SlotToReg, FunctionCall, SlotToReg, SlotToReg,
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||
RegToByte, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, Branch, SlotToReg, SlotToReg, FunctionReturn,
|
||||
RegToByte, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, Branch, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, FunctionReturn, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, Branch, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
Branch, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
|
||||
FunctionReturn, SlotToReg, SlotToReg, Branch, Transfer,
|
||||
Syscall, NilClass]
|
||||
assert_equal Parfait::Word , get_return.class
|
||||
assert_equal "Kello" , get_return.to_string
|
||||
assert_equal Fixnum , get_return.class
|
||||
assert_equal "K".ord , get_return
|
||||
end
|
||||
def test_reg_to_byte
|
||||
done = main_ticks(41)
|
||||
@ -34,7 +35,7 @@ module Risc
|
||||
assert_equal "K".ord , @interpreter.get_register(done.register)
|
||||
end
|
||||
def test_exit
|
||||
done = main_ticks(66)
|
||||
done = main_ticks(71)
|
||||
assert_equal Syscall , done.class
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user