lighthouse-pulse/crypto/eth2_key_derivation/tests/tests.rs
Paul Hauner 4331834003
Directory Restructure (#1163)
* Move tests -> testing

* Directory restructure

* Update Cargo.toml during restructure

* Update Makefile during restructure

* Fix arbitrary path
2020-05-18 21:24:23 +10:00

29 lines
562 B
Rust

#![cfg(test)]
use eth2_key_derivation::DerivedKey;
#[test]
fn empty_seed() {
assert!(
DerivedKey::from_seed(&[]).is_err(),
"empty seed should fail"
);
}
#[test]
fn deterministic() {
assert_eq!(
DerivedKey::from_seed(&[42]).unwrap().secret(),
DerivedKey::from_seed(&[42]).unwrap().secret()
);
}
#[test]
fn children_deterministic() {
let master = DerivedKey::from_seed(&[42]).unwrap();
assert_eq!(
master.child(u32::max_value()).secret(),
master.child(u32::max_value()).secret(),
)
}