rushcheck 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/Rakefile +9 -1
  2. data/Rakefile.in +9 -1
  3. data/data/rushcheck/doc/rushcheck.thtml +55 -0
  4. data/data/rushcheck/examples/proc.rb +1 -1
  5. data/data/rushcheck/examples/rspec/stack.rb +42 -0
  6. data/data/rushcheck/examples/rspec/stack_spec.rb +223 -0
  7. data/data/rushcheck/rdoc/classes/RushCheck/Arbitrary.src/M000035.html +1 -1
  8. data/data/rushcheck/rdoc/classes/RushCheck/Assertion.html +14 -3
  9. data/data/rushcheck/rdoc/classes/RushCheck/Assertion.src/M000073.html +1 -2
  10. data/data/rushcheck/rdoc/classes/RushCheck/Assertion.src/M000074.html +6 -33
  11. data/data/rushcheck/rdoc/classes/RushCheck/Claim.html +199 -0
  12. data/data/rushcheck/rdoc/classes/RushCheck/Claim.src/M000107.html +21 -0
  13. data/data/rushcheck/rdoc/classes/RushCheck/Coarbitrary.src/M000058.html +1 -1
  14. data/data/rushcheck/rdoc/classes/RushCheck/Gen.html +3 -3
  15. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000076.html +0 -1
  16. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000077.html +1 -1
  17. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000078.html +1 -1
  18. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000079.html +1 -1
  19. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000080.html +1 -1
  20. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000081.html +1 -1
  21. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000082.html +1 -1
  22. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000083.html +1 -1
  23. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000084.html +1 -1
  24. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000085.html +1 -1
  25. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000086.html +1 -1
  26. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000087.html +1 -1
  27. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000088.html +1 -1
  28. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000089.html +1 -1
  29. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000090.html +1 -1
  30. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000091.html +1 -1
  31. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000092.html +1 -1
  32. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000093.html +1 -1
  33. data/data/rushcheck/rdoc/classes/RushCheck/Gen.src/M000094.html +1 -1
  34. data/data/rushcheck/rdoc/classes/RushCheck.html +25 -1
  35. data/data/rushcheck/rdoc/created.rid +1 -1
  36. data/data/rushcheck/rdoc/files/rushcheck/arbitrary_rb.html +20 -2
  37. data/data/rushcheck/rdoc/files/rushcheck/assertion_rb.html +1 -1
  38. data/data/rushcheck/rdoc/files/rushcheck/claim_rb.html +119 -0
  39. data/data/rushcheck/rdoc/files/rushcheck/gen_rb.html +1 -1
  40. data/data/rushcheck/rdoc/files/rushcheck/random_rb.html +1 -1
  41. data/data/rushcheck/rdoc/files/rushcheck/version_rb.html +107 -0
  42. data/data/rushcheck/rdoc/files/rushcheck_rb.html +3 -1
  43. data/data/rushcheck/rdoc/fr_class_index.html +1 -0
  44. data/data/rushcheck/rdoc/fr_file_index.html +2 -0
  45. data/data/rushcheck/rdoc/fr_method_index.html +8 -7
  46. data/lib/rushcheck/arbitrary.rb +15 -1
  47. data/lib/rushcheck/assertion.rb +21 -6
  48. data/lib/rushcheck/claim.rb +56 -0
  49. data/lib/rushcheck/gen.rb +2 -4
  50. data/lib/rushcheck/version.rb +1 -1
  51. data/lib/rushcheck.rb +1 -0
  52. metadata +11 -2
