queencheck 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/Gemfile +13 -10
- data/Guardfile +8 -2
- data/README.markdown +14 -15
- data/Rakefile +8 -0
- data/VERSION +1 -1
- data/lib/queencheck.rb +8 -1
- data/lib/queencheck/core.rb +1 -1
- data/lib/queencheck/string.rb +2 -2
- data/queencheck.gemspec +41 -32
- data/spec/queencheck/arbitrary_spec.rb +2 -1
- metadata +71 -38
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem "jeweler"
|
5
|
-
gem "rake"
|
6
|
-
gem "rspec", "2.8.0"
|
7
|
-
gem "
|
8
|
-
gem "growl", "1.0.3"
|
9
|
-
gem "spork", "0.9.0.rc9"
|
10
|
-
gem "
|
11
|
-
gem "
|
12
|
-
gem "guard-
|
13
|
-
gem "
|
4
|
+
gem "jeweler", ">= 1.8.3"
|
5
|
+
gem "rake", ">= 0.9.2.2"
|
6
|
+
gem "rspec", ">= 2.8.0"
|
7
|
+
gem "fuubar", ">= 0.0.6"
|
8
|
+
gem "growl", ">= 1.0.3"
|
9
|
+
gem "spork", ">= 0.9.0.rc9"
|
10
|
+
gem "rb-fsevent", ">= 0.9.0"
|
11
|
+
gem "guard-spork", ">= 0.5.1"
|
12
|
+
gem "guard-rspec", ">= 0.6.0"
|
13
|
+
gem "guard-bundler", ">= 0.1.3"
|
14
|
+
gem "guard-yard", ">= 1.0.2"
|
15
|
+
gem "yard", ">= 0.7.4"
|
16
|
+
gem "yard-tomdoc", ">= 0.3.0"
|
14
17
|
end
|
data/Guardfile
CHANGED
@@ -4,11 +4,17 @@ guard 'bundler' do
|
|
4
4
|
watch(/^.+\.gemspec/)
|
5
5
|
end
|
6
6
|
|
7
|
-
|
7
|
+
spork_port = RUBY_VERSION >= '1.9.2' ? 8989 : 8988
|
8
|
+
guard 'spork', :cucumber => false, :bundler => false, :rspec_port => spork_port do
|
8
9
|
end
|
9
10
|
|
10
|
-
guard 'rspec', :version => 2, :cli =>
|
11
|
+
guard 'rspec', :version => 2, :cli => "--drb --drb-port #{spork_port} --color --format Fuubar" do
|
11
12
|
watch(%r{^spec/.+_spec\.rb$})
|
12
13
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
14
|
watch('spec/spec_helper.rb') { "spec" }
|
14
15
|
end
|
16
|
+
|
17
|
+
guard 'yard', :plugin => 'yard-tomdoc' do
|
18
|
+
watch(%r{lib/.+\.rb})
|
19
|
+
end
|
20
|
+
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# QueenCheck [![Build Status](https://secure.travis-ci.org/rosylilly/QueenCheck.png)](http://travis-ci.org/rosylilly/QueenCheck)
|
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
2
|
|
3
3
|
QueenCheck is random test library.
|
4
4
|
|
@@ -6,20 +6,19 @@ Inspired by QuickCheck library in Haskell.
|
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
-
|
10
|
-
gem install queencheck
|
11
|
-
```
|
9
|
+
$ gem install queencheck
|
12
10
|
|
13
|
-
```ruby
|
14
|
-
require 'queencheck'
|
15
11
|
|
16
|
-
|
12
|
+
## Example
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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}"
|
data/Rakefile
CHANGED
@@ -18,3 +18,11 @@ begin
|
|
18
18
|
rescue LoadError
|
19
19
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
20
20
|
end
|
21
|
+
|
22
|
+
require 'yard'
|
23
|
+
require 'yard/rake/yardoc_task'
|
24
|
+
YARD::Rake::YardocTask.new do |t|
|
25
|
+
t.files = ['lib/**/*.rb']
|
26
|
+
t.options = ['--plugin=yard-tomdoc']
|
27
|
+
t.options << '--debug' << '--verbose' if $trace
|
28
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/queencheck.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
require "pathname"
|
2
|
+
$:.unshift Pathname.new(File.expand_path('../', __FILE__))
|
2
3
|
|
3
4
|
require 'queencheck/core'
|
4
5
|
require 'queencheck/arbitrary'
|
@@ -8,3 +9,9 @@ require 'queencheck/float'
|
|
8
9
|
require 'queencheck/boolean'
|
9
10
|
require 'queencheck/array'
|
10
11
|
require 'queencheck/string'
|
12
|
+
|
13
|
+
module QueenCheck
|
14
|
+
unless defined? Version
|
15
|
+
Version = `cat #{Pathname.new(File.expand_path('../../', __FILE__))}/VERSION`.strip
|
16
|
+
end
|
17
|
+
end
|
data/lib/queencheck/core.rb
CHANGED
@@ -12,7 +12,7 @@ module QueenCheck
|
|
12
12
|
@types = types.map do | type |
|
13
13
|
if type.respond_to?(:arbitrary?) && type.arbitrary?
|
14
14
|
next type
|
15
|
-
elsif
|
15
|
+
elsif type.kind_of?(Symbol)
|
16
16
|
type = QueenCheck::Arbitrary::Instance.get_by_id(type)
|
17
17
|
next type if type
|
18
18
|
end
|
data/lib/queencheck/string.rb
CHANGED
@@ -3,7 +3,7 @@ require 'queencheck/arbitrary'
|
|
3
3
|
class String
|
4
4
|
extend QueenCheck::Arbitrary
|
5
5
|
|
6
|
-
@@max_length =
|
6
|
+
@@max_length = 256
|
7
7
|
|
8
8
|
set_arbitrary do | seed |
|
9
9
|
max = (@@max_length * (seed * seed)).ceil
|
@@ -38,7 +38,7 @@ class String
|
|
38
38
|
end
|
39
39
|
|
40
40
|
ret = []
|
41
|
-
(rand(max/2) + (max/2)).times do
|
41
|
+
(rand(max/2) + (max/2)).ceil.times do
|
42
42
|
ret << charset.sample
|
43
43
|
end
|
44
44
|
|
data/queencheck.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "queencheck"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sho Kusano"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-02-02"
|
13
13
|
s.description = "QueenCheck is random test library. Inspired by QuickCheck library in Haskell."
|
14
14
|
s.email = "rosylilly@aduca.org"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -51,39 +51,48 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.specification_version = 3
|
52
52
|
|
53
53
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
-
s.add_development_dependency(%q<jeweler>, [">=
|
55
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
56
|
-
s.add_development_dependency(%q<rspec>, ["
|
57
|
-
s.add_development_dependency(%q<
|
58
|
-
s.add_development_dependency(%q<growl>, ["
|
59
|
-
s.add_development_dependency(%q<spork>, ["
|
60
|
-
s.add_development_dependency(%q<
|
61
|
-
s.add_development_dependency(%q<
|
62
|
-
s.add_development_dependency(%q<guard-
|
63
|
-
s.add_development_dependency(%q<
|
54
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.3"])
|
55
|
+
s.add_development_dependency(%q<rake>, [">= 0.9.2.2"])
|
56
|
+
s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
|
57
|
+
s.add_development_dependency(%q<fuubar>, [">= 0.0.6"])
|
58
|
+
s.add_development_dependency(%q<growl>, [">= 1.0.3"])
|
59
|
+
s.add_development_dependency(%q<spork>, [">= 0.9.0.rc9"])
|
60
|
+
s.add_development_dependency(%q<rb-fsevent>, [">= 0.9.0"])
|
61
|
+
s.add_development_dependency(%q<guard-spork>, [">= 0.5.1"])
|
62
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0.6.0"])
|
63
|
+
s.add_development_dependency(%q<guard-bundler>, [">= 0.1.3"])
|
64
|
+
s.add_development_dependency(%q<guard-yard>, [">= 1.0.2"])
|
65
|
+
s.add_development_dependency(%q<yard>, [">= 0.7.4"])
|
66
|
+
s.add_development_dependency(%q<yard-tomdoc>, [">= 0.3.0"])
|
64
67
|
else
|
65
|
-
s.add_dependency(%q<jeweler>, [">=
|
66
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
67
|
-
s.add_dependency(%q<rspec>, ["
|
68
|
-
s.add_dependency(%q<
|
69
|
-
s.add_dependency(%q<growl>, ["
|
70
|
-
s.add_dependency(%q<spork>, ["
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
73
|
-
s.add_dependency(%q<guard-
|
74
|
-
s.add_dependency(%q<
|
68
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
69
|
+
s.add_dependency(%q<rake>, [">= 0.9.2.2"])
|
70
|
+
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
71
|
+
s.add_dependency(%q<fuubar>, [">= 0.0.6"])
|
72
|
+
s.add_dependency(%q<growl>, [">= 1.0.3"])
|
73
|
+
s.add_dependency(%q<spork>, [">= 0.9.0.rc9"])
|
74
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0.9.0"])
|
75
|
+
s.add_dependency(%q<guard-spork>, [">= 0.5.1"])
|
76
|
+
s.add_dependency(%q<guard-rspec>, [">= 0.6.0"])
|
77
|
+
s.add_dependency(%q<guard-bundler>, [">= 0.1.3"])
|
78
|
+
s.add_dependency(%q<guard-yard>, [">= 1.0.2"])
|
79
|
+
s.add_dependency(%q<yard>, [">= 0.7.4"])
|
80
|
+
s.add_dependency(%q<yard-tomdoc>, [">= 0.3.0"])
|
75
81
|
end
|
76
82
|
else
|
77
|
-
s.add_dependency(%q<jeweler>, [">=
|
78
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
79
|
-
s.add_dependency(%q<rspec>, ["
|
80
|
-
s.add_dependency(%q<
|
81
|
-
s.add_dependency(%q<growl>, ["
|
82
|
-
s.add_dependency(%q<spork>, ["
|
83
|
-
s.add_dependency(%q<
|
84
|
-
s.add_dependency(%q<
|
85
|
-
s.add_dependency(%q<guard-
|
86
|
-
s.add_dependency(%q<
|
83
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
84
|
+
s.add_dependency(%q<rake>, [">= 0.9.2.2"])
|
85
|
+
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
86
|
+
s.add_dependency(%q<fuubar>, [">= 0.0.6"])
|
87
|
+
s.add_dependency(%q<growl>, [">= 1.0.3"])
|
88
|
+
s.add_dependency(%q<spork>, [">= 0.9.0.rc9"])
|
89
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0.9.0"])
|
90
|
+
s.add_dependency(%q<guard-spork>, [">= 0.5.1"])
|
91
|
+
s.add_dependency(%q<guard-rspec>, [">= 0.6.0"])
|
92
|
+
s.add_dependency(%q<guard-bundler>, [">= 0.1.3"])
|
93
|
+
s.add_dependency(%q<guard-yard>, [">= 1.0.2"])
|
94
|
+
s.add_dependency(%q<yard>, [">= 0.7.4"])
|
95
|
+
s.add_dependency(%q<yard-tomdoc>, [">= 0.3.0"])
|
87
96
|
end
|
88
97
|
end
|
89
98
|
|
@@ -32,9 +32,10 @@ describe QueenCheck::Arbitrary do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'named search' do
|
35
|
-
arb = QueenCheck::Arbitrary(:sample) {}
|
35
|
+
arb = QueenCheck::Arbitrary(:sample) { (1..10).to_a[rand(10)] }
|
36
36
|
|
37
37
|
QueenCheck::Arbitrary(:sample).should eq(arb)
|
38
|
+
QueenCheck(Kernel, :p, :sample).should_not be_nil
|
38
39
|
end
|
39
40
|
end
|
40
41
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,118 +9,151 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jeweler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70352749528960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.8.3
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70352749528960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70352749562760 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 0.9.2.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70352749562760
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70352749562220 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70352749562220
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
48
|
+
name: fuubar
|
49
|
+
requirement: &70352749561680 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.6
|
54
|
+
version: 0.0.6
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70352749561680
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: growl
|
60
|
-
requirement: &
|
60
|
+
requirement: &70352749561200 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: 1.0.3
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70352749561200
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: spork
|
71
|
-
requirement: &
|
71
|
+
requirement: &70352749560720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ! '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 0.9.0.rc9
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70352749560720
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rb-fsevent
|
82
|
+
requirement: &70352749560240 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.9.0
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70352749560240
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
92
|
name: guard-spork
|
82
|
-
requirement: &
|
93
|
+
requirement: &70352749559740 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
|
-
- -
|
96
|
+
- - ! '>='
|
86
97
|
- !ruby/object:Gem::Version
|
87
98
|
version: 0.5.1
|
88
99
|
type: :development
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *70352749559740
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
|
-
name:
|
93
|
-
requirement: &
|
103
|
+
name: guard-rspec
|
104
|
+
requirement: &70352749559220 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
|
-
- -
|
107
|
+
- - ! '>='
|
97
108
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
109
|
+
version: 0.6.0
|
99
110
|
type: :development
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70352749559220
|
102
113
|
- !ruby/object:Gem::Dependency
|
103
114
|
name: guard-bundler
|
104
|
-
requirement: &
|
115
|
+
requirement: &70352749558740 !ruby/object:Gem::Requirement
|
105
116
|
none: false
|
106
117
|
requirements:
|
107
118
|
- - ! '>='
|
108
119
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
120
|
+
version: 0.1.3
|
110
121
|
type: :development
|
111
122
|
prerelease: false
|
112
|
-
version_requirements: *
|
123
|
+
version_requirements: *70352749558740
|
113
124
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
115
|
-
requirement: &
|
125
|
+
name: guard-yard
|
126
|
+
requirement: &70352749558260 !ruby/object:Gem::Requirement
|
116
127
|
none: false
|
117
128
|
requirements:
|
118
|
-
- -
|
129
|
+
- - ! '>='
|
119
130
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
131
|
+
version: 1.0.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70352749558260
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: yard
|
137
|
+
requirement: &70352749557760 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 0.7.4
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *70352749557760
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: yard-tomdoc
|
148
|
+
requirement: &70352749557260 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 0.3.0
|
121
154
|
type: :development
|
122
155
|
prerelease: false
|
123
|
-
version_requirements: *
|
156
|
+
version_requirements: *70352749557260
|
124
157
|
description: QueenCheck is random test library. Inspired by QuickCheck library in
|
125
158
|
Haskell.
|
126
159
|
email: rosylilly@aduca.org
|