prop_check 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -5
- data/lib/prop_check.rb +7 -0
- data/lib/prop_check/version.rb +1 -1
- metadata +2 -3
- data/lib/prop_check/rspec.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e5aeef61ddf82569ca885327d32b9fe8fd939f2fdbef48709cb19504b5cf041
|
4
|
+
data.tar.gz: d914dcac32f7a3a976661a0280c71f0a7a665411550aed9902317b04c82ee290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c5b76ac37ba8e03b2c41c04c4cc359844fa2e52d0af8893787531c23f3a54b046eb7eed13b055fed44c8983f87cbfe492d1524746624a3744300a73caf01da
|
7
|
+
data.tar.gz: 9beb7ac4e605c72cc8e9b3907e727ae532c2eec4a530b6a9b7c31445135e37c8849c9f186d4571aaf38c24e28989ebe856ed2e5e873baf2ed7b740a73561dae7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -90,8 +90,8 @@ end
|
|
90
90
|
|
91
91
|
# And then in a test case:
|
92
92
|
include PropCheck::Generators
|
93
|
-
PropCheck.forall(array(integer)) do |
|
94
|
-
result = naive_average(
|
93
|
+
PropCheck.forall(numbers: array(integer)) do |numbers:|
|
94
|
+
result = naive_average(numbers)
|
95
95
|
unless result.is_a?(Integer) do
|
96
96
|
raise "Expected the average to be an integer!"
|
97
97
|
end
|
@@ -105,7 +105,7 @@ ZeroDivisionError:
|
|
105
105
|
(after 6 successful property test runs)
|
106
106
|
Failed on:
|
107
107
|
`{
|
108
|
-
:
|
108
|
+
:numbers => []
|
109
109
|
}`
|
110
110
|
|
111
111
|
Exception message:
|
@@ -133,8 +133,8 @@ PropCheck will see if the failure still happens with `x = 50`.
|
|
133
133
|
If it does , it will try `x = 25`. If not, it will try `x = 75`, and so on.
|
134
134
|
|
135
135
|
This means if something only goes wrong for `x = 2`, the program will try:
|
136
|
-
- `x = 100`(fails)
|
137
|
-
- x = 50`(fails),
|
136
|
+
- `x = 100`(fails),
|
137
|
+
- `x = 50`(fails),
|
138
138
|
- `x = 25`(fails),
|
139
139
|
- `x = 12`(fails),
|
140
140
|
- `x = 6`(fails),
|
data/lib/prop_check.rb
CHANGED
@@ -9,6 +9,13 @@ require 'prop_check/helper'
|
|
9
9
|
# You probably want to look at the documentation of
|
10
10
|
# PropCheck::Generator and PropCheck::Generators
|
11
11
|
# to find out more about how to use generators.
|
12
|
+
#
|
13
|
+
# Common usage is to call `extend PropCheck` in your (testing) modules.
|
14
|
+
#
|
15
|
+
# This will:
|
16
|
+
# 1. Add the local method `forall` which will call `PropCheck.forall`
|
17
|
+
# 2. `include PropCheck::Generators`.
|
18
|
+
#
|
12
19
|
module PropCheck
|
13
20
|
module Errors
|
14
21
|
class Error < StandardError; end
|
data/lib/prop_check/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prop_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Qqwy/Wiebe-Marten Wijnja
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,7 +85,6 @@ files:
|
|
85
85
|
- lib/prop_check/lazy_tree.rb
|
86
86
|
- lib/prop_check/property.rb
|
87
87
|
- lib/prop_check/property/configuration.rb
|
88
|
-
- lib/prop_check/rspec.rb
|
89
88
|
- lib/prop_check/version.rb
|
90
89
|
- prop_check.gemspec
|
91
90
|
homepage: https://github.com/Qqwy/ruby-prop_check/
|
data/lib/prop_check/rspec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module PropCheck
|
2
|
-
##
|
3
|
-
# Integration with RSpec
|
4
|
-
#
|
5
|
-
# Currently very basic; it does two things:
|
6
|
-
# 1. adds the local `forall` method to examples that calls `PropCheck.forall`
|
7
|
-
# 2. adds `include PropCheck::Generators` statement.
|
8
|
-
module RSpec
|
9
|
-
# To make it available within examples
|
10
|
-
def self.extend_object(obj)
|
11
|
-
obj.instance_eval do
|
12
|
-
include PropCheck::Generators
|
13
|
-
end
|
14
|
-
|
15
|
-
obj.define_method(:forall) do |*args, **kwargs, &block|
|
16
|
-
PropCheck.forall(*args, **kwargs, &block)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|