@@ -0,0 +1,119 @@
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>File: claim.rb</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="fileHeader">
50
+ <h1>claim.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>rushcheck/claim.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Oct 13 01:43:00 JST 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>claim.rb</h1>
73
+ <pre>
74
+ this file provides a class Claim for random testing.
75
+ </pre>
76
+
77
+ </div>
78
+
79
+ <div id="requires-list">
80
+ <h3 class="section-bar">Required files</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="gen_rb.html">rushcheck/gen</a>&nbsp;&nbsp;
84
+ <a href="guard_rb.html">rushcheck/guard</a>&nbsp;&nbsp;
85
+ <a href="property_rb.html">rushcheck/property</a>&nbsp;&nbsp;
86
+ <a href="result_rb.html">rushcheck/result</a>&nbsp;&nbsp;
87
+ <a href="testable_rb.html">rushcheck/testable</a>&nbsp;&nbsp;
88
+ </div>
89
+ </div>
90
+
91
+ </div>
92
+
93
+
94
+ </div>
95
+
96
+
97
+ <!-- if includes -->
98
+
99
+ <div id="section">
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <!-- if method_list -->
109
+
110
+
111
+ </div>
112
+
113
+
114
+ <div id="validator-badges">
115
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
116
+ </div>
117
+
118
+ </body>
119
+ </html>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Wed Oct 04 18:39:24 JST 2006</td>
59
+ <td>Sun Oct 08 17:36:52 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sat Sep 16 04:39:36 JST 2006</td>
59
+ <td>Sat Oct 07 12:32:29 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -0,0 +1,107 @@
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>File: version.rb</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="fileHeader">
50
+ <h1>version.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>rushcheck/version.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Oct 13 02:25:29 JST 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ version.rb
74
+ </p>
75
+
76
+ </div>
77
+
78
+
79
+ </div>
80
+
81
+
82
+ </div>
83
+
84
+
85
+ <!-- if includes -->
86
+
87
+ <div id="section">
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <!-- if method_list -->
97
+
98
+
99
+ </div>
100
+
101
+
102
+ <div id="validator-badges">
103
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
104
+ </div>
105
+
106
+ </body>
107
+ </html>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Wed Oct 04 18:26:24 JST 2006</td>
59
+ <td>Fri Oct 13 01:42:09 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -83,10 +83,12 @@ href="../classes/RushCheck.html">RushCheck</a> for random testing.
83
83
  <div class="name-list">
84
84
  <a href="rushcheck/arbitrary_rb.html">rushcheck/arbitrary</a>&nbsp;&nbsp;
85
85
  <a href="rushcheck/assertion_rb.html">rushcheck/assertion</a>&nbsp;&nbsp;
86
+ <a href="rushcheck/claim_rb.html">rushcheck/claim</a>&nbsp;&nbsp;
86
87
  <a href="rushcheck/gen_rb.html">rushcheck/gen</a>&nbsp;&nbsp;
87
88
  <a href="rushcheck/guard_rb.html">rushcheck/guard</a>&nbsp;&nbsp;
88
89
  <a href="rushcheck/random_rb.html">rushcheck/random</a>&nbsp;&nbsp;
89
90
  <a href="rushcheck/testable_rb.html">rushcheck/testable</a>&nbsp;&nbsp;
91
+ <a href="rushcheck/version_rb.html">rushcheck/version</a>&nbsp;&nbsp;
90
92
  <a href="rushcheck/array_rb.html">rushcheck/array</a>&nbsp;&nbsp;
91
93
  <a href="rushcheck/bool_rb.html">rushcheck/bool</a>&nbsp;&nbsp;
92
94
  <a href="rushcheck/float_rb.html">rushcheck/float</a>&nbsp;&nbsp;
@@ -30,6 +30,7 @@
30
30
  <a href="classes/RushCheck.html">RushCheck</a><br />
31
31
  <a href="classes/RushCheck/Arbitrary.html">RushCheck::Arbitrary</a><br />
32
32
  <a href="classes/RushCheck/Assertion.html">RushCheck::Assertion</a><br />
33
+ <a href="classes/RushCheck/Claim.html">RushCheck::Claim</a><br />
33
34
  <a href="classes/RushCheck/Coarbitrary.html">RushCheck::Coarbitrary</a><br />
34
35
  <a href="classes/RushCheck/Config.html">RushCheck::Config</a><br />
35
36
  <a href="classes/RushCheck/Gen.html">RushCheck::Gen</a><br />
@@ -25,6 +25,7 @@
25
25
  <a href="files/rushcheck/array_rb.html">rushcheck/array.rb</a><br />
26
26
  <a href="files/rushcheck/assertion_rb.html">rushcheck/assertion.rb</a><br />
27
27
  <a href="files/rushcheck/bool_rb.html">rushcheck/bool.rb</a><br />
