Sha256: e0cc7e6a13fb8debc24d3648d5a60d49f5f52b3b08f2a5432e1ce7625fc04f0a

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true

require 'tataru'

describe Tataru::Instructions::CompareInstruction do
  it 'sets to 1 if equal' do
    mem = Tataru::Memory.new
    instr = Tataru::Instructions::CompareInstruction.new('abc')

    mem.hash[:temp] = { result: 'abc' }

    instr.memory = mem
    instr.run

    expect(mem.hash[:temp][:result]).to eq 1
  end

  it 'sets to 0 if not equal' do
    mem = Tataru::Memory.new
    instr = Tataru::Instructions::CompareInstruction.new('def')

    mem.hash[:temp] = { result: 'abc' }

    instr.memory = mem
    instr.run

    expect(mem.hash[:temp][:result]).to eq 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 spec/instructions/compare_instruction_spec.rb