CC change test fixes finished
This commit is contained in:
@ -11,23 +11,24 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, RegToSlot, SlotToReg, #5
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #10
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall, #15
|
||||
LoadConstant, SlotToReg, OperatorInstruction, IsZero, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #25
|
||||
LoadConstant, RegToSlot, SlotToReg, SlotToReg, DynamicJump, #30
|
||||
LoadConstant, SlotToReg, SlotToReg, RegToSlot, LoadConstant, #35
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #40
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, #45
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #50
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, #55
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #60
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, #65
|
||||
SlotToReg, SlotToReg, Syscall, NilClass,] #70
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #15
|
||||
FunctionCall, LoadConstant, SlotToReg, OperatorInstruction, IsZero, #20
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #25
|
||||
RegToSlot, SlotToReg, LoadConstant, RegToSlot, SlotToReg, #30
|
||||
SlotToReg, DynamicJump, LoadConstant, SlotToReg, SlotToReg, #35
|
||||
RegToSlot, LoadConstant, RegToSlot, Branch, SlotToReg, #40
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #45
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #50
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #55
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #60
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #65
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #70
|
||||
NilClass,] #75
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
def base ; 30 ; end
|
||||
def base ; 32 ; end
|
||||
|
||||
def test_block_jump
|
||||
load_ins = main_ticks(base)
|
||||
|
@ -11,30 +11,31 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, SlotToReg, FunctionCall, LoadConstant, SlotToReg, #15
|
||||
OperatorInstruction, IsZero, SlotToReg, RegToSlot, SlotToReg, #20
|
||||
SlotToReg, RegToSlot, SlotToReg, LoadConstant, RegToSlot, #25
|
||||
SlotToReg, SlotToReg, DynamicJump, LoadConstant, RegToSlot, #30
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #35
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, RegToSlot, #40
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #45
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, RegToSlot, #50
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #55
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #60
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #65
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, LoadConstant, #15
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #25
|
||||
LoadConstant, RegToSlot, SlotToReg, SlotToReg, DynamicJump, #30
|
||||
LoadConstant, RegToSlot, Branch, SlotToReg, SlotToReg, #35
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #40
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #45
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #50
|
||||
SlotToReg, RegToSlot, SlotToReg, RegToSlot, Branch, #55
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #60
|
||||
SlotToReg, FunctionReturn, Transfer, SlotToReg, SlotToReg, #65
|
||||
Syscall, NilClass,] #70
|
||||
assert_equal 15 , get_return
|
||||
end
|
||||
|
||||
def test_load_return
|
||||
load_ins = main_ticks(24)
|
||||
load_ins = main_ticks(26)
|
||||
assert_equal LoadConstant , load_ins.class
|
||||
assert_equal Parfait::ReturnAddress , @interpreter.get_register(load_ins.register).class
|
||||
end
|
||||
|
||||
def test_load_block
|
||||
load_ins = main_ticks(28)
|
||||
load_ins = main_ticks(30)
|
||||
assert_equal DynamicJump , load_ins.class
|
||||
assert_equal Parfait::Block , @interpreter.get_register(load_ins.register).class
|
||||
assert_equal :main_block , @interpreter.get_register(load_ins.register).name
|
||||
|
@ -12,23 +12,24 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, SlotToReg, FunctionCall, LoadConstant, SlotToReg, #15
|
||||
LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction, #25
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #30
|
||||
Branch, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #35
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #45
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, LoadConstant, #15
|
||||
SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #25
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #30
|
||||
Branch, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #35
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #40
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #45
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #50
|
||||
NilClass,] #55
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
def base_ticks(num)
|
||||
main_ticks(13 + num)
|
||||
main_ticks(14 + num)
|
||||
end
|
||||
def test_base
|
||||
assert_equal FunctionCall , main_ticks( 13 ).class
|
||||
assert_equal FunctionCall , main_ticks( 14 ).class
|
||||
end
|
||||
def test_load_factory
|
||||
lod = base_ticks( 1 )
|
||||
|
@ -11,32 +11,32 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
# show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall, #10
|
||||
LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, #15
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, Transfer, #20
|
||||
Transfer, LoadData, OperatorInstruction, LoadData, OperatorInstruction, #25
|
||||
OperatorInstruction, LoadData, Branch, Transfer, OperatorInstruction, #30
|
||||
OperatorInstruction, LoadData, Transfer, OperatorInstruction, OperatorInstruction, #35
|
||||
LoadData, Transfer, OperatorInstruction, OperatorInstruction, LoadData, #40
|
||||
OperatorInstruction, LoadData, Transfer, OperatorInstruction, OperatorInstruction, #45
|
||||
Transfer, LoadData, OperatorInstruction, LoadData, OperatorInstruction, #50
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #55
|
||||
RegToSlot, SlotToReg, Branch, SlotToReg, SlotToReg, #60
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #65
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #70
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #75
|
||||
NilClass,] #80s
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10
|
||||
FunctionCall, LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, #15
|
||||
IsNotZero, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #20
|
||||
Transfer, Transfer, LoadData, OperatorInstruction, LoadData, #25
|
||||
OperatorInstruction, OperatorInstruction, Branch, LoadData, Transfer, #30
|
||||
OperatorInstruction, OperatorInstruction, LoadData, Transfer, OperatorInstruction, #35
|
||||
OperatorInstruction, LoadData, Transfer, OperatorInstruction, OperatorInstruction, #40
|
||||
LoadData, OperatorInstruction, LoadData, Transfer, OperatorInstruction, #45
|
||||
OperatorInstruction, Transfer, LoadData, OperatorInstruction, LoadData, #50
|
||||
OperatorInstruction, OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, #55
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #60
|
||||
SlotToReg, FunctionReturn, SlotToReg, RegToSlot, Branch, #65
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #70
|
||||
SlotToReg, FunctionReturn, Transfer, SlotToReg, SlotToReg, #75
|
||||
Syscall, NilClass,] #80
|
||||
assert_equal 2 , get_return
|
||||
end
|
||||
|
||||
def test_load_25
|
||||
load_ins = main_ticks 3
|
||||
load_ins = main_ticks 4
|
||||
assert_equal LoadConstant , load_ins.class
|
||||
assert_equal 25 , @interpreter.get_register(load_ins.register).value
|
||||
end
|
||||
def test_return_class
|
||||
ret = main_ticks(71)
|
||||
ret = main_ticks(72)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
link = @interpreter.get_register( ret.register )
|
||||
assert_equal ::Integer , link.class
|
||||
|
@ -10,20 +10,20 @@ module Risc
|
||||
end
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, SlotToReg, FunctionCall, LoadConstant, SlotToReg, #15
|
||||
LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, ByteToReg, RegToSlot, #25
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #30
|
||||
Branch, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, #35
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #40
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, #45
|
||||
SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, LoadConstant, #15
|
||||
SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, ByteToReg, #25
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #30
|
||||
Branch, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #35
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #45
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
assert_equal "H".ord , get_return
|
||||
end
|
||||
def test_byte_to_reg
|
||||
done = main_ticks(24)
|
||||
done = main_ticks(25)
|
||||
assert_equal ByteToReg , done.class
|
||||
assert_equal "H".ord , @interpreter.get_register(done.register)
|
||||
end
|
||||
|
@ -11,20 +11,21 @@ module Risc
|
||||
|
||||
def test_minus
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, SlotToReg, FunctionCall, LoadConstant, SlotToReg, #15
|
||||
LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction, #25
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #30
|
||||
Branch, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #35
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #45
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, LoadConstant, #15
|
||||
SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #25
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #30
|
||||
Branch, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #35
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #40
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #45
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #50
|
||||
NilClass,] #55
|
||||
assert_equal 1 , get_return
|
||||
end
|
||||
def test_op
|
||||
op = main_ticks(25)
|
||||
op = main_ticks(26)
|
||||
assert_equal OperatorInstruction , op.class
|
||||
assert_equal :- , op.operator
|
||||
assert_equal :r2 , op.left.symbol
|
||||
@ -33,10 +34,10 @@ module Risc
|
||||
assert_equal 5 , @interpreter.get_register(:r3)
|
||||
end
|
||||
def test_return
|
||||
ret = main_ticks(45)
|
||||
ret = main_ticks(46)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal :r3 , ret.register.symbol
|
||||
assert_equal 26008 , @interpreter.get_register(ret.register)
|
||||
assert_equal 26012 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,21 +11,21 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall, #10
|
||||
LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, #15
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, LoadData, #20
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #25
|
||||
RegToSlot, SlotToReg, Branch, SlotToReg, SlotToReg, #30
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #35
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #40
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #45
|
||||
NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10
|
||||
FunctionCall, LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, #15
|
||||
IsNotZero, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #20
|
||||
LoadData, OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, #25
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #30
|
||||
SlotToReg, FunctionReturn, SlotToReg, RegToSlot, Branch, #35
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #40
|
||||
SlotToReg, FunctionReturn, Transfer, SlotToReg, SlotToReg, #45
|
||||
Syscall, NilClass,] #50
|
||||
assert_equal 2 , get_return
|
||||
end
|
||||
|
||||
def test_op
|
||||
op = main_ticks(21)
|
||||
op = main_ticks(22)
|
||||
assert_equal OperatorInstruction , op.class
|
||||
assert_equal :>> , op.operator
|
||||
assert_equal :r2 , op.left.symbol
|
||||
|
@ -11,16 +11,17 @@ module Risc
|
||||
|
||||
def test_mult
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, SlotToReg, FunctionCall, LoadConstant, SlotToReg, #15
|
||||
LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction, #25
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #30
|
||||
Branch, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #35
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #45
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, LoadConstant, #15
|
||||
SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #25
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #30
|
||||
Branch, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #35
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #40
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #45
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #50
|
||||
NilClass,] #55
|
||||
assert_equal 0 , get_return
|
||||
end
|
||||
def test_zero
|
||||
@ -28,7 +29,7 @@ module Risc
|
||||
assert @interpreter.flags[:zero]
|
||||
end
|
||||
def test_op
|
||||
op = main_ticks(25)
|
||||
op = main_ticks(26)
|
||||
assert_equal OperatorInstruction , op.class
|
||||
assert_equal :r2 , op.left.symbol
|
||||
assert_equal :r3 , op.right.symbol
|
||||
|
@ -11,23 +11,24 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, SlotToReg, FunctionCall, LoadConstant, SlotToReg, #15
|
||||
LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction, #25
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #30
|
||||
Branch, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #35
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #45
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, LoadConstant, #15
|
||||
SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, #20
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #25
|
||||
OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #30
|
||||
Branch, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #35
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #40
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #45
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #50
|
||||
NilClass,] #55
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
def base_ticks(num)
|
||||
main_ticks(13 + num)
|
||||
main_ticks(14 + num)
|
||||
end
|
||||
def test_base
|
||||
cal = main_ticks( 13 )
|
||||
cal = main_ticks( 14 )
|
||||
assert_equal FunctionCall , cal.class
|
||||
end
|
||||
def test_load_receiver
|
||||
|
@ -11,27 +11,27 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall, #10
|
||||
LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, IsNotZero, #15
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg, #20
|
||||
Transfer, Syscall, Transfer, Transfer, SlotToReg, #25
|
||||
RegToSlot, SlotToReg, Branch, SlotToReg, RegToSlot, #30
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, #35
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #40
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, #45
|
||||
SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10
|
||||
FunctionCall, LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, #15
|
||||
IsNotZero, SlotToReg, RegToSlot, RegToSlot, SlotToReg, #20
|
||||
SlotToReg, Transfer, Syscall, Transfer, Transfer, #25
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #30
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #35
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #45
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #50
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
assert_equal 11 , get_return #bytes written
|
||||
end
|
||||
def test_call
|
||||
cal = main_ticks(10)
|
||||
cal = main_ticks(11)
|
||||
assert_equal FunctionCall , cal.class
|
||||
assert_equal :putstring , cal.method.name
|
||||
end
|
||||
|
||||
def test_putstring_sys
|
||||
done = main_ticks(22)
|
||||
done = main_ticks(23)
|
||||
assert_equal Syscall , done.class
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
assert_equal 11 , @interpreter.get_register(:r0)
|
||||
@ -44,16 +44,16 @@ module Risc
|
||||
assert_equal 11 , @interpreter.get_register(:r3)
|
||||
end
|
||||
def test_restore_message
|
||||
sl = main_ticks(24)
|
||||
sl = main_ticks(25)
|
||||
assert_transfer(sl, :r8 ,:r0)
|
||||
assert_equal Parfait::Message , @interpreter.get_register(:r0).class
|
||||
end
|
||||
def test_move_sys_return
|
||||
sl = main_ticks(30)
|
||||
sl = main_ticks(31)
|
||||
assert_reg_to_slot( sl , :r1 ,:r2 , 5)
|
||||
end
|
||||
def test_return
|
||||
done = main_ticks(44)
|
||||
done = main_ticks(45)
|
||||
assert_equal FunctionReturn , done.class
|
||||
end
|
||||
|
||||
|
@ -11,19 +11,20 @@ module Risc
|
||||
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #10
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #15
|
||||
FunctionCall, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #20
|
||||
SlotToReg, SlotToReg, RegToByte, SlotToReg, SlotToReg, #25
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #30
|
||||
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #35
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #40
|
||||
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #45
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #15
|
||||
SlotToReg, FunctionCall, SlotToReg, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, RegToByte, SlotToReg, #25
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #30
|
||||
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #35
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #40
|
||||
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #45
|
||||
NilClass,] #50
|
||||
assert_equal "K".ord , get_return
|
||||
end
|
||||
def test_reg_to_byte
|
||||
done = main_ticks(23)
|
||||
done = main_ticks(24)
|
||||
assert_equal RegToByte , done.class
|
||||
assert_equal "K".ord , @interpreter.get_register(done.register)
|
||||
end
|
||||
|
@ -24,17 +24,16 @@ module Risc
|
||||
IsZero, SlotToReg, OperatorInstruction, IsZero, SlotToReg, #55
|
||||
Branch, LoadConstant, OperatorInstruction, IsZero, SlotToReg, #60
|
||||
OperatorInstruction, IsZero, RegToSlot, LoadConstant, SlotToReg, #65
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, LoadConstant, #70
|
||||
SlotToReg, RegToSlot, SlotToReg, LoadConstant, SlotToReg, #75
|
||||
DynamicJump, LoadConstant, SlotToReg, LoadConstant, OperatorInstruction, #80
|
||||
IsNotZero, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #85
|
||||
LoadData, OperatorInstruction, RegToSlot, RegToSlot, SlotToReg, #90
|
||||
SlotToReg, RegToSlot, SlotToReg, Branch, SlotToReg, #95
|
||||
SlotToReg, FunctionReturn, SlotToReg, RegToSlot, Branch, #100
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #105
|
||||
SlotToReg, FunctionReturn, Transfer, SlotToReg, SlotToReg, #110
|
||||
Syscall, NilClass,] #115
|
||||
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #70
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #75
|
||||
SlotToReg, DynamicJump, LoadConstant, SlotToReg, LoadConstant, #80
|
||||
OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, SlotToReg, #85
|
||||
SlotToReg, LoadData, OperatorInstruction, RegToSlot, RegToSlot, #90
|
||||
SlotToReg, SlotToReg, RegToSlot, Branch, SlotToReg, #95
|
||||
SlotToReg, SlotToReg, FunctionReturn, SlotToReg, RegToSlot, #100
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #105
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, #110
|
||||
SlotToReg, Syscall, NilClass,] #115
|
||||
assert_equal ::Integer , get_return.class
|
||||
assert_equal 1 , get_return
|
||||
end
|
||||
@ -51,17 +50,17 @@ module Risc
|
||||
end
|
||||
|
||||
def test_dyn
|
||||
cal = main_ticks(76)
|
||||
cal = main_ticks(77)
|
||||
assert_equal DynamicJump , cal.class
|
||||
end
|
||||
def test_return
|
||||
ret = main_ticks(107)
|
||||
ret = main_ticks(108)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
link = @interpreter.get_register( ret.register )
|
||||
assert_equal ::Integer , link.class
|
||||
end
|
||||
def test_sys
|
||||
sys = main_ticks(111)
|
||||
sys = main_ticks(112)
|
||||
assert_equal Syscall , sys.class
|
||||
end
|
||||
end
|
||||
|
@ -19,7 +19,7 @@ module Risc
|
||||
@instruction_events << was
|
||||
end
|
||||
def length
|
||||
27
|
||||
28
|
||||
end
|
||||
def test_state_change
|
||||
@interpreter.register_event :state_changed , self
|
||||
@ -40,12 +40,11 @@ module Risc
|
||||
def test_chain
|
||||
#show_ticks # get output of what is
|
||||
check_chain [Branch, LoadConstant, SlotToReg, SlotToReg, RegToSlot, #5
|
||||
LoadConstant, RegToSlot, SlotToReg, LoadConstant, RegToSlot, #10
|
||||
LoadConstant, RegToSlot, FunctionCall, LoadConstant, RegToSlot, #15
|
||||
Branch, SlotToReg, SlotToReg, RegToSlot, SlotToReg, #20
|
||||
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, #25
|
||||
SlotToReg, Syscall, NilClass,] #30
|
||||
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #10
|
||||
RegToSlot, LoadConstant, RegToSlot, FunctionCall, LoadConstant, #15
|
||||
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #20
|
||||
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, #25
|
||||
SlotToReg, SlotToReg, Syscall, NilClass,] #30
|
||||
assert_equal ::Integer , get_return.class
|
||||
assert_equal 5 , get_return
|
||||
end
|
||||
|
Reference in New Issue
Block a user