28
+ <a href="files/rushcheck/claim_rb.html">rushcheck/claim.rb</a><br />
28
29
  <a href="files/rushcheck/config_rb.html">rushcheck/config.rb</a><br />
29
30
  <a href="files/rushcheck/float_rb.html">rushcheck/float.rb</a><br />
30
31
  <a href="files/rushcheck/gen_rb.html">rushcheck/gen.rb</a><br />
@@ -39,6 +40,7 @@
39
40
  <a href="files/rushcheck/testable_rb.html">rushcheck/testable.rb</a><br />
40
41
  <a href="files/rushcheck/testoptions_rb.html">rushcheck/testoptions.rb</a><br />
41
42
  <a href="files/rushcheck/testresult_rb.html">rushcheck/testresult.rb</a><br />
43
+ <a href="files/rushcheck/version_rb.html">rushcheck/version.rb</a><br />
42
44
  </div>
43
45
  </div>
44
46
  </body>
@@ -74,41 +74,42 @@
74
74
  <a href="classes/RushCheck/Property.html#M000105">new (RushCheck::Property)</a><br />
75
75
  <a href="classes/RushCheck/Config.html#M000069">new (RushCheck::Config)</a><br />
76
76
  <a href="classes/RushCheck/Assertion.html#M000073">new (RushCheck::Assertion)</a><br />
77
+ <a href="classes/RushCheck/Result.html#M000096">new (RushCheck::Result)</a><br />
77
78
  <a href="classes/RushCheck/TheStdGen.html#M000101">new (RushCheck::TheStdGen)</a><br />
78
79
  <a href="classes/RushCheck/TestResult.html#M000100">new (RushCheck::TestResult)</a><br />
79
- <a href="classes/RushCheck/TestFailed.html#M000099">new (RushCheck::TestFailed)</a><br />
80
80
  <a href="classes/RushCheck/StdGen.html#M000061">new (RushCheck::StdGen)</a><br />
81
81
  <a href="classes/RushCheck/TestOptions.html#M000059">new (RushCheck::TestOptions)</a><br />
82
- <a href="classes/RushCheck/Result.html#M000096">new (RushCheck::Result)</a><br />
83
82
  <a href="classes/RushCheck/Gen.html#M000087">new (RushCheck::Gen)</a><br />
83
+ <a href="classes/RushCheck/TestFailed.html#M000099">new (RushCheck::TestFailed)</a><br />
84
84
  <a href="classes/RushCheck/Result.html#M000095">nothing (RushCheck::Result)</a><br />
85
85
  <a href="classes/RushCheck/Gen.html#M000081">oneof (RushCheck::Gen)</a><br />
86
86
  <a href="classes/RushCheck/Gen.html#M000082">promote (RushCheck::Gen)</a><br />
87
87
  <a href="classes/RushCheck/Testable.html#M000044">property (RushCheck::Testable)</a><br />
88
88
  <a href="classes/RushCheck/Result.html#M000098">property (RushCheck::Result)</a><br />
89
- <a href="classes/RandomProc.html#M000022">property (RandomProc)</a><br />
90
89
  <a href="classes/FalseClass.html#M000008">property (FalseClass)</a><br />
90
+ <a href="classes/RushCheck/Claim.html#M000107">property (RushCheck::Claim)</a><br />
91
91
  <a href="classes/RushCheck/Property.html#M000106">property (RushCheck::Property)</a><br />
92
+ <a href="classes/NilClass.html#M000025">property (NilClass)</a><br />
92
93
  <a href="classes/TrueClass.html#M000032">property (TrueClass)</a><br />
93
94
  <a href="classes/RushCheck/Assertion.html#M000074">property (RushCheck::Assertion)</a><br />
94
- <a href="classes/NilClass.html#M000025">property (NilClass)</a><br />
95
+ <a href="classes/RandomProc.html#M000022">property (RandomProc)</a><br />
95
96
  <a href="classes/RushCheck/Config.html#M000066">quick (RushCheck::Config)</a><br />
96
97
  <a href="classes/RushCheck/Testable.html#M000046">quick_check (RushCheck::Testable)</a><br />
