queencheck 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,19 @@
1
1
  require 'queencheck/rspec'
2
2
 
3
- describe 'QueenCheck::RSpec' do
4
- qcheck 1, :+, [Integer], {count: 5} do | result, arguments, exception |
5
- result.should == arguments[0] + 1
6
- end
3
+ describe QueenCheck do
4
+ QueenCheck('stadard check', String) { | x |
5
+ x.class.should == String
6
+ }
7
+
8
+ verboseQueenCheck('verbose check', QueenCheck::ASCIIChar) { | x |
9
+ x.size.should == 1
10
+ }
7
11
 
8
- qcheck 1, :/, [Integer], {count: 5} do | result, arguments, exception |
9
- if exception
10
- if exception.kind_of?(ZeroDivisionError)
11
- arguments[0].should == 0
12
- else
13
- raise exception
14
- end
15
- else
16
- result.should == 1 / arguments[0]
17
- end
12
+ labelingQueenCheck('labelig check', {
13
+ "x > y" => proc{|x,y| x > y },
14
+ "x < y" => proc{|x,y| x < y },
15
+ "x = y" => proc{|x,y| x == y },
16
+ },Integer, Integer) do | x, y |
17
+ (x + y).should == y + x
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queencheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-06 00:00:00.000000000 Z
12
+ date: 2012-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: colorize
16
+ requirement: &70160982288100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.5.8
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70160982288100
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: rake
16
- requirement: &70236171344200 !ruby/object:Gem::Requirement
27
+ requirement: &70160982287160 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ! '>='
@@ -21,10 +32,10 @@ dependencies:
21
32
  version: 0.9.2.2
22
33
  type: :development
23
34
  prerelease: false
24
- version_requirements: *70236171344200
35
+ version_requirements: *70160982287160
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- requirement: &70236171387000 !ruby/object:Gem::Requirement
38
+ requirement: &70160982286680 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: 2.8.0
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *70236171387000
46
+ version_requirements: *70160982286680
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: fuubar
38
- requirement: &70236171386500 !ruby/object:Gem::Requirement
49
+ requirement: &70160982286200 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: 0.0.6
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70236171386500
57
+ version_requirements: *70160982286200
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: jeweler
49
- requirement: &70236171386020 !ruby/object:Gem::Requirement
60
+ requirement: &70160982285720 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: 1.8.3
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70236171386020
68
+ version_requirements: *70160982285720
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: growl
60
- requirement: &70236171385400 !ruby/object:Gem::Requirement
71
+ requirement: &70160982285240 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: 1.0.3
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70236171385400
79
+ version_requirements: *70160982285240
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: spork
71
- requirement: &70236171384920 !ruby/object:Gem::Requirement
82
+ requirement: &70160982284760 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 0.9.0.rc9
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70236171384920
90
+ version_requirements: *70160982284760
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: rb-fsevent
82
- requirement: &70236171384440 !ruby/object:Gem::Requirement
93
+ requirement: &70160982284280 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 0.9.0
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70236171384440
101
+ version_requirements: *70160982284280
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: guard-spork
93
- requirement: &70236171383960 !ruby/object:Gem::Requirement
104
+ requirement: &70160982283720 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: 0.5.1
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *70236171383960
112
+ version_requirements: *70160982283720
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: guard-rspec
104
- requirement: &70236171383480 !ruby/object:Gem::Requirement
115
+ requirement: &70160982283200 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: 0.6.0
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *70236171383480
123
+ version_requirements: *70160982283200
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: guard-bundler
115
- requirement: &70236171383000 !ruby/object:Gem::Requirement
126
+ requirement: &70160982282720 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ! '>='
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: 0.1.3
121
132
  type: :development
122
133
  prerelease: false
123
- version_requirements: *70236171383000
134
+ version_requirements: *70160982282720
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: guard-yard
126
- requirement: &70236171382200 !ruby/object:Gem::Requirement
137
+ requirement: &70160982282240 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ! '>='
@@ -131,10 +142,10 @@ dependencies:
131
142
  version: 1.0.2
132
143
  type: :development
133
144
  prerelease: false
134
- version_requirements: *70236171382200
145
+ version_requirements: *70160982282240
135
146
  - !ruby/object:Gem::Dependency
136
147
  name: yard
137
- requirement: &70236171381420 !ruby/object:Gem::Requirement
148
+ requirement: &70160982425520 !ruby/object:Gem::Requirement
138
149
  none: false
