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

LagrangeBasisEvaluations: make tests more random regarding the domain size #2527

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions kimchi/src/lagrange_basis_evaluations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ mod tests {
use ark_ff::{One, UniformRand, Zero};
use ark_poly::{Polynomial, Radix2EvaluationDomain};
use mina_curves::pasta::Fp;
use rand::Rng;

#[test]
fn test_lagrange_evaluations() {
let n = 1 << 4;
let domain = Radix2EvaluationDomain::new(n).unwrap();
let mut rng = o1_utils::tests::make_test_rng(None);
let domain_log_size = rng.gen_range(1..10);
let n = 1 << domain_log_size;
let domain = Radix2EvaluationDomain::new(n).unwrap();
let x = Fp::rand(&mut rng);
let evaluator = LagrangeBasisEvaluations::new(domain.size(), domain, x);

Expand All @@ -181,9 +183,10 @@ mod tests {

#[test]
fn test_new_with_chunked_segments() {
let n = 1 << 4;
let domain = Radix2EvaluationDomain::new(n).unwrap();
let mut rng = o1_utils::tests::make_test_rng(None);
let domain_log_size = rng.gen_range(1..10);
let n = 1 << domain_log_size;
let domain = Radix2EvaluationDomain::new(n).unwrap();
let x = Fp::rand(&mut rng);
let evaluator = LagrangeBasisEvaluations::new(domain.size(), domain, x);
let evaluator_chunked =
Expand All @@ -205,7 +208,8 @@ mod tests {
#[test]
fn test_evaluation() {
let mut rng = o1_utils::tests::make_test_rng(None);
let n = 1 << 10;
let domain_log_size = rng.gen_range(1..10);
let n = 1 << domain_log_size;
let domain = Radix2EvaluationDomain::new(n).unwrap();

let evals = {
Expand All @@ -228,7 +232,8 @@ mod tests {
#[test]
fn test_evaluation_boolean() {
let mut rng = o1_utils::tests::make_test_rng(None);
let n = 1 << 1;
let domain_log_size = rng.gen_range(1..10);
let n = 1 << domain_log_size;
let domain = Radix2EvaluationDomain::new(n).unwrap();

let evals = {
Expand All @@ -240,7 +245,6 @@ mod tests {
Fp::zero()
});
}
e = vec![Fp::zero(), Fp::one()];
dannywillems marked this conversation as resolved.
Show resolved Hide resolved
Evaluations::from_vec_and_domain(e, domain)
};

Expand Down