Sha256: 78f10727fe2f9160b487af3c81fcc1a1aad15549219e2bad6ead812f1c2dd6d5

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

#encoding: utf-8
require File.join(File.dirname(__FILE__), "../../spec_helper")
include Nudge


describe ExecSwapInstruction do
  
  it_should_behave_like "every Nudge Instruction"
  
  before(:each) do
    @context = Interpreter.new
    @i1 = ExecSwapInstruction.new(@context)
  end
  
  
  describe "\#go" do
    before(:each) do
      @myInterpreter = Interpreter.new
      @i1 = ExecSwapInstruction.new(@myInterpreter)
      @myInterpreter.reset("block{value «bool»\n value «int»}\n«bool» false\n«int» 88")
      @myInterpreter.step # [pushing the two points]
    end

    describe "\#preconditions?" do
      it "should check that the :exec stack has at least one item" do
        @i1.preconditions?.should == true
      end
    end

    describe "\#cleanup" do
      it "should push a copy of the top item onto the :exec stack" do
        @myInterpreter.stacks[:exec].entries[0].value.should == 88
        @myInterpreter.stacks[:exec].entries[1].value.should == false
        @i1.go
        @myInterpreter.stacks[:exec].depth.should == 2
        @myInterpreter.stacks[:exec].entries[0].value.should == false
        @myInterpreter.stacks[:exec].entries[1].value.should == 88
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
nudge-0.2.9 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.8 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.7 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.6 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.5 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.4 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.3 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.2 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.1 spec/instructions/exec/exec_swap_spec.rb
nudge-0.2.0 spec/instructions/exec/exec_swap_spec.rb
nudge-0.1.3 spec/instructions/exec/exec_swap_spec.rb
nudge-0.1.2 spec/instructions/exec/exec_swap_spec.rb
nudge-0.1.1 spec/instructions/exec/exec_swap_spec.rb
nudge-0.1.0 spec/instructions/exec/exec_swap_spec.rb