Sha256: 89ae21b7e542a33154357549516ee91b5e03ed87e63b7882e743dd65ea8679f0

Contents?: true

Size: 561 Bytes

Versions: 6

Compression:

Stored size: 561 Bytes

Contents

require 'queencheck/arbitrary'

class Array
  extend QueenCheck::Arbitrary

  @@bound = 10

  set_arbitrary do |seed|
    if seed == 0
      return []
    else
      base = ((@@bound * seed).ceil)

      ary = Array.new(rand(base) + 1)

      if seed > 0.3
        ary.map!{|ar| Array.new(rand(base) + 1) }
      end

      if seed > 0.5
        ary.map!{|ar| ar.map!{|a| Array.new(rand(base) + 1) } }
      end

      if seed > 0.8
        ary.map!{|ar| ar.map!{|a| a.map!{|item| Array.new(rand(base) + 1) } } }
      end

      return ary
    end
  end
end


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
queencheck-0.1.2 lib/queencheck/array.rb
queencheck-0.1.1 lib/queencheck/array.rb
queencheck-0.1.0 lib/queencheck/array.rb
queencheck-0.0.2 lib/queencheck/array.rb
queencheck-0.0.1 lib/queencheck/array.rb
queencheck-0.0.0 lib/queencheck/array.rb