diff --git a/tfhe/src/shortint/server_key/tests/noise_level.rs b/tfhe/src/shortint/server_key/tests/noise_level.rs index b884bbde26..3dd0fd34e6 100644 --- a/tfhe/src/shortint/server_key/tests/noise_level.rs +++ b/tfhe/src/shortint/server_key/tests/noise_level.rs @@ -1,7 +1,7 @@ use crate::shortint::ciphertext::NoiseLevel; use crate::shortint::keycache::KEY_CACHE; use crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; -use crate::shortint::{Ciphertext, ServerKey}; +use crate::shortint::{Ciphertext, MaxNoiseLevel, ServerKey}; fn test_ct_unary_op_noise_level_propagation(sk: &ServerKey, ct: &Ciphertext) { let test_fn = |op: &dyn Fn(&ServerKey, &Ciphertext) -> Ciphertext, @@ -324,6 +324,11 @@ fn test_noise_level_propagation_ci_run_filter() { let keys = KEY_CACHE.get_from_param(params); let (ck, sk) = (keys.client_key(), keys.server_key()); + // The goal of this test is to check the noise level is properly propagated + // thus it does operations in a way that is not correct noise-wise + let mut sk = sk.clone(); + sk.max_noise_level = MaxNoiseLevel::new(usize::MAX); + let modulus: u64 = params.message_modulus.0 as u64; for _ in 0..10 { @@ -335,21 +340,21 @@ fn test_noise_level_propagation_ci_run_filter() { let ct2 = sk.unchecked_add(&ct1, &ct1); for ct in [&trivial0, &trivial, &ct1, &ct2] { - test_ct_unary_op_noise_level_propagation(sk, ct); - test_ct_unary_op_assign_noise_level_propagation(sk, ct); + test_ct_unary_op_noise_level_propagation(&sk, ct); + test_ct_unary_op_assign_noise_level_propagation(&sk, ct); } for ct_left in [&trivial0, &trivial, &ct1, &ct2] { for ct_right in [&trivial0, &trivial, &ct1, &ct2] { - test_ct_binary_op_noise_level_propagation(sk, ct_left, ct_right); - test_ct_binary_op_assign_noise_level_propagation(sk, ct_left, ct_right); + test_ct_binary_op_noise_level_propagation(&sk, ct_left, ct_right); + test_ct_binary_op_assign_noise_level_propagation(&sk, ct_left, ct_right); } } for ct in [&trivial0, &trivial, &ct1, &ct2] { for scalar in 0..params.carry_modulus.0 * params.message_modulus.0 { - test_ct_scalar_op_noise_level_propagation(sk, ct, scalar as u8); - test_ct_scalar_op_assign_noise_level_propagation(sk, ct, scalar as u8); + test_ct_scalar_op_noise_level_propagation(&sk, ct, scalar as u8); + test_ct_scalar_op_assign_noise_level_propagation(&sk, ct, scalar as u8); } } }