Add zst tests and some other parsing tests

This commit is contained in:
Elichai Turkel 2019-08-21 17:58:55 -04:00
parent ddb8e4fdf2
commit d7461e4cdc
No known key found for this signature in database
GPG Key ID: 9383CDE9E8E66A7F
1 changed files with 30 additions and 0 deletions

View File

@ -576,6 +576,36 @@ mod test {
PublicKey::from_slice(&[0x55; constants::PUBLIC_KEY_SIZE]), PublicKey::from_slice(&[0x55; constants::PUBLIC_KEY_SIZE]),
Err(InvalidPublicKey) Err(InvalidPublicKey)
); );
assert_eq!(
PublicKey::from_slice(&[]),
Err(InvalidPublicKey)
);
}
#[test]
fn test_seckey_from_bad_slice() {
// Bad sizes
assert_eq!(
SecretKey::from_slice(&[0; constants::SECRET_KEY_SIZE - 1]),
Err(InvalidSecretKey)
);
assert_eq!(
SecretKey::from_slice(&[0; constants::SECRET_KEY_SIZE + 1]),
Err(InvalidSecretKey)
);
// Bad parse
assert_eq!(
SecretKey::from_slice(&[0xff; constants::SECRET_KEY_SIZE]),
Err(InvalidSecretKey)
);
assert_eq!(
SecretKey::from_slice(&[0x00; constants::SECRET_KEY_SIZE]),
Err(InvalidSecretKey)
);
assert_eq!(
SecretKey::from_slice(&[]),
Err(InvalidSecretKey)
);
} }
#[test] #[test]