small changes in tests
This commit is contained in:
parent
dc316dcfeb
commit
611226c117
22
json-tests/json/rlp/stream/list_of_empty_data.json
Normal file
22
json-tests/json/rlp/stream/list_of_empty_data.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"input":
|
||||
[
|
||||
{
|
||||
"operation": "append_list",
|
||||
"len": 3
|
||||
},
|
||||
{
|
||||
"operation": "append",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"operation": "append",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"operation": "append",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"output": "0xc3808080"
|
||||
}
|
19
json-tests/json/rlp/stream/list_of_empty_data2.json
Normal file
19
json-tests/json/rlp/stream/list_of_empty_data2.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"input":
|
||||
[
|
||||
{
|
||||
"operation": "append_list",
|
||||
"len": 3
|
||||
},
|
||||
{
|
||||
"operation": "append_empty"
|
||||
},
|
||||
{
|
||||
"operation": "append_empty"
|
||||
},
|
||||
{
|
||||
"operation": "append_empty"
|
||||
}
|
||||
],
|
||||
"output": "0xc3808080"
|
||||
}
|
16
src/rlp.rs
16
src/rlp.rs
@ -1335,6 +1335,20 @@ mod tests {
|
||||
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]
|
||||
fn rlp_stream_list3() {
|
||||
let mut stream = RlpStream::new();
|
||||
@ -1503,7 +1517,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_rlp_json() {
|
||||
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);
|
||||
|
||||
let mut stream = RlpStream::new();
|
||||
|
Loading…
Reference in New Issue
Block a user