Sha256: 99a7825317569c22a0997eaf361743864e0e16da64124b09903650abf1c3408b

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Benchmark::Malloc::Allocation do
  it "gathers info about allocated object" do
    object = Object.new
    alloc = described_class.new(object)

    expect(alloc.memsize).to be <= 40
    expect(alloc.source_line).to eq(nil)
    expect(alloc.method_id).to eq(nil)
    expect(alloc.class_path).to eq(nil)
    expect(alloc.source_file).to eq(nil)
  end

  it "extracts allocation info" do
    object = Object.new
    alloc = described_class.new(object)

    extracted = alloc.extract(:class, :memsize)

    expect(extracted[0]).to eq(Object)
    expect(extracted[1]).to be <= 40
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark-malloc-0.1.0 spec/unit/allocation/new_spec.rb