Fix all but one test
Riples upon riples. The one left looks like the genuine article
This commit is contained in:
@ -10,7 +10,7 @@ module Risc
|
||||
end
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
||||
RegToSlot, LoadConstant, LoadConstant, SlotToReg, SlotToReg, # 10
|
||||
RegToSlot, RegToSlot, RegToSlot, Branch, RegToSlot,
|
||||
@ -25,15 +25,14 @@ module Risc
|
||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, RegToSlot, # 60
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
|
||||
SlotToReg, Branch, RegToSlot, RegToSlot, SlotToReg, # 70
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, SlotToReg,
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, # 80
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, RegToSlot,
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, LoadConstant, # 80
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, FunctionReturn, SlotToReg, SlotToReg, RegToSlot, # 90
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg, # 90
|
||||
Branch, SlotToReg, FunctionReturn, SlotToReg, SlotToReg,
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, # 100
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
|
||||
Branch, SlotToReg, SlotToReg, FunctionReturn, Transfer, # 110
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, Branch, # 100
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg,
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
|
||||
|
@ -24,15 +24,14 @@ module Risc
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg, # 60
|
||||
SlotToReg, SlotToReg, Branch, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, # 70
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg, # 80
|
||||
SlotToReg, Branch, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, Branch, RegToSlot, SlotToReg, SlotToReg, # 90
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg, # 100
|
||||
Branch, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, # 70
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, SlotToReg, # 80
|
||||
Branch, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, LoadConstant, # 90
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, Branch,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, # 100
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 15 , get_return
|
||||
end
|
||||
|
||||
|
@ -11,8 +11,8 @@ module Risc
|
||||
end
|
||||
|
||||
def test_chain
|
||||
#show_base_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, # 10
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, # 20
|
||||
@ -22,11 +22,10 @@ module Risc
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, # 40
|
||||
LoadConstant, SlotToReg, RegToSlot, Branch, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, Branch, SlotToReg, SlotToReg, RegToSlot, # 60
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, # 70
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 60
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
def base_ticks(num)
|
||||
|
@ -10,8 +10,8 @@ module Risc
|
||||
end
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, # 10
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, RegToSlot,
|
||||
SlotToReg, FunctionCall, LoadConstant, SlotToReg, LoadConstant, # 20
|
||||
@ -26,11 +26,10 @@ module Risc
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
LoadConstant, SlotToReg, Branch, RegToSlot, RegToSlot, # 70
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot, # 80
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, Branch,
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg, # 90
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg,
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, # 80
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, Branch,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, # 90
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 2 , get_return
|
||||
end
|
||||
|
||||
@ -44,7 +43,7 @@ module Risc
|
||||
assert_load load_ins, Parfait::Factory
|
||||
end
|
||||
def test_return_class
|
||||
ret = main_ticks(93)
|
||||
ret = main_ticks(89)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
link = @interpreter.get_register( ret.register )
|
||||
assert_equal ::Integer , link.class
|
||||
|
@ -19,12 +19,11 @@ module Risc
|
||||
SlotToReg, SlotToReg, SlotToReg, ByteToReg, RegToSlot,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, LoadConstant, # 40
|
||||
SlotToReg, RegToSlot, RegToSlot, Branch, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, SlotToReg, # 50
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, Branch,
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, LoadConstant, # 60
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, FunctionReturn, Transfer, SlotToReg, SlotToReg, # 70
|
||||
Syscall, NilClass, ]
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, RegToSlot, # 50
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, Branch,
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg, # 60
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg,
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal "H".ord , get_return
|
||||
end
|
||||
def test_byte_to_reg
|
||||
|
@ -21,11 +21,10 @@ module Risc
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, # 40
|
||||
LoadConstant, SlotToReg, RegToSlot, Branch, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, Branch, SlotToReg, SlotToReg, RegToSlot, # 60
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, # 70
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 60
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 1 , get_return
|
||||
end
|
||||
def test_op
|
||||
@ -38,10 +37,10 @@ module Risc
|
||||
assert_equal 5 , @interpreter.get_register(:r3)
|
||||
end
|
||||
def test_return
|
||||
ret = main_ticks(68)
|
||||
ret = main_ticks(64)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal :r1 , ret.register.symbol
|
||||
assert_equal 23196 , @interpreter.get_register(ret.register)
|
||||
assert_equal 23004 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ module Risc
|
||||
end
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, # 10
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, RegToSlot,
|
||||
@ -19,12 +19,11 @@ module Risc
|
||||
Branch, SlotToReg, LoadData, OperatorInstruction, RegToSlot, # 30
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, Branch, # 40
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, Branch, # 50
|
||||
SlotToReg, SlotToReg, RegToSlot, Branch, LoadConstant,
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg, # 60
|
||||
SlotToReg, FunctionReturn, Transfer, SlotToReg, SlotToReg,
|
||||
Syscall, NilClass, ]
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, RegToSlot,
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, LoadConstant, # 50
|
||||
SlotToReg, RegToSlot, RegToSlot, Branch, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, # 60
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 2 , get_return
|
||||
end
|
||||
|
||||
|
@ -11,7 +11,7 @@ module Risc
|
||||
|
||||
def test_mult
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, # 10
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, # 20
|
||||
@ -21,11 +21,10 @@ module Risc
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, # 40
|
||||
LoadConstant, SlotToReg, RegToSlot, Branch, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, Branch, SlotToReg, SlotToReg, RegToSlot, # 60
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, # 70
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 60
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal 0 , get_return
|
||||
end
|
||||
def test_zero
|
||||
|
@ -10,8 +10,8 @@ module Risc
|
||||
end
|
||||
|
||||
def test_chain
|
||||
#show_base_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, # 10
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, # 20
|
||||
@ -21,11 +21,11 @@ module Risc
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, # 40
|
||||
LoadConstant, SlotToReg, RegToSlot, Branch, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, Branch, SlotToReg, SlotToReg, RegToSlot, # 60
|
||||
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, # 70
|
||||
SlotToReg, Syscall, NilClass, ]
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot,
|
||||
Branch, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 60
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer,
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
def base_ticks(num)
|
||||
|
@ -20,11 +20,11 @@ module Risc
|
||||
Transfer, Transfer, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, Branch, # 40
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
|
||||
FunctionReturn, SlotToReg, SlotToReg, RegToSlot, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg,
|
||||
RegToSlot, Branch, LoadConstant, SlotToReg, RegToSlot, # 60
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn,
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass, ] # 70
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, SlotToReg, # 60
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall,
|
||||
NilClass, ]
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
assert_equal 11 , get_return #bytes written
|
||||
end
|
||||
@ -57,7 +57,7 @@ module Risc
|
||||
assert_reg_to_slot( sl , :r1 ,:r2 , 5)
|
||||
end
|
||||
def test_return
|
||||
done = main_ticks(65)
|
||||
done = main_ticks(61)
|
||||
assert_equal FunctionReturn , done.class
|
||||
end
|
||||
|
||||
|
@ -11,7 +11,7 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
check_main_chain [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, # 10
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, SlotToReg, RegToSlot, # 20
|
||||
@ -20,10 +20,9 @@ module Risc
|
||||
SlotToReg, SlotToReg, RegToByte, SlotToReg, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, Branch, RegToSlot, # 40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn,
|
||||
SlotToReg, SlotToReg, Branch, RegToSlot, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 60
|
||||
SlotToReg, Branch, SlotToReg, SlotToReg, FunctionReturn,
|
||||
SlotToReg, RegToSlot, Branch, Branch, SlotToReg, # 50
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, # 60
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
assert_equal "K".ord , get_return
|
||||
end
|
||||
|
@ -35,11 +35,10 @@ module Risc
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, # 110
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
|
||||
SlotToReg, Branch, SlotToReg, SlotToReg, FunctionReturn, # 120
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, Branch, # 130
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, # 140
|
||||
SlotToReg, SlotToReg, Syscall, NilClass, ]
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, Branch, # 130
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn,
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass, ]# 140
|
||||
assert_equal ::Integer , get_return.class
|
||||
assert_equal 1 , get_return
|
||||
end
|
||||
@ -60,13 +59,13 @@ module Risc
|
||||
assert_equal DynamicJump , cal.class
|
||||
end
|
||||
def test_return
|
||||
ret = main_ticks(139)
|
||||
ret = main_ticks(135)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
link = @interpreter.get_register( ret.register )
|
||||
assert_equal ::Integer , link.class
|
||||
end
|
||||
def test_sys
|
||||
sys = main_ticks(143)
|
||||
sys = main_ticks(139)
|
||||
assert_equal Syscall , sys.class
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user