queencheck 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Guardfile +7 -2
- data/README.markdown +7 -3
- data/VERSION +1 -1
- data/lib/queencheck/core.rb +5 -5
- data/lib/queencheck/string.rb +7 -1
- data/queencheck.gemspec +6 -2
- data/spec/queencheck/core_spec.rb +2 -2
- data/spec/queencheck/integer_spec.rb +6 -0
- data/spec/queencheck/string_spec.rb +13 -0
- data/spec/spec_helper.rb +1 -3
- metadata +32 -20
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
guard 'bundler' do
|
2
|
+
watch('Gemfile')
|
3
|
+
# Uncomment next line if Gemfile contain `gemspec' command
|
4
|
+
watch(/^.+\.gemspec/)
|
5
|
+
end
|
6
|
+
|
1
7
|
guard 'spork', :cucumber => false, :bundler => false do
|
2
8
|
end
|
3
9
|
|
4
|
-
guard 'rspec', version
|
10
|
+
guard 'rspec', :version => 2, :cli => '--drb --color --format Fuubar' do
|
5
11
|
watch(%r{^spec/.+_spec\.rb$})
|
6
12
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
13
|
watch('spec/spec_helper.rb') { "spec" }
|
8
14
|
end
|
9
|
-
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# QueenCheck
|
1
|
+
# QueenCheck [![Build Status](https://secure.travis-ci.org/rosylilly/QueenCheck.png)](http://travis-ci.org/rosylilly/QueenCheck)
|
2
2
|
|
3
3
|
QueenCheck is random test library.
|
4
4
|
|
@@ -6,6 +6,10 @@ Inspired by QuickCheck library in Haskell.
|
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
+
```shell
|
10
|
+
gem install queencheck
|
11
|
+
```
|
12
|
+
|
9
13
|
```ruby
|
10
14
|
require 'queencheck'
|
11
15
|
|
@@ -14,8 +18,8 @@ number = 100
|
|
14
18
|
check = QueenCheck.new(number, :+, Integer)
|
15
19
|
|
16
20
|
res = check.run(verbose: true) do | result, arguments, error |
|
17
|
-
|
21
|
+
result == number + arguments[0]
|
18
22
|
end
|
19
23
|
|
20
|
-
puts "#{res
|
24
|
+
puts "#{res.passes} / #{res.examples}"
|
21
25
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/queencheck/core.rb
CHANGED
@@ -62,7 +62,7 @@ module QueenCheck
|
|
62
62
|
unless is_exception
|
63
63
|
case test_result
|
64
64
|
when true
|
65
|
-
stats.
|
65
|
+
stats.passes += 1
|
66
66
|
when false
|
67
67
|
stats.failures += 1
|
68
68
|
end
|
@@ -77,15 +77,15 @@ module QueenCheck
|
|
77
77
|
class Result
|
78
78
|
def initialize(examples)
|
79
79
|
@examples = examples
|
80
|
-
@
|
80
|
+
@passes = 0
|
81
81
|
@failures = 0
|
82
82
|
@exceptions = []
|
83
83
|
end
|
84
|
-
attr_reader :examples, :
|
84
|
+
attr_reader :examples, :passes, :failures
|
85
85
|
|
86
|
-
def
|
86
|
+
def passes=(n)
|
87
87
|
raise RangeError if n > @examples
|
88
|
-
@
|
88
|
+
@passes = n
|
89
89
|
end
|
90
90
|
|
91
91
|
def failures=(n)
|
data/lib/queencheck/string.rb
CHANGED
@@ -31,9 +31,15 @@ class String
|
|
31
31
|
charset += (0x1000 ... 0x20000).to_a
|
32
32
|
end
|
33
33
|
|
34
|
+
if !charset.respond_to?(:sample)
|
35
|
+
class << charset
|
36
|
+
def sample; self[rand(self.length)]; end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
34
40
|
ret = []
|
35
41
|
(rand(max/2) + (max/2)).times do
|
36
|
-
ret << charset
|
42
|
+
ret << charset.sample
|
37
43
|
end
|
38
44
|
|
39
45
|
return ret.pack('U*')
|
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.1"
|
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-01-
|
12
|
+
s.date = "2012-01-23"
|
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 = [
|
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
"spec/queencheck/core_spec.rb",
|
40
40
|
"spec/queencheck/elements_of_spec.rb",
|
41
41
|
"spec/queencheck/integer_spec.rb",
|
42
|
+
"spec/queencheck/string_spec.rb",
|
42
43
|
"spec/spec_helper.rb"
|
43
44
|
]
|
44
45
|
s.homepage = "https://github.com/rosylilly/QueenCheck"
|
@@ -58,6 +59,7 @@ Gem::Specification.new do |s|
|
|
58
59
|
s.add_development_dependency(%q<spork>, ["= 0.9.0.rc9"])
|
59
60
|
s.add_development_dependency(%q<guard-spork>, ["= 0.5.1"])
|
60
61
|
s.add_development_dependency(%q<rb-fsevent>, ["= 0.4.3.1"])
|
62
|
+
s.add_development_dependency(%q<guard-bundler>, [">= 0"])
|
61
63
|
s.add_development_dependency(%q<fuubar>, ["~> 0.0.6"])
|
62
64
|
else
|
63
65
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
@@ -68,6 +70,7 @@ Gem::Specification.new do |s|
|
|
68
70
|
s.add_dependency(%q<spork>, ["= 0.9.0.rc9"])
|
69
71
|
s.add_dependency(%q<guard-spork>, ["= 0.5.1"])
|
70
72
|
s.add_dependency(%q<rb-fsevent>, ["= 0.4.3.1"])
|
73
|
+
s.add_dependency(%q<guard-bundler>, [">= 0"])
|
71
74
|
s.add_dependency(%q<fuubar>, ["~> 0.0.6"])
|
72
75
|
end
|
73
76
|
else
|
@@ -79,6 +82,7 @@ Gem::Specification.new do |s|
|
|
79
82
|
s.add_dependency(%q<spork>, ["= 0.9.0.rc9"])
|
80
83
|
s.add_dependency(%q<guard-spork>, ["= 0.5.1"])
|
81
84
|
s.add_dependency(%q<rb-fsevent>, ["= 0.4.3.1"])
|
85
|
+
s.add_dependency(%q<guard-bundler>, [">= 0"])
|
82
86
|
s.add_dependency(%q<fuubar>, ["~> 0.0.6"])
|
83
87
|
end
|
84
88
|
end
|
@@ -11,7 +11,7 @@ describe QueenCheck do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
ret.examples.should eq(100)
|
14
|
-
ret.
|
14
|
+
ret.passes.should eq(100)
|
15
15
|
ret.failures.should eq(0)
|
16
16
|
end
|
17
17
|
|
@@ -27,7 +27,7 @@ describe QueenCheck do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
ret.examples.should eq(100)
|
30
|
-
ret.
|
30
|
+
ret.passes.should eq(100)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/spec/spec_helper.rb
CHANGED
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.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jeweler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70136368109140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70136368109140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70136368108440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70136368108440
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70136368088520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70136368088520
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard-rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70136368085600 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - =
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.6.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70136368085600
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: growl
|
60
|
-
requirement: &
|
60
|
+
requirement: &70136368084400 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - =
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.3
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70136368084400
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: spork
|
71
|
-
requirement: &
|
71
|
+
requirement: &70136368082340 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - =
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.9.0.rc9
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70136368082340
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-spork
|
82
|
-
requirement: &
|
82
|
+
requirement: &70136368105040 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - =
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.5.1
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70136368105040
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rb-fsevent
|
93
|
-
requirement: &
|
93
|
+
requirement: &70136368104460 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - =
|
@@ -98,10 +98,21 @@ dependencies:
|
|
98
98
|
version: 0.4.3.1
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70136368104460
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: guard-bundler
|
104
|
+
requirement: &70136368103700 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70136368103700
|
102
113
|
- !ruby/object:Gem::Dependency
|
103
114
|
name: fuubar
|
104
|
-
requirement: &
|
115
|
+
requirement: &70136368103060 !ruby/object:Gem::Requirement
|
105
116
|
none: false
|
106
117
|
requirements:
|
107
118
|
- - ~>
|
@@ -109,7 +120,7 @@ dependencies:
|
|
109
120
|
version: 0.0.6
|
110
121
|
type: :development
|
111
122
|
prerelease: false
|
112
|
-
version_requirements: *
|
123
|
+
version_requirements: *70136368103060
|
113
124
|
description: QueenCheck is random test library. Inspired by QuickCheck library in
|
114
125
|
Haskell.
|
115
126
|
email: rosylilly@aduca.org
|
@@ -141,6 +152,7 @@ files:
|
|
141
152
|
- spec/queencheck/core_spec.rb
|
142
153
|
- spec/queencheck/elements_of_spec.rb
|
143
154
|
- spec/queencheck/integer_spec.rb
|
155
|
+
- spec/queencheck/string_spec.rb
|
144
156
|
- spec/spec_helper.rb
|
145
157
|
homepage: https://github.com/rosylilly/QueenCheck
|
146
158
|
licenses: []
|