pub fn test_object_encoding_roundtrip<T>(
object: &T
) -> Result<Vec<u8>, DataEncodingTestFailure<T>> where
T: StrictEncode + StrictDecode + PartialEq + Clone + Debug,
👎 Deprecated since 1.6.1:
use strict_encoding_test crate instead
Expand description
Test helper performing encode-decode roundtrip for a provided object. Object
type must be PartialEq + Clone + Debug
.
Returns
If suceeds, encoded byte string representing the object. Otheriwse,
DataEncodingTestFailure
(see description below)
Error
Errors on:
- encoding or decoding failures;
- if the original object is not equivalent to its decoded version;
- if encoder returns number of bytes that does not match the length of the encoded data.
Panics
Function does not panics and instead returns DataEncodingTestFailure
for
each type of test failures.