Skip to content

Commit 11a9726

Browse files
committed
refactor(common): 'tests_setup' behind 'test_tools' feature
1 parent 1d251ed commit 11a9726

File tree

6 files changed

+38
-19
lines changed

6 files changed

+38
-19
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
mod error;
22
mod interface;
3-
mod signer_fake;
43
mod signer_with_key;
5-
pub mod tests_setup;
64
mod verifier_standard;
75

86
pub use error::*;
97
pub use interface::*;
10-
pub use signer_fake::*;
118
pub use signer_with_key::*;
12-
pub use tests_setup::*;
139
pub use verifier_standard::*;
10+
11+
cfg_test_tools! {
12+
mod signer_fake;
13+
pub mod tests_setup;
14+
15+
pub use signer_fake::*;
16+
}

mithril-common/src/crypto_helper/cardano/kes/signer_fake.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ use std::sync::Mutex;
55

66
use crate::{
77
crypto_helper::{
8-
cardano::{
9-
create_kes_cryptographic_material, KesCryptographicMaterialForTest,
10-
KesPartyIndexForTest, KesSignerStandard,
8+
cardano::kes::{
9+
tests_setup::{
10+
create_kes_cryptographic_material, KesCryptographicMaterialForTest,
11+
KesPartyIndexForTest,
12+
},
13+
KesSignerStandard,
1114
},
1215
KesPeriod, KesSigner, OpCert,
1316
},

mithril-common/src/crypto_helper/cardano/kes/signer_with_key.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ impl KesSigner for KesSignerStandard {
6565
mod tests {
6666
use super::*;
6767

68-
use crate::crypto_helper::cardano::{
69-
kes::tests_setup::{create_kes_cryptographic_material, KesCryptographicMaterialForTest},
70-
KesPartyIndexForTest, KesVerifier, KesVerifierStandard,
68+
use crate::crypto_helper::cardano::kes::{
69+
tests_setup::{
70+
create_kes_cryptographic_material, KesCryptographicMaterialForTest,
71+
KesPartyIndexForTest,
72+
},
73+
KesVerifier, KesVerifierStandard,
7174
};
7275

7376
#[test]

mithril-common/src/crypto_helper/cardano/kes/verifier_standard.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ impl KesVerifier for KesVerifierStandard {
4747

4848
#[cfg(test)]
4949
mod tests {
50-
use crate::crypto_helper::cardano::{
51-
kes::tests_setup::{create_kes_cryptographic_material, KesCryptographicMaterialForTest},
52-
KesPartyIndexForTest, KesSigner, KesSignerStandard,
50+
use crate::crypto_helper::cardano::kes::{
51+
tests_setup::{
52+
create_kes_cryptographic_material, KesCryptographicMaterialForTest,
53+
KesPartyIndexForTest,
54+
},
55+
KesSigner, KesSignerStandard,
5356
};
5457

5558
use super::*;

mithril-common/src/crypto_helper/cardano/key_certification.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,20 @@ impl KeyRegWrapper {
299299

300300
#[cfg(test)]
301301
mod test {
302-
use super::*;
303-
use crate::crypto_helper::cardano::{
304-
kes::tests_setup::{create_kes_cryptographic_material, KesCryptographicMaterialForTest},
305-
KesPartyIndexForTest, KesSignerStandard,
302+
use crate::crypto_helper::cardano::kes::{
303+
tests_setup::{
304+
create_kes_cryptographic_material, KesCryptographicMaterialForTest,
305+
KesPartyIndexForTest,
306+
},
307+
KesSignerStandard,
306308
};
307309
use crate::crypto_helper::{OpCert, SerDeShelleyFileFormat};
308310

309311
use rand_chacha::ChaCha20Rng;
310312
use rand_core::SeedableRng;
311313

314+
use super::*;
315+
312316
#[test]
313317
fn test_vector_key_reg() {
314318
let params = StmParameters {

mithril-common/src/crypto_helper/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ cfg_test_tools! {
1616
pub use cardano::ColdKeyGenerator;
1717

1818
pub use cardano::{
19-
KesPeriod, KesSigner, KesSignerFake, KesSignerStandard, KesVerifier, KesVerifierStandard,
20-
KesVerifyError, OpCert, ProtocolInitializerErrorWrapper, ProtocolRegistrationErrorWrapper,
19+
KesPeriod, KesSigner, KesSignerStandard, KesVerifier, KesVerifierStandard, KesVerifyError,
20+
OpCert, ProtocolInitializerErrorWrapper, ProtocolRegistrationErrorWrapper,
2121
SerDeShelleyFileFormat, Sum6KesBytes,
2222
};
23+
cfg_test_tools! {
24+
pub use cardano::KesSignerFake;
25+
}
2326
pub use codec::*;
2427
pub use ed25519_alias::{era::*, genesis::*, manifest::*};
2528
pub use merkle_map::{MKMap, MKMapKey, MKMapNode, MKMapProof, MKMapValue};

0 commit comments

Comments
 (0)