small changes in tests

This commit is contained in:
debris 2015-12-03 11:36:20 +01:00
parent dc316dcfeb
commit 611226c117
7 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,22 @@
{
"input":
[
{
"operation": "append_list",
"len": 3
},
{
"operation": "append",
"value": ""
},
{
"operation": "append",
"value": ""
},
{
"operation": "append",
"value": ""
}
],
"output": "0xc3808080"
}

View File

@ -0,0 +1,19 @@
{
"input":
[
{
"operation": "append_list",
"len": 3
},
{
"operation": "append_empty"
},
{
"operation": "append_empty"
},
{
"operation": "append_empty"
}
],
"output": "0xc3808080"
}

View File

@ -1335,6 +1335,20 @@ mod tests {
0x80, 0x80, 0x80, 0x80, 0x80, 0x80]); 0x80, 0x80, 0x80, 0x80, 0x80, 0x80]);
} }
#[test]
fn rlp_stream_list4() {
let mut stream = RlpStream::new();
stream.append_list(17);
let v: Vec<u8> = vec![];
for _ in 0..17 {
stream.append(&v);
}
let out = stream.out();
assert_eq!(out, vec![0xd1, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80]);
}
#[test] #[test]
fn rlp_stream_list3() { fn rlp_stream_list3() {
let mut stream = RlpStream::new(); let mut stream = RlpStream::new();
@ -1503,7 +1517,7 @@ mod tests {
#[test] #[test]
fn test_rlp_json() { fn test_rlp_json() {
println!("Json rlp test: "); println!("Json rlp test: ");
execute_tests_from_directory::<rlptest::RlpStreamTest, _>("json-tests/json/rlp/*.json", &mut | file, input, output | { execute_tests_from_directory::<rlptest::RlpStreamTest, _>("json-tests/json/rlp/stream/*.json", &mut | file, input, output | {
println!("file: {}", file); println!("file: {}", file);
let mut stream = RlpStream::new(); let mut stream = RlpStream::new();