prop_check 0.18.1 → 0.18.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 117dfaa6197dcb53fd6619ae414452a277d668a34736331169407361dbdcb0bc
4
- data.tar.gz: 86a17a6070762151d0e84010c3bdf75569df962c1428fb7008f46cfe685f312c
3
+ metadata.gz: 4c85d7bb545c99b3953f68f42a7e37e14b96ddde115b42670689aa7094dfef42
4
+ data.tar.gz: efe151cb45c09d94d7e987d490096a321488832bc8d8041ab513ee64b71335d9
5
5
  SHA512:
6
- metadata.gz: 1d00f635551fc17b870a0f3065040662b85565a19a498d84dbdb76de106f0138d905f2da0fdb89f5ee25e666411abdc7d4d7b61831114d99ed80451471f450f0
7
- data.tar.gz: 8ec326b8e39ceed7d587de59c6fac591e91d4429bdef0a9770542643e7a1d5323667f59cf196611cac42324288994096054afc72ea6eb2722640a68c3cc745b6
6
+ metadata.gz: b5d180fe6141074ef202fba5c251a96492c2e5ad9706491ec615df1e5010c12623e3c5b53b8adaa5e75435df9ec48a464543672e33c81af4b18528da6f184860
7
+ data.tar.gz: a4b2e62dee58f53bc291202cbae157119eba7858f24b70ea5eb8790e578eceb0f2b140c1e5707c68037fcc09c2dddd17f57970de45fb3271503322a4de25fe05
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  matrix:
18
18
  # NOTE: Ruby 3.2 is not in here, as `doctest-core` first needs to be updated to support it
19
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
19
+ ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2']
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v3
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.1.3
1
+ ruby 2.7.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ - 0.18.2
2
+ - Documentation updates:
3
+ - PR #18: Adding an example of using prop_check with the `test-unit` testing framework to the README. Thank you, @niku!
4
+ - PR #17, #18, #21: fixing typos in various parts of the documentation. Thank you, @meganemura, @niku and @harlantwood!
1
5
  - 0.18.1
2
6
  - Fixes:
3
7
  - Compatibility with Ruby 3.2:
data/Gemfile CHANGED
@@ -8,6 +8,6 @@ gem "bundler", "~> 2.0"
8
8
  group :test do
9
9
  gem "rake", "~> 12.3", require: false
10
10
  gem "rspec", "~> 3.0", require: false
11
- gem "doctest-rspec", require: false
11
+ gem "doctest2-rspec", require: false
12
12
  gem "simplecov", require: false
13
13
  end
data/Justfile ADDED
@@ -0,0 +1,16 @@
1
+ setup_and_test: setup test
2
+
3
+ setup:
4
+ bin/setup
5
+
6
+ test:
7
+ bundle exec rspec
8
+
9
+ console:
10
+ bin/console
11
+
12
+ install:
13
+ bundle exec rake install
14
+
15
+ release:
16
+ bundle exec rake release
data/README.md CHANGED
@@ -156,6 +156,23 @@ class NaiveAverageTest < MiniTest::Unit::TestCase
156
156
  end
157
157
  ```
158
158
 
159
+ The test case, using test-unit:
160
+ ``` ruby
161
+ require "test-unit"
162
+
163
+ class TestNaiveAverage < Test::Unit::TestCase
164
+ G = PropCheck::Generators
165
+
166
+ def test_that_it_returns_an_integer_for_any_input
167
+ PropCheck.forall(G.array(G.integer)) do |numbers|
168
+ result = naive_average(numbers)
169
+
170
+ assert_instance_of(Integer, result)
171
+ end
172
+ end
173
+ end
174
+ ```
175
+
159
176
  The test case, using only vanilla Ruby:
160
177
  ```ruby
161
178
  # And then in a test case:
@@ -250,7 +267,7 @@ Always returns the given value. No shrinking.
250
267
 
251
268
  Allows you to take the result of one generator and transform it into something else.
252
269
 
253
- >> G.choose(32..128).map(&:chr).sample(1, size: 10, Random.new(42))
270
+ >> G.choose(32..128).map(&:chr).sample(1, size: 10, rng: Random.new(42))
254
271
  => ["S"]
255
272
 
256
273
  #### Generator#bind
