rushcheck 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -3
- data/Rakefile.in +37 -0
- data/data/rushcheck/doc/rushcheck.thtml +20 -0
- data/data/rushcheck/rdoc/classes/FalseClass.html +17 -17
- data/data/rushcheck/rdoc/classes/FalseClass.src/M000006.html +18 -0
- data/data/rushcheck/rdoc/classes/FalseClass.src/M000007.html +18 -0
- data/data/rushcheck/rdoc/classes/FalseClass.src/M000008.html +18 -0
- data/data/rushcheck/rdoc/classes/Float.html +21 -21
- data/data/rushcheck/rdoc/classes/Float.src/M000015.html +21 -0
- data/data/rushcheck/rdoc/classes/Float.src/M000016.html +18 -0
- data/data/rushcheck/rdoc/classes/Float.src/M000017.html +22 -0
- data/data/rushcheck/rdoc/classes/Float.src/M000018.html +20 -0
- data/data/rushcheck/rdoc/classes/Integer.html +28 -29
- data/data/rushcheck/rdoc/classes/Integer.src/M000001.html +18 -0
- data/data/rushcheck/rdoc/classes/Integer.src/M000002.html +18 -0
- data/data/rushcheck/rdoc/classes/Integer.src/M000003.html +25 -0
- data/data/rushcheck/rdoc/classes/Integer.src/M000004.html +19 -0
- data/data/rushcheck/rdoc/classes/NilClass.html +17 -17
- data/data/rushcheck/rdoc/classes/NilClass.src/M000023.html +18 -0
- data/data/rushcheck/rdoc/classes/NilClass.src/M000024.html +18 -0
- data/data/rushcheck/rdoc/classes/NilClass.src/M000025.html +18 -0
- data/data/rushcheck/rdoc/classes/RandomArray.html +16 -16
- data/data/rushcheck/rdoc/classes/RandomArray.src/M000009.html +19 -0
- data/data/rushcheck/rdoc/classes/RandomArray.src/M000010.html +35 -0
- data/data/rushcheck/rdoc/classes/RandomArray.src/M000011.html +22 -0
- data/data/rushcheck/rdoc/classes/RandomHash.html +17 -17
- data/data/rushcheck/rdoc/classes/RandomHash.src/M000012.html +19 -0
- data/data/rushcheck/rdoc/classes/RandomHash.src/M000013.html +26 -0
- data/data/rushcheck/rdoc/classes/RandomHash.src/M000014.html +22 -0
- data/data/rushcheck/rdoc/classes/RandomProc.html +22 -22
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000019.html +18 -0
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000020.html +30 -0
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000021.html +26 -0
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000022.html +20 -0
- data/data/rushcheck/rdoc/classes/RushCheck.html +218 -0
- data/data/rushcheck/rdoc/classes/RushCheck.src/M000033.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck.src/M000034.html +27 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Arbitrary.html +136 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Arbitrary.src/M000035.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Assertion.html +187 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Assertion.src/M000073.html +20 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Assertion.src/M000074.html +50 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Coarbitrary.html +135 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Coarbitrary.src/M000058.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.html +270 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000066.html +23 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000067.html +22 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000068.html +22 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000069.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000070.html +38 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000071.html +55 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Config.src/M000072.html +50 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.html +558 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000075.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000076.html +41 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000077.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000078.html +20 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000079.html +28 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000080.html +24 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000081.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000082.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000083.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000084.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000085.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000086.html +24 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000087.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000088.html +21 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000089.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000090.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000091.html +23 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000092.html +19 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000093.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000094.html +24 -0
- data/data/rushcheck/rdoc/classes/RushCheck/GuardException.html +111 -0
- data/data/rushcheck/rdoc/classes/RushCheck/HsRandom.html +201 -0
- data/data/rushcheck/rdoc/classes/RushCheck/HsRandom.src/M000041.html +22 -0
- data/data/rushcheck/rdoc/classes/RushCheck/HsRandom.src/M000042.html +32 -0
- data/data/rushcheck/rdoc/classes/RushCheck/HsRandom.src/M000043.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Property.html +174 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Property.src/M000105.html +26 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Property.src/M000106.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomBool.html +146 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomBool.src/M000039.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomBool.src/M000040.html +19 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomGen.html +196 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomGen.src/M000036.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomGen.src/M000037.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/RandomGen.src/M000038.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Result.html +214 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Result.src/M000095.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Result.src/M000096.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Result.src/M000097.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/StdGen.html +252 -0
- data/data/rushcheck/rdoc/classes/RushCheck/StdGen.src/M000061.html +23 -0
- data/data/rushcheck/rdoc/classes/RushCheck/StdGen.src/M000062.html +21 -0
- data/data/rushcheck/rdoc/classes/RushCheck/StdGen.src/M000063.html +21 -0
- data/data/rushcheck/rdoc/classes/RushCheck/StdGen.src/M000064.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/StdGen.src/M000065.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestExausted.html +113 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestFailed.html +155 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestFailed.src/M000099.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestOk.html +113 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestOptions.html +172 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestOptions.src/M000059.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestOptions.src/M000060.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestResult.html +160 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TestResult.src/M000100.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.html +326 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000044.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000045.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000048.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000049.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000050.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000052.html +19 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000053.html +21 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000054.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000056.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/Testable.src/M000057.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TheStdGen.html +200 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TheStdGen.src/M000101.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TheStdGen.src/M000102.html +20 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TheStdGen.src/M000103.html +21 -0
- data/data/rushcheck/rdoc/classes/RushCheck/TheStdGen.src/M000104.html +18 -0
- data/data/rushcheck/rdoc/classes/SpecialString.html +5 -5
- data/data/rushcheck/rdoc/classes/SpecialString.src/M000005.html +37 -0
- data/data/rushcheck/rdoc/classes/String.html +21 -21
- data/data/rushcheck/rdoc/classes/String.src/M000026.html +24 -0
- data/data/rushcheck/rdoc/classes/String.src/M000027.html +18 -0
- data/data/rushcheck/rdoc/classes/String.src/M000028.html +25 -0
- data/data/rushcheck/rdoc/classes/String.src/M000029.html +22 -0
- data/data/rushcheck/rdoc/classes/TrueClass.html +17 -17
- data/data/rushcheck/rdoc/classes/TrueClass.src/M000030.html +18 -0
- data/data/rushcheck/rdoc/classes/TrueClass.src/M000031.html +18 -0
- data/data/rushcheck/rdoc/classes/TrueClass.src/M000032.html +18 -0
- data/data/rushcheck/rdoc/created.rid +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/arbitrary_rb.html +5 -8
- data/data/rushcheck/rdoc/files/rushcheck/array_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/assertion_rb.html +2 -3
- data/data/rushcheck/rdoc/files/rushcheck/bool_rb.html +3 -2
- data/data/rushcheck/rdoc/files/rushcheck/config_rb.html +3 -4
- data/data/rushcheck/rdoc/files/rushcheck/float_rb.html +3 -3
- data/data/rushcheck/rdoc/files/rushcheck/gen_rb.html +5 -5
- data/data/rushcheck/rdoc/files/rushcheck/guard_rb.html +2 -2
- data/data/rushcheck/rdoc/files/rushcheck/hash_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/integer_rb.html +2 -2
- data/data/rushcheck/rdoc/files/rushcheck/proc_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/property_rb.html +3 -4
- data/data/rushcheck/rdoc/files/rushcheck/random_rb.html +3 -6
- data/data/rushcheck/rdoc/files/rushcheck/result_rb.html +3 -4
- data/data/rushcheck/rdoc/files/rushcheck/string_rb.html +4 -4
- data/data/rushcheck/rdoc/files/rushcheck/testable_rb.html +2 -3
- data/data/rushcheck/rdoc/files/rushcheck/testoptions_rb.html +3 -3
- data/data/rushcheck/rdoc/files/rushcheck/testresult_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck_rb.html +5 -4
- data/data/rushcheck/rdoc/fr_class_index.html +20 -20
- data/data/rushcheck/rdoc/fr_method_index.html +106 -105
- data/lib/rushcheck.rb +1 -0
- data/lib/rushcheck/assertion.rb +9 -4
- data/lib/rushcheck/gen.rb +1 -1
- data/lib/rushcheck/version.rb +8 -0
- data/lib/rushcheck/version.rb.in +8 -0
- metadata +144 -2
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>verbose (RushCheck::Config)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/config.rb, line 23</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">verbose</span>
|
15
|
+
<span class="ruby-identifier">new</span>(<span class="ruby-value">100</span>, <span class="ruby-value">1000</span>,
|
16
|
+
<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-value">3</span>},
|
17
|
+
<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
18
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">":\n"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>)
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>batch (RushCheck::Config)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/config.rb, line 31</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">batch</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">v</span>)
|
15
|
+
<span class="ruby-identifier">new</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">n</span> <span class="ruby-operator">*</span> <span class="ruby-value">10</span>,
|
16
|
+
<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">x</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-value">3</span>).<span class="ruby-identifier">to_i</span>},
|
17
|
+
<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
18
|
+
<span class="ruby-identifier">v</span> <span class="ruby-value">? </span><span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">":\n"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>)
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (RushCheck::Config)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/config.rb, line 39</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">max_test</span>, <span class="ruby-identifier">max_fail</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">every</span>)
|
15
|
+
<span class="ruby-ivar">@max_test</span>, <span class="ruby-ivar">@max_fail</span>, <span class="ruby-ivar">@size</span>, <span class="ruby-ivar">@every</span> = <span class="ruby-identifier">max_test</span>, <span class="ruby-identifier">max_fail</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">every</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>done (RushCheck::Config)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/config.rb, line 44</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">done</span>(<span class="ruby-identifier">mesg</span>, <span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">stamps</span>)
|
15
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">mesg</span> <span class="ruby-operator">+</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ntest</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">' tests'</span>
|
16
|
+
|
17
|
+
<span class="ruby-identifier">bag</span> = <span class="ruby-identifier">stamps</span>.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">empty?</span>}.<span class="ruby-identifier">sort</span>.
|
18
|
+
<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span>, <span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
|
19
|
+
<span class="ruby-identifier">r</span>[<span class="ruby-identifier">m</span>] = <span class="ruby-identifier">r</span>[<span class="ruby-identifier">m</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">r</span>[<span class="ruby-identifier">m</span>] <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
20
|
+
<span class="ruby-identifier">r</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">sort_by</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>}.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span>
|
22
|
+
<span class="ruby-identifier">percentage</span> = ((<span class="ruby-value">100</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">1</span>]) <span class="ruby-operator">/</span> <span class="ruby-identifier">ntest</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'%'</span>
|
23
|
+
([<span class="ruby-identifier">percentage</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">join</span>(<span class="ruby-value str">', '</span>)
|
24
|
+
<span class="ruby-keyword kw">end</span>
|
25
|
+
|
26
|
+
<span class="ruby-identifier">mes</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">bag</span>.<span class="ruby-identifier">length</span>
|
27
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span>
|
28
|
+
<span class="ruby-value str">".\n"</span>
|
29
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>
|
30
|
+
<span class="ruby-value str">'('</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bag</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">").\n"</span>
|
31
|
+
<span class="ruby-keyword kw">else</span>
|
32
|
+
<span class="ruby-value str">".\n"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bag</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">".\n"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">".\n"</span>
|
33
|
+
<span class="ruby-keyword kw">end</span>
|
34
|
+
|
35
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">mes</span>
|
36
|
+
<span class="ruby-keyword kw">end</span></pre>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>tests (RushCheck::Config)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/config.rb, line 69</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tests</span>(<span class="ruby-identifier">gen</span>, <span class="ruby-identifier">rnd</span>, <span class="ruby-identifier">nt</span>=<span class="ruby-value">1</span>, <span class="ruby-identifier">nf</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">stamps</span>=[])
|
15
|
+
<span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">nfail</span> = <span class="ruby-identifier">nt</span>, <span class="ruby-identifier">nf</span>
|
16
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ntest</span> <span class="ruby-operator">></span> <span class="ruby-identifier">max_test</span>
|
18
|
+
<span class="ruby-identifier">done</span>(<span class="ruby-value str">'OK, passed'</span>, <span class="ruby-identifier">max_test</span>, <span class="ruby-identifier">stamps</span>)
|
19
|
+
<span class="ruby-identifier">tests_result</span> = <span class="ruby-keyword kw">true</span>
|
20
|
+
<span class="ruby-keyword kw">break</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">nfail</span> <span class="ruby-operator">></span> <span class="ruby-identifier">max_fail</span>
|
23
|
+
<span class="ruby-identifier">done</span>(<span class="ruby-value str">'Arguments exhausted after '</span>, <span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">stamps</span>)
|
24
|
+
<span class="ruby-identifier">tests_result</span> = <span class="ruby-keyword kw">nil</span>
|
25
|
+
<span class="ruby-keyword kw">break</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
|
28
|
+
<span class="ruby-identifier">rnd_l</span>, <span class="ruby-identifier">rnd_r</span> = <span class="ruby-identifier">rnd</span>.<span class="ruby-identifier">split</span>
|
29
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">gen</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">size</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">ntest</span>), <span class="ruby-identifier">rnd_r</span>)
|
30
|
+
<span class="ruby-identifier">message</span> = <span class="ruby-identifier">every</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">result</span>.<span class="ruby-identifier">arguments</span>)
|
31
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">message</span> <span class="ruby-comment cmt"># don't puts</span>
|
32
|
+
|
33
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">ok</span>
|
34
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>
|
35
|
+
<span class="ruby-identifier">nfail</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
36
|
+
<span class="ruby-keyword kw">redo</span>
|
37
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">true</span>
|
38
|
+
<span class="ruby-identifier">stamps</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">stamp</span>)
|
39
|
+
<span class="ruby-identifier">ntest</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
40
|
+
<span class="ruby-keyword kw">redo</span>
|
41
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">false</span>
|
42
|
+
<span class="ruby-identifier">error</span> = <span class="ruby-value str">"Falsifiable, after "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ntest</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" tests:\n"</span> <span class="ruby-operator">+</span>
|
43
|
+
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
44
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">error</span>
|
45
|
+
<span class="ruby-identifier">tests_result</span> = <span class="ruby-keyword kw">false</span>
|
46
|
+
<span class="ruby-keyword kw">break</span>
|
47
|
+
<span class="ruby-keyword kw">else</span>
|
48
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">"RushCheck: illegal result"</span>)
|
49
|
+
<span class="ruby-keyword kw">end</span>
|
50
|
+
<span class="ruby-keyword kw">end</span>
|
51
|
+
|
52
|
+
<span class="ruby-identifier">tests_result</span>
|
53
|
+
<span class="ruby-keyword kw">end</span></pre>
|
54
|
+
</body>
|
55
|
+
</html>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>test_batch (RushCheck::Config)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/config.rb, line 110</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_batch</span>(<span class="ruby-identifier">gen</span>, <span class="ruby-identifier">rnd</span>, <span class="ruby-identifier">nt</span>=<span class="ruby-value">1</span>, <span class="ruby-identifier">nf</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">stamps</span>=[])
|
15
|
+
<span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">nfail</span> = <span class="ruby-identifier">nt</span>, <span class="ruby-identifier">nf</span>
|
16
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ntest</span> <span class="ruby-operator">></span> <span class="ruby-identifier">max_test</span>
|
18
|
+
<span class="ruby-identifier">tests_result</span> = <span class="ruby-constant">RushCheck</span><span class="ruby-operator">::</span><span class="ruby-constant">TestOk</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"OK, passed"</span>, <span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">stamps</span>)
|
19
|
+
<span class="ruby-keyword kw">break</span>
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">nfail</span> <span class="ruby-operator">></span> <span class="ruby-identifier">max_fail</span>
|
22
|
+
<span class="ruby-identifier">test_result</span> = <span class="ruby-constant">RushCheck</span><span class="ruby-operator">::</span><span class="ruby-constant">TestExausted</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Arguments exhausted after '</span>, <span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">stamps</span>)
|
23
|
+
<span class="ruby-keyword kw">break</span>
|
24
|
+
<span class="ruby-keyword kw">end</span>
|
25
|
+
|
26
|
+
<span class="ruby-identifier">rnd_l</span>, <span class="ruby-identifier">rnd_r</span> = <span class="ruby-identifier">rnd</span>.<span class="ruby-identifier">split</span>
|
27
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">gen</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">size</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">ntest</span>), <span class="ruby-identifier">rnd_r</span>)
|
28
|
+
<span class="ruby-identifier">message</span> = <span class="ruby-identifier">every</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">ntest</span>, <span class="ruby-identifier">result</span>.<span class="ruby-identifier">arguments</span>)
|
29
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">message</span> <span class="ruby-comment cmt"># don't puts</span>
|
30
|
+
|
31
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">ok</span>
|
32
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>
|
33
|
+
<span class="ruby-identifier">nfail</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
34
|
+
<span class="ruby-keyword kw">redo</span>
|
35
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">true</span>
|
36
|
+
<span class="ruby-identifier">stamps</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">stamp</span>)
|
37
|
+
<span class="ruby-identifier">ntest</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
38
|
+
<span class="ruby-keyword kw">redo</span>
|
39
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">false</span>
|
40
|
+
<span class="ruby-identifier">tests_result</span> = <span class="ruby-constant">RushCheck</span><span class="ruby-operator">::</span><span class="ruby-constant">TestFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">arguments</span>, <span class="ruby-identifier">ntest</span>)
|
41
|
+
<span class="ruby-keyword kw">break</span>
|
42
|
+
<span class="ruby-keyword kw">else</span>
|
43
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">"RushCheck: illegal result"</span>)
|
44
|
+
<span class="ruby-keyword kw">end</span>
|
45
|
+
<span class="ruby-keyword kw">end</span>
|
46
|
+
|
47
|
+
<span class="ruby-identifier">test_result</span>
|
48
|
+
<span class="ruby-keyword kw">end</span></pre>
|
49
|
+
</body>
|
50
|
+
</html>
|
@@ -0,0 +1,558 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: RushCheck::Gen</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">RushCheck::Gen</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/rushcheck/gen_rb.html">
|
59
|
+
rushcheck/gen.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
<a href="Gen.html">Gen</a> provides functions for generating test
|
84
|
+
instances.
|
85
|
+
</p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div id="method-list">
|
93
|
+
<h3 class="section-bar">Methods</h3>
|
94
|
+
|
95
|
+
<div class="name-list">
|
96
|
+
<a href="#M000088">bind</a>
|
97
|
+
<a href="#M000075">choose</a>
|
98
|
+
<a href="#M000077">create</a>
|
99
|
+
<a href="#M000076">create_by_gen</a>
|
100
|
+
<a href="#M000078">elements</a>
|
101
|
+
<a href="#M000090">fmap</a>
|
102
|
+
<a href="#M000091">forall</a>
|
103
|
+
<a href="#M000079">frequency</a>
|
104
|
+
<a href="#M000092">generate</a>
|
105
|
+
<a href="#M000080">lift_array</a>
|
106
|
+
<a href="#M000087">new</a>
|
107
|
+
<a href="#M000081">oneof</a>
|
108
|
+
<a href="#M000082">promote</a>
|
109
|
+
<a href="#M000083">rand</a>
|
110
|
+
<a href="#M000093">resize</a>
|
111
|
+
<a href="#M000084">sized</a>
|
112
|
+
<a href="#M000085">unit</a>
|
113
|
+
<a href="#M000089">value</a>
|
114
|
+
<a href="#M000094">variant</a>
|
115
|
+
<a href="#M000086">vector</a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
<!-- if includes -->
|
123
|
+
|
124
|
+
<div id="section">
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- if method_list -->
|
134
|
+
<div id="methods">
|
135
|
+
<h3 class="section-bar">Public Class methods</h3>
|
136
|
+
|
137
|
+
<div id="method-M000075" class="method-detail">
|
138
|
+
<a name="M000075"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="Gen.src/M000075.html" target="Code" class="method-signature"
|
142
|
+
onclick="popupCode('Gen.src/M000075.html');return false;">
|
143
|
+
<span class="method-name">choose</span><span class="method-args">(lo=nil, hi=nil)</span>
|
144
|
+
</a>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div class="method-description">
|
148
|
+
<p>
|
149
|
+
choose is one of primitive generators to create a random <a
|
150
|
+
href="Gen.html">Gen</a> object. choose returns a <a href="Gen.html">Gen</a>
|
151
|
+
object which generates a random value in the bound. It may useful to
|
152
|
+
implement arbitrary method into your class.
|
153
|
+
</p>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div id="method-M000077" class="method-detail">
|
158
|
+
<a name="M000077"></a>
|
159
|
+
|
160
|
+
<div class="method-heading">
|
161
|
+
<a href="Gen.src/M000077.html" target="Code" class="method-signature"
|
162
|
+
onclick="popupCode('Gen.src/M000077.html');return false;">
|
163
|
+
<span class="method-name">create</span><span class="method-args">(cs) {|f| ...}</span>
|
164
|
+
</a>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
<p>
|
169
|
+
create is one of primitive generators to create a random <a
|
170
|
+
href="Gen.html">Gen</a> object. create takes an array of classes, and any
|
171
|
+
block to generate object. Then create returns a <a href="Gen.html">Gen</a>
|
172
|
+
object. It may useful to implement arbitrary method into your class.
|
173
|
+
</p>
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div id="method-M000076" class="method-detail">
|
178
|
+
<a name="M000076"></a>
|
179
|
+
|
180
|
+
<div class="method-heading">
|
181
|
+
<a href="Gen.src/M000076.html" target="Code" class="method-signature"
|
182
|
+
onclick="popupCode('Gen.src/M000076.html');return false;">
|
183
|
+
<span class="method-name">create_by_gen</span><span class="method-args">(xs, &f)</span>
|
184
|
+
</a>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
<p>
|
189
|
+
create_gen is one of primitive generators to create a random <a
|
190
|
+
href="Gen.html">Gen</a> object. create_gen takes an array of <a
|
191
|
+
href="Gen.html">Gen</a> objects, and any block to generate object. Then
|
192
|
+
create_gen returns a <a href="Gen.html">Gen</a> object. It may useful to
|
193
|
+
implement arbitrary method into your class.
|
194
|
+
</p>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="method-M000078" class="method-detail">
|
199
|
+
<a name="M000078"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="Gen.src/M000078.html" target="Code" class="method-signature"
|
203
|
+
onclick="popupCode('Gen.src/M000078.html');return false;">
|
204
|
+
<span class="method-name">elements</span><span class="method-args">(xs)</span>
|
205
|
+
</a>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="method-description">
|
209
|
+
<p>
|
210
|
+
elements is one of primitive generators to create a random <a
|
211
|
+
href="Gen.html">Gen</a> object. elements requires an array and returns a <a
|
212
|
+
href="Gen.html">Gen</a> object which generates an object in the array
|
213
|
+
randomly. It may useful to implement arbitrary method into your class.
|
214
|
+
</p>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="method-M000079" class="method-detail">
|
219
|
+
<a name="M000079"></a>
|
220
|
+
|
221
|
+
<div class="method-heading">
|
222
|
+
<a href="Gen.src/M000079.html" target="Code" class="method-signature"
|
223
|
+
onclick="popupCode('Gen.src/M000079.html');return false;">
|
224
|
+
<span class="method-name">frequency</span><span class="method-args">(xs)</span>
|
225
|
+
</a>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
<div class="method-description">
|
229
|
+
<p>
|
230
|
+
frequency is one of primitive generators to create a random <a
|
231
|
+
href="Gen.html">Gen</a> object. frequency requires an array of pairs and
|
232
|
+
returns a <a href="Gen.html">Gen</a> object. The first component of pair
|
233
|
+
should be a positive <a href="../Integer.html">Integer</a> and the second
|
234
|
+
one should be a <a href="Gen.html">Gen</a> object. The integer acts as a
|
235
|
+
weight for choosing random <a href="Gen.html">Gen</a> object in the array.
|
236
|
+
For example, frequency([[1, <a href="Gen.html#M000083">Gen.rand</a>], [2,
|
237
|
+
<a href="../Integer.html#M000002">Integer.arbitrary</a>]]) returns the
|
238
|
+
random generator <a href="Gen.html#M000083">Gen.rand</a> in 33%, while
|
239
|
+
another random generator of <a href="../Integer.html">Integer</a> (<a
|
240
|
+
href="../Integer.html#M000002">Integer.arbitrary</a>) in 67%.
|
241
|
+
</p>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div id="method-M000080" class="method-detail">
|
246
|
+
<a name="M000080"></a>
|
247
|
+
|
248
|
+
<div class="method-heading">
|
249
|
+
<a href="Gen.src/M000080.html" target="Code" class="method-signature"
|
250
|
+
onclick="popupCode('Gen.src/M000080.html');return false;">
|
251
|
+
<span class="method-name">lift_array</span><span class="method-args">(xs) {|.value(n, r1)| ...}</span>
|
252
|
+
</a>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<div class="method-description">
|
256
|
+
<p>
|
257
|
+
<a href="Gen.html#M000080">lift_array</a> is one of primitive generators to
|
258
|
+
create a randam <a href="Gen.html">Gen</a> object. <a
|
259
|
+
href="Gen.html#M000080">lift_array</a> takes an array and a block which has
|
260
|
+
a variable. The block should return a <a href="Gen.html">Gen</a> object. <a
|
261
|
+
href="Gen.html#M000080">lift_array</a> returns a <a href="Gen.html">Gen</a>
|
262
|
+
object which generates an array of the result of given block for applying
|
263
|
+
each member of given array.
|
264
|
+
</p>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div id="method-M000087" class="method-detail">
|
269
|
+
<a name="M000087"></a>
|
270
|
+
|
271
|
+
<div class="method-heading">
|
272
|
+
<a href="Gen.src/M000087.html" target="Code" class="method-signature"
|
273
|
+
onclick="popupCode('Gen.src/M000087.html');return false;">
|
274
|
+
<span class="method-name">new</span><span class="method-args">(&f)</span>
|
275
|
+
</a>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div class="method-description">
|
279
|
+
<p>
|
280
|
+
to initialize <a href="Gen.html">Gen</a> object, it requires a block which
|
281
|
+
takes two variables. The first argument of block is assumed as an integer,
|
282
|
+
and the second one is assumed as a random generator of <a
|
283
|
+
href="RandomGen.html">RandomGen</a>.
|
284
|
+
</p>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div id="method-M000081" class="method-detail">
|
289
|
+
<a name="M000081"></a>
|
290
|
+
|
291
|
+
<div class="method-heading">
|
292
|
+
<a href="Gen.src/M000081.html" target="Code" class="method-signature"
|
293
|
+
onclick="popupCode('Gen.src/M000081.html');return false;">
|
294
|
+
<span class="method-name">oneof</span><span class="method-args">(gens)</span>
|
295
|
+
</a>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
<div class="method-description">
|
299
|
+
<p>
|
300
|
+
oneof is /one of/ primitive generators to create a random <a
|
301
|
+
href="Gen.html">Gen</a> object. oneof requires an array of <a
|
302
|
+
href="Gen.html">Gen</a> objects, and returns a <a href="Gen.html">Gen</a>
|
303
|
+
object which choose a <a href="Gen.html">Gen</a> object in the array
|
304
|
+
randomly. It may useful to implement arbitrary method into your class.
|
305
|
+
</p>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div id="method-M000082" class="method-detail">
|
310
|
+
<a name="M000082"></a>
|
311
|
+
|
312
|
+
<div class="method-heading">
|
313
|
+
<a href="Gen.src/M000082.html" target="Code" class="method-signature"
|
314
|
+
onclick="popupCode('Gen.src/M000082.html');return false;">
|
315
|
+
<span class="method-name">promote</span><span class="method-args">() {|a| ...}</span>
|
316
|
+
</a>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
<div class="method-description">
|
320
|
+
<p>
|
321
|
+
promote is the function to create a <a href="Gen.html">Gen</a> object which
|
322
|
+
generates a procedure (Proc). promote requires a block which takes one
|
323
|
+
variable and the block should be return a <a href="Gen.html">Gen</a>
|
324
|
+
object. promote returns a <a href="Gen.html">Gen</a> object which generate
|
325
|
+
a new procedure with the given block. It may useful to implement
|
326
|
+
coarbitrary method into your class.
|
327
|
+
</p>
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div id="method-M000083" class="method-detail">
|
332
|
+
<a name="M000083"></a>
|
333
|
+
|
334
|
+
<div class="method-heading">
|
335
|
+
<a href="Gen.src/M000083.html" target="Code" class="method-signature"
|
336
|
+
onclick="popupCode('Gen.src/M000083.html');return false;">
|
337
|
+
<span class="method-name">rand</span><span class="method-args">()</span>
|
338
|
+
</a>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
<p>
|
343
|
+
rand returns a <a href="Gen.html">Gen</a> object which generates a random
|
344
|
+
number generator.
|
345
|
+
</p>
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
|
349
|
+
<div id="method-M000084" class="method-detail">
|
350
|
+
<a name="M000084"></a>
|
351
|
+
|
352
|
+
<div class="method-heading">
|
353
|
+
<a href="Gen.src/M000084.html" target="Code" class="method-signature"
|
354
|
+
onclick="popupCode('Gen.src/M000084.html');return false;">
|
355
|
+
<span class="method-name">sized</span><span class="method-args">() {|n| ...}</span>
|
356
|
+
</a>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div class="method-description">
|
360
|
+
<p>
|
361
|
+
sized is a combinator which the programmer can use to access the size
|
362
|
+
bound. It requires a block which takes a variable as an integer for size.
|
363
|
+
The block should be a function which changes the size of random instances.
|
364
|
+
</p>
|
365
|
+
</div>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div id="method-M000085" class="method-detail">
|
369
|
+
<a name="M000085"></a>
|
370
|
+
|
371
|
+
<div class="method-heading">
|
372
|
+
<a href="Gen.src/M000085.html" target="Code" class="method-signature"
|
373
|
+
onclick="popupCode('Gen.src/M000085.html');return false;">
|
374
|
+
<span class="method-name">unit</span><span class="method-args">(x)</span>
|
375
|
+
</a>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
<div class="method-description">
|
379
|
+
<p>
|
380
|
+
unit is a monadic function which equals the return function in the
|
381
|
+
Haskell’s monad. It requires one variable and returns a <a
|
382
|
+
href="Gen.html">Gen</a> object which generates the given object.
|
383
|
+
</p>
|
384
|
+
</div>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
<div id="method-M000086" class="method-detail">
|
388
|
+
<a name="M000086"></a>
|
389
|
+
|
390
|
+
<div class="method-heading">
|
391
|
+
<a href="Gen.src/M000086.html" target="Code" class="method-signature"
|
392
|
+
onclick="popupCode('Gen.src/M000086.html');return false;">
|
393
|
+
<span class="method-name">vector</span><span class="method-args">(c, len)</span>
|
394
|
+
</a>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
<div class="method-description">
|
398
|
+
<p>
|
399
|
+
vector is one of primitive generators to create a <a
|
400
|
+
href="Gen.html">Gen</a> object. vector takes two variables, while the first
|
401
|
+
one should be class, and the second one should be length. vector returns a
|
402
|
+
<a href="Gen.html">Gen</a> object which generates an array whose components
|
403
|
+
belongs the given class and given length.
|
404
|
+
</p>
|
405
|
+
</div>
|
406
|
+
</div>
|
407
|
+
|
408
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
409
|
+
|
410
|
+
<div id="method-M000088" class="method-detail">
|
411
|
+
<a name="M000088"></a>
|
412
|
+
|
413
|
+
<div class="method-heading">
|
414
|
+
<a href="Gen.src/M000088.html" target="Code" class="method-signature"
|
415
|
+
onclick="popupCode('Gen.src/M000088.html');return false;">
|
416
|
+
<span class="method-name">bind</span><span class="method-args">() {|value(n, r1)| ...}</span>
|
417
|
+
</a>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
<div class="method-description">
|
421
|
+
<p>
|
422
|
+
bind is a monadic function such as Haskel’s (>>=). bind takes a
|
423
|
+
block which has two variables where the first one is assumed as an integer,
|
424
|
+
and the second one is assumed as a random generator of <a
|
425
|
+
href="RandomGen.html">RandomGen</a>.
|
426
|
+
</p>
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
<div id="method-M000090" class="method-detail">
|
431
|
+
<a name="M000090"></a>
|
432
|
+
|
433
|
+
<div class="method-heading">
|
434
|
+
<a href="Gen.src/M000090.html" target="Code" class="method-signature"
|
435
|
+
onclick="popupCode('Gen.src/M000090.html');return false;">
|
436
|
+
<span class="method-name">fmap</span><span class="method-args">() {|x| ...}</span>
|
437
|
+
</a>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div class="method-description">
|
441
|
+
<p>
|
442
|
+
fmap is a categorical function as same in Haskell. fmap requires a block
|
443
|
+
which takes one variable.
|
444
|
+
</p>
|
445
|
+
</div>
|
446
|
+
</div>
|
447
|
+
|
448
|
+
<div id="method-M000091" class="method-detail">
|
449
|
+
<a name="M000091"></a>
|
450
|
+
|
451
|
+
<div class="method-heading">
|
452
|
+
<a href="Gen.src/M000091.html" target="Code" class="method-signature"
|
453
|
+
onclick="popupCode('Gen.src/M000091.html');return false;">
|
454
|
+
<span class="method-name">forall</span><span class="method-args">() {|*a| ...}</span>
|
455
|
+
</a>
|
456
|
+
</div>
|
457
|
+
|
458
|
+
<div class="method-description">
|
459
|
+
<p>
|
460
|
+
forall is a function to create a <a href="Gen.html">Gen</a> object. forall
|
461
|
+
requires a block which takes any variables and returns a <a
|
462
|
+
href="Property.html">Property</a> object. Then forall returns a generator
|
463
|
+
of the property.
|
464
|
+
</p>
|
465
|
+
</div>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div id="method-M000092" class="method-detail">
|
469
|
+
<a name="M000092"></a>
|
470
|
+
|
471
|
+
<div class="method-heading">
|
472
|
+
<a href="Gen.src/M000092.html" target="Code" class="method-signature"
|
473
|
+
onclick="popupCode('Gen.src/M000092.html');return false;">
|
474
|
+
<span class="method-name">generate</span><span class="method-args">(n, rnd)</span>
|
475
|
+
</a>
|
476
|
+
</div>
|
477
|
+
|
478
|
+
<div class="method-description">
|
479
|
+
<p>
|
480
|
+
generate returns the random instance. generates takes two variables, where
|
481
|
+
the first one should be an integer and the second should be the random
|
482
|
+
number generator such as <a href="StdGen.html">StdGen</a>.
|
483
|
+
</p>
|
484
|
+
</div>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
<div id="method-M000093" class="method-detail">
|
488
|
+
<a name="M000093"></a>
|
489
|
+
|
490
|
+
<div class="method-heading">
|
491
|
+
<a href="Gen.src/M000093.html" target="Code" class="method-signature"
|
492
|
+
onclick="popupCode('Gen.src/M000093.html');return false;">
|
493
|
+
<span class="method-name">resize</span><span class="method-args">(n)</span>
|
494
|
+
</a>
|
495
|
+
</div>
|
496
|
+
|
497
|
+
<div class="method-description">
|
498
|
+
<p>
|
499
|
+
resize returns another <a href="Gen.html">Gen</a> object which resized by
|
500
|
+
the given paramater. resize takes one variable in <a
|
501
|
+
href="../Integer.html">Integer</a>.
|
502
|
+
</p>
|
503
|
+
</div>
|
504
|
+
</div>
|
505
|
+
|
506
|
+
<div id="method-M000089" class="method-detail">
|
507
|
+
<a name="M000089"></a>
|
508
|
+
|
509
|
+
<div class="method-heading">
|
510
|
+
<a href="Gen.src/M000089.html" target="Code" class="method-signature"
|
511
|
+
onclick="popupCode('Gen.src/M000089.html');return false;">
|
512
|
+
<span class="method-name">value</span><span class="method-args">(n, g)</span>
|
513
|
+
</a>
|
514
|
+
</div>
|
515
|
+
|
516
|
+
<div class="method-description">
|
517
|
+
<p>
|
518
|
+
value is a method to get the value of the internal procedure. value takes
|
519
|
+
two variables where the first argument is assumed as an integer and the
|
520
|
+
second one is assumed as a random generator of <a
|
521
|
+
href="RandomGen.html">RandomGen</a>.
|
522
|
+
</p>
|
523
|
+
</div>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
<div id="method-M000094" class="method-detail">
|
527
|
+
<a name="M000094"></a>
|
528
|
+
|
529
|
+
<div class="method-heading">
|
530
|
+
<a href="Gen.src/M000094.html" target="Code" class="method-signature"
|
531
|
+
onclick="popupCode('Gen.src/M000094.html');return false;">
|
532
|
+
<span class="method-name">variant</span><span class="method-args">(v)</span>
|
533
|
+
</a>
|
534
|
+
</div>
|
535
|
+
|
536
|
+
<div class="method-description">
|
537
|
+
<p>
|
538
|
+
variant constructs a generator which transforms the random number seed.
|
539
|
+
variant takes one variable which should be an <a
|
540
|
+
href="../Integer.html">Integer</a>. variant is needed to generate rundom
|
541
|
+
functions.
|
542
|
+
</p>
|
543
|
+
</div>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
|
547
|
+
</div>
|
548
|
+
|
549
|
+
|
550
|
+
</div>
|
551
|
+
|
552
|
+
|
553
|
+
<div id="validator-badges">
|
554
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
</body>
|
558
|
+
</html>
|