Comments (5)
There's no shrinking of expressions going on at all right now. I focused on shrinking statements, as that makes a program 'more' small ;) But expressions should be shrunk, absolutely. It's not something I will prioritize until after the paper deadline, I think. There are some other small things that I need to fix with the expression shrinker as well. Some programs are shrunk a lot, but could still be shrunk even more.
Just as a quick intro to something that confused me a bit now when I learned this myself recently:
QuickCheck shrinking is not of the form that e.g it turns 5 + 7
into the subexpression 12
, but rather it turns 5 + 7
into the subexpressions 5
& 7
. You could pattern match on this specific case of integer constants arithmetic, of course, and produce the subexpressions 5
, 7
& 12
, but it won't be the general case that expressions are normalized. It's a syntactical division of the tree into its immediate subtrees.
If you have (5 + 7) * (7 - 2)
you turn that into the subexpressions 5 + 7
& 7 - 2
. You don't recursively shrink them further yourself, as QuickCheck automatically does that for you if it needs to. Nothing will go wrong if you do it yourself, but it might slow down shrinking as you might test more mutations than you have to.
from scoria.
I suppose chopping expressions into bits and pieces works too, but is there no way to essentially pipe the example programs through a constant-folder sort of pass?
from scoria.
You could, yes. The shrink interface as seen by QuickCheck is the function shrink :: a -> [a]
, which in our case is shrink :: Program -> [Program]
. The result could be the singleton list containing the folded program. What you are describing is not necessarily the way shrinking is usually done though. It's supposed to be a
E.g an expression such as 5 + 7
would presumable have been evaluated while being subjected to a test, so shrinking and then testing 12
would test the semantically equivalent program, even if it is syntactically smaller. If you perform this constant folding and the new program also fails, you can not shrink it further as it is now a single leaf node rather than a tree. Maybe the bug only appears if the number is odd? The arbitrary
& shrink
functions are supposed to be quite 'simple' in their operation.
from scoria.
from scoria.
Fixed by #39
from scoria.
Related Issues (20)
- Implement unit type as SSMType HOT 4
- Even better shrinker! HOT 2
- Can't use references in operators HOT 6
- SSM time types for frontend HOT 9
- Lower deref from statement level to expression level HOT 1
- Profile interpreter to see if it's the culprit that makes the tests take longer than previously HOT 3
- Transpilation bug - names are duplicated HOT 4
- Ask Zephyr people about 64bit timers
- Refactor interpreter
- Connect standard streams to global references HOT 1
- Make expressions compile to ordinary types in C, not scheduled variables HOT 1
- Remove arguments to the entry point HOT 1
- Inefficient distribution of priorities HOT 1
- Propagate parse errors from trace parsers to testing framework
- Make core syntax more fine grained
- Examples wishlist HOT 2
- Don't assume long == 64-bit
- Add "escape hatch" in EDSL HOT 2
- Integer overflow in interpreter might be UB HOT 1
- [RFC] Output handlers 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 scoria.