-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve "How to Specify it! In Java" #1
Comments
I did not yet read all of it but I really like this "translation". I did not read the oroginal, yet. In section 4.2 you forgot to replace k with key and k' with otherKey in the paragraph. |
@gtrefs Thanks. Fixed. |
Maybe a little explanation what integrated shrinking is would help. Is there a way to explain it in 3 or 4 sentences? |
I found a t here: Informally, we expect the effect of inserting key1 value1 into t before calling. Should be tree. |
Will that do? |
In 4.6: @Property(tries = 1_000_000)
void measure(
@ForAll Integer key,
@ForAll("trees") BST<Integer, Integer> bst
) {
List<Integer> keys = bst.keys();
String frequency = keys.contains(key) ? "present" : "absent";
Statistics.label("frequency").collect(frequency);
String position =
bst.isLeaf() ? "empty"
: keys.equals(Collections.singletonList(key)) ? "just key"
: keys.get(0).equals(key) ? "at start"
: keys.get(keys.size() - 1 ).equals(key) ? "at end"
: "middle";
Statistics.label("position").collect(position);
} When I follow this explanation:
I assume that the statistics in the second table is about the position of the key in the tree when it is present in the tree. The code tells a different story. When the key is not in the tree, it is counted as |
Here's the original:
I'd say that this code will label k's position regardless of it being present in t (<= and >= work even if k is not in t). But you are right about my code being wrong since classification only works if |
Here's the adapted statistics code:
This seems to better reflect the original code. And the results are indeed closer to the QuickCheck results:
|
Please add any comments and suggestions to this issue.
Thank you all!
The text was updated successfully, but these errors were encountered: