Function strict_encoding::test_helpers::test_encoding_roundtrip
source · [−]pub fn test_encoding_roundtrip<T>(
object: &T,
test_vec: impl AsRef<[u8]>
) -> Result<(), 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 double encode-decode roundtrip for an object
and a matching binary encoding test vector. Object type must be
PartialEq + Clone + Debug
.
Error
Errors on:
- encoding or decoding failures;
- if the original object is not equivalent to its decoded version;
- if the original test vector is not equivalent to its transcoded version;
- if encoder returns number of bytes that does not match the length of the test vector.
Panics
Function does not panics and instead returns DataEncodingTestFailure
for
each type of test failures.