New tests
This commit is contained in:
parent
4b957d8785
commit
84f99fc471
|
@ -206,6 +206,23 @@ mod decoder_tests {
|
||||||
assert_eq!(v.annotations().len(), 0);
|
assert_eq!(v.annotations().len(), 0);
|
||||||
assert_eq!(v.value(), &Value::from(1));
|
assert_eq!(v.value(), &Value::from(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test] fn two_values_at_once() {
|
||||||
|
let mut buf = &b"\x81tPing\x81tPong"[..];
|
||||||
|
assert_eq!(buf.len(), 12);
|
||||||
|
let mut d = Decoder::<_, PlainValue>::new(&mut buf, None);
|
||||||
|
assert_eq!(d.next().unwrap().value(), &Value::simple_record("Ping", vec![]));
|
||||||
|
assert_eq!(d.next().unwrap().value(), &Value::simple_record("Pong", vec![]));
|
||||||
|
assert_eq!(buf.len(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test] fn buf_advanced() {
|
||||||
|
let mut buf = &b"\x81tPing\x81tPong"[..];
|
||||||
|
assert_eq!(buf.len(), 12);
|
||||||
|
let mut d = Decoder::<_, PlainValue>::new(&mut buf, None);
|
||||||
|
assert_eq!(d.next().unwrap().value(), &Value::simple_record("Ping", vec![]));
|
||||||
|
assert_eq!(buf.len(), 6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue