Sha256: a8702f5f18d70686bb6298eefd93943365e0a2ea2019b0afb1f3c3c352d4fdaa

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

require 'test/unit'
require 'bits_count'
require 'benchmark'

module Fixtures
  ROOT = File.expand_path('fixtures',  File.dirname(__FILE__))

  def fixture_path(name)
    File.expand_path(name.to_s, ROOT)
  end

  class << self
    
    def all
      Dir.glob(File.expand_path("*.bin", ROOT)).map do |path|
        file_name = File.basename(path, '.bin')
        bit0_count = file_name[/bit0-(\d+)/, 1].to_i
        bit1_count = file_name[/bit1-(\d+)/, 1].to_i
        [path, bit0_count, bit1_count]
      end
    end


    def large_bin
      path = File.expand_path("tmp/large.bin", ROOT)
      if !File.exists?(path)
        File.open(path, "wb") do |f|
          1024.times { f.write(([0x55555555] * 256).pack("N*")) }
        end
      end
      path
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bits_count-0.0.1 test/test_helper.rb