rushcheck 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/data/rushcheck/doc/rushcheck.txt +68 -10
- data/data/rushcheck/examples/candy.rb +43 -0
- data/data/rushcheck/rdoc/classes/Arbitrary.html +5 -5
- data/data/rushcheck/rdoc/classes/Arbitrary.src/M000076.html +18 -0
- data/data/rushcheck/rdoc/classes/Assertion.src/M000016.html +9 -4
- data/data/rushcheck/rdoc/classes/Coarbitrary.html +5 -5
- data/data/rushcheck/rdoc/classes/Coarbitrary.src/M000096.html +18 -0
- data/data/rushcheck/rdoc/classes/Float.html +20 -20
- data/data/rushcheck/rdoc/classes/Float.src/M000048.html +7 -4
- data/data/rushcheck/rdoc/classes/Float.src/M000049.html +4 -8
- data/data/rushcheck/rdoc/classes/Float.src/M000050.html +8 -6
- data/data/rushcheck/rdoc/classes/Float.src/M000051.html +20 -0
- data/data/rushcheck/rdoc/classes/Gen.html +109 -87
- data/data/rushcheck/rdoc/classes/Gen.src/M000026.html +1 -1
- data/data/rushcheck/rdoc/classes/Gen.src/M000027.html +28 -5
- data/data/rushcheck/rdoc/classes/Gen.src/M000028.html +6 -14
- data/data/rushcheck/rdoc/classes/Gen.src/M000029.html +13 -9
- data/data/rushcheck/rdoc/classes/Gen.src/M000030.html +10 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000031.html +4 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000032.html +4 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000033.html +4 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000034.html +4 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000035.html +4 -10
- data/data/rushcheck/rdoc/classes/Gen.src/M000036.html +10 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000037.html +4 -7
- data/data/rushcheck/rdoc/classes/Gen.src/M000038.html +7 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000039.html +4 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000040.html +4 -9
- data/data/rushcheck/rdoc/classes/Gen.src/M000041.html +9 -5
- data/data/rushcheck/rdoc/classes/Gen.src/M000042.html +5 -4
- data/data/rushcheck/rdoc/classes/Gen.src/M000043.html +4 -10
- data/data/rushcheck/rdoc/classes/Gen.src/M000044.html +24 -0
- data/data/rushcheck/rdoc/classes/HsRandom.html +20 -20
- data/data/rushcheck/rdoc/classes/HsRandom.src/M000082.html +8 -18
- data/data/rushcheck/rdoc/classes/HsRandom.src/M000083.html +18 -4
- data/data/rushcheck/rdoc/classes/HsRandom.src/M000084.html +18 -0
- data/data/rushcheck/rdoc/classes/NilClass.html +15 -15
- data/data/rushcheck/rdoc/classes/NilClass.src/M000060.html +4 -4
- data/data/rushcheck/rdoc/classes/NilClass.src/M000061.html +4 -4
- data/data/rushcheck/rdoc/classes/NilClass.src/M000062.html +18 -0
- data/data/rushcheck/rdoc/classes/Property.html +10 -10
- data/data/rushcheck/rdoc/classes/Property.src/M000071.html +12 -4
- data/data/rushcheck/rdoc/classes/Property.src/M000072.html +18 -0
- data/data/rushcheck/rdoc/classes/RandomArray.src/M000022.html +2 -2
- data/data/rushcheck/rdoc/classes/RandomBool.html +10 -10
- data/data/rushcheck/rdoc/classes/RandomBool.src/M000080.html +4 -5
- data/data/rushcheck/rdoc/classes/RandomBool.src/M000081.html +19 -0
- data/data/rushcheck/rdoc/classes/RandomGen.html +20 -20
- data/data/rushcheck/rdoc/classes/RandomGen.src/M000077.html +3 -3
- data/data/rushcheck/rdoc/classes/RandomGen.src/M000078.html +3 -3
- data/data/rushcheck/rdoc/classes/RandomGen.src/M000079.html +18 -0
- data/data/rushcheck/rdoc/classes/RandomHash.html +16 -16
- data/data/rushcheck/rdoc/classes/RandomHash.src/M000045.html +4 -12
- data/data/rushcheck/rdoc/classes/RandomHash.src/M000046.html +11 -7
- data/data/rushcheck/rdoc/classes/RandomHash.src/M000047.html +22 -0
- data/data/rushcheck/rdoc/classes/RandomProc.html +20 -20
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000056.html +4 -16
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000057.html +13 -9
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000058.html +11 -5
- data/data/rushcheck/rdoc/classes/RandomProc.src/M000059.html +20 -0
- data/data/rushcheck/rdoc/classes/Result.html +19 -19
- data/data/rushcheck/rdoc/classes/Result.src/M000052.html +4 -4
- data/data/rushcheck/rdoc/classes/Result.src/M000053.html +4 -4
- data/data/rushcheck/rdoc/classes/Result.src/M000054.html +18 -0
- data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000004.html +1 -1
- data/data/rushcheck/rdoc/classes/RushCheckConfig.src/M000005.html +1 -1
- data/data/rushcheck/rdoc/classes/String.html +20 -20
- data/data/rushcheck/rdoc/classes/String.src/M000067.html +10 -4
- data/data/rushcheck/rdoc/classes/String.src/M000068.html +4 -11
- data/data/rushcheck/rdoc/classes/String.src/M000069.html +10 -7
- data/data/rushcheck/rdoc/classes/String.src/M000070.html +22 -0
- data/data/rushcheck/rdoc/classes/Testable.html +54 -54
- data/data/rushcheck/rdoc/classes/Testable.src/M000085.html +4 -4
- data/data/rushcheck/rdoc/classes/Testable.src/M000086.html +18 -0
- data/data/rushcheck/rdoc/classes/Testable.src/M000089.html +4 -4
- data/data/rushcheck/rdoc/classes/Testable.src/M000090.html +4 -4
- data/data/rushcheck/rdoc/classes/Testable.src/M000091.html +18 -0
- data/data/rushcheck/rdoc/classes/Testable.src/M000093.html +18 -0
- data/data/rushcheck/rdoc/classes/Testable.src/M000095.html +18 -0
- data/data/rushcheck/rdoc/classes/TheStdGen.html +20 -20
- data/data/rushcheck/rdoc/classes/TheStdGen.src/M000063.html +4 -6
- data/data/rushcheck/rdoc/classes/TheStdGen.src/M000064.html +6 -7
- data/data/rushcheck/rdoc/classes/TheStdGen.src/M000065.html +7 -4
- data/data/rushcheck/rdoc/classes/TheStdGen.src/M000066.html +18 -0
- data/data/rushcheck/rdoc/classes/TrueClass.html +15 -15
- data/data/rushcheck/rdoc/classes/TrueClass.src/M000073.html +4 -4
- data/data/rushcheck/rdoc/classes/TrueClass.src/M000074.html +4 -4
- data/data/rushcheck/rdoc/classes/TrueClass.src/M000075.html +18 -0
- data/data/rushcheck/rdoc/created.rid +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/array_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/assertion_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/config_rb.html +1 -1
- data/data/rushcheck/rdoc/files/rushcheck/gen_rb.html +8 -1
- data/data/rushcheck/rdoc/files/rushcheck/rushcheck_rb.html +6 -2
- data/data/rushcheck/rdoc/files/rushcheck/testable_rb.html +1 -1
- data/data/rushcheck/rdoc/fr_method_index.html +75 -74
- data/lib/rushcheck/gen.rb +40 -3
- metadata +22 -2
@@ -93,24 +93,25 @@ instances.
|
|
93
93
|
<h3 class="section-bar">Methods</h3>
|
94
94
|
|
95
95
|
<div class="name-list">
|
96
|
-
<a href="#
|
96
|
+
<a href="#M000038">bind</a>
|
97
97
|
<a href="#M000026">choose</a>
|
98
|
-
<a href="#M000027">
|
99
|
-
<a href="#
|
100
|
-
<a href="#M000040">
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
106
|
-
<a href="#M000031">
|
107
|
-
<a href="#M000032">
|
108
|
-
<a href="#
|
109
|
-
<a href="#
|
110
|
-
<a href="#M000034">
|
111
|
-
<a href="#
|
112
|
-
<a href="#
|
113
|
-
<a href="#
|
98
|
+
<a href="#M000027">create</a>
|
99
|
+
<a href="#M000028">elements</a>
|
100
|
+
<a href="#M000040">fmap</a>
|
101
|
+
<a href="#M000041">forall</a>
|
102
|
+
<a href="#M000029">frequency</a>
|
103
|
+
<a href="#M000042">generate</a>
|
104
|
+
<a href="#M000030">lift_array</a>
|
105
|
+
<a href="#M000037">new</a>
|
106
|
+
<a href="#M000031">oneof</a>
|
107
|
+
<a href="#M000032">promote</a>
|
108
|
+
<a href="#M000033">rand</a>
|
109
|
+
<a href="#M000043">resize</a>
|
110
|
+
<a href="#M000034">sized</a>
|
111
|
+
<a href="#M000035">unit</a>
|
112
|
+
<a href="#M000039">value</a>
|
113
|
+
<a href="#M000044">variant</a>
|
114
|
+
<a href="#M000036">vector</a>
|
114
115
|
</div>
|
115
116
|
</div>
|
116
117
|
|
@@ -158,6 +159,27 @@ implement arbitrary method into your class.
|
|
158
159
|
<div class="method-heading">
|
159
160
|
<a href="Gen.src/M000027.html" target="Code" class="method-signature"
|
160
161
|
onclick="popupCode('Gen.src/M000027.html');return false;">
|
162
|
+
<span class="method-name">create</span><span class="method-args">(xs, &f)</span>
|
163
|
+
</a>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div class="method-description">
|
167
|
+
<p>
|
168
|
+
create is one of primitive generators to create a random <a
|
169
|
+
href="Gen.html">Gen</a> object. create takes an array of <a
|
170
|
+
href="Gen.html">Gen</a> objects, and any block to generate object. Then
|
171
|
+
create returns a <a href="Gen.html">Gen</a> object. It may useful to
|
172
|
+
implement arbitrary method into your class.
|
173
|
+
</p>
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div id="method-M000028" class="method-detail">
|
178
|
+
<a name="M000028"></a>
|
179
|
+
|
180
|
+
<div class="method-heading">
|
181
|
+
<a href="Gen.src/M000028.html" target="Code" class="method-signature"
|
182
|
+
onclick="popupCode('Gen.src/M000028.html');return false;">
|
161
183
|
<span class="method-name">elements</span><span class="method-args">(xs)</span>
|
162
184
|
</a>
|
163
185
|
</div>
|
@@ -172,12 +194,12 @@ randomly. It may useful to implement arbitrary method into your class.
|
|
172
194
|
</div>
|
173
195
|
</div>
|
174
196
|
|
175
|
-
<div id="method-
|
176
|
-
<a name="
|
197
|
+
<div id="method-M000029" class="method-detail">
|
198
|
+
<a name="M000029"></a>
|
177
199
|
|
178
200
|
<div class="method-heading">
|
179
|
-
<a href="Gen.src/
|
180
|
-
onclick="popupCode('Gen.src/
|
201
|
+
<a href="Gen.src/M000029.html" target="Code" class="method-signature"
|
202
|
+
onclick="popupCode('Gen.src/M000029.html');return false;">
|
181
203
|
<span class="method-name">frequency</span><span class="method-args">(xs)</span>
|
182
204
|
</a>
|
183
205
|
</div>
|
@@ -190,44 +212,44 @@ returns a <a href="Gen.html">Gen</a> object. The first component of pair
|
|
190
212
|
should be a positive <a href="Integer.html">Integer</a> and the second one
|
191
213
|
should be a <a href="Gen.html">Gen</a> object. The integer acts as a weight
|
192
214
|
for choosing random <a href="Gen.html">Gen</a> object in the array. For
|
193
|
-
example, frequency([[1, <a href="Gen.html#
|
215
|
+
example, frequency([[1, <a href="Gen.html#M000033">Gen.rand</a>], [2, <a
|
194
216
|
href="Integer.html#M000007">Integer.arbitrary</a>]]) returns the random
|
195
|
-
generator <a href="Gen.html#
|
217
|
+
generator <a href="Gen.html#M000033">Gen.rand</a> in 33%, while another
|
196
218
|
random generator of <a href="Integer.html">Integer</a> (<a
|
197
219
|
href="Integer.html#M000007">Integer.arbitrary</a>) in 67%.
|
198
220
|
</p>
|
199
221
|
</div>
|
200
222
|
</div>
|
201
223
|
|
202
|
-
<div id="method-
|
203
|
-
<a name="
|
224
|
+
<div id="method-M000030" class="method-detail">
|
225
|
+
<a name="M000030"></a>
|
204
226
|
|
205
227
|
<div class="method-heading">
|
206
|
-
<a href="Gen.src/
|
207
|
-
onclick="popupCode('Gen.src/
|
208
|
-
<span class="method-name">lift_array</span><span class="method-args">(
|
228
|
+
<a href="Gen.src/M000030.html" target="Code" class="method-signature"
|
229
|
+
onclick="popupCode('Gen.src/M000030.html');return false;">
|
230
|
+
<span class="method-name">lift_array</span><span class="method-args">(xs) {|.value(n, r1)| ...}</span>
|
209
231
|
</a>
|
210
232
|
</div>
|
211
233
|
|
212
234
|
<div class="method-description">
|
213
235
|
<p>
|
214
|
-
<a href="Gen.html#
|
236
|
+
<a href="Gen.html#M000030">lift_array</a> is one of primitive generators to
|
215
237
|
create a randam <a href="Gen.html">Gen</a> object. <a
|
216
|
-
href="Gen.html#
|
238
|
+
href="Gen.html#M000030">lift_array</a> takes an array and a block which has
|
217
239
|
a variable. The block should return a <a href="Gen.html">Gen</a> object. <a
|
218
|
-
href="Gen.html#
|
240
|
+
href="Gen.html#M000030">lift_array</a> returns a <a href="Gen.html">Gen</a>
|
219
241
|
object which generates an array of the result of given block for applying
|
220
242
|
each member of given array.
|
221
243
|
</p>
|
222
244
|
</div>
|
223
245
|
</div>
|
224
246
|
|
225
|
-
<div id="method-
|
226
|
-
<a name="
|
247
|
+
<div id="method-M000037" class="method-detail">
|
248
|
+
<a name="M000037"></a>
|
227
249
|
|
228
250
|
<div class="method-heading">
|
229
|
-
<a href="Gen.src/
|
230
|
-
onclick="popupCode('Gen.src/
|
251
|
+
<a href="Gen.src/M000037.html" target="Code" class="method-signature"
|
252
|
+
onclick="popupCode('Gen.src/M000037.html');return false;">
|
231
253
|
<span class="method-name">new</span><span class="method-args">(&f)</span>
|
232
254
|
</a>
|
233
255
|
</div>
|
@@ -242,12 +264,12 @@ href="RandomGen.html">RandomGen</a>.
|
|
242
264
|
</div>
|
243
265
|
</div>
|
244
266
|
|
245
|
-
<div id="method-
|
246
|
-
<a name="
|
267
|
+
<div id="method-M000031" class="method-detail">
|
268
|
+
<a name="M000031"></a>
|
247
269
|
|
248
270
|
<div class="method-heading">
|
249
|
-
<a href="Gen.src/
|
250
|
-
onclick="popupCode('Gen.src/
|
271
|
+
<a href="Gen.src/M000031.html" target="Code" class="method-signature"
|
272
|
+
onclick="popupCode('Gen.src/M000031.html');return false;">
|
251
273
|
<span class="method-name">oneof</span><span class="method-args">(gens)</span>
|
252
274
|
</a>
|
253
275
|
</div>
|
@@ -263,12 +285,12 @@ randomly. It may useful to implement arbitrary method into your class.
|
|
263
285
|
</div>
|
264
286
|
</div>
|
265
287
|
|
266
|
-
<div id="method-
|
267
|
-
<a name="
|
288
|
+
<div id="method-M000032" class="method-detail">
|
289
|
+
<a name="M000032"></a>
|
268
290
|
|
269
291
|
<div class="method-heading">
|
270
|
-
<a href="Gen.src/
|
271
|
-
onclick="popupCode('Gen.src/
|
292
|
+
<a href="Gen.src/M000032.html" target="Code" class="method-signature"
|
293
|
+
onclick="popupCode('Gen.src/M000032.html');return false;">
|
272
294
|
<span class="method-name">promote</span><span class="method-args">() {|a| ...}</span>
|
273
295
|
</a>
|
274
296
|
</div>
|
@@ -285,12 +307,12 @@ coarbitrary method into your class.
|
|
285
307
|
</div>
|
286
308
|
</div>
|
287
309
|
|
288
|
-
<div id="method-
|
289
|
-
<a name="
|
310
|
+
<div id="method-M000033" class="method-detail">
|
311
|
+
<a name="M000033"></a>
|
290
312
|
|
291
313
|
<div class="method-heading">
|
292
|
-
<a href="Gen.src/
|
293
|
-
onclick="popupCode('Gen.src/
|
314
|
+
<a href="Gen.src/M000033.html" target="Code" class="method-signature"
|
315
|
+
onclick="popupCode('Gen.src/M000033.html');return false;">
|
294
316
|
<span class="method-name">rand</span><span class="method-args">()</span>
|
295
317
|
</a>
|
296
318
|
</div>
|
@@ -303,12 +325,12 @@ number generator.
|
|
303
325
|
</div>
|
304
326
|
</div>
|
305
327
|
|
306
|
-
<div id="method-
|
307
|
-
<a name="
|
328
|
+
<div id="method-M000034" class="method-detail">
|
329
|
+
<a name="M000034"></a>
|
308
330
|
|
309
331
|
<div class="method-heading">
|
310
|
-
<a href="Gen.src/
|
311
|
-
onclick="popupCode('Gen.src/
|
332
|
+
<a href="Gen.src/M000034.html" target="Code" class="method-signature"
|
333
|
+
onclick="popupCode('Gen.src/M000034.html');return false;">
|
312
334
|
<span class="method-name">sized</span><span class="method-args">() {|n| ...}</span>
|
313
335
|
</a>
|
314
336
|
</div>
|
@@ -322,12 +344,12 @@ The block should be a function which changes the size of random instances.
|
|
322
344
|
</div>
|
323
345
|
</div>
|
324
346
|
|
325
|
-
<div id="method-
|
326
|
-
<a name="
|
347
|
+
<div id="method-M000035" class="method-detail">
|
348
|
+
<a name="M000035"></a>
|
327
349
|
|
328
350
|
<div class="method-heading">
|
329
|
-
<a href="Gen.src/
|
330
|
-
onclick="popupCode('Gen.src/
|
351
|
+
<a href="Gen.src/M000035.html" target="Code" class="method-signature"
|
352
|
+
onclick="popupCode('Gen.src/M000035.html');return false;">
|
331
353
|
<span class="method-name">unit</span><span class="method-args">(x)</span>
|
332
354
|
</a>
|
333
355
|
</div>
|
@@ -341,12 +363,12 @@ href="Gen.html">Gen</a> object which generates the given object.
|
|
341
363
|
</div>
|
342
364
|
</div>
|
343
365
|
|
344
|
-
<div id="method-
|
345
|
-
<a name="
|
366
|
+
<div id="method-M000036" class="method-detail">
|
367
|
+
<a name="M000036"></a>
|
346
368
|
|
347
369
|
<div class="method-heading">
|
348
|
-
<a href="Gen.src/
|
349
|
-
onclick="popupCode('Gen.src/
|
370
|
+
<a href="Gen.src/M000036.html" target="Code" class="method-signature"
|
371
|
+
onclick="popupCode('Gen.src/M000036.html');return false;">
|
350
372
|
<span class="method-name">vector</span><span class="method-args">(c, len)</span>
|
351
373
|
</a>
|
352
374
|
</div>
|
@@ -364,12 +386,12 @@ belongs the given class and given length.
|
|
364
386
|
|
365
387
|
<h3 class="section-bar">Public Instance methods</h3>
|
366
388
|
|
367
|
-
<div id="method-
|
368
|
-
<a name="
|
389
|
+
<div id="method-M000038" class="method-detail">
|
390
|
+
<a name="M000038"></a>
|
369
391
|
|
370
392
|
<div class="method-heading">
|
371
|
-
<a href="Gen.src/
|
372
|
-
onclick="popupCode('Gen.src/
|
393
|
+
<a href="Gen.src/M000038.html" target="Code" class="method-signature"
|
394
|
+
onclick="popupCode('Gen.src/M000038.html');return false;">
|
373
395
|
<span class="method-name">bind</span><span class="method-args">() {|value(n, r1)| ...}</span>
|
374
396
|
</a>
|
375
397
|
</div>
|
@@ -384,12 +406,12 @@ href="RandomGen.html">RandomGen</a>.
|
|
384
406
|
</div>
|
385
407
|
</div>
|
386
408
|
|
387
|
-
<div id="method-
|
388
|
-
<a name="
|
409
|
+
<div id="method-M000040" class="method-detail">
|
410
|
+
<a name="M000040"></a>
|
389
411
|
|
390
412
|
<div class="method-heading">
|
391
|
-
<a href="Gen.src/
|
392
|
-
onclick="popupCode('Gen.src/
|
413
|
+
<a href="Gen.src/M000040.html" target="Code" class="method-signature"
|
414
|
+
onclick="popupCode('Gen.src/M000040.html');return false;">
|
393
415
|
<span class="method-name">fmap</span><span class="method-args">() {|x| ...}</span>
|
394
416
|
</a>
|
395
417
|
</div>
|
@@ -402,12 +424,12 @@ which takes one variable.
|
|
402
424
|
</div>
|
403
425
|
</div>
|
404
426
|
|
405
|
-
<div id="method-
|
406
|
-
<a name="
|
427
|
+
<div id="method-M000041" class="method-detail">
|
428
|
+
<a name="M000041"></a>
|
407
429
|
|
408
430
|
<div class="method-heading">
|
409
|
-
<a href="Gen.src/
|
410
|
-
onclick="popupCode('Gen.src/
|
431
|
+
<a href="Gen.src/M000041.html" target="Code" class="method-signature"
|
432
|
+
onclick="popupCode('Gen.src/M000041.html');return false;">
|
411
433
|
<span class="method-name">forall</span><span class="method-args">() {|*a| ...}</span>
|
412
434
|
</a>
|
413
435
|
</div>
|
@@ -422,12 +444,12 @@ of the property.
|
|
422
444
|
</div>
|
423
445
|
</div>
|
424
446
|
|
425
|
-
<div id="method-
|
426
|
-
<a name="
|
447
|
+
<div id="method-M000042" class="method-detail">
|
448
|
+
<a name="M000042"></a>
|
427
449
|
|
428
450
|
<div class="method-heading">
|
429
|
-
<a href="Gen.src/
|
430
|
-
onclick="popupCode('Gen.src/
|
451
|
+
<a href="Gen.src/M000042.html" target="Code" class="method-signature"
|
452
|
+
onclick="popupCode('Gen.src/M000042.html');return false;">
|
431
453
|
<span class="method-name">generate</span><span class="method-args">(n, rnd)</span>
|
432
454
|
</a>
|
433
455
|
</div>
|
@@ -441,12 +463,12 @@ number generator such as <a href="StdGen.html">StdGen</a>.
|
|
441
463
|
</div>
|
442
464
|
</div>
|
443
465
|
|
444
|
-
<div id="method-
|
445
|
-
<a name="
|
466
|
+
<div id="method-M000043" class="method-detail">
|
467
|
+
<a name="M000043"></a>
|
446
468
|
|
447
469
|
<div class="method-heading">
|
448
|
-
<a href="Gen.src/
|
449
|
-
onclick="popupCode('Gen.src/
|
470
|
+
<a href="Gen.src/M000043.html" target="Code" class="method-signature"
|
471
|
+
onclick="popupCode('Gen.src/M000043.html');return false;">
|
450
472
|
<span class="method-name">resize</span><span class="method-args">(n)</span>
|
451
473
|
</a>
|
452
474
|
</div>
|
@@ -460,12 +482,12 @@ href="Integer.html">Integer</a>.
|
|
460
482
|
</div>
|
461
483
|
</div>
|
462
484
|
|
463
|
-
<div id="method-
|
464
|
-
<a name="
|
485
|
+
<div id="method-M000039" class="method-detail">
|
486
|
+
<a name="M000039"></a>
|
465
487
|
|
466
488
|
<div class="method-heading">
|
467
|
-
<a href="Gen.src/
|
468
|
-
onclick="popupCode('Gen.src/
|
489
|
+
<a href="Gen.src/M000039.html" target="Code" class="method-signature"
|
490
|
+
onclick="popupCode('Gen.src/M000039.html');return false;">
|
469
491
|
<span class="method-name">value</span><span class="method-args">(n, g)</span>
|
470
492
|
</a>
|
471
493
|
</div>
|
@@ -480,12 +502,12 @@ href="RandomGen.html">RandomGen</a>.
|
|
480
502
|
</div>
|
481
503
|
</div>
|
482
504
|
|
483
|
-
<div id="method-
|
484
|
-
<a name="
|
505
|
+
<div id="method-M000044" class="method-detail">
|
506
|
+
<a name="M000044"></a>
|
485
507
|
|
486
508
|
<div class="method-heading">
|
487
|
-
<a href="Gen.src/
|
488
|
-
onclick="popupCode('Gen.src/
|
509
|
+
<a href="Gen.src/M000044.html" target="Code" class="method-signature"
|
510
|
+
onclick="popupCode('Gen.src/M000044.html');return false;">
|
489
511
|
<span class="method-name">variant</span><span class="method-args">(v)</span>
|
490
512
|
</a>
|
491
513
|
</div>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 16</span>
|
14
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
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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -5,16 +5,39 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>create (Gen)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 24</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">xs</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">f</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">nguard</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">xs</span>.<span class="ruby-identifier">length</span>
|
18
|
+
<span class="ruby-identifier">guards</span> = <span class="ruby-identifier">nguard</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nguard</span>, <span class="ruby-constant">Guard</span>.<span class="ruby-identifier">new</span>) <span class="ruby-operator">:</span> []
|
16
19
|
|
17
|
-
|
20
|
+
<span class="ruby-identifier">try</span> = <span class="ruby-value">0</span>
|
21
|
+
<span class="ruby-keyword kw">begin</span>
|
22
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">try</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@@max_create</span>
|
23
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">"Failed to guards too many."</span>)
|
24
|
+
<span class="ruby-keyword kw">end</span>
|
25
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">xs</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">gen</span><span class="ruby-operator">|</span>
|
26
|
+
<span class="ruby-identifier">r1</span>, <span class="ruby-identifier">r2</span> = <span class="ruby-identifier">r2</span>.<span class="ruby-identifier">split</span>
|
27
|
+
<span class="ruby-identifier">gen</span>.<span class="ruby-identifier">value</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">r1</span>)
|
28
|
+
<span class="ruby-keyword kw">end</span>
|
29
|
+
<span class="ruby-identifier">ys</span> = <span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">guards</span>
|
30
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ys</span>)
|
31
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
32
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">ex</span>
|
33
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">RushCheckGuard</span>
|
34
|
+
<span class="ruby-identifier">try</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
35
|
+
<span class="ruby-keyword kw">retry</span>
|
36
|
+
<span class="ruby-keyword kw">else</span>
|
37
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-identifier">ex</span>, <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>)
|
38
|
+
<span class="ruby-keyword kw">end</span>
|
39
|
+
<span class="ruby-keyword kw">end</span>
|
40
|
+
<span class="ruby-keyword kw">end</span>
|
18
41
|
<span class="ruby-keyword kw">end</span></pre>
|
19
42
|
</body>
|
20
43
|
</html>
|
@@ -5,24 +5,16 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>elements (Gen)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">
|
16
|
-
|
17
|
-
<span class="ruby-identifier">choose</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">
|
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"><=</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>
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 57</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">"given argument is empty"</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>] }
|
26
18
|
<span class="ruby-keyword kw">end</span></pre>
|
27
19
|
</body>
|
28
20
|
</html>
|
@@ -5,20 +5,24 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>frequency (Gen)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 71</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">"Illegal frequency:#{xs.inspect}"</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"><=</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>
|
20
24
|
<span class="ruby-keyword kw">end</span>
|
21
|
-
<span class="ruby-keyword kw">end</span>
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
22
26
|
<span class="ruby-keyword kw">end</span></pre>
|
23
27
|
</body>
|
24
28
|
</html>
|
@@ -5,14 +5,20 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>lift_array (Gen)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 90</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">xs</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">xs</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">r2</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>
|
16
22
|
<span class="ruby-keyword kw">end</span></pre>
|
17
23
|
</body>
|
18
24
|
</html>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>oneof (Gen)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 104</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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>promote (Gen)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">
|
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-identifier">r</span>}
|
13
|
+
<pre><span class="ruby-comment cmt"># File rushcheck/gen.rb, line 114</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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|