97
98
  <a href="classes/RushCheck/Testable.html#M000047">quickcheck (RushCheck::Testable)</a><br />
98
99
  <a href="classes/RushCheck/Gen.html#M000083">rand (RushCheck::Gen)</a><br />
99
100
  <a href="classes/RushCheck/HsRandom.html#M000041">random (RushCheck::HsRandom)</a><br />
100
101
  <a href="classes/RushCheck/HsRandom.html#M000042">random_array (RushCheck::HsRandom)</a><br />
101
- <a href="classes/Float.html#M000017">random_range (Float)</a><br />
102
102
  <a href="classes/Integer.html#M000003">random_range (Integer)</a><br />
103
- <a href="classes/String.html#M000028">random_range (String)</a><br />
104
103
  <a href="classes/RushCheck/RandomBool.html#M000040">random_range (RushCheck::RandomBool)</a><br />
104
+ <a href="classes/String.html#M000028">random_range (String)</a><br />
105
+ <a href="classes/Float.html#M000017">random_range (Float)</a><br />
105
106
  <a href="classes/RushCheck/HsRandom.html#M000043">random_std (RushCheck::HsRandom)</a><br />
106
107
  <a href="classes/RushCheck/Gen.html#M000093">resize (RushCheck::Gen)</a><br />
107
108
  <a href="classes/RushCheck/Result.html#M000097">result (RushCheck::Result)</a><br />
108
109
  <a href="classes/RushCheck/Testable.html#M000052">run (RushCheck::Testable)</a><br />
109
110
  <a href="classes/RushCheck/Testable.html#M000053">run_tests (RushCheck::Testable)</a><br />
110
- <a href="classes/RandomProc.html#M000019">set_pattern (RandomProc)</a><br />
111
111
  <a href="classes/RandomArray.html#M000009">set_pattern (RandomArray)</a><br />
112
+ <a href="classes/RandomProc.html#M000019">set_pattern (RandomProc)</a><br />
112
113
  <a href="classes/RandomHash.html#M000012">set_pattern (RandomHash)</a><br />
113
114
  <a href="classes/RushCheck/Gen.html#M000084">sized (RushCheck::Gen)</a><br />
114
115
  <a href="classes/RushCheck/RandomGen.html#M000037">split (RushCheck::RandomGen)</a><br />
@@ -4,7 +4,21 @@
4
4
  # Arbitrary provides an instance method arbitrary.
5
5
  # Coarbitrary provides a class method coarbitrary.
6
6
  # However they are abstract methods and should be overrided
7
- # in each class after include/extend them.
7
+ # in each class after extend/include them.
8
+ #
9
+ # class YourClass
10
+ # extend RushCheck::Arbitrary
11
+ # include RushCheck::Coarbitrary
12
+ #
13
+ # def self.arbitrary
14
+ # # must be overrided
15
+ # end
16
+ #
17
+ # def coarbitrary
18
+ # # must be overrided also
19
+ # end
20
+ # end
21
+ #
8
22
 
9
23
  module RushCheck
10
24
 
@@ -17,8 +17,15 @@ module RushCheck
17
17
  # body
18
18
  # end
19
19
  #
20
+ # The return value of the body of testcase is checked by
21
+ # the method 'check'.
22
+ #
20
23
  # Note that the number of arguments in the block must be
21
24
  # equal to the number of arguments of Assertion.new.
25
+ # However, for a curried block, we can write also
26
+ # Assertion.new(*cs) {|*xs| ...}
27
+ #
28
+ # See also class Claim, which is a subclass of Assertion
22
29
  # See also the RushCheck tutorial and several examples.
23
30
  #
24
31
  class Assertion
@@ -26,12 +33,13 @@ module RushCheck
26
33
  include RushCheck::Testable
27
34
 
28
35
  def initialize(*xs, &f)
29
- raise ArgumentError unless f.arity == xs.length
30
36
  @inputs = xs[0..(f.arity - 1)]
31
37
  @proc = f
32
38
  end
33
39
 
34
- def property
40
+ def _property
41
+ # :nodoc:
42
+ # should be raise when the number of arguments are differ?
35
43
  g = RushCheck::Gen.new do |n, r|
