This repository is working sample of prop_check with test-unit.
$ ruby run_test.rb
Loaded suite 6dec8e397943cdc372b969fff26299e7
Started
E
================================================================================================================================================
Error: test_that_it_returns_an_integer_for_any_input(TestNaiveAverage):
ZeroDivisionError:
(after 2 successful property test runs)
Failed on:
`[]`
Exception message:
---
divided by 0
---
(shrinking impossible)
/Users/niku/src/6dec8e397943cdc372b969fff26299e7/naive_average.rb:2:in `/'
/Users/niku/src/6dec8e397943cdc372b969fff26299e7/naive_average.rb:2:in `naive_average'
/Users/niku/src/6dec8e397943cdc372b969fff26299e7/test_my.rb:10:in `block in test_that_it_returns_an_integer_for_any_input'
7:
8: def test_that_it_returns_an_integer_for_any_input
9: PropCheck.forall(G.array(G.integer)) do |numbers|
=> 10: result = naive_average(numbers)
11:
12: assert_instance_of(Integer, result)
13: end
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/helper.rb:41:in `call_splatted'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:298:in `check_attempt'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:254:in `block in check'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:125:in `<<'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:125:in `block in each'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:52:in `block in call'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:22:in `block in initialize'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:51:in `call'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:40:in `block in wrap_block'
<internal:kernel>:187:in `loop'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/hooks.rb:128:in `each'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:252:in `each'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:252:in `each'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:252:in `each'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:252:in `check'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check/property.rb:46:in `forall'
/Users/niku/.asdf/installs/ruby/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/prop_check-0.18.1/lib/prop_check.rb:34:in `forall'
/Users/niku/src/6dec8e397943cdc372b969fff26299e7/test_my.rb:9:in `test_that_it_returns_an_integer_for_any_input'
================================================================================================================================================
Finished in 0.00091 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------
1 tests, 2 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
------------------------------------------------------------------------------------------------------------------------------------------------
1098.90 tests/s, 2197.80 assertions/s