Skip to content

Commit

Permalink
Problem: rlp2 tests failed due to incorrect crate name
Browse files Browse the repository at this point in the history
Solution: use rlp2 instead of rlp
  • Loading branch information
sjmackenzie committed Jun 13, 2017
1 parent 3b30ab3 commit d82031b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 41 deletions.
8 changes: 4 additions & 4 deletions rlp2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ pub const EMPTY_LIST_RLP: [u8; 1] = [0xC0; 1];
/// Shortcut function to decode trusted rlp
///
/// ```rust
/// extern crate rlp;
/// extern crate rlp2;
///
/// fn main () {
/// let data = vec![0x83, b'c', b'a', b't'];
/// let animal: String = rlp::decode(&data);
/// let animal: String = rlp2::decode(&data);
/// assert_eq!(animal, "cat".to_owned());
/// }
/// ```
Expand All @@ -93,11 +93,11 @@ pub fn decode_list<T>(bytes: &[u8]) -> Vec<T> where T: Decodable {
/// Shortcut function to encode structure into rlp.
///
/// ```rust
/// extern crate rlp;
/// extern crate rlp2;
///
/// fn main () {
/// let animal = "cat";
/// let out = rlp::encode(&animal).to_vec();
/// let out = rlp2::encode(&animal).to_vec();
/// assert_eq!(out, vec![0x83, b'c', b'a', b't']);
/// }
/// ```
Expand Down
40 changes: 20 additions & 20 deletions rlp2/src/rlpin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// The raw data of the RLP as slice.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand Down Expand Up @@ -73,8 +73,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// Returns number of RLP items.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand All @@ -91,8 +91,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// Returns the number of bytes in the data, or zero if it isn't data.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand All @@ -112,8 +112,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// slices is faster.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand All @@ -129,8 +129,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// No value
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![];
Expand All @@ -145,8 +145,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// Contains a zero-length string or zero-length list.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc0];
Expand All @@ -161,8 +161,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// List value
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand All @@ -177,8 +177,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// String value
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand All @@ -193,8 +193,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// Int value
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc1, 0x10];
Expand All @@ -210,8 +210,8 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view {
/// Get iterator over rlp-slices
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let data = vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'];
Expand Down
20 changes: 10 additions & 10 deletions rlp2/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ impl RlpStream {
/// Appends value to the end of stream, chainable.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let mut stream = RlpStream::new_list(2);
Expand Down Expand Up @@ -99,8 +99,8 @@ impl RlpStream {
/// Declare appending the list of given size, chainable.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let mut stream = RlpStream::new_list(2);
Expand Down Expand Up @@ -149,8 +149,8 @@ impl RlpStream {
/// Apends null to the end of stream, chainable.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let mut stream = RlpStream::new_list(2);
Expand Down Expand Up @@ -215,8 +215,8 @@ impl RlpStream {
/// Clear the output stream so far.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let mut stream = RlpStream::new_list(3);
Expand All @@ -237,8 +237,8 @@ impl RlpStream {
/// Returns true if stream doesnt expect any more items.
///
/// ```rust
/// extern crate rlp;
/// use rlp::*;
/// extern crate rlp2;
/// use rlp2::*;
///
/// fn main () {
/// let mut stream = RlpStream::new_list(2);
Expand Down
13 changes: 6 additions & 7 deletions rlp2/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern crate rlp;
extern crate rlp2;

use std::{fmt, cmp};
use rlp::{Encodable, Decodable, UntrustedRlp, RlpStream, DecoderError};
use rlp2::{Encodable, Decodable, UntrustedRlp, RlpStream, DecoderError};

#[test]
fn rlp_at() {
Expand Down Expand Up @@ -82,7 +82,7 @@ fn run_encode_tests<T>(tests: Vec<ETestPair<T>>)
where T: Encodable
{
for t in &tests {
let res = rlp::encode(&t.0);
let res = rlp2::encode(&t.0);
assert_eq!(&res[..], &t.1[..]);
}
}
Expand All @@ -93,7 +93,7 @@ fn run_encode_tests_list<T>(tests: Vec<VETestPair<T>>)
where T: Encodable
{
for t in &tests {
let res = rlp::encode_list(&t.0);
let res = rlp2::encode_list(&t.0);
assert_eq!(&res[..], &t.1[..]);
}
}
Expand Down Expand Up @@ -181,14 +181,14 @@ struct VDTestPair<T>(Vec<T>, Vec<u8>) where T: Decodable + fmt::Debug + cmp::Eq;

fn run_decode_tests<T>(tests: Vec<DTestPair<T>>) where T: Decodable + fmt::Debug + cmp::Eq {
for t in &tests {
let res: T = rlp::decode(&t.1);
let res: T = rlp2::decode(&t.1);
assert_eq!(res, t.0);
}
}

fn run_decode_tests_list<T>(tests: Vec<VDTestPair<T>>) where T: Decodable + fmt::Debug + cmp::Eq {
for t in &tests {
let res: Vec<T> = rlp::decode_list(&t.1);
let res: Vec<T> = rlp2::decode_list(&t.1);
assert_eq!(res, t.0);
}
}
Expand Down Expand Up @@ -367,4 +367,3 @@ fn test_rlp_stream_unbounded_list() {
stream.complete_unbounded_list();
assert!(stream.is_finished());
}

0 comments on commit d82031b

Please sign in to comment.