Skip to content

Commit

Permalink
MVPoly: add tests for is_constant
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Aug 28, 2024
1 parent 317da6a commit 03ac16b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mvpoly/tests/prime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,3 +663,24 @@ fn test_degree_random_degree() {
let degree = unsafe { p.degree() };
assert!(degree <= max_degree);
}

#[test]
fn test_is_constant() {
let mut rng = o1_utils::tests::make_test_rng(None);
let c = Fp::rand(&mut rng);
let p = Dense::<Fp, 4, 5>::from(c);
assert!(p.is_constant());

let p = Dense::<Fp, 4, 5>::zero();
assert!(p.is_constant());

let p = Dense::<Fp, 4, 5>::from_variable(2_usize);
assert!(!p.is_constant());

let p = Dense::<Fp, 4, 5>::from_variable(3_usize);
assert!(!p.is_constant());

// This might be flaky
let p = unsafe { Dense::<Fp, 4, 5>::random(&mut rng, None) };
assert!(!p.is_constant());
}

0 comments on commit 03ac16b

Please sign in to comment.