Sha256: aae5d9e31ff8da1b2058557961d1e47b1925f690b04b8f3efc68c5990e9a23a8

Contents?: true

Size: 923 Bytes

Versions: 8

Compression:

Stored size: 923 Bytes

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)

class MeasureMemoryTest < TestCase
  include MemoryTestHelper

  def test_memory_mode
    RubyProf::measure_mode = RubyProf::MEMORY
    assert_equal(RubyProf::MEMORY, RubyProf::measure_mode)
  end

  def test_memory_enabled_defined
    assert(defined?(RubyProf::MEMORY_ENABLED))
  end

  if RubyProf::MEMORY_ENABLED
    def test_memory
      RubyProf::measure_mode = RubyProf::MEMORY
      RubyProf.enable_gc_stats_if_needed
      t = RubyProf.measure_memory
      assert_kind_of Float, t
      u = RubyProf.measure_memory
      assert_operator u, :>, t
      total = memory_test_helper
      assert(total > 0, 'Should measure more than zero kilobytes of memory usage')
      refute_equal(0, total % 1, 'Should not truncate fractional kilobyte measurements')
    ensure
      RubyProf.disable_gc_stats_if_needed
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ruby-prof-0.17.0 test/measure_memory_test.rb
airbnb-ruby-prof-0.0.1 test/measure_memory_test.rb
ruby-prof-0.16.2 test/measure_memory_test.rb
ruby-prof-0.16.1 test/measure_memory_test.rb
ruby-prof-0.16.0 test/measure_memory_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/ruby-prof-0.15.9/test/measure_memory_test.rb
ruby-prof-0.15.9 test/measure_memory_test.rb
ruby-prof-0.15.8 test/measure_memory_test.rb