Skip to content
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

[saffron] Property based test for query #2972

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

martyall
Copy link
Contributor

  • move the blob_test_utils module to utils.rs and use as standard way for all data generation. Renamed the generator from BlobData to UserData to reflect that it has nothing to do with blobs apriori

  • reworked @marcbeunardeau88 's test to generate and test multiple queries for every user data generation round

@@ -92,86 +92,13 @@ impl<G: CommitmentCurve> FieldBlob<G> {
}
}

#[cfg(test)]
mod blob_test_utils {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this got copy/pasted over to utils.rs since it is useful for generating data in pretty much all cases

@@ -57,17 +56,6 @@ pub struct QueryBytes {
pub len: usize,
}

/// For testing purposes
impl QueryBytes {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this anymore since we can use the combinators from proptest to generate exactly what we want

let query_strategy = (0..(n - 1)).prop_flat_map(move |start| {
((start + 1)..n).prop_map(move |end| QueryBytes { start, len: end - start})
});
let queries_strategy = prop::collection::vec(query_strategy, 10);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generate and test 10 queries for every round of testing

@martyall martyall changed the title set up property based test to check multiple queries per data generation [saffron] Property based test for query Jan 28, 2025
@martyall martyall merged commit e3253d3 into marc/query-saffron Jan 29, 2025
4 of 12 checks passed
@martyall martyall deleted the martin/marc/query-saffron branch January 29, 2025 20:06
@martyall martyall mentioned this pull request Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants