Sha256: 49ba7354a8351d9d27141721ba5fab92287a0a4579bb28f6602297b7bd086f65
Contents?: true
Size: 621 Bytes
Versions: 1
Compression:
Stored size: 621 Bytes
Contents
# frozen_string_literal: true require 'tataru' describe Tataru::Instructions::ReturnInstruction do it 'return to top of stack' do mem = Tataru::Memory.new instr = Tataru::Instructions::ReturnInstruction.new mem.call_stack = [1, 2, 3] instr.memory = mem instr.run expect(mem.program_counter).to eq 3 end it 'sets error if no more stack' do mem = Tataru::Memory.new mem.call_stack = [] instr = Tataru::Instructions::ReturnInstruction.new instr.memory = mem instr.run expect(mem.program_counter).to eq 0 expect(mem.error).to eq 'At bottom of stack' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tataru-0.2.0 | spec/instructions/return_instruction_spec.rb |