From 90b8b612cca168dcfdd100d1772fc81295d97b8e Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Sun, 14 May 2017 00:21:23 +0800 Subject: [PATCH] add asserts for spec::basic_authority --- json/src/spec/basic_authority.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/json/src/spec/basic_authority.rs b/json/src/spec/basic_authority.rs index 06f50268e..01fe8f088 100644 --- a/json/src/spec/basic_authority.rs +++ b/json/src/spec/basic_authority.rs @@ -42,7 +42,12 @@ pub struct BasicAuthority { #[cfg(test)] mod tests { use serde_json; + use uint::Uint; + use util::U256; + use hash::Address; + use util::hash::H160; use spec::basic_authority::BasicAuthority; + use spec::validator_set::ValidatorSet; #[test] fn basic_authority_deserialization() { @@ -56,6 +61,11 @@ mod tests { } }"#; - let _deserialized: BasicAuthority = serde_json::from_str(s).unwrap(); + let deserialized: BasicAuthority = serde_json::from_str(s).unwrap(); + + assert_eq!(deserialized.params.gas_limit_bound_divisor, Uint(U256::from(0x0400))); + assert_eq!(deserialized.params.duration_limit, Uint(U256::from(0x0d))); + let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]); + assert_eq!(deserialized.params.validators, vs); } }