36
44
  r2 = r
37
45
  if @inputs
@@ -45,10 +53,7 @@ module RushCheck
45
53
  end
46
54
  end.bind do |args|
47
55
  test = begin
48
- if @proc.call(*args)
49
- then RushCheck::Result.new(true)
50
- else RushCheck::Result.new(false)
51
- end
56
+ yield(args)
52
57
  rescue Exception => ex
53
58
  case ex
54
59
  when RushCheck::GuardException
@@ -69,6 +74,16 @@ module RushCheck
69
74
 
70
75
  RushCheck::Property.new(g)
71
76
  end
77
+ private :_property
78
+
79
+ def property
80
+ _property { |args|
81
+ if @proc.call(*args)
82
+ then RushCheck::Result.new(true)
83
+ else RushCheck::Result.new(false)
84
+ end
85
+ }
86
+ end
72
87
 
73
88
  end
74
89
 
@@ -0,0 +1,56 @@
1
+ #= claim.rb
2
+ # this file provides a class Claim for random testing.
3
+
4
+ require 'rushcheck/gen'
5
+ require 'rushcheck/guard'
6
+ require 'rushcheck/property'
7
+ require 'rushcheck/result'
8
+ require 'rushcheck/testable'
9
+
10
+ module RushCheck
11
+
12
+ # class Claim is one of main features of RushCheck.
13
+ # You can write a testcase for random testing as follows:
14
+ #
15
+ # Claim.new(Integer, String) do |x, y|
16
+ # RushCheck::guard { precondition }
17
+ # body
18
+ # end
19
+ #
20
+ # The notation of Claim.new is same as Assertion.new is,
21
+ # however the semantics are different. When checking the
22
+ # body of testcase, the returned value is ignored. In
23
+ # other words, the body is executed but not checked the
24
+ # result. However, if an exception is raised while executing
25
+ # the body, then checking is failed. This means that the
26
+ # above testing case can be written by Assertion.new
27
+ # as follows:
28
+ #
29
+ # # meaning of Claim.new is similar to Assertion.new
30
+ # Assertion.new(Integer, String) do |x, y|
31
+ # RushCheck::guard { precondition }
32
+ # body
33
+ # true
34
+ # end
35
+ #
36
+ # Claim maybe useful for combining unit testing library,
37
+ # because sometimes we want to execute several assertions
38
+ # of unit testing library such as assert_equal(x, y).
39
+ # The assertions of unit testing library does not return
40
+ # true or false, but return nil (just only testing).
41
+ #
42
+ # Claim is-an Assertion so its subclass. See also Assertion.
43
+
44
+ class Claim < Assertion
45
+
46
+ include RushCheck::Testable
47
+
48
+ def property
49
+ _property { |args|
50
+ @proc.call(*args)
51
+ RushCheck::Result.new(true)
52
+ }
53
+ end
54
+
55
+ end
56
+ end
data/lib/rushcheck/gen.rb CHANGED
@@ -25,7 +25,6 @@ module RushCheck
25
25
  # Then create_gen returns a Gen object. It may useful to implement
26
26
  # arbitrary method into your class.
27
27
  def self.create_by_gen(xs, &f)
28
- raise ArgumentError unless f.arity == xs.length
29
28
  self.new do |n, r|
30
29
  r2 = r
31
30
 
@@ -168,9 +167,8 @@ module RushCheck
168
167
  end
169
168
 
170
169
  # bind is a monadic function such as Haskel's (>>=).
171
- # bind takes a block which has two variables where the first one
172
- # is assumed as an integer, and the second one is assumed as a
173
- # random generator of RandomGen. The block should return a Gen object.
170
+ # bind takes a block which has a variable where is the return value
171
+ # of the Gen object. The block should return a Gen object.
174
172
  def bind
175
173
  self.class.new do |n, r|
176
174
  r1, r2 = r.split
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RushCheck
5
5
 
6
- VERSION = "0.5"
6
+ VERSION = "0.6"
7
7
 
8
8
  end
data/lib/rushcheck.rb CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'rushcheck/arbitrary'
6
6
  require 'rushcheck/assertion'
