https://github.com/delonnewman/contracts-gen
Generate data from contracts
https://github.com/delonnewman/contracts-gen
contracts design-by-contract functional functional-programing generative-testing ruby testing
Last synced: 3 months ago
JSON representation
Generate data from contracts
- Host: GitHub
- URL: https://github.com/delonnewman/contracts-gen
- Owner: delonnewman
- License: mit
- Created: 2019-07-16T17:22:01.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-21T00:58:24.000Z (over 4 years ago)
- Last Synced: 2024-05-01T12:34:57.419Z (about 1 year ago)
- Topics: contracts, design-by-contract, functional, functional-programing, generative-testing, ruby, testing
- Language: Ruby
- Homepage: https://www.rubydoc.info/gems/contracts-gen
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

[](https://badge.fury.io/rb/contracts-gen)Contracts::Gen
==============An extension for [Gen::Test][1], defining generators for [Contracts][2].
Synopsis
========```ruby
require 'gen/test'
require 'contracts'
require 'contracts/gen'Sum = lambda { |xs| xs.reduce(:+) }
C = Contracts
class SumTest < Minitest::Test
include Gen::Testdef 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:
```ruby
gem 'contracts-gen'
```to your Gemfile, and then execute:
> bundle
See Also
========- [Gen::Test][1]
- [Contracts][2][1]: https://github.com/delonnewman/gen-test
[2]: https://github.com/egonSchiele/contracts.ruby