@@ -262,7 +279,7 @@ Allows you to create one or another generator conditionally on the output of ano
262
279
 
263
280
  This is an advanced feature. Often, you can use a combination of `Generators.tuple` and `Generator#map` instead:
264
281
 
265
- >> G.tuple(integer, integer).sample(1, size: 100, rng: Random.new(42)
282
+ >> G.tuple(G.integer, G.integer).sample(1, size: 100, rng: Random.new(42))
266
283
  => [[2, 79]]
267
284
 
268
285
  #### Generators.one_of
@@ -309,13 +326,17 @@ Here are some simple recommendations for the best results:
309
326
  .check(&block)
310
327
  end
311
328
  ```
312
- - Other setup/cleanup should also usually happen around each generated example rather than around the whole test: Instead of using the hooks exposed by RSpec/MiniTest/etc., use the before/after/around hooks exposed by PropCheck.
329
+ - Other setup/cleanup should also usually happen around each generated example rather than around the whole test: Instead of using the hooks exposed by RSpec/MiniTest/test-unit/etc., use the before/after/around hooks exposed by PropCheck.
313
330
 
314
331
  ## Development
315
332
 
316
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
333
+ After checking out the repo, use the [just](https://github.com/casey/just) command runner for common tasks:
317
334
 
318
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
335
+ - `just setup`: Installs dev dependencies
336
+ - `just test`: Runs the test suite
337
+ - `just console`: Opens an IRb console with the gem loaded for experimenting.
338
+ - `just install`: Install the gem on your local machine.
339
+ - `just release`: Create and push a new release to the git repo and Rubygems. (Be sure to increase the version number in `version.rb` first!)
319
340
 
320
341
  ## Contributing
321
342
 
@@ -234,7 +234,7 @@ module PropCheck
234
234
  end
235
235
 
236
236
  ##
237
- # Generates any nonzerno floating-point number.
237
+ # Generates any nonzero floating-point number.
238
238
  # Will generate special floats (except NaN) from time to time.
239
239
  # c.f. #float
240
240
  def nonzero_float
@@ -266,7 +266,7 @@ module PropCheck
266
266
  end
267
267
 
268
268
  ##
269
- # Generates positive floating point numbers
269
+ # Generates negative floating point numbers
270
270
  # Will generate special floats (except NaN) from time to time.
271
271
  # c.f. #float
272
272
  def negative_float
@@ -479,7 +479,7 @@ module PropCheck
479
479
 
480
480
  ##
481
481
  #
482
- # Alias for `#hash` that does not conflict with a possibly overriden `Object#hash`.
482
+ # Alias for `#hash` that does not conflict with a possibly overridden `Object#hash`.
483
483
  #
484
484
  def hash_of(key_generator, value_generator, **kwargs)
485
485
  array(tuple(key_generator, value_generator), **kwargs)
@@ -1,3 +1,3 @@
1
1
  module PropCheck
2
- VERSION = '0.18.1'
2
+ VERSION = '0.18.2'
3
3
  end
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.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Qqwy/Wiebe-Marten Wijnja
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-11 00:00:00.000000000 Z
11
+ date: 2024-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -43,6 +43,7 @@ files:
43
43
  - CHANGELOG.md
44
44
  - CODE_OF_CONDUCT.md
45
45
  - Gemfile
46
+ - Justfile
46
47
  - LICENSE.txt
47
48
  - README.md
48
49
  - Rakefile
@@ -68,7 +69,7 @@ metadata:
68
69
  homepage_uri: https://github.com/Qqwy/ruby-prop_check/
69
70
  source_code_uri: https://github.com/Qqwy/ruby-prop_check/
70
71
  changelog_uri: https://github.com/Qqwy/ruby-prop_check/CHANGELOG.md
71
- post_install_message:
72
+ post_install_message:
72
73
  rdoc_options: []
73
74
  require_paths:
74
75
  - lib
@@ -83,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
84
  - !ruby/object:Gem::Version
84
85
  version: '0'
85
86
  requirements: []
86
- rubygems_version: 3.3.26
87
- signing_key:
87
+ rubygems_version: 3.1.6
88
+ signing_key:
88
89
  specification_version: 4
89
90
  summary: PropCheck allows you to do property-based testing, including shrinking.
90
91
  test_files: []