Comments (2)
You... you've got another packing coming that does PropCheck.jl
stuff but better? Well then, I'm excited for that!
As for what check
itself returns, I'm fine with its user-facing API to stay as it is for now. As for my wrapper, here's an improved update for anyone looking for a workaround. I understand why it was designed that way, I just felt the need to point out the discord between your documentation of usage examples and idiomatic Julia testing.
function wrap_check(prop::Function, gen::Integrated)
chk = check(splat(prop), gen)
chk isa Bool && return chk
@info chk
return prop(chk[1]...)
end
It grabs the counterexample and feeds it back to the property-checking function. So I can have @test wrap_check(...)
throughout my test code, and upon finding counterexamples it'll have run the counterexample on prop
and returned the false value with a nicer report than a test error.
Keep up the great work @Seelengrab
from propcheck.jl.
Loving the package so far!
Thank you! Nice to hear that someone is using this :)
Since check only returns true or the value of the counter example, I don't think this is appropriate usage.
This is intentional - it was the easiest way of getting the found counterexample reported as part of a testsuite, making use of @testset
. As is, check
should only ever return a Bool
if the result is true
, and a non-Bool
counterexample otherwise. This is subtly broken if the counterexample itself is true
:
julia> using PropCheck
julia> prop(b) = !b
prop (generic function with 1 method)
julia> using Test
julia> PropCheck.check(prop, PropCheck.itype(Bool))
┌ Info: Found counterexample for 'prop', beginning shrinking...
└ Counterexample = true
[ Info: 1 counterexamples found for prop
true
julia> @test PropCheck.check(prop, PropCheck.itype(Bool))
┌ Info: Found counterexample for 'prop', beginning shrinking...
└ Counterexample = true
[ Info: 1 counterexamples found for prop
Test Passed
which is of course a bit bad. I intended to eventually replace this @test check
approach entirely with a solution based on a custom AbstractTestSet
, which would avoid that problem, but never got to it. Part of the reason is that support for printing of custom testsets was only recently merged into Julia, see JuliaLang/julia#53215. Another reason is that I'm currently working on a package that already handles this & much more better, while being faster :)
As for changing what check
itself returns - that likely won't change at all, if I'm going to change the user-facing API it'd be by replacing @ŧest
with a different macro entirely.
from propcheck.jl.
Related Issues (13)
- Move `trim` argument of `filter` to keyword? HOT 1
- Automatic test running based on methods HOT 1
- Allow generation of abstract types HOT 1
- Improve handling of errors during generation HOT 1
- Better handling of errors during testing & shrinking HOT 1
- Function aware value generation HOT 1
- Better printing of shrinker types HOT 1
- Automatic regression testing HOT 4
- Integrated shrinker producing special cases HOT 1
- PropCheck Logo HOT 5
- Replace camelcase HOT 2
- DataGenerators.jl stuff HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from propcheck.jl.