-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add new test queries #421
Add new test queries #421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions on how to get more testing power out of the tests, otherwise happy to merge.
...est_data/tests/valid_queries/fold_with_no_outputs_transform_and_filter_less_than.graphql.ron
Outdated
Show resolved
Hide resolved
...est_data/tests/valid_queries/fold_with_outputs_transform_and_filter_greater_than.graphql.ron
Outdated
Show resolved
Hide resolved
...e/test_data/tests/valid_queries/fold_with_outputs_transform_and_filter_less_than.graphql.ron
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider (either here or in a separate PR) also including a test case where there is both a >=
and a <=
filter on the count and there's no outputs in the fold. It would make sure the new optimization doesn't kick in in situations where the count can be observed indirectly via a filter that could flip from passing to not passing as the count grows.
Two variations worth testing here:
- when we count to a number that clears the
>=
, and then hit the end of the@fold
iterator before we hit the<=
number, the result is returned - when we exceed the
<=
number, we stop counting immediately regardless of everything else
Another variation of that test case: have both a >=
and a one_of
filter. In this case, we need the exact count always, because that's the only way to match the one_of
filter.
..._data/tests/valid_queries/fold_with_no_outputs_transform_and_filter_greater_than.graphql.ron
Show resolved
Hide resolved
// This @fold statement doesn't actually need to fully evaluate: | ||
// it has no outputs, and the predicate can be determined to be satisfied | ||
// with only a partial evaluation of the @fold. | ||
// | ||
// The number 30 is composite and has 3 prime factors: 2, 3, 5. | ||
// This test checks whether the evaluation of the @fold is stopped early | ||
// after two of those three primes are produced (satisfying the predicate). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not true — in fact the opposite is true. The @output
on the count requires us to fully evaluate the @fold
, or else we don't know what the count is.
Did you mean to put this comment in a different file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's from an earlier test that I copied, not meant to be here after I added the @output
. I've fixed it :)
...e/test_data/tests/valid_queries/fold_with_no_outputs_transform_and_filter_one_of.graphql.ron
Show resolved
Hide resolved
...est_data/tests/valid_queries/fold_with_outputs_transform_and_filter_greater_than.graphql.ron
Outdated
Show resolved
Hide resolved
...est_data/tests/valid_queries/fold_with_outputs_transform_and_filter_greater_than.graphql.ron
Outdated
Show resolved
Hide resolved
TestGraphQLQuery ( | ||
schema_name: "numbers", | ||
query: r#" | ||
{ | ||
Number(min: 30, max: 30) { | ||
... on Composite { | ||
value @output | ||
|
||
primeFactor @fold @transform(op: "count") @filter(op: "<", value: ["$min_primes"]) { | ||
prime: value @output | ||
} | ||
} | ||
} | ||
}"#, | ||
arguments: { | ||
"min_primes": Uint64(2) | ||
}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this test case is testing? Also it seems to have no results because the < 2
predicate on the fold filters everything out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the same test case for > and <, I didn't think it would be a problem to add another behavioral test case to ensure no breaks in existing behavior.
No description provided.