more of env_info

This commit is contained in:
Nikolay Volf 2016-02-01 15:35:13 +04:00
parent 1778393a51
commit cf963b1957

View File

@ -67,22 +67,28 @@ mod tests {
use super::*; use super::*;
use rustc_serialize::*; use rustc_serialize::*;
use util::from_json::FromJson; use util::from_json::FromJson;
use util::hash::*;
use std::str::FromStr;
#[test] #[test]
fn it_serializes_form_json() { fn it_serializes_form_json() {
let env_info = EnvInfo::from_json(&json::Json::from_str( let env_info = EnvInfo::from_json(&json::Json::from_str(
r#" r#"
{ {
"currentCoinbase": "0x0000000000000000000000000000000000000000", "currentCoinbase": "0x000000f00000000f000000000000f00000000f00",
"currentNumber": 0, "currentNumber": 1112339,
"currentDifficulty": 0, "currentDifficulty": 50000,
"currentGasLimit" : 0, "currentGasLimit" : 40000,
"currentTimestamp" : 0 "currentTimestamp" : 1100
} }
"# "#
).unwrap()); ).unwrap());
assert_eq!(env_info.number, 0); assert_eq!(env_info.number, 1112339);
assert_eq!(env_info.author, Address::from_str("000000f00000000f000000000000f00000000f00").unwrap());
assert_eq!(env_info.gas_limit, x!(40000));
assert_eq!(env_info.difficulty, x!(50000));
assert_eq!(env_info.gas_used, x!(0));
} }
#[test] #[test]