mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Add tests to BDD
This commit is contained in:
@@ -11,7 +11,7 @@ use crate::layouts::prepared::GLWESecretPreparedToRef;
|
||||
use crate::layouts::{GGSW, GGSWInfos, GGSWToRef, GLWEInfos, GLWEPlaintext, LWEInfos, prepared::GLWESecretPrepared};
|
||||
|
||||
impl<D: DataRef> GGSW<D> {
|
||||
pub fn assert_noise<M, BE: Backend, P, S, F>(&self, module: &M, sk_prepared: &S, pt_want: &P, max_noise: F)
|
||||
pub fn assert_noise<M, BE: Backend, P, S, F>(&self, module: &M, sk_prepared: &S, pt_want: &P, max_noise: &F)
|
||||
where
|
||||
S: GLWESecretPreparedToRef<BE>,
|
||||
P: ScalarZnxToRef,
|
||||
@@ -32,7 +32,7 @@ impl<D: DataRef> GGSW<D> {
|
||||
}
|
||||
|
||||
pub trait GGSWNoise<BE: Backend> {
|
||||
fn ggsw_assert_noise<R, S, P, F>(&self, res: &R, sk_prepared: &S, pt_want: &P, max_noise: F)
|
||||
fn ggsw_assert_noise<R, S, P, F>(&self, res: &R, sk_prepared: &S, pt_want: &P, max_noise: &F)
|
||||
where
|
||||
R: GGSWToRef,
|
||||
S: GLWESecretPreparedToRef<BE>,
|
||||
@@ -57,7 +57,7 @@ where
|
||||
Scratch<BE>: ScratchTakeBasic,
|
||||
ScratchOwned<BE>: ScratchOwnedBorrow<BE> + ScratchOwnedAlloc<BE>,
|
||||
{
|
||||
fn ggsw_assert_noise<R, S, P, F>(&self, res: &R, sk_prepared: &S, pt_want: &P, max_noise: F)
|
||||
fn ggsw_assert_noise<R, S, P, F>(&self, res: &R, sk_prepared: &S, pt_want: &P, max_noise: &F)
|
||||
where
|
||||
R: GGSWToRef,
|
||||
S: GLWESecretPreparedToRef<BE>,
|
||||
|
||||
@@ -168,7 +168,7 @@ where
|
||||
) + 0.5
|
||||
};
|
||||
|
||||
ct_out.assert_noise(module, &sk_prepared, &pt_scalar, max_noise);
|
||||
ct_out.assert_noise(module, &sk_prepared, &pt_scalar, &max_noise);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ where
|
||||
) + 0.5
|
||||
};
|
||||
|
||||
ct.assert_noise(module, &sk_prepared, &pt_scalar, max_noise);
|
||||
ct.assert_noise(module, &sk_prepared, &pt_scalar, &max_noise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ where
|
||||
|
||||
let noise_f = |_col_i: usize| -(k as f64) + SIGMA.log2() + 0.5;
|
||||
|
||||
ct.assert_noise(module, &sk_prepared, &pt_scalar, noise_f);
|
||||
ct.assert_noise(module, &sk_prepared, &pt_scalar, &noise_f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ where
|
||||
let mut ct: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_infos);
|
||||
ct.decompress(module, &ct_compressed);
|
||||
|
||||
ct.assert_noise(module, &sk_prepared, &pt_scalar, noise_f);
|
||||
ct.assert_noise(module, &sk_prepared, &pt_scalar, &noise_f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ where
|
||||
) + 0.5
|
||||
};
|
||||
|
||||
ggsw_out.assert_noise(module, &sk_prepared, &pt_in, max_noise);
|
||||
ggsw_out.assert_noise(module, &sk_prepared, &pt_in, &max_noise);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ where
|
||||
) + 0.5
|
||||
};
|
||||
|
||||
ggsw_out.assert_noise(module, &sk_prepared, &pt_in, max_noise);
|
||||
ggsw_out.assert_noise(module, &sk_prepared, &pt_in, &max_noise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ where
|
||||
) + 0.5
|
||||
};
|
||||
|
||||
ggsw_out.assert_noise(module, &sk_out_prepared, &pt_scalar, max_noise);
|
||||
ggsw_out.assert_noise(module, &sk_out_prepared, &pt_scalar, &max_noise);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ where
|
||||
) + 0.5
|
||||
};
|
||||
|
||||
ggsw_out.assert_noise(module, &sk_out_prepared, &pt_scalar, max_noise);
|
||||
ggsw_out.assert_noise(module, &sk_out_prepared, &pt_scalar, &max_noise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user