Comments (10)
Using @ForAll BigRange(min="0",max="0") WithNull(0.5) BigDecimal bd
seems equivalent to nullOrZero3
and cannot be done exhaustively.
from jqwik.
Minimal test for failing combination:
public class NullOrZeroTest {
Object ZERO = new Object();
@Property @Report(Reporting.GENERATED)
boolean nullOrZero2(@ForAll("nullOrZero2") Object bd1, @ForAll("nullOrZero2") Object bd2) {
return bd1 == null || bd1 == ZERO || bd2 == null || bd2 == ZERO;
}
@Provide Arbitrary<Object> nullOrZero2() {
return Arbitraries.of(ZERO, null);
}
}
from jqwik.
I'm just starting to try understanding what you want to do so bear with me...
Your last example NullOrZeroTest
succeeds when I try it:
timestamp = 2019-12-13T10:46:34.003, generated = [java.lang.Object@1e9e725a, java.lang.Object@1e9e725a]
timestamp = 2019-12-13T10:46:34.006, generated = [java.lang.Object@1e9e725a, null]
timestamp = 2019-12-13T10:46:34.006, generated = [null, java.lang.Object@1e9e725a]
timestamp = 2019-12-13T10:46:34.016, NullOrZeroTest:nullOrZero2 =
|-------------------jqwik-------------------
tries = 3 | # of calls to property
checks = 3 | # of not rejected calls
generation-mode = EXHAUSTIVE | parameters are exhaustively generated
after-failure = PREVIOUS_SEED | use the previous seed
seed = -5796249568264761713 | random seed to reproduce generated values
This is almost what I'd expect. I'm just wondering why [null, null]
does not show up as 4th example and I will look into this. Is that your point?
When I switch on randomized generation with @Property(generation = GenerationMode.RANDOMIZED)
it does show up, though.
from jqwik.
@Provide Arbitrary<BigDecimal> nullOrZero3() {
return Arbitraries.bigDecimals().between(BigDecimal.ZERO, BigDecimal.ZERO)
.withSamples((BigDecimal) null);
}
should also be able to be used in an exhaustive generation context. I'll have a look at that as well.
from jqwik.
Ah yes, sorry, that might have been too much information with too little explanation ;-)
Given Arbitraries.of(null, ZERO)
- it creates null as the only value when used in exhaustive mode for a single parameter
Given Arbitraries.of(ZERO, null)
- it creates ZERO and null as values when used in exhaustive mode for a single parameter
- it creates all permutations but [null, null] when used in exhaustive mode for two parameters
Randomized generation is fine in all cases, but must be selected manually.
from jqwik.
Understood. I'm going to examine that.
from jqwik.
Bug concerning handling of null values in exhaustive generation has been fixed. Already available in version 1.2.2-SNAPSHOT. See 24ff64c
Exhaustive generation of Arbitraries.bigDecimals().between(BigDecimal.ZERO, BigDecimal.ZERO)
is a different beast, which I will tackle next.
from jqwik.
Thank you for the quick response!
from jqwik.
The exhaustive generation of single big decimal range is now also possible (1e4cc24) and available in 1.2.2-SNAPSHOT
All of your examples above should now hopefully work as expected.
Thanks for catching two glitches in a single go!
from jqwik.
Great, thank you!
from jqwik.
Related Issues (20)
- Make IgnoreException "attempts" (and other related hard coded values) configurable HOT 11
- Allow to define a scope/lifespan with @Provide methods HOT 7
- Support UniqueElements annotation for Extensions HOT 1
- Bug: PropertyExecutor.execute() does not handle AssertionErrors correctly HOT 1
- ClassCastException when using Combinators during shrinking HOT 21
- ListArbitrary<T> providers are not selected to resolve List<T> parameters HOT 1
- Support OpenJML for Arbitraries
- Jqwik Quarkus Support HOT 2
- Type arguments are missing in some situations HOT 8
- support for heterogeneous arbitrary configurators in base HOT 9
- Arbitrary.size as an option to tweak during arbitrary construction. HOT 22
- Feature Request: Report generator state when generation fails with exception
- Provide a way to suppress excessive output/stacktraces HOT 16
- Domains inject parameterized values incorrectly HOT 25
- Method to specify the order of execution for tests HOT 5
- Programmatic use of jqwik without JUnit HOT 3
- Repeatead chars not working as expected HOT 6
- Every X years in @YearRange HOT 1
- Allow parallel test runs with SBT HOT 15
- Infinite action chains biased towards small sizes HOT 5
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 jqwik.