Sha256: 442fd89dafa6cba836fcf33fbab27b56f8d239a069df34dc7f6f1e8460b2544b

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

require 'test_helper'

describe "Allocation Strategies" do

  before(:all) do
    Extension.new "alloc_strats" do |e|
      e.sources full_dir("headers/alloc_strats.h")
      node = e.namespace "alloc_strats"
    end
  end

  # The test here is simple because if the allocation
  # strategies aren't properly defined, the extension
  # won't even compile. GCC will complain about trying to
  # instantiate an object with a non-public constructor
  # and it all dies.
  specify "properly figures out what allocation to do" do
    require 'alloc_strats'

    # Private constructor, public destructor
    NoConstructor

    # Private constructor and destructor
    Neither
  end

  specify "can get access to Neither object" do
    n = Neither.get_instance
    n.should_not be_nil

    n.process(4, 5).should == 20
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbplusplus-1.4.0 test/allocation_strategies_test.rb