Sha256: 134fa488812f4ddfc8b80ed782434ff4a815f2cd82398941e0ad89df46bd07d1

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

# coding: utf-8
# 列表集成测试

require 'minitest/autorun'
require 'benchmark'
require 'memory_profiler'

$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))

require 'cos'

class ListTest < Minitest::Test

  def setup
    @bucket = COS.client(config: '~/.cos.yml').bucket
  end

  def test_list_big_dir
    memory_profiler do

      Benchmark.bm(32) do |bm|
        bm.report('List a big dir') do
          @bucket.list('big_dir').each do |res|
            puts res.name
          end
        end
      end

    end
  end

  private

  def memory_profiler
    report = MemoryProfiler.report do
      yield if block_given?
    end

    # 打印内存信息
    report.pretty_print
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cos-0.1.2 test/list_test.rb
cos-0.1.1 test/list_test.rb