Sha256: b2b936215daf98b4cc032b88c671ac346522ce65aea7ea9ee17c7151c6fe0e9d

Contents?: true

Size: 1002 Bytes

Versions: 1

Compression:

Stored size: 1002 Bytes

Contents

require 'spec_helper'

require 'ronin/code/asm/syntax/common'

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

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

    it "must convert a keyword to a String" do
      expect(subject.emit_keyword(name)).to eq(name.to_s)
    end
  end

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

    it "must convert it into a hexadecimal value" do
      expect(subject.emit_integer(integer)).to eq(hexadecimal)
    end

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

      it "must convert it into a hexadecimal value" do
        expect(subject.emit_integer(negative)).to eq(hexadecimal)
      end
    end
  end

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

    it "must append a ':' to the name" do
      expect(subject.emit_label(name)).to eq(label)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-code-asm-1.0.0.beta1 spec/syntax/common_spec.rb