add asserts in spec param.rs
This commit is contained in:
parent
a61b249d57
commit
5c7c30cc4b
@ -64,21 +64,27 @@ pub struct Params {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
use uint::Uint;
|
||||||
|
use util::U256;
|
||||||
use spec::params::Params;
|
use spec::params::Params;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn params_deserialization() {
|
fn params_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"homesteadTransition": "0x118c30",
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"chainID" : "0x15",
|
"chainID" : "0x15",
|
||||||
"subprotocolName" : "exp",
|
"subprotocolName" : "exp",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"accountStartNonce": "0x00"
|
"accountStartNonce": "0x01"
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let _deserialized: Params = serde_json::from_str(s).unwrap();
|
let deserialized: Params = serde_json::from_str(s).unwrap();
|
||||||
// TODO: validate all fields
|
assert_eq!(deserialized.maximum_extra_data_size, Uint(U256::from(0x20)));
|
||||||
|
assert_eq!(deserialized.network_id, Uint(U256::from(0x1)));
|
||||||
|
assert_eq!(deserialized.chain_id, Some(Uint(U256::from(0x15))));
|
||||||
|
assert_eq!(deserialized.subprotocol_name, Some("exp".to_owned()));
|
||||||
|
assert_eq!(deserialized.min_gas_limit, Uint(U256::from(0x1388)));
|
||||||
|
assert_eq!(deserialized.account_start_nonce, Some(Uint(U256::from(0x01))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user