7
+ require 'rushcheck/claim'
7
8
  require 'rushcheck/gen'
8
9
  require 'rushcheck/guard'
9
10
  require 'rushcheck/random'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rushcheck
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.5"
7
- date: 2006-10-08 00:00:00.000000 +09:00
6
+ version: "0.6"
7
+ date: 2006-10-13 00:00:00.000000 +09:00
8
8
  summary: A lightweight random testing tool
9
9
  require_paths:
10
10
  - lib
@@ -36,6 +36,7 @@ files:
36
36
  - lib/rushcheck/array.rb
37
37
  - lib/rushcheck/assertion.rb
38
38
  - lib/rushcheck/bool.rb
39
+ - lib/rushcheck/claim.rb
39
40
  - lib/rushcheck/config.rb
40
41
  - lib/rushcheck/float.rb
41
42
  - lib/rushcheck/gen.rb
@@ -62,7 +63,10 @@ files:
62
63
  - data/rushcheck/examples/printf.rb
63
64
  - data/rushcheck/examples/proc.rb
64
65
  - data/rushcheck/examples/roguetile.rb
66
+ - data/rushcheck/examples/rspec
65
67
  - data/rushcheck/examples/sample.rb
68
+ - data/rushcheck/examples/rspec/stack.rb
69
+ - data/rushcheck/examples/rspec/stack_spec.rb
66
70
  - data/rushcheck/rdoc/classes
67
71
  - data/rushcheck/rdoc/created.rid
68
72
  - data/rushcheck/rdoc/files
@@ -279,6 +283,8 @@ files:
279
283
  - data/rushcheck/rdoc/classes/RushCheck/Arbitrary.src
280
284
  - data/rushcheck/rdoc/classes/RushCheck/Assertion.html
281
285
  - data/rushcheck/rdoc/classes/RushCheck/Assertion.src
286
+ - data/rushcheck/rdoc/classes/RushCheck/Claim.html
287
+ - data/rushcheck/rdoc/classes/RushCheck/Claim.src
282
288
  - data/rushcheck/rdoc/classes/RushCheck/Coarbitrary.html
283
289
  - data/rushcheck/rdoc/classes/RushCheck/Coarbitrary.src
284
290
  - data/rushcheck/rdoc/classes/RushCheck/Config.html
@@ -313,6 +319,7 @@ files:
313
319
  - data/rushcheck/rdoc/classes/RushCheck/Arbitrary.src/M000035.html
314
320
  - data/rushcheck/rdoc/classes/RushCheck/Assertion.src/M000073.html
315
321
  - data/rushcheck/rdoc/classes/RushCheck/Assertion.src/M000074.html
322
+ - data/rushcheck/rdoc/classes/RushCheck/Claim.src/M000107.html
316
323
  - data/rushcheck/rdoc/classes/RushCheck/Coarbitrary.src/M000058.html
317
324
  - data/rushcheck/rdoc/classes/RushCheck/Config.src/M000066.html
318
325
  - data/rushcheck/rdoc/classes/RushCheck/Config.src/M000067.html
@@ -458,6 +465,7 @@ files:
458
465
  - data/rushcheck/rdoc/files/rushcheck/array_rb.html
459
466
  - data/rushcheck/rdoc/files/rushcheck/assertion_rb.html
460
467
  - data/rushcheck/rdoc/files/rushcheck/bool_rb.html
468
+ - data/rushcheck/rdoc/files/rushcheck/claim_rb.html
461
469
  - data/rushcheck/rdoc/files/rushcheck/config_rb.html
462
470
  - data/rushcheck/rdoc/files/rushcheck/float_rb.html
463
471
  - data/rushcheck/rdoc/files/rushcheck/gen_rb.html
@@ -473,6 +481,7 @@ files:
473
481
  - data/rushcheck/rdoc/files/rushcheck/testable_rb.html
474
482
  - data/rushcheck/rdoc/files/rushcheck/testoptions_rb.html
475
483
  - data/rushcheck/rdoc/files/rushcheck/testresult_rb.html
484
+ - data/rushcheck/rdoc/files/rushcheck/version_rb.html
476
485
  - COPYING
477
486
  - INSTALL
478
487
  - LICENSE