lots more ripples from changing calling convention
This commit is contained in:
@ -23,11 +23,12 @@ HERE
|
||||
check_chain ["Branch","Label","LoadConstant","SlotToReg","RegToSlot",
|
||||
"LoadConstant","RegToSlot","FunctionCall","Label","SlotToReg",
|
||||
"LoadConstant","RegToSlot","LoadConstant","RegToSlot","LoadConstant",
|
||||
"RegToSlot","LoadConstant","RegToSlot","LoadConstant","RegToSlot",
|
||||
"LoadConstant","RegToSlot","RegisterTransfer","FunctionCall","Label",
|
||||
"SlotToReg","SlotToReg","SlotToReg","RegToByte","Label",
|
||||
"FunctionReturn","RegisterTransfer","SlotToReg","SlotToReg","Label",
|
||||
"FunctionReturn","RegisterTransfer","Syscall","NilClass"]
|
||||
"SlotToReg","SlotToReg","RegToSlot","LoadConstant","SlotToReg",
|
||||
"RegToSlot","LoadConstant","SlotToReg","RegToSlot","LoadConstant",
|
||||
"RegToSlot","RegisterTransfer","FunctionCall","Label","SlotToReg",
|
||||
"SlotToReg","SlotToReg","SlotToReg","SlotToReg","RegToByte",
|
||||
"Label","FunctionReturn","RegisterTransfer","SlotToReg","SlotToReg",
|
||||
"Label","FunctionReturn","RegisterTransfer","Syscall","NilClass"]
|
||||
end
|
||||
|
||||
def test_branch
|
||||
@ -50,12 +51,12 @@ HERE
|
||||
assert_equal Register::FunctionCall , ticks(8).class
|
||||
end
|
||||
def test_exit
|
||||
done = ticks(39)
|
||||
done = ticks(45)
|
||||
assert_equal NilClass , done.class
|
||||
end
|
||||
|
||||
def test_reg_to_byte
|
||||
done = ticks(29)
|
||||
done = ticks(35)
|
||||
assert_equal Register::RegToByte , done.class
|
||||
assert_equal "h".ord , @interpreter.get_register(done.register)
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
require_relative "helper"
|
||||
|
||||
class IfTest < MiniTest::Test
|
||||
class IfCalledTest < MiniTest::Test
|
||||
include Ticker
|
||||
include Compiling
|
||||
|
||||
@ -36,15 +36,16 @@ HERE
|
||||
check_chain ["Branch","Label","LoadConstant","SlotToReg","RegToSlot",
|
||||
"LoadConstant","RegToSlot","FunctionCall","Label","SlotToReg",
|
||||
"SlotToReg","RegToSlot","LoadConstant","RegToSlot","LoadConstant",
|
||||
"RegToSlot","LoadConstant","RegToSlot","LoadConstant","RegToSlot",
|
||||
"RegisterTransfer","FunctionCall","Label","SlotToReg","LoadConstant",
|
||||
"OperatorInstruction","IsZero","SlotToReg","LoadConstant","RegToSlot",
|
||||
"LoadConstant","RegToSlot","LoadConstant","RegToSlot","LoadConstant",
|
||||
"RegToSlot","RegisterTransfer","FunctionCall","Label","SlotToReg",
|
||||
"SlotToReg","RegisterTransfer","Syscall","RegisterTransfer","RegisterTransfer",
|
||||
"RegToSlot","Label","FunctionReturn","RegisterTransfer","SlotToReg",
|
||||
"SlotToReg","Branch","Label","Label","FunctionReturn",
|
||||
"RegisterTransfer","SlotToReg","SlotToReg","Label","FunctionReturn",
|
||||
"RegisterTransfer","Syscall","NilClass"]
|
||||
"SlotToReg","SlotToReg","RegToSlot","LoadConstant","SlotToReg",
|
||||
"RegToSlot","LoadConstant","RegToSlot","RegisterTransfer","FunctionCall",
|
||||
"Label","SlotToReg","SlotToReg","LoadConstant","OperatorInstruction",
|
||||
"IsZero","SlotToReg","LoadConstant","RegToSlot","LoadConstant",
|
||||
"RegToSlot","LoadConstant","SlotToReg","SlotToReg","RegToSlot",
|
||||
"LoadConstant","RegToSlot","RegisterTransfer","FunctionCall","Label",
|
||||
"SlotToReg","SlotToReg","RegisterTransfer","Syscall","RegisterTransfer",
|
||||
"RegisterTransfer","RegToSlot","Label","FunctionReturn","RegisterTransfer",
|
||||
"SlotToReg","SlotToReg","Branch","Label","Label",
|
||||
"FunctionReturn","RegisterTransfer","SlotToReg","SlotToReg","Label",
|
||||
"FunctionReturn","RegisterTransfer","Syscall","NilClass"]
|
||||
end
|
||||
end
|
||||
|
@ -20,11 +20,11 @@ HERE
|
||||
check_chain ["Branch","Label","LoadConstant","SlotToReg","RegToSlot",
|
||||
"LoadConstant","RegToSlot","FunctionCall","Label","SlotToReg",
|
||||
"LoadConstant","RegToSlot","LoadConstant","RegToSlot","LoadConstant",
|
||||
"RegToSlot","LoadConstant","RegToSlot","RegisterTransfer","FunctionCall",
|
||||
"Label","SlotToReg","SlotToReg","RegisterTransfer","Syscall",
|
||||
"RegisterTransfer","RegisterTransfer","RegToSlot","Label","FunctionReturn",
|
||||
"RegisterTransfer","SlotToReg","SlotToReg","Label","FunctionReturn",
|
||||
"RegisterTransfer","Syscall","NilClass"]
|
||||
"SlotToReg","SlotToReg","RegToSlot","LoadConstant","RegToSlot",
|
||||
"RegisterTransfer","FunctionCall","Label","SlotToReg","SlotToReg",
|
||||
"RegisterTransfer","Syscall","RegisterTransfer","RegisterTransfer","RegToSlot",
|
||||
"Label","FunctionReturn","RegisterTransfer","SlotToReg","SlotToReg",
|
||||
"Label","FunctionReturn","RegisterTransfer","Syscall","NilClass"]
|
||||
end
|
||||
|
||||
def test_branch
|
||||
@ -48,13 +48,13 @@ HERE
|
||||
end
|
||||
|
||||
def test_putstring
|
||||
done = ticks(25)
|
||||
done = ticks(27)
|
||||
assert_equal Register::Syscall , done.class
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
end
|
||||
|
||||
def test_return
|
||||
done = ticks(30)
|
||||
done = ticks(32)
|
||||
assert_equal Register::FunctionReturn , done.class
|
||||
assert Register::Label , @interpreter.instruction.class
|
||||
assert @interpreter.instruction.is_a?(Register::Instruction) , "not instruction #{@interpreter.instruction}"
|
||||
|
@ -23,11 +23,12 @@ HERE
|
||||
check_chain ["Branch","Label","LoadConstant","SlotToReg","RegToSlot",
|
||||
"LoadConstant","RegToSlot","FunctionCall","Label","SlotToReg",
|
||||
"LoadConstant","RegToSlot","LoadConstant","RegToSlot","LoadConstant",
|
||||
"RegToSlot","LoadConstant","RegToSlot","LoadConstant","RegToSlot",
|
||||
"RegisterTransfer","FunctionCall","Label","SlotToReg","SlotToReg",
|
||||
"ByteToReg","RegToSlot","Label","FunctionReturn","RegisterTransfer",
|
||||
"SlotToReg","SlotToReg","Label","FunctionReturn","RegisterTransfer",
|
||||
"Syscall","NilClass"]
|
||||
"SlotToReg","SlotToReg","RegToSlot","LoadConstant","SlotToReg",
|
||||
"RegToSlot","LoadConstant","RegToSlot","RegisterTransfer","FunctionCall",
|
||||
"Label","SlotToReg","SlotToReg","SlotToReg","ByteToReg",
|
||||
"RegToSlot","Label","FunctionReturn","RegisterTransfer","SlotToReg",
|
||||
"SlotToReg","Label","FunctionReturn","RegisterTransfer","Syscall",
|
||||
"NilClass"]
|
||||
end
|
||||
|
||||
def test_branch
|
||||
@ -50,12 +51,12 @@ HERE
|
||||
assert_equal Register::FunctionCall , ticks(8).class
|
||||
end
|
||||
def test_exit
|
||||
done = ticks(37)
|
||||
done = ticks(41)
|
||||
assert_equal NilClass , done.class
|
||||
end
|
||||
|
||||
def test_byte_to_reg
|
||||
done = ticks(26)
|
||||
done = ticks(30)
|
||||
assert_equal Register::ByteToReg , done.class
|
||||
assert_equal "H".ord , @interpreter.get_register(done.register)
|
||||
end
|
||||
|
Reference in New Issue
Block a user