rubycheck 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubycheck.rb +5 -5
  3. metadata +5 -20
  4. data/example.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4f40a17b352914e3fe3a4b207ddf58918169851
4
- data.tar.gz: cc0c396f970798c6d49bddf94bc230b8f23e17d6
3
+ metadata.gz: 6ec34c44e9e6e6669faf9449371fc755ae41dfe5
4
+ data.tar.gz: 097e524dd00f3a74bfbf6d7350444248016501de
5
5
  SHA512:
6
- metadata.gz: 40466f085d6c7be387de6e0917da7d2a91db909915ba5117456504ffaf40b93c81f9f2b4ff13e671647e975053c471ea48711e19a7d545fa2e265aa4d7fdc1f7
7
- data.tar.gz: 3bab24d7c007df4fe463499b06e204a9599122efc3625888cef56ba4b60f8862661ad9f56869e4d62f2c858963fc67d02d91c1fcacd72d486a51aa2dbc7dfa66
6
+ metadata.gz: 076a81daaadc87ed6ec296624a6980faaed7b3ae058cdd358069aa8c5cebd6a91e38ab7e4d099c789c60495a71145530d1772754e4fc5f2fb7800e6c0232e664
7
+ data.tar.gz: 93aedb403da62509d6c8925705b6c174d0fe4c43edbe1c1c5b66256717a11a97584db415745fdb7ad47b367189f4998707a9f76c3786f6d0b50c8f90a21de855
data/lib/rubycheck.rb CHANGED
@@ -53,8 +53,10 @@ module RubyCheck
53
53
  end
54
54
  end
55
55
 
56
- # Evaluates property over 100 random unit tests,
57
- # with argument values specified in generators.
56
+ #
57
+ # Evaluates property over 100 random unit tests, with argument values specified in generators.
58
+ # Returns true, or the failing test case.
59
+ #
58
60
 
59
61
  Contract Proc, ArrayOf[Proc] => Bool
60
62
  def self.for_all(property, gen_syms)
@@ -63,10 +65,8 @@ module RubyCheck
63
65
  fail PropertyFailure.new(test_case), 'test case error' unless property.call(*test_case)
64
66
  end
65
67
  rescue PropertyFailure => e
66
- puts "*** Failed!\n#{e.test_case}"
67
- false
68
+ e.test_case
68
69
  else
69
- puts "+++ OK, passed #{TRIALS} tests."
70
70
  true
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Pennebaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-14 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - '>='
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: '0.6'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - '>='
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: '0.6'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rspec
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -206,20 +206,6 @@ dependencies:
206
206
  - - '>='
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: cucumber
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - '>='
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - '>='
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
209
  description: See example.rb for API usage.
224
210
  email: andrew.pennebaker@gmail.com
225
211
  executables: []
@@ -227,7 +213,6 @@ extensions: []
227
213
  extra_rdoc_files: []
228
214
  files:
229
215
  - lib/rubycheck.rb
230
- - example.rb
231
216
  homepage: http://www.yellosoft.us/quickcheck
232
217
  licenses: []
233
218
  metadata: {}
@@ -247,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
232
  version: '0'
248
233
  requirements: []
249
234
  rubyforge_project:
250
- rubygems_version: 2.0.6
235
+ rubygems_version: 2.1.10
251
236
  signing_key:
252
237
  specification_version: 4
253
238
  summary: a Ruby port of the QuickCheck unit test framework
data/example.rb DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubycheck'
4
-
5
- # Define gen_even
6
- module RubyCheck
7
- def self.gen_even
8
- i = gen_int
9
-
10
- if i.even?
11
- i
12
- else
13
- i + 1
14
- end
15
- end
16
- end
17
-
18
- prop_even = -> n { n.even? }
19
-
20
- # Should fail.
21
- RubyCheck.for_all(prop_even, [:gen_int])
22
-
23
- # Should pass.
24
- RubyCheck.for_all(prop_even, [:gen_even])
25
-
26
- # Define gen_palindrome
27
- module RubyCheck
28
- def self.gen_palindrome
29
- s = gen_str
30
- s + s.reverse
31
- end
32
- end
33
-
34
- prop_palindrome = -> s { s == s.reverse }
35
-
36
- # Should fail.
37
- RubyCheck.for_all(prop_palindrome, [:gen_str])
38
-
39
- # Should pass.
40
- RubyCheck.for_all(prop_palindrome, [:gen_palindrome])