finishes the yellow world instructions
This commit is contained in:
@@ -53,17 +53,30 @@ class InterpreterTest < MiniTest::Test
|
||||
["Branch" , "LoadConstant" , "GetSlot" , "SetSlot" , "RegisterTransfer" ,
|
||||
"GetSlot" , "FunctionCall" , "SaveReturn" , "LoadConstant" , "SetSlot" ,
|
||||
"GetSlot" , "GetSlot" , "SetSlot" , "LoadConstant" , "SetSlot" ,
|
||||
"RegisterTransfer" , "GetSlot" , "FunctionCall" , "SaveReturn" ,
|
||||
"RegisterTransfer" , "Syscall"].each_with_index do |name , index|
|
||||
"RegisterTransfer" , "GetSlot" , "FunctionCall" , "SaveReturn" , "RegisterTransfer" ,
|
||||
"Syscall" , "RegisterTransfer" , "RegisterTransfer" , "SetSlot" , "GetSlot" ,
|
||||
"GetSlot" , "RegisterTransfer" ,"GetSlot" , "GetSlot","GetSlot",
|
||||
"FunctionReturn" , "RegisterTransfer" , "Syscall" , "NilClass"].each_with_index do |name , index|
|
||||
got = ticks(1)
|
||||
assert got.class.name.index(name) , "Wrong class for #{index}, expect #{name} , got #{got}"
|
||||
assert got.class.name.index(name) , "Wrong class for #{index+1}, expect #{name} , got #{got}"
|
||||
end
|
||||
end
|
||||
|
||||
def test_putstring
|
||||
done = ticks(21)
|
||||
assert_equal Register::Syscall , done.class
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
assert_equal "Hello again" , @interpreter.stdout
|
||||
end
|
||||
|
||||
def test_return
|
||||
done = ticks(31)
|
||||
assert_equal Register::FunctionReturn , done.class
|
||||
assert @interpreter.block.is_a?(Virtual::Block)
|
||||
assert @interpreter.instruction.is_a?(Register::Instruction) , "not instruction #{@interpreter.instruction}"
|
||||
end
|
||||
|
||||
def test_exit
|
||||
done = ticks(34)
|
||||
assert_equal NilClass , done.class
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user