rushcheck 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/COPYING +515 -0
  2. data/INSTALL +14 -0
  3. data/LICENSE +5 -0
  4. data/README +49 -0
  5. data/Rakefile +39 -0
  6. data/copying.txt +23 -0
  7. data/data/rushcheck/doc/policy.txt +520 -0
  8. data/data/rushcheck/doc/rushcheck.txt +612 -0
  9. data/data/rushcheck/examples/printf.rb +22 -0
  10. data/data/rushcheck/examples/proc.rb +33 -0
  11. data/data/rushcheck/examples/roguetile.rb +153 -0
  12. data/data/rushcheck/examples/sample.rb +52 -0
  13. data/data/rushcheck/rdoc/classes/Arbitrary.html +148 -0
  14. data/data/rushcheck/rdoc/classes/Arbitrary.src/M000075.html +18 -0
  15. data/data/rushcheck/rdoc/classes/Assertion.html +183 -0
  16. data/data/rushcheck/rdoc/classes/Assertion.src/M000015.html +20 -0
  17. data/data/rushcheck/rdoc/classes/Assertion.src/M000016.html +45 -0
  18. data/data/rushcheck/rdoc/classes/Coarbitrary.html +135 -0
  19. data/data/rushcheck/rdoc/classes/Coarbitrary.src/M000095.html +18 -0
  20. data/data/rushcheck/rdoc/classes/FalseClass.html +177 -0
  21. data/data/rushcheck/rdoc/classes/FalseClass.src/M000018.html +18 -0
  22. data/data/rushcheck/rdoc/classes/FalseClass.src/M000019.html +18 -0
  23. data/data/rushcheck/rdoc/classes/FalseClass.src/M000020.html +18 -0
  24. data/data/rushcheck/rdoc/classes/Float.html +191 -0
  25. data/data/rushcheck/rdoc/classes/Float.src/M000047.html +21 -0
  26. data/data/rushcheck/rdoc/classes/Float.src/M000048.html +18 -0
  27. data/data/rushcheck/rdoc/classes/Float.src/M000049.html +22 -0
  28. data/data/rushcheck/rdoc/classes/Float.src/M000050.html +20 -0
  29. data/data/rushcheck/rdoc/classes/Gen.html +515 -0
  30. data/data/rushcheck/rdoc/classes/Gen.src/M000026.html +18 -0
  31. data/data/rushcheck/rdoc/classes/Gen.src/M000027.html +20 -0
  32. data/data/rushcheck/rdoc/classes/Gen.src/M000028.html +28 -0
  33. data/data/rushcheck/rdoc/classes/Gen.src/M000029.html +24 -0
  34. data/data/rushcheck/rdoc/classes/Gen.src/M000030.html +18 -0
  35. data/data/rushcheck/rdoc/classes/Gen.src/M000031.html +18 -0
  36. data/data/rushcheck/rdoc/classes/Gen.src/M000032.html +18 -0
  37. data/data/rushcheck/rdoc/classes/Gen.src/M000033.html +18 -0
  38. data/data/rushcheck/rdoc/classes/Gen.src/M000034.html +18 -0
  39. data/data/rushcheck/rdoc/classes/Gen.src/M000035.html +24 -0
  40. data/data/rushcheck/rdoc/classes/Gen.src/M000036.html +18 -0
  41. data/data/rushcheck/rdoc/classes/Gen.src/M000037.html +21 -0
  42. data/data/rushcheck/rdoc/classes/Gen.src/M000038.html +18 -0
  43. data/data/rushcheck/rdoc/classes/Gen.src/M000039.html +18 -0
  44. data/data/rushcheck/rdoc/classes/Gen.src/M000040.html +23 -0
  45. data/data/rushcheck/rdoc/classes/Gen.src/M000041.html +19 -0
  46. data/data/rushcheck/rdoc/classes/Gen.src/M000042.html +18 -0
  47. data/data/rushcheck/rdoc/classes/Gen.src/M000043.html +24 -0
  48. data/data/rushcheck/rdoc/classes/Guard.html +159 -0
  49. data/data/rushcheck/rdoc/classes/Guard.src/M000024.html +27 -0
  50. data/data/rushcheck/rdoc/classes/Guard.src/M000025.html +18 -0
  51. data/data/rushcheck/rdoc/classes/HsRandom.html +201 -0
  52. data/data/rushcheck/rdoc/classes/HsRandom.src/M000081.html +22 -0
  53. data/data/rushcheck/rdoc/classes/HsRandom.src/M000082.html +32 -0
  54. data/data/rushcheck/rdoc/classes/HsRandom.src/M000083.html +18 -0
  55. data/data/rushcheck/rdoc/classes/Integer.html +212 -0
  56. data/data/rushcheck/rdoc/classes/Integer.src/M000006.html +18 -0
  57. data/data/rushcheck/rdoc/classes/Integer.src/M000007.html +18 -0
  58. data/data/rushcheck/rdoc/classes/Integer.src/M000008.html +21 -0
  59. data/data/rushcheck/rdoc/classes/Integer.src/M000009.html +19 -0
  60. data/data/rushcheck/rdoc/classes/NilClass.html +177 -0
  61. data/data/rushcheck/rdoc/classes/NilClass.src/M000059.html +18 -0
  62. data/data/rushcheck/rdoc/classes/NilClass.src/M000060.html +18 -0
  63. data/data/rushcheck/rdoc/classes/NilClass.src/M000061.html +18 -0
  64. data/data/rushcheck/rdoc/classes/Property.html +174 -0
  65. data/data/rushcheck/rdoc/classes/Property.src/M000070.html +26 -0
  66. data/data/rushcheck/rdoc/classes/Property.src/M000071.html +18 -0
  67. data/data/rushcheck/rdoc/classes/RandomArray.html +184 -0
  68. data/data/rushcheck/rdoc/classes/RandomArray.src/M000021.html +18 -0
  69. data/data/rushcheck/rdoc/classes/RandomArray.src/M000022.html +35 -0
  70. data/data/rushcheck/rdoc/classes/RandomArray.src/M000023.html +22 -0
  71. data/data/rushcheck/rdoc/classes/RandomBool.html +146 -0
  72. data/data/rushcheck/rdoc/classes/RandomBool.src/M000079.html +18 -0
  73. data/data/rushcheck/rdoc/classes/RandomBool.src/M000080.html +19 -0
  74. data/data/rushcheck/rdoc/classes/RandomGen.html +196 -0
  75. data/data/rushcheck/rdoc/classes/RandomGen.src/M000076.html +18 -0
  76. data/data/rushcheck/rdoc/classes/RandomGen.src/M000077.html +18 -0
  77. data/data/rushcheck/rdoc/classes/RandomGen.src/M000078.html +18 -0
  78. data/data/rushcheck/rdoc/classes/RandomHash.html +197 -0
  79. data/data/rushcheck/rdoc/classes/RandomHash.src/M000044.html +18 -0
  80. data/data/rushcheck/rdoc/classes/RandomHash.src/M000045.html +26 -0
  81. data/data/rushcheck/rdoc/classes/RandomHash.src/M000046.html +22 -0
  82. data/data/rushcheck/rdoc/classes/RandomProc.html +192 -0
  83. data/data/rushcheck/rdoc/classes/RandomProc.src/M000055.html +18 -0
  84. data/data/rushcheck/rdoc/classes/RandomProc.src/M000056.html +30 -0
  85. data/data/rushcheck/rdoc/classes/RandomProc.src/M000057.html +26 -0
  86. data/data/rushcheck/rdoc/classes/RandomProc.src/M000058.html +20 -0
  87. data/data/rushcheck/rdoc/classes/Result.html +214 -0
  88. data/data/rushcheck/rdoc/classes/Result.src/M000051.html +18 -0
  89. data/data/rushcheck/rdoc/classes/Result.src/M000052.html +18 -0
  90. data/data/rushcheck/rdoc/classes/Result.src/M000053.html +18 -0
  91. data/data/rushcheck/rdoc/classes/RushCheckConfig.html +240 -0
  92. data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000001.html +23 -0
  93. data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000002.html +22 -0
  94. data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000003.html +18 -0
  95. data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000004.html +38 -0
  96. data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000005.html +55 -0
  97. data/data/rushcheck/rdoc/classes/RushCheckGuard.html +118 -0
  98. data/data/rushcheck/rdoc/classes/SpecialString.html +151 -0
  99. data/data/rushcheck/rdoc/classes/SpecialString.src/M000017.html +37 -0
  100. data/data/rushcheck/rdoc/classes/StdGen.html +252 -0
  101. data/data/rushcheck/rdoc/classes/StdGen.src/M000010.html +23 -0
  102. data/data/rushcheck/rdoc/classes/StdGen.src/M000011.html +21 -0
  103. data/data/rushcheck/rdoc/classes/StdGen.src/M000012.html +21 -0
  104. data/data/rushcheck/rdoc/classes/StdGen.src/M000013.html +18 -0
  105. data/data/rushcheck/rdoc/classes/StdGen.src/M000014.html +18 -0
  106. data/data/rushcheck/rdoc/classes/String.html +191 -0
  107. data/data/rushcheck/rdoc/classes/String.src/M000066.html +24 -0
  108. data/data/rushcheck/rdoc/classes/String.src/M000067.html +18 -0
  109. data/data/rushcheck/rdoc/classes/String.src/M000068.html +25 -0
  110. data/data/rushcheck/rdoc/classes/String.src/M000069.html +22 -0
  111. data/data/rushcheck/rdoc/classes/Testable.html +281 -0
  112. data/data/rushcheck/rdoc/classes/Testable.src/M000084.html +18 -0
  113. data/data/rushcheck/rdoc/classes/Testable.src/M000085.html +18 -0
  114. data/data/rushcheck/rdoc/classes/Testable.src/M000088.html +18 -0
  115. data/data/rushcheck/rdoc/classes/Testable.src/M000089.html +18 -0
  116. data/data/rushcheck/rdoc/classes/Testable.src/M000090.html +18 -0
  117. data/data/rushcheck/rdoc/classes/Testable.src/M000092.html +18 -0
  118. data/data/rushcheck/rdoc/classes/Testable.src/M000094.html +18 -0
  119. data/data/rushcheck/rdoc/classes/TheStdGen.html +200 -0
  120. data/data/rushcheck/rdoc/classes/TheStdGen.src/M000062.html +18 -0
  121. data/data/rushcheck/rdoc/classes/TheStdGen.src/M000063.html +20 -0
  122. data/data/rushcheck/rdoc/classes/TheStdGen.src/M000064.html +21 -0
  123. data/data/rushcheck/rdoc/classes/TheStdGen.src/M000065.html +18 -0
  124. data/data/rushcheck/rdoc/classes/TrueClass.html +177 -0
  125. data/data/rushcheck/rdoc/classes/TrueClass.src/M000072.html +18 -0
  126. data/data/rushcheck/rdoc/classes/TrueClass.src/M000073.html +18 -0
  127. data/data/rushcheck/rdoc/classes/TrueClass.src/M000074.html +18 -0
  128. data/data/rushcheck/rdoc/created.rid +1 -0
  129. data/data/rushcheck/rdoc/files/rushcheck/arbitrary_rb.html +114 -0
  130. data/data/rushcheck/rdoc/files/rushcheck/array_rb.html +117 -0
  131. data/data/rushcheck/rdoc/files/rushcheck/assertion_rb.html +120 -0
  132. data/data/rushcheck/rdoc/files/rushcheck/bool_rb.html +120 -0
  133. data/data/rushcheck/rdoc/files/rushcheck/config_rb.html +109 -0
  134. data/data/rushcheck/rdoc/files/rushcheck/float_rb.html +118 -0
  135. data/data/rushcheck/rdoc/files/rushcheck/gen_rb.html +111 -0
  136. data/data/rushcheck/rdoc/files/rushcheck/guard_rb.html +108 -0
  137. data/data/rushcheck/rdoc/files/rushcheck/hash_rb.html +117 -0
  138. data/data/rushcheck/rdoc/files/rushcheck/integer_rb.html +118 -0
  139. data/data/rushcheck/rdoc/files/rushcheck/proc_rb.html +118 -0
  140. data/data/rushcheck/rdoc/files/rushcheck/property_rb.html +119 -0
  141. data/data/rushcheck/rdoc/files/rushcheck/random_rb.html +126 -0
  142. data/data/rushcheck/rdoc/files/rushcheck/result_rb.html +118 -0
  143. data/data/rushcheck/rdoc/files/rushcheck/rushcheck_rb.html +123 -0
  144. data/data/rushcheck/rdoc/files/rushcheck/string_rb.html +121 -0
  145. data/data/rushcheck/rdoc/files/rushcheck/testable_rb.html +117 -0
  146. data/data/rushcheck/rdoc/fr_class_index.html +51 -0
  147. data/data/rushcheck/rdoc/fr_file_index.html +43 -0
  148. data/data/rushcheck/rdoc/fr_method_index.html +121 -0
  149. data/data/rushcheck/rdoc/index.html +24 -0
  150. data/data/rushcheck/rdoc/rdoc-style.css +208 -0
  151. data/lib/rushcheck/arbitrary.rb +28 -0
  152. data/lib/rushcheck/array.rb +49 -0
  153. data/lib/rushcheck/assertion.rb +67 -0
  154. data/lib/rushcheck/bool.rb +90 -0
  155. data/lib/rushcheck/config.rb +98 -0
  156. data/lib/rushcheck/float.rb +43 -0
  157. data/lib/rushcheck/gen.rb +189 -0
  158. data/lib/rushcheck/guard.rb +27 -0
  159. data/lib/rushcheck/hash.rb +45 -0
  160. data/lib/rushcheck/integer.rb +43 -0
  161. data/lib/rushcheck/proc.rb +53 -0
  162. data/lib/rushcheck/property.rb +29 -0
  163. data/lib/rushcheck/random.rb +215 -0
  164. data/lib/rushcheck/result.rb +26 -0
  165. data/lib/rushcheck/rushcheck.rb +17 -0
  166. data/lib/rushcheck/string.rb +100 -0
  167. data/lib/rushcheck/testable.rb +41 -0
  168. metadata +238 -0
