Sha256: cc5329315b674a98d18cde4732b2cd63b934a13abe45b6faef237e745af130b7

Contents?: true

Size: 972 Bytes

Versions: 2

Compression:

Stored size: 972 Bytes

Contents

require 'spec_helper'

require 'ronin/asm/syntax/common'

describe ASM::Syntax::Common do
  subject { described_class }

  describe "emit_keyword" do
    let(:name) { :_start }

    it "should convert a keyword to a String" do
      subject.emit_keyword(name).should == name.to_s
    end
  end

  describe "emit_integer" do
    let(:integer)     { 255    }
    let(:hexadecimal) { "0xff" }

    it "should convert it into a hexadecimal value" do
      subject.emit_integer(integer).should == hexadecimal
    end

    context "when given a negative number" do
      let(:negative)    { -255    }
      let(:hexadecimal) { "-0xff" }

      it "should convert it into a hexadecimal value" do
        subject.emit_integer(negative).should == hexadecimal
      end
    end
  end

  describe "emit_label" do
    let(:name)  { :_start   }
    let(:label) { '_start:' }

    it "should append a ':' to the name" do
      subject.emit_label(name).should == label
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ronin-asm-0.2.0 spec/asm/syntax/common_spec.rb
ronin-asm-0.1.0 spec/syntax/common_spec.rb