pbt 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -9
- data/lib/pbt/arbitrary/integer_arbitrary.rb +13 -2
- data/lib/pbt/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0585c0152a9703256b3265830dd9105b33ebc65877555517af3ad643a6b8839
|
4
|
+
data.tar.gz: ac62f147919ac2e68642d70d9e0bb9d2c8010ef54b2aefc4d6c679fe1b9d7197
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54535a35fa3097b1fe3f4893f83ef9c646598b385c9d4c32f3eb2686aab3727ca22154a87edef748f94090682acee6f7090ecb4d51233e66e861b30bd20df0d3
|
7
|
+
data.tar.gz: e8126c1c5f1b044d83f66b6d0a734783d2843f16f0b24f9a1172797e5b144a630a26c642bfc606f57de9911935f1b25ff0c1d8af48ef92486680c80e264308b0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.1] - 2025-06-29
|
4
|
+
|
5
|
+
- Fix `IntegerArbitrary#shrink` to respect min/max bounds [#36](https://github.com/ohbarye/pbt/pull/36)
|
6
|
+
|
3
7
|
## [0.5.0] - 2024-12-30
|
4
8
|
|
5
9
|
- [Breaking change] Drop `:process` and `:thread` workers since there are no concrete use cases.
|
@@ -28,7 +32,7 @@
|
|
28
32
|
## [0.2.0] - 2024-04-17
|
29
33
|
|
30
34
|
- Add verbose mode. It's useful to debug the test case.
|
31
|
-
|
35
|
+
|
32
36
|
## [0.1.1] - 2024-04-14
|
33
37
|
|
34
38
|
- Change default worker from `:ractor` to `:none`
|
@@ -39,15 +43,15 @@
|
|
39
43
|
- Implement composite arbitraries
|
40
44
|
- Support shrinking
|
41
45
|
- Support multiple concurrency methods
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
- Ractor
|
47
|
+
- Process
|
48
|
+
- Thread
|
49
|
+
- None (Run tests sequentially)
|
46
50
|
- Documentation
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
- Add better examples
|
52
|
+
- Arbitrary usage
|
53
|
+
- Configuration
|
54
|
+
|
51
55
|
## [0.0.1] - 2024-01-27
|
52
56
|
|
53
57
|
- Initial release (Proof of concept)
|
@@ -20,7 +20,13 @@ module Pbt
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# @see Arbitrary#shrink
|
23
|
-
def shrink(current, target:
|
23
|
+
def shrink(current, target: nil)
|
24
|
+
# If no target is specified, use the appropriate bound as target
|
25
|
+
target ||= DEFAULT_TARGET.clamp(@min, @max)
|
26
|
+
|
27
|
+
# Ensure target is within bounds
|
28
|
+
target = target.clamp(@min, @max)
|
29
|
+
|
24
30
|
gap = current - target
|
25
31
|
return Enumerator.new { |_| } if gap == 0
|
26
32
|
|
@@ -30,9 +36,14 @@ module Pbt
|
|
30
36
|
while (diff = (current - target).abs) > 1
|
31
37
|
halved = diff / 2
|
32
38
|
current -= is_positive_gap ? halved : -halved
|
39
|
+
# Ensure current stays within bounds
|
40
|
+
current = current.clamp(@min, @max)
|
33
41
|
y.yield current
|
34
42
|
end
|
35
|
-
|
43
|
+
# Only yield target if it's different from current
|
44
|
+
if current != target
|
45
|
+
y.yield target
|
46
|
+
end
|
36
47
|
end
|
37
48
|
end
|
38
49
|
end
|
data/lib/pbt/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ohbarye
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
|
-
description:
|
14
12
|
email:
|
15
13
|
- over.rye@gmail.com
|
16
14
|
executables: []
|
@@ -61,7 +59,6 @@ metadata:
|
|
61
59
|
homepage_uri: https://github.com/ohbarye/pbt
|
62
60
|
source_code_uri: https://github.com/ohbarye/pbt
|
63
61
|
changelog_uri: https://github.com/ohbarye/pbt/releases
|
64
|
-
post_install_message:
|
65
62
|
rdoc_options: []
|
66
63
|
require_paths:
|
67
64
|
- lib
|
@@ -76,8 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
73
|
- !ruby/object:Gem::Version
|
77
74
|
version: '0'
|
78
75
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
80
|
-
signing_key:
|
76
|
+
rubygems_version: 3.6.7
|
81
77
|
specification_version: 4
|
82
78
|
summary: Property-Based Testing tool for Ruby, utilizing Ractor for parallelizing
|
83
79
|
test cases.
|