mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
chore(ci): remove private feature __coverage to use tarpaulin cfg
This commit is contained in:
8
Makefile
8
Makefile
@@ -370,13 +370,13 @@ test_core_crypto_cov: install_rs_build_toolchain install_rs_check_toolchain inst
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_BUILD_TOOLCHAIN) tarpaulin --profile $(CARGO_PROFILE) \
|
||||
--out xml --output-dir coverage/core_crypto --line --engine llvm --timeout 500 \
|
||||
--implicit-test-threads $(COVERAGE_EXCLUDED_FILES) \
|
||||
--features=$(TARGET_ARCH_FEATURE),experimental,internal-keycache,__coverage \
|
||||
--features=$(TARGET_ARCH_FEATURE),experimental,internal-keycache \
|
||||
-p $(TFHE_SPEC) -- core_crypto::
|
||||
@if [[ "$(AVX512_SUPPORT)" == "ON" ]]; then \
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_CHECK_TOOLCHAIN) tarpaulin --profile $(CARGO_PROFILE) \
|
||||
--out xml --output-dir coverage/core_crypto_avx512 --line --engine llvm --timeout 500 \
|
||||
--implicit-test-threads $(COVERAGE_EXCLUDED_FILES) \
|
||||
--features=$(TARGET_ARCH_FEATURE),experimental,internal-keycache,__coverage,$(AVX512_FEATURE) \
|
||||
--features=$(TARGET_ARCH_FEATURE),experimental,internal-keycache,$(AVX512_FEATURE) \
|
||||
-p $(TFHE_SPEC) -- -Z unstable-options --report-time core_crypto::; \
|
||||
fi
|
||||
|
||||
@@ -407,7 +407,7 @@ test_boolean_cov: install_rs_check_toolchain install_tarpaulin
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_CHECK_TOOLCHAIN) tarpaulin --profile $(CARGO_PROFILE) \
|
||||
--out xml --output-dir coverage/boolean --line --engine llvm --timeout 500 \
|
||||
$(COVERAGE_EXCLUDED_FILES) \
|
||||
--features=$(TARGET_ARCH_FEATURE),boolean,internal-keycache,__coverage \
|
||||
--features=$(TARGET_ARCH_FEATURE),boolean,internal-keycache \
|
||||
-p $(TFHE_SPEC) -- -Z unstable-options --report-time boolean::
|
||||
|
||||
.PHONY: test_c_api_rs # Run the rust tests for the C API
|
||||
@@ -452,7 +452,7 @@ test_shortint_cov: install_rs_check_toolchain install_tarpaulin
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_CHECK_TOOLCHAIN) tarpaulin --profile $(CARGO_PROFILE) \
|
||||
--out xml --output-dir coverage/shortint --line --engine llvm --timeout 500 \
|
||||
$(COVERAGE_EXCLUDED_FILES) \
|
||||
--features=$(TARGET_ARCH_FEATURE),shortint,internal-keycache,__coverage \
|
||||
--features=$(TARGET_ARCH_FEATURE),shortint,internal-keycache \
|
||||
-p $(TFHE_SPEC) -- -Z unstable-options --report-time shortint::
|
||||
|
||||
.PHONY: test_integer_ci # Run the tests for integer ci
|
||||
|
||||
@@ -128,7 +128,6 @@ generator_aarch64_aes = ["concrete-csprng/generator_aarch64_aes"]
|
||||
|
||||
# Private features
|
||||
__profiling = []
|
||||
__coverage = []
|
||||
|
||||
seeder_unix = ["concrete-csprng/seeder_unix"]
|
||||
seeder_x86_64_rdseed = ["concrete-csprng/seeder_x86_64_rdseed"]
|
||||
|
||||
@@ -145,9 +145,9 @@ mod tests {
|
||||
PARAMETERS_ERROR_PROB_2_POW_MINUS_165,
|
||||
};
|
||||
use crate::boolean::random_boolean;
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 32;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
#[test]
|
||||
@@ -155,7 +155,7 @@ mod tests {
|
||||
test_compressed_public_key(DEFAULT_PARAMETERS);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
#[test]
|
||||
fn test_compressed_public_key_tfhe_lib_parameters() {
|
||||
test_compressed_public_key(PARAMETERS_ERROR_PROB_2_POW_MINUS_165);
|
||||
|
||||
@@ -143,9 +143,9 @@ mod tests {
|
||||
use crate::boolean::random_boolean;
|
||||
|
||||
use super::PublicKey;
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 32;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
#[test]
|
||||
@@ -153,7 +153,7 @@ mod tests {
|
||||
test_public_key(DEFAULT_PARAMETERS);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
#[test]
|
||||
fn test_public_key_tfhe_lib_parameters() {
|
||||
test_public_key(PARAMETERS_ERROR_PROB_2_POW_MINUS_165);
|
||||
@@ -189,7 +189,7 @@ mod tests {
|
||||
test_public_key(DEFAULT_PARAMETERS);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
#[test]
|
||||
fn test_decompressing_public_key_tfhe_lib_parameters() {
|
||||
test_decompressing_public_key(PARAMETERS_ERROR_PROB_2_POW_MINUS_165);
|
||||
|
||||
@@ -6,21 +6,21 @@ use crate::boolean::server_key::{BinaryBooleanGates, BinaryBooleanGatesAssign, S
|
||||
use crate::boolean::{random_boolean, random_integer};
|
||||
|
||||
/// Number of assert in randomized tests
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 128;
|
||||
|
||||
// Use lower numbers for coverage to ensure fast tests to counter balance slowdown due to code
|
||||
// instrumentation
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
/// Number of ciphertext in the deep circuit test
|
||||
const NB_CT: usize = 8;
|
||||
|
||||
/// Number of gates computed in the deep circuit test
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_GATE: usize = 1 << 11;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_GATE: usize = 1 << 5;
|
||||
|
||||
mod default_parameters_tests {
|
||||
@@ -69,7 +69,7 @@ mod default_parameters_tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
mod low_prob_parameters_tests {
|
||||
use super::*;
|
||||
use crate::boolean::parameters::PARAMETERS_ERROR_PROB_2_POW_MINUS_165;
|
||||
@@ -162,7 +162,7 @@ mod default_parameters_ks_pbs_tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
mod low_prob_parameters_ks_pbs_tests {
|
||||
use super::*;
|
||||
use crate::boolean::parameters::PARAMETERS_ERROR_PROB_2_POW_MINUS_165_KS_PBS;
|
||||
@@ -209,7 +209,7 @@ mod low_prob_parameters_ks_pbs_tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
mod tfhe_lib_parameters_tests {
|
||||
use super::*;
|
||||
use crate::boolean::parameters::TFHE_LIB_PARAMETERS;
|
||||
|
||||
@@ -6,9 +6,9 @@ use crate::core_crypto::commons::generators::{
|
||||
use crate::core_crypto::commons::math::random::{ActivatedRandomGenerator, CompressionSeed};
|
||||
use crate::core_crypto::commons::test_tools;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_parallel_and_seeded_ggsw_encryption_equivalence<Scalar>(
|
||||
@@ -236,7 +236,7 @@ fn ggsw_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTestPar
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -304,7 +304,7 @@ fn ggsw_par_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus + Send + Sync>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -375,7 +375,7 @@ fn ggsw_seeded_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -446,7 +446,7 @@ fn ggsw_seeded_par_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus + Sync + Sen
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn glwe_encrypt_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
@@ -66,7 +66,7 @@ fn glwe_encrypt_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ fn glwe_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTestPar
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ fn glwe_list_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTe
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ fn glwe_trivial_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ fn glwe_allocate_trivial_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -417,7 +417,7 @@ fn glwe_seeded_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -498,7 +498,7 @@ fn glwe_seeded_list_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn glwe_encrypt_add_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
@@ -79,7 +79,7 @@ fn glwe_encrypt_add_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ fn glwe_encrypt_add_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTes
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ fn glwe_encrypt_plaintext_list_add_assign_decrypt_custom_mod<Scalar: UnsignedTor
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ fn glwe_encrypt_plaintext_list_sub_assign_decrypt_custom_mod<Scalar: UnsignedTor
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ fn glwe_encrypt_plaintext_add_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -478,7 +478,7 @@ fn glwe_encrypt_plaintext_sub_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -559,7 +559,7 @@ fn glwe_encrypt_opposite_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -641,7 +641,7 @@ fn glwe_encrypt_cleartext_mul_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -725,7 +725,7 @@ fn glwe_encrypt_cleartext_mul_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -806,7 +806,7 @@ fn glwe_encrypt_sub_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -887,7 +887,7 @@ fn glwe_encrypt_sub_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTes
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn glwe_encrypt_sample_extract_decrypt_custom_mod<Scalar: UnsignedTorus + Send + Sync>(
|
||||
@@ -113,7 +113,7 @@ fn glwe_encrypt_sample_extract_decrypt_custom_mod<Scalar: UnsignedTorus + Send +
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ use crate::core_crypto::commons::parameters::{
|
||||
use crate::core_crypto::commons::test_tools::new_secret_random_generator;
|
||||
use crate::core_crypto::entities::*;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_parallel_and_seeded_bsk_gen_equivalence<T: UnsignedTorus + Sync + Send>(
|
||||
|
||||
@@ -5,9 +5,9 @@ use crate::core_crypto::commons::generators::{
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::ActivatedRandomGenerator;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_seeded_lwe_cpk_gen_equivalence<Scalar: UnsignedTorus>(
|
||||
|
||||
@@ -2,9 +2,9 @@ use super::*;
|
||||
use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
use crate::core_crypto::commons::test_tools;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn parallel_and_seeded_lwe_list_encryption_equivalence<Scalar: UnsignedTorus + Sync + Send>(
|
||||
@@ -195,7 +195,7 @@ fn lwe_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTestPara
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ fn lwe_allocate_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ fn lwe_trivial_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ fn lwe_allocate_trivial_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ fn lwe_list_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTes
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ fn lwe_list_par_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus + Sync + Send>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -560,7 +560,7 @@ fn lwe_public_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicT
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -635,7 +635,7 @@ fn lwe_seeded_public_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -718,7 +718,7 @@ fn lwe_seeded_list_par_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus + Sync +
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -784,7 +784,7 @@ fn lwe_seeded_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicT
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -845,7 +845,7 @@ fn lwe_seeded_allocate_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -982,7 +982,7 @@ fn lwe_compact_public_encrypt_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn lwe_encrypt_ks_decrypt_custom_mod<Scalar: UnsignedTorus + Send + Sync>(
|
||||
@@ -101,7 +101,7 @@ fn lwe_encrypt_ks_decrypt_custom_mod<Scalar: UnsignedTorus + Send + Sync>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ use crate::core_crypto::commons::generators::{
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::ActivatedRandomGenerator;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_seeded_lwe_ksk_gen_equivalence<Scalar: UnsignedTorus + Send + Sync>(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn lwe_encrypt_add_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
@@ -67,7 +67,7 @@ fn lwe_encrypt_add_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ fn lwe_encrypt_add_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTest
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ fn lwe_encrypt_plaintext_add_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ fn lwe_encrypt_plaintext_sub_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,7 @@ fn lwe_encrypt_opposite_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -409,7 +409,7 @@ fn lwe_encrypt_ciphertext_cleartext_mul_assign_decrypt_custom_mod<Scalar: Unsign
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -481,7 +481,7 @@ fn lwe_encrypt_cleartext_mul_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -570,7 +570,7 @@ fn lwe_encrypt_sub_assign_decrypt_custom_mod<Scalar: UnsignedTorus>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -659,7 +659,7 @@ fn lwe_encrypt_sub_decrypt_custom_mod<Scalar: UnsignedTorus>(params: ClassicTest
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ use crate::core_crypto::commons::test_tools::new_secret_random_generator;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::prelude::CastFrom;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_parallel_and_seeded_multi_bit_bsk_gen_equivalence<
|
||||
|
||||
@@ -3,14 +3,14 @@ use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
// Divided by two compared to other tests, we are running the algorithm twice for determinism
|
||||
const NB_TESTS_LIGHT: usize = 5;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS_LIGHT: usize = 1;
|
||||
|
||||
pub fn generate_keys<
|
||||
@@ -169,7 +169,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ fn lwe_encrypt_multi_bit_deterministic_pbs_decrypt_custom_mod<Scalar>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -528,7 +528,7 @@ fn std_lwe_encrypt_multi_bit_deterministic_pbs_decrypt_custom_mod<Scalar>(
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn generate_keys<Scalar: UnsignedTorus + Sync + Send + Serialize + DeserializeOwned>(
|
||||
@@ -111,7 +111,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ use crate::core_crypto::commons::generators::{
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::ActivatedRandomGenerator;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_seeded_lwe_pksk_gen_equivalence<Scalar: UnsignedTorus>(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
fn test_parallel_pfpks_equivalence<Scalar: UnsignedTorus + Send + Sync>(
|
||||
|
||||
@@ -3,9 +3,9 @@ use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
pub fn generate_keys<
|
||||
@@ -158,7 +158,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does
|
||||
// not yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -519,7 +519,7 @@ where
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does not
|
||||
// yield higher coverage
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@ use dyn_stack::{GlobalPodBuffer, PodStack, ReborrowMut, StackReq};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
// Tests take about 2-3 seconds on a laptop with this number
|
||||
const NB_TESTS: usize = 32;
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS_LIGHT: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS_LIGHT: usize = 1;
|
||||
|
||||
pub fn generate_keys<
|
||||
@@ -802,9 +802,9 @@ fn test_wop_add_one(params: FftWopPbsTestParams<u64>) {
|
||||
// We are going to encrypt 10 bits
|
||||
let number_of_input_bits: usize = 10;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const SIZE: usize = 10;
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const SIZE: usize = 1;
|
||||
|
||||
// Test on 610, binary representation 10011 00010
|
||||
|
||||
@@ -316,7 +316,7 @@ fn test_ct_scalar_op_assign_noise_level_propagation(sk: &ServerKey, ct: &Ciphert
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))] // This test is ignored in coverage, it takes around 4 hours to run otherwise.
|
||||
#[cfg(not(tarpaulin))] // This test is ignored in coverage, it takes around 4 hours to run otherwise.
|
||||
#[test]
|
||||
fn test_noise_level_propagation_ci_run_filter() {
|
||||
let params = PARAM_MESSAGE_2_CARRY_2_KS_PBS;
|
||||
|
||||
@@ -6,29 +6,29 @@ use paste::paste;
|
||||
use rand::Rng;
|
||||
|
||||
/// Number of assert in randomized tests
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 200;
|
||||
/// Number of iterations in randomized tests for smart operations
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS_SMART: usize = 10;
|
||||
/// Number of sub tests used to increase degree of ciphertexts
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_SUB_TEST_SMART: usize = 40;
|
||||
|
||||
// Use lower numbers for coverage to ensure fast tests to counter balance slowdown due to code
|
||||
// instrumentation
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
/// Number of iterations in randomized tests for smart operations
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS_SMART: usize = 1;
|
||||
// This constant is tailored to trigger a message extract during operation processing.
|
||||
// It's applicable for PARAM_MESSAGE_2_CARRY_2_KS_PBS parameters set.
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_SUB_TEST_SMART: usize = 5;
|
||||
|
||||
// Macro to generate tests for all parameter sets
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
macro_rules! create_parametrized_test{
|
||||
($name:ident { $($param:ident),* }) => {
|
||||
paste! {
|
||||
@@ -82,7 +82,7 @@ macro_rules! create_parametrized_test{
|
||||
}
|
||||
|
||||
// Test against a small subset of parameters to speed up coverage tests
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
macro_rules! create_parametrized_test{
|
||||
($name:ident { $($param:ident),* }) => {
|
||||
paste! {
|
||||
@@ -105,7 +105,7 @@ macro_rules! create_parametrized_test{
|
||||
}
|
||||
|
||||
//Macro to generate tests for parameters sets compatible with the bivariate pbs
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
macro_rules! create_parametrized_test_bivariate_pbs_compliant{
|
||||
($name:ident { $($param:ident),* }) => {
|
||||
paste! {
|
||||
@@ -147,7 +147,7 @@ macro_rules! create_parametrized_test_bivariate_pbs_compliant{
|
||||
}
|
||||
|
||||
// Test against a small subset of parameters to speed up coverage tests
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
macro_rules! create_parametrized_test_bivariate_pbs_compliant{
|
||||
($name:ident { $($param:ident),* }) => {
|
||||
paste! {
|
||||
@@ -220,19 +220,19 @@ create_parametrized_test!(shortint_trivial_pbs_many_lut);
|
||||
// Public key tests are limited to small parameter sets to avoid blowing up memory and large testing
|
||||
// times. Compressed keygen takes 20 minutes for params 2_2 and for encryption as well.
|
||||
// 2_2 uncompressed keys take ~2 GB and 3_3 about ~34 GB, hence why we stop at 2_2.
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
#[test]
|
||||
fn test_shortint_compressed_public_key_smart_add_param_message_1_carry_1_ks_pbs() {
|
||||
shortint_compressed_public_key_smart_add(PARAM_MESSAGE_1_CARRY_1_KS_PBS);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
#[test]
|
||||
fn test_shortint_public_key_smart_add_param_message_1_carry_1_ks_pbs() {
|
||||
shortint_public_key_smart_add(PARAM_MESSAGE_1_CARRY_1_KS_PBS);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
#[test]
|
||||
fn test_shortint_public_key_smart_add_param_message_2_carry_2_ks_pbs() {
|
||||
shortint_public_key_smart_add(PARAM_MESSAGE_2_CARRY_2_KS_PBS);
|
||||
|
||||
@@ -5,23 +5,23 @@ use paste::paste;
|
||||
use rand::Rng;
|
||||
|
||||
/// Number of assert in randomized tests
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 30;
|
||||
/// Number of sub tests used to increase degree of ciphertexts
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_SUB_TEST: usize = 40;
|
||||
|
||||
// Use lower numbers for coverage to ensure fast tests to counter balance slowdown due to code
|
||||
// instrumentation
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_TESTS: usize = 1;
|
||||
// This constant is tailored to trigger a message extract during operation processing.
|
||||
// It's applicable for PARAM_MESSAGE_2_CARRY_2_KS_PBS parameters set.
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
const NB_SUB_TEST: usize = 5;
|
||||
|
||||
// Macro to generate tests for all parameter sets
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
macro_rules! create_parametrized_test{
|
||||
($name:ident { $($param:ident),* }) => {
|
||||
paste! {
|
||||
@@ -97,7 +97,7 @@ macro_rules! create_parametrized_test{
|
||||
}
|
||||
|
||||
// Test against a small subset of parameters to speed up coverage tests
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
macro_rules! create_parametrized_test{
|
||||
($name:ident { $($param:ident),* }) => {
|
||||
paste! {
|
||||
|
||||
@@ -11,7 +11,7 @@ use rand::Rng;
|
||||
|
||||
const NB_TESTS: usize = 1;
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
macro_rules! create_parametrized_test{
|
||||
($name:ident { $( ($sks_param:ident, $wopbs_param:ident) ),* }) => {
|
||||
paste! {
|
||||
@@ -34,7 +34,7 @@ macro_rules! create_parametrized_test{
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
macro_rules! create_parametrized_wopbs_only_test{
|
||||
($name:ident { $( $wopbs_param:ident ),* }) => {
|
||||
paste! {
|
||||
@@ -58,7 +58,7 @@ macro_rules! create_parametrized_wopbs_only_test{
|
||||
}
|
||||
|
||||
// Test against a small subset of parameters to speed up coverage tests
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
macro_rules! create_parametrized_test{
|
||||
($name:ident { $( ($sks_param:ident, $wopbs_param:ident) ),* }) => {
|
||||
paste! {
|
||||
@@ -78,7 +78,7 @@ macro_rules! create_parametrized_test{
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "__coverage")]
|
||||
#[cfg(tarpaulin)]
|
||||
macro_rules! create_parametrized_wopbs_only_test{
|
||||
($name:ident { $( $wopbs_param:ident ),* }) => {
|
||||
paste! {
|
||||
@@ -100,7 +100,7 @@ macro_rules! create_parametrized_wopbs_only_test{
|
||||
|
||||
create_parametrized_test!(generate_lut);
|
||||
create_parametrized_test!(generate_lut_modulus);
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
create_parametrized_wopbs_only_test!(generate_lut_modulus_not_power_of_two);
|
||||
|
||||
fn generate_lut(params: (ClassicPBSParameters, WopbsParameters)) {
|
||||
@@ -152,7 +152,7 @@ fn generate_lut_modulus(params: (ClassicPBSParameters, WopbsParameters)) {
|
||||
|
||||
// Coverage time is taking to long due to key generation (around 400s)
|
||||
// Keycache cannot be applied without turning the test into a flaky one.
|
||||
#[cfg(not(feature = "__coverage"))]
|
||||
#[cfg(not(tarpaulin))]
|
||||
fn generate_lut_modulus_not_power_of_two(params: WopbsParameters) {
|
||||
let (cks, sks) = gen_keys(params);
|
||||
let wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks);
|
||||
|
||||
Reference in New Issue
Block a user