139
150
  requirements:
140
151
  - - ! '>='
@@ -142,10 +153,10 @@ dependencies:
142
153
  version: 0.7.4
143
154
  type: :development
144
155
  prerelease: false
145
- version_requirements: *70236171381420
156
+ version_requirements: *70160982425520
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: yard-tomdoc
148
- requirement: &70236171380700 !ruby/object:Gem::Requirement
159
+ requirement: &70160982424980 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ! '>='
@@ -153,42 +164,62 @@ dependencies:
153
164
  version: 0.3.0
154
165
  type: :development
155
166
  prerelease: false
156
- version_requirements: *70236171380700
167
+ version_requirements: *70160982424980
168
+ - !ruby/object:Gem::Dependency
169
+ name: redcarpet
170
+ requirement: &70160982424500 !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: *70160982424500
179
+ - !ruby/object:Gem::Dependency
180
+ name: pry
181
+ requirement: &70160982424020 !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: *70160982424020
157
190
  description: QueenCheck is random test library. Inspired by QuickCheck library in
158
191
  Haskell.
159
192
  email: rosylilly@aduca.org
160
193
  executables: []
161
194
  extensions: []
162
195
  extra_rdoc_files:
163
- - README.markdown
196
+ - README.md
164
197
  files:
165
198
  - .rspec
166
199
  - .rvmrc
167
200
  - .travis.yml
168
201
  - Gemfile
169
202
  - Guardfile
170
- - README.markdown
203
+ - README.md
171
204
  - Rakefile
172
205
  - VERSION
173
206
  - lib/queencheck.rb
207
+ - lib/queencheck/arbitraries/all.rb
208
+ - lib/queencheck/arbitraries/boolean.rb
209
+ - lib/queencheck/arbitraries/integer.rb
210
+ - lib/queencheck/arbitraries/string.rb
174
211
  - lib/queencheck/arbitrary.rb
175
- - lib/queencheck/array.rb
176
- - lib/queencheck/boolean.rb
177
- - lib/queencheck/config.rb
212
+ - lib/queencheck/condition.rb
178
213
  - lib/queencheck/core.rb
179
- - lib/queencheck/elements_of.rb
180
- - lib/queencheck/float.rb
181
- - lib/queencheck/integer.rb
214
+ - lib/queencheck/exception.rb
215
+ - lib/queencheck/gen.rb
216
+ - lib/queencheck/result.rb
182
217
  - lib/queencheck/rspec.rb
183
- - lib/queencheck/rspec/dsl.rb
184
- - lib/queencheck/string.rb
185
218
  - queencheck.gemspec
186
219
  - spec/queencheck/arbitrary_spec.rb
187
220
  - spec/queencheck/core_spec.rb
188
- - spec/queencheck/elements_of_spec.rb
189
- - spec/queencheck/integer_spec.rb
221
+ - spec/queencheck/gen_spec.rb
190
222
  - spec/queencheck/rspec_spec.rb
191
- - spec/queencheck/string_spec.rb
192
223
  - spec/spec_helper.rb
193
224
  homepage: https://github.com/rosylilly/QueenCheck
194
225
  licenses: []
@@ -202,6 +233,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
233
  - - ! '>='
203
234
  - !ruby/object:Gem::Version
204
235
  version: '0'
236
+ segments:
237
+ - 0
238
+ hash: 2669412712847825288
205
239
  required_rubygems_version: !ruby/object:Gem::Requirement
206
240
  none: false
207
241
  requirements:
@@ -210,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
244
  version: '0'
211
245
  requirements: []
212
246
  rubyforge_project:
213
- rubygems_version: 1.8.10
247
+ rubygems_version: 1.8.11
214
248
  signing_key:
215
249
  specification_version: 3
216
250
  summary: like haskell's QuickCheck
