diff --git a/implementations/rust/src/lib.rs b/implementations/rust/src/lib.rs index ee5f9f6..1b63b94 100644 --- a/implementations/rust/src/lib.rs +++ b/implementations/rust/src/lib.rs @@ -206,6 +206,23 @@ mod decoder_tests { assert_eq!(v.annotations().len(), 0); 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)]