README.textile in rantly-0.3.2 vs README.textile in rantly-1.0.0
- old
+ new
@@ -1,28 +1,14 @@
-!https://travis-ci.org/hayeah/rantly.png?branch=master!:https://travis-ci.org/hayeah/rantly
+!https://badge.fury.io/rb/rantly.svg!:https://badge.fury.io/rb/rantly
-h1. Repository move (Beginning 2015-07-07)
+!https://travis-ci.org/abargnesi/rantly.svg?branch=master!:https://travis-ci.org/abargnesi/rantly
-The official _rantly_ repository has moved from "hayeah/rantly":https://github.com/hayeah/rantly to "abargnesi/rantly":https://github.com/abargnesi/rantly. The creator of _rantly_ is "Howard Yeh":https://github.com/hayeah. "Anthony Bargnesi":https://github.com/abargnesi is the current maintainer.
-
-New development will occur in "abargnesi/rantly":https://github.com/abargnesi/rantly.
-
-The transition plan is as follows:
-
-* [x] Investigate and move open issues from "hayeah/rantly":https://github.com/hayeah/rantly to "abargnesi/rantly":https://github.com/abargnesi/rantly.
-* [x] Evaluate and likely merge pull requests into hayeah/rantly. Push these changes to "abargnesi/rantly":https://github.com/abargnesi/rantly.
-* [x] Move over any closed issues that have relevant discourse.
-* [ ] Fix open issues.
-* [x] Push new gem version after testing functionality.
-* [ ] Continue new development; Changes will be pushed back upstream to "hayeah/rantly":https://github.com/hayeah/rantly over the course of the next month.
-* [x] Added CHANGELOG markdown file. Includes what was added between 0.3.1 (2011-12-15) and 0.3.2 (2015-09-16).
-
h1. Imperative Random Data Generator and Quickcheck
-You can use Rant to generate random test data, and use its Test::Unit extension for property-based testing.
+You can use Rantly to generate random test data, and use its Test::Unit extension for property-based testing.
-Rant is basically a recursive descent interpreter, each of its method returns a random value of some type (string, integer, float, etc.).
+Rantly is basically a recursive descent interpreter, each of its method returns a random value of some type (string, integer, float, etc.).
Its implementation has no alien mathematics inside. Completely side-effect-free-free.
h1. Install
@@ -329,10 +315,30 @@
}.check { |(len,arr)|
assert_equal len, arr.length
}
</code></pre>
+To control the number of property tests to generate, you have three options. In order of precedence:
+
+# Pass an integer argument to @check@
+
+<pre><code>
+property_of {
+ integer
+}.check(9000) { |i|
+ assert_kind_of Integer, i
+}
+</code></pre>
+
+#_ Set the @RANTLY_COUNT@ environment variable
+
+<pre><code>
+RANTLY_COUNT=9000 ruby my_property_test.rb
+</code></pre>
+
+#_ If neither of the above are set, the default will be to run the @check@ block 100 times.
+
If you wish to have quiet output from Rantly, set environmental variable:
<pre><code>
RANTLY_VERBOSE=0 # silent
RANTLY_VERBOSE=1 # verbose and default if env is not set
</code></pre>
@@ -343,25 +349,52 @@
Shrinking reduces the value of common types to some terminal lower bound. These functions are added to the Ruby types <code>Integer</code>, <code>String</code>, <code>Array</code>, and <code>Hash</code>.
For example a <code>String</code> is shrinkable until it is empty (e.g. <code>""</code>),
<pre><code>
-"foo".shrink # => "fo"
-"foo".shrink.shrink # => "f"
-"foo".shrink.shrink.shrink # => ""
-"".shrinkable? # => false
+"foo".shrinkable? # => true
+"foo".shrink # => "fo"
+"fo".shrink # => "f"
+"f".shrink # => ""
+"".shrinkable? # => false
</code></pre>
-Shrinking allows <code>Property#check</code> to find the minimum value that still fails the condition.
+Shrinking allows <code>Property#check</code> to find a reduced value that still fails the condition. The value is not truely minimal because:
+* we do not perform a complete in-depth traversal of the failure tree
+* we limit the search to a maximum 1024 shrinking operations
+
+but is usually reduced enough to start debugging.
+
Enable shrinking with
<pre><code>
require 'rantly/shrinks'
</code></pre>
+Use <code>Tuple</code> class if you want an array whose elements are individually shrinked, but are not removed. Example:
-That's about it. Enjoy :)
+<pre><code>
+property_of {
+ len = range(0, 10)
+ Tuple.new( array(len) { integer } )
+}.check {
+ # .. property check here ..
+}
+</code></pre>
+
+Use <code>Deflating</code> class if you want an array whose elements are individully shrinked whenever possible, and removed otherwise. Example:
+
+<pre><code>
+property_of {
+ len = range(0, 10)
+ Deflated.new( array(len) { integer } )
+}.check {
+ # .. property check here ..
+}
+</code></pre>
+
+Normal arrays or hashes are not shrinked.
h1. Copyright
Copyright (c) 2009 Howard Yeh. See LICENSE for details.