@@ -1,24 +0,0 @@
1
- # QueenCheck [![Build Status](https://secure.travis-ci.org/rosylilly/QueenCheck.png)](http://travis-ci.org/rosylilly/QueenCheck) [![Gem Status](https://gemnasium.com/rosylilly/QueenCheck.png)](https://gemnasium.com/rosylilly/QueenCheck)
2
-
3
- QueenCheck is random test library.
4
-
5
- Inspired by QuickCheck library in Haskell.
6
-
7
- ## Usage
8
-
9
- $ gem install queencheck
10
-
11
-
12
- ## Example
13
-
14
- require 'queencheck'
15
-
16
- number = 100
17
-
18
- check = QueenCheck(number, :+, Integer)
19
-
20
- res = check.run(verbose: true) do | result, arguments, error |
21
- result == number + arguments[0]
22
- end
23
-
24
- puts "#{res.passes} / #{res.examples}"
@@ -1,33 +0,0 @@
1
- require 'queencheck/arbitrary'
2
-
3
- class Array
4
- extend QueenCheck::Arbitrary
5
-
6
- @@bound = 10
7
-
8
- set_arbitrary do |seed|
9
- if seed == 0
10
- return []
11
- else
12
- base = ((@@bound * seed).ceil)
13
-
14
- ary = Array.new(rand(base) + 1)
15
-
16
- if seed > 0.3
17
- ary.map!{|ar| Array.new(rand(base) + 1) }
18
- end
19
-
20
- if seed > 0.5
21
- ary.map!{|ar| ar.map!{|a| Array.new(rand(base) + 1) } }
22
- end
23
-
24
- if seed > 0.8
25
- ary.map!{|ar| ar.map!{|a| a.map!{|item| Array.new(rand(base) + 1) } } }
26
- end
27
-
28
- return ary
29
- end
30
- end
31
- end
32
-
33
-
@@ -1,9 +0,0 @@
1
- require 'queencheck/arbitrary'
2
-
3
- class Boolean
4
- extend QueenCheck::Arbitrary
5
-
6
- set_arbitrary do | seed |
7
- rand(2).zero? ? true : false
8
- end
9
- end
@@ -1,16 +0,0 @@
1
-
2
- module QueenCheck
3
- class Config
4
- attr_reader :count, :log
5
-
6
- def initialize(options = nil)
7
- options ||= {}
8
-
9
- @count = options[:count] || 100 # デフォルトの試行回数は 100 回
10
- @verbose = options[:verbose] || false
11
- @log = options[:log] || STDOUT
12
- end
13
-
14
- def verbose?; @verbose; end
15
- end
16
- end
@@ -1,44 +0,0 @@
1
-
2
- module QueenCheck
3
- class << self
4
- def ElementsOf(name, elements = nil)
5
- if elements.nil? && !name.kind_of?(Array)
6
- return QueenCheck::ElementsOf.get_by_id(name)
7
- else
8
- return QueenCheck::ElementsOf.new(name, elements)
9
- end
10
- end
11
- end
12
-
13
- class ElementsOf
14
- @@instances = {}
15
-
16
- def self.get_by_id(id)
17
- return @@instances[id.to_s.to_sym]
18
- end
19
-
20
- attr_reader :elements, :name
21
-
22
- def arbitrary?; true; end
23
-
24
- def arbitrary(seed)
25
- @elements[rand(@elements.length)]
26
- end
27
-
28
- def initialize(name, elements = nil)
29
- if elements.nil? && name.kind_of?(Array)
30
- elements = name
31
- name = nil
32
- end
33
-
34
- raise ArgumentError, 'elements length require over 1' if !elements.respond_to?(:length) || elements.length < 0
35
- @elements = elements
36
-
37
- if name
38
- @name = name.to_s.to_sym
39
- @@instances[@name] = self
40
- QueenCheck::Arbitrary::Instance.collection["elements_of_#{@name}".to_sym] = self
41
- end
42
- end
43
- end
44
- end
@@ -1,23 +0,0 @@
1
- require 'queencheck/arbitrary'
2
-
3
- class Float
4
- extend QueenCheck::Arbitrary
5
-
6
- @@bound = 25
7
-
8
- set_arbitrary do |seed|
9
- if seed == 0
10
- 0.0
11
- else
12
- if seed > 0.9 && rand(3) > 0
13
- return rand(2).zero? ? 0.0/0.0 : rand(2).zero? ? 1.0/0 : -1.0/0
14
- end
15
- base = ((@@bound * seed).ceil).to_f
16
- max = 10.0 ** base
17
- num = rand(max)
18
- nod = num.to_s.length
19
- num.to_f / (10 ** ((rand(nod / 2) + nod / 2) / 2)) * (rand(2).zero? ? 1.0 : -1.0)
20
- end
21
- end
22
- end
23
-