Sha256: 1012f8f895a1bb0131b4d124692cb3db1103662a8795225c0000a4235f977cb3

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'rubyqc/test'

describe Array do
  describe 'sort' do
    should 'Any front elements should be <= any rear elements' do
      check([Fixnum]*100).times(10) do |array|
        array.sort.each_cons(2).each{ |x, y| x.should <= y }
      end
    end
  end
end

describe Hash do
  describe 'compare_by_identity' do
    should 'Treat diff arr with the same contents diff when set' do
      arr = [0]
      forall(booleans, [arr, [0]], [arr, [1]]) do |flag, a, b|
        h = {}
        h.compare_by_identity if flag
        h[a] = h[b] = true

        if (flag && a.object_id != b.object_id) || a != b
          h.size.should.eq 2
        else
          h.size.should.eq 1
        end
      end
    end
  end
end

class User < Struct.new(:id, :name)
  def self.rubyqc
    new(Fixnum.rubyqc, String.rubyqc)
  end
end

describe 'User.rubyqc' do
  should 'Generate random users' do
    check(User) do |user|
      user     .should.kind_of User
      user.id  .should.kind_of Fixnum
      user.name.should.kind_of String
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyqc-0.0.2 test/test_readme.rb