Sha256: 16310535255f613ff9c87ef579ba4a5eb5a0eaaf90aca566eb4348cb18506b2d

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'
require 'ronin/arch'

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

3 entries across 3 versions & 1 rubygems

Version Path
ronin-1.0.0.pre3 spec/arch_spec.rb
ronin-1.0.0.pre2 spec/arch_spec.rb
ronin-1.0.0.pre1 spec/arch_spec.rb