Sha256: 6765d3cf82e28c1adeab6c2ebf63a3ce5a55dd21e1cbad2bab14429308f56fd3

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

require 'indis-arm/instruction_helper'

describe Indis::ARM::InstructionHelper do
  it "should decode registers" do
    b = '0000111100000010'.reverse.to_i(2)
    r = Indis::ARM::InstructionHelper.regs_from_bits(b)
    r.should == [:r4, :r5, :r6, :r7, :r14]
  end
end

describe Indis::ARM::PseudoCodeInstructionHelper do
  it "should perform ZeroExtend" do
    Indis::ARM::InstructionHelper.ZeroExtend('1101'.to_bo, 6).to_s.should == '001101'
  end
  
  it "should perform LSR" do
    a = Indis::ARM::InstructionHelper.LSR_C('101100'.to_bo, 3)
    a[0].to_s.should == '000101'
    a[1].should == 1
  end
  
  it "should perform Shift_C" do
    Indis::ARM::InstructionHelper.Shift_C('101100'.to_bo, :SRType_ROR, 2, 0).map{|v|v.to_s}.should == ['001011', '1']
  end
  
  it "should perform ARMExpandImm_C" do
    Indis::ARM::InstructionHelper.ARMExpandImm('000000001100'.to_bo).to_i.should == 12
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
indis-arm-0.3.1 spec/indis-arm/instruction_helper_spec.rb
indis-arm-0.3.0 spec/indis-arm/instruction_helper_spec.rb