0.0
No commit activity in last 3 years
No release in over 3 years
Contracts for generative testing
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 13.0
~> 3.0

Runtime

~> 0.16.0
~> 1.9.6
~> 0.2
 Project Readme

Ruby Gem Version

Contracts::Gen

An extension for Gen::Test, defining generators for Contracts.

Synopsis

require 'gen/test'
require 'contracts'
require 'contracts/gen'

Sum = lambda { |xs| xs.reduce(:+) }

C = Contracts

class SumTest < Minitest::Test
  include Gen::Test

  def test_sum_for_all_arrays_of_integers
    for_all C::ArrayOf[Integer] do |xs|
      y = Sum[xs]
      assert_equal(y, xs.reduce(:+))
    end
  end
end

Install

> gem install contracts-gen

or, add:

gem 'contracts-gen'

to your Gemfile, and then execute:

> bundle

See Also