Sha256: 2542e70ad260b2f597ae3f0bf13408bcadc6d397cac6f5346df7f2c959d70bf4

Contents?: true

Size: 1.51 KB

Versions: 4

Compression:

Stored size: 1.51 KB

Contents

require 'ronin/arch'

require 'helpers/database'

describe Arch do
  it "should require a name, endian and address_length attributes" do
    @arch = Arch.new
    @arch.should_not be_valid
    
    @arch.name = 'future'
    @arch.should_not be_valid
   
    @arch.endian = 'little'
    @arch.should_not be_valid

    @arch.address_length = 4
    @arch.should be_valid
  end

  it "should require a unique name" do
    @first_arch = Arch.create(:name => 'cats',
                              :endian => 'little',
                              :address_length => 4)
    @first_arch.should be_valid

    @second_arch = Arch.new(:name => 'cats',
                            :endian => 'big',
                            :address_length => 4)
    @second_arch.should_not be_valid
  end

  it "should require either 'little' or 'big' for the endian attribute" do
    @arch = Arch.new(:name => 'test',
                     :endian => 'lol',
                     :address_length => 4)
    @arch.should_not be_valid

    @arch.endian = 'little'
    @arch.should be_valid

    @arch.endian = 'big'
    @arch.should be_valid
  end

  it "should require a numeric valid for the address_length attribute" do
    @arch = Arch.new(:name => 'test2',
                     :endian => 'big',
                     :address_length => 'x')
    @arch.should_not be_valid

    @arch.address_length = '4'
    @arch.should be_valid

    @arch.address_length = 4
    @arch.should be_valid
  end

  it "should provide built-in archs" do
    Arch.i386.should_not be_nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ronin-0.1.2 spec/arch_spec.rb
ronin-0.1.3 spec/arch_spec.rb
ronin-0.1.4 spec/arch_spec.rb
ronin-0.2.0 spec/arch_spec.rb