mirror of
https://github.com/mii443/RustySecrets.git
synced 2025-08-22 16:25:32 +00:00
Refactoring to allow for a more flexible API.
This commit is contained in:
@ -1,22 +1,11 @@
|
||||
extern crate rusty_secrets;
|
||||
|
||||
use rusty_secrets::custom_error::{pie2io};
|
||||
use rusty_secrets::generate_shares;
|
||||
use std::error::Error;
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Threshold K can not be larger than N")]
|
||||
fn test_generate_invalid_k() {
|
||||
let share1 = "2-1-1YAYwmOHqZ69jA".to_string().into_bytes();
|
||||
|
||||
generate_shares(10, 5, &share1).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_errors() {
|
||||
let nan = "2a".to_string();
|
||||
match nan.parse::<u8>().map_err(pie2io) {
|
||||
Ok(_) => assert!(false),
|
||||
Err(x) => assert_eq!("Integer parsing error", x.description()),
|
||||
}
|
||||
generate_shares(10, 5, share1.as_slice(), true).unwrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user