@@ -0,0 +1,515 @@
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: 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">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="#M000037">bind</a>&nbsp;&nbsp;
97
+ <a href="#M000026">choose</a>&nbsp;&nbsp;
98
+ <a href="#M000027">elements</a>&nbsp;&nbsp;
99
+ <a href="#M000039">fmap</a>&nbsp;&nbsp;
100
+ <a href="#M000040">forall</a>&nbsp;&nbsp;
101
+ <a href="#M000028">frequency</a>&nbsp;&nbsp;
102
+ <a href="#M000041">generate</a>&nbsp;&nbsp;
103
+ <a href="#M000029">lift_array</a>&nbsp;&nbsp;
104
+ <a href="#M000036">new</a>&nbsp;&nbsp;
105
+ <a href="#M000030">oneof</a>&nbsp;&nbsp;
106
+ <a href="#M000031">promote</a>&nbsp;&nbsp;
107
+ <a href="#M000032">rand</a>&nbsp;&nbsp;
108
+ <a href="#M000042">resize</a>&nbsp;&nbsp;
109
+ <a href="#M000033">sized</a>&nbsp;&nbsp;
110
+ <a href="#M000034">unit</a>&nbsp;&nbsp;
111
+ <a href="#M000038">value</a>&nbsp;&nbsp;
112
+ <a href="#M000043">variant</a>&nbsp;&nbsp;
113
+ <a href="#M000035">vector</a>&nbsp;&nbsp;
114
+ </div>
115
+ </div>
116
+
117
+ </div>
118
+
119
+
120
+ <!-- if includes -->
121
+
122
+ <div id="section">
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <!-- if method_list -->
132
+ <div id="methods">
133
+ <h3 class="section-bar">Public Class methods</h3>
134
+
135
+ <div id="method-M000026" class="method-detail">
136
+ <a name="M000026"></a>
137
+
138
+ <div class="method-heading">
139
+ <a href="Gen.src/M000026.html" target="Code" class="method-signature"
140
+ onclick="popupCode('Gen.src/M000026.html');return false;">
141
+ <span class="method-name">choose</span><span class="method-args">(lo=nil, hi=nil)</span>
142
+ </a>
143
+ </div>
144
+
145
+ <div class="method-description">
146
+ <p>
147
+ choose is one of primitive generators to create a random <a
148
+ href="Gen.html">Gen</a> object. choose returns a <a href="Gen.html">Gen</a>
149
+ object which generates a random value in the bound. It may useful to
150
+ implement arbitrary method into your class.
151
+ </p>
152
+ </div>
153
+ </div>
154
+
155
+ <div id="method-M000027" class="method-detail">
156
+ <a name="M000027"></a>
157
+
158
+ <div class="method-heading">
159
+ <a href="Gen.src/M000027.html" target="Code" class="method-signature"
160
+ onclick="popupCode('Gen.src/M000027.html');return false;">
161
+ <span class="method-name">elements</span><span class="method-args">(xs)</span>
162
+ </a>
163
+ </div>
164
+
165
+ <div class="method-description">
166
+ <p>
167
+ elements is one of primitive generators to create a random <a
168
+ href="Gen.html">Gen</a> object. elements requires an array and returns a <a
169
+ href="Gen.html">Gen</a> object which generates an object in the array
170
+ randomly. It may useful to implement arbitrary method into your class.
171
+ </p>
172
+ </div>
173
+ </div>
174
+
175
+ <div id="method-M000028" class="method-detail">
176
+ <a name="M000028"></a>
177
+
178
+ <div class="method-heading">
179
+ <a href="Gen.src/M000028.html" target="Code" class="method-signature"
180
+ onclick="popupCode('Gen.src/M000028.html');return false;">
181
+ <span class="method-name">frequency</span><span class="method-args">(xs)</span>
182
+ </a>
183
+ </div>
184
+
185
+ <div class="method-description">
186
+ <p>
187
+ frequency is one of primitive generators to create a random <a
188
+ href="Gen.html">Gen</a> object. frequency requires an array of pairs and
189
+ returns a <a href="Gen.html">Gen</a> object. The first component of pair
190
+ should be a positive <a href="Integer.html">Integer</a> and the second one
191
+ should be a <a href="Gen.html">Gen</a> object. The integer acts as a weight
192
+ for choosing random <a href="Gen.html">Gen</a> object in the array. For
193
+ example, frequency([[1, <a href="Gen.html#M000032">Gen.rand</a>], [2, <a
194
+ href="Integer.html#M000007">Integer.arbitrary</a>]]) returns the random
195
+ generator <a href="Gen.html#M000032">Gen.rand</a> in 33%, while another
196
+ random generator of <a href="Integer.html">Integer</a> (<a
197
+ href="Integer.html#M000007">Integer.arbitrary</a>) in 67%.
198
+ </p>
199
+ </div>
200
+ </div>
201
+
202
+ <div id="method-M000029" class="method-detail">
203
+ <a name="M000029"></a>
204
+
205
+ <div class="method-heading">
206
+ <a href="Gen.src/M000029.html" target="Code" class="method-signature"
207
+ onclick="popupCode('Gen.src/M000029.html');return false;">
208
+ <span class="method-name">lift_array</span><span class="method-args">(ary) {|.value(n, r1)| ...}</span>
209
+ </a>
210
+ </div>
211
+
212
+ <div class="method-description">
213
+ <p>
214
+ <a href="Gen.html#M000029">lift_array</a> is one of primitive generators to
215
+ create a randam <a href="Gen.html">Gen</a> object. <a
216
+ href="Gen.html#M000029">lift_array</a> takes an array and a block which has
217
+ a variable. The block should return a <a href="Gen.html">Gen</a> object. <a
218
+ href="Gen.html#M000029">lift_array</a> returns a <a href="Gen.html">Gen</a>
219
+ object which generates an array of the result of given block for applying
220
+ each member of given array.
221
+ </p>
222
+ </div>
223
+ </div>
224
+
225
+ <div id="method-M000036" class="method-detail">
226
+ <a name="M000036"></a>
227
+
228
+ <div class="method-heading">
229
+ <a href="Gen.src/M000036.html" target="Code" class="method-signature"
230
+ onclick="popupCode('Gen.src/M000036.html');return false;">
231
+ <span class="method-name">new</span><span class="method-args">(&amp;f)</span>
232
+ </a>
233
+ </div>
234
+
235
+ <div class="method-description">
236
+ <p>
237
+ to initialize <a href="Gen.html">Gen</a> object, it requires a block which
238
+ takes two variables. The first argument of block is assumed as an integer,
239
+ and the second one is assumed as a random generator of <a
240
+ href="RandomGen.html">RandomGen</a>.
241
+ </p>
242
+ </div>
243
+ </div>
244
+
245
+ <div id="method-M000030" class="method-detail">
246
+ <a name="M000030"></a>
247
+
248
+ <div class="method-heading">
249
+ <a href="Gen.src/M000030.html" target="Code" class="method-signature"
250
+ onclick="popupCode('Gen.src/M000030.html');return false;">
251
+ <span class="method-name">oneof</span><span class="method-args">(gens)</span>
252
+ </a>
253
+ </div>
254
+
255
+ <div class="method-description">
256
+ <p>
257
+ oneof is /one of/ primitive generators to create a random <a
258
+ href="Gen.html">Gen</a> object. oneof requires an array of <a
259
+ href="Gen.html">Gen</a> objects, and returns a <a href="Gen.html">Gen</a>
260
+ object which choose a <a href="Gen.html">Gen</a> object in the array
261
+ randomly. It may useful to implement arbitrary method into your class.
262
+ </p>
263
+ </div>
264
+ </div>
265
+
266
+ <div id="method-M000031" class="method-detail">
267
+ <a name="M000031"></a>
268
+
269
+ <div class="method-heading">
270
+ <a href="Gen.src/M000031.html" target="Code" class="method-signature"
271
+ onclick="popupCode('Gen.src/M000031.html');return false;">
272
+ <span class="method-name">promote</span><span class="method-args">() {|a| ...}</span>
273
+ </a>
274
+ </div>
275
+
276
+ <div class="method-description">
277
+ <p>
278
+ promote is the function to create a <a href="Gen.html">Gen</a> object which
279
+ generates a procedure (Proc). promote requires a block which takes one
280
+ variable and the block should be return a <a href="Gen.html">Gen</a>
281
+ object. promote returns a <a href="Gen.html">Gen</a> object which generate
282
+ a new procedure with the given block. It may useful to implement
283
+ coarbitrary method into your class.
284
+ </p>
285
+ </div>
286
+ </div>
287
+
288
+ <div id="method-M000032" class="method-detail">
289
+ <a name="M000032"></a>
290
+
291
+ <div class="method-heading">
292
+ <a href="Gen.src/M000032.html" target="Code" class="method-signature"
293
+ onclick="popupCode('Gen.src/M000032.html');return false;">
294
+ <span class="method-name">rand</span><span class="method-args">()</span>
295
+ </a>
296
+ </div>
297
+
298
+ <div class="method-description">
299
+ <p>
300
+ rand returns a <a href="Gen.html">Gen</a> object which generates a random
301
+ number generator.
302
+ </p>
303
+ </div>
304
+ </div>
305
+
306
+ <div id="method-M000033" class="method-detail">
307
+ <a name="M000033"></a>
308
+
309
+ <div class="method-heading">
310
+ <a href="Gen.src/M000033.html" target="Code" class="method-signature"
311
+ onclick="popupCode('Gen.src/M000033.html');return false;">
312
+ <span class="method-name">sized</span><span class="method-args">() {|n| ...}</span>
313
+ </a>
314
+ </div>
315
+
316
+ <div class="method-description">
317
+ <p>
318
+ sized is a combinator which the programmer can use to access the size
319
+ bound. It requires a block which takes a variable as an integer for size.
320
+ The block should be a function which changes the size of random instances.
321
+ </p>
322
+ </div>
323
+ </div>
324
+
325
+ <div id="method-M000034" class="method-detail">
326
+ <a name="M000034"></a>
327
+
328
+ <div class="method-heading">
329
+ <a href="Gen.src/M000034.html" target="Code" class="method-signature"
330
+ onclick="popupCode('Gen.src/M000034.html');return false;">
331
+ <span class="method-name">unit</span><span class="method-args">(x)</span>
332
+ </a>
333
+ </div>
334
+
335
+ <div class="method-description">
336
+ <p>
337
+ unit is a monadic function which equals the return function in the
338
+ Haskell&#8217;s monad. It requires one variable and returns a <a
339
+ href="Gen.html">Gen</a> object which generates the given object.
340
+ </p>
341
+ </div>
342
+ </div>
343
+
344
+ <div id="method-M000035" class="method-detail">
345
+ <a name="M000035"></a>
346
+
347
+ <div class="method-heading">
348
+ <a href="Gen.src/M000035.html" target="Code" class="method-signature"
349
+ onclick="popupCode('Gen.src/M000035.html');return false;">
350
+ <span class="method-name">vector</span><span class="method-args">(c, len)</span>
351
+ </a>
352
+ </div>
353
+
354
+ <div class="method-description">
355
+ <p>
356
+ vector is one of primitive generators to create a <a
357
+ href="Gen.html">Gen</a> object. vector takes two variables, while the first
358
+ one should be class, and the second one should be length. vector returns a
359
+ <a href="Gen.html">Gen</a> object which generates an array whose components
360
+ belongs the given class and given length.
361
+ </p>
362
+ </div>
363
+ </div>
364
+
365
+ <h3 class="section-bar">Public Instance methods</h3>
366
+
367
+ <div id="method-M000037" class="method-detail">
368
+ <a name="M000037"></a>
369
+
370
+ <div class="method-heading">
371
+ <a href="Gen.src/M000037.html" target="Code" class="method-signature"
372
+ onclick="popupCode('Gen.src/M000037.html');return false;">
373
+ <span class="method-name">bind</span><span class="method-args">() {|value(n, r1)| ...}</span>
374
+ </a>
375
+ </div>
376
+
377
+ <div class="method-description">
378
+ <p>
379
+ bind is a monadic function such as Haskel&#8217;s (&gt;&gt;=). bind takes a
380
+ block which has two variables where the first one is assumed as an integer,
381
+ and the second one is assumed as a random generator of <a
382
+ href="RandomGen.html">RandomGen</a>.
383
+ </p>
384
+ </div>
385
+ </div>
386
+
387
+ <div id="method-M000039" class="method-detail">
388
+ <a name="M000039"></a>
389
+
390
+ <div class="method-heading">
391
+ <a href="Gen.src/M000039.html" target="Code" class="method-signature"
392
+ onclick="popupCode('Gen.src/M000039.html');return false;">
393
+ <span class="method-name">fmap</span><span class="method-args">() {|x| ...}</span>
394
+ </a>
395
+ </div>
396
+
397
+ <div class="method-description">
398
+ <p>
399
+ fmap is a categorical function as same in Haskell. fmap requires a block
400
+ which takes one variable.
401
+ </p>
402
+ </div>
403
+ </div>
404
+
405
+ <div id="method-M000040" class="method-detail">
406
+ <a name="M000040"></a>
407
+
408
+ <div class="method-heading">
409
+ <a href="Gen.src/M000040.html" target="Code" class="method-signature"
410
+ onclick="popupCode('Gen.src/M000040.html');return false;">
411
+ <span class="method-name">forall</span><span class="method-args">() {|*a| ...}</span>
412
+ </a>
413
+ </div>
414
+
415
+ <div class="method-description">
416
+ <p>
417
+ forall is a function to create a <a href="Gen.html">Gen</a> object. forall
418
+ requires a block which takes any variables and returns a <a
419
+ href="Property.html">Property</a> object. Then forall returns a generator
420
+ of the property.
421
+ </p>
422
+ </div>
423
+ </div>
424
+
425
+ <div id="method-M000041" class="method-detail">
426
+ <a name="M000041"></a>
427
+
428
+ <div class="method-heading">
429
+ <a href="Gen.src/M000041.html" target="Code" class="method-signature"
430
+ onclick="popupCode('Gen.src/M000041.html');return false;">
431
+ <span class="method-name">generate</span><span class="method-args">(n, rnd)</span>
432
+ </a>
433
+ </div>
434
+
435
+ <div class="method-description">
436
+ <p>
437
+ generate returns the random instance. generates takes two variables, where
438
+ the first one should be an integer and the second should be the random
439
+ number generator such as <a href="StdGen.html">StdGen</a>.
440
+ </p>
441
+ </div>
442
+ </div>
443
+
444
+ <div id="method-M000042" class="method-detail">
445
+ <a name="M000042"></a>
446
+
447
+ <div class="method-heading">
448
+ <a href="Gen.src/M000042.html" target="Code" class="method-signature"
449
+ onclick="popupCode('Gen.src/M000042.html');return false;">
450
+ <span class="method-name">resize</span><span class="method-args">(n)</span>
451
+ </a>
452
+ </div>
453
+
454
+ <div class="method-description">
455
+ <p>
456
+ resize returns another <a href="Gen.html">Gen</a> object which resized by
457
+ the given paramater. resize takes one variable in <a
458
+ href="Integer.html">Integer</a>.
459
+ </p>
460
+ </div>
461
+ </div>
462
+
463
+ <div id="method-M000038" class="method-detail">
464
+ <a name="M000038"></a>
465
+
466
+ <div class="method-heading">
467
+ <a href="Gen.src/M000038.html" target="Code" class="method-signature"
468
+ onclick="popupCode('Gen.src/M000038.html');return false;">
469
+ <span class="method-name">value</span><span class="method-args">(n, g)</span>
470
+ </a>
471
+ </div>
472
+
473
+ <div class="method-description">
474
+ <p>
475
+ value is a method to get the value of the internal procedure. value takes
476
+ two variables where the first argument is assumed as an integer and the
477
+ second one is assumed as a random generator of <a
478
+ href="RandomGen.html">RandomGen</a>.
479
+ </p>
480
+ </div>
481
+ </div>
482
+
483
+ <div id="method-M000043" class="method-detail">
484
+ <a name="M000043"></a>
485
+
486
+ <div class="method-heading">
487
+ <a href="Gen.src/M000043.html" target="Code" class="method-signature"
488
+ onclick="popupCode('Gen.src/M000043.html');return false;">
489
+ <span class="method-name">variant</span><span class="method-args">(v)</span>
490
+ </a>
491
+ </div>
492
+
493
+ <div class="method-description">
494
+ <p>
495
+ variant constructs a generator which transforms the random number seed.
496
+ variant takes one variable which should be an <a
497
+ href="Integer.html">Integer</a>. variant is needed to generate rundom
498
+ functions.
499
+ </p>
500
+ </div>
501
+ </div>
502
+
503
+
504
+ </div>
505
+
506
+
507
+ </div>
508
+
509
+
510
+ <div id="validator-badges">
511
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
512
+ </div>
513
+
514
+ </body>
515
+ </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>choose (Gen)</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/gen.rb, line 12</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">choose</span>(<span class="ruby-identifier">lo</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">hi</span>=<span class="ruby-keyword kw">nil</span>)
15
+ <span class="ruby-identifier">rand</span>.<span class="ruby-identifier">fmap</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">lo</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">random</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">lo</span>, <span class="ruby-identifier">hi</span>)[<span class="ruby-value">0</span>] }
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,20 @@
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>elements (Gen)</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/gen.rb, line 20</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">elements</span>(<span class="ruby-identifier">xs</span>)
15
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">&quot;given argument is empty&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xs</span>.<span class="ruby-identifier">empty?</span>
16
+
17
+ <span class="ruby-identifier">choose</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">xs</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">fmap</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">xs</span>[<span class="ruby-identifier">i</span>] }
18
+ <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,28 @@
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>frequency (Gen)</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/gen.rb, line 34</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">frequency</span>(<span class="ruby-identifier">xs</span>)
15
+ <span class="ruby-identifier">tot</span> = <span class="ruby-identifier">xs</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span>, <span class="ruby-identifier">pair</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">0</span>]}
16
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-node">&quot;Illegal frequency:#{xs.inspect}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tot</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
17
+ <span class="ruby-identifier">choose</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">tot</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">bind</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
18
+ <span class="ruby-identifier">m</span> = <span class="ruby-identifier">n</span>
19
+ <span class="ruby-identifier">xs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span>
20
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">0</span>]
21
+ <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">break</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">1</span>]
22
+ <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">0</span>]
23
+ <span class="ruby-keyword kw">end</span>
24
+ <span class="ruby-keyword kw">end</span>
25
+ <span class="ruby-keyword kw">end</span>
26
+ <span class="ruby-keyword kw">end</span></pre>
27
+ </body>
28
+ </html>
@@ -0,0 +1,24 @@
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>lift_array (Gen)</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/gen.rb, line 53</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">lift_array</span>(<span class="ruby-identifier">ary</span>)
15
+ <span class="ruby-constant">Gen</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">r</span><span class="ruby-operator">|</span>
16
+ <span class="ruby-identifier">r2</span> = <span class="ruby-identifier">r</span>
17
+ <span class="ruby-identifier">ary</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
18
+ <span class="ruby-identifier">r1</span>, <span class="ruby-identifier">r2</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">split</span>
19
+ <span class="ruby-keyword kw">yield</span>.<span class="ruby-identifier">value</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">r1</span>)
20
+ <span class="ruby-keyword kw">end</span>
21
+ <span class="ruby-keyword kw">end</span>
22
+ <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </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>oneof (Gen)</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/gen.rb, line 67</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">oneof</span>(<span class="ruby-identifier">gens</span>)
15
+ <span class="ruby-identifier">elements</span>(<span class="ruby-identifier">gens</span>).<span class="ruby-identifier">bind</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>}
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </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>promote (Gen)</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/gen.rb, line 77</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">promote</span>
15
+ <span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">a</span>).<span class="ruby-identifier">value</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">r</span>) } }
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>