Enum strict_encoding::test_helpers::EnumEncodingTestFailure [−][src]
pub enum EnumEncodingTestFailure<T> where
T: Clone + PartialEq + Debug, {
EncoderFailure(T, Error),
DecoderFailure(T, Error, Vec<u8>),
DecodedDiffersFromOriginal {
original: T,
decoded: T,
},
ValueMismatch {
enum_name: &'static str,
variant_name: &'static str,
expected: usize,
actual: usize,
},
EncodedValueMismatch {
enum_name: &'static str,
variant_name: &'static str,
expected: Vec<u8>,
actual: Vec<u8>,
},
DecoderWrongErrorOnUnknownValue(u8, Error),
UnknownDecodesToVariant(u8, T),
FailedEq(T),
FailedNe(T, T),
FailedOrd(T, T),
}
Expand description
Failures happening during strict encoding tests of enum encodings.
NB: These errors are specific for testing configuration and should not be used in non-test environment.
Variants
Failure during encoding enum variant
Tuple Fields of EncoderFailure
0: T
1: Error
Failure during decoding binary representation of enum variant
Test case failure representing mismatch between enum variant produced by decoding from the originally encoded enum variant
Fields of DecodedDiffersFromOriginal
Test case failure representing mismatch between expected enum variant primitive value and the actual primitive value assigned to the enum variant by the rust compiler
Fields of ValueMismatch
Test case failure representing failed byte string representation of the encoded enum variant
Fields of EncodedValueMismatch
Test case failure representing incorrect decoder error during processing out-of-enum range value
Tuple Fields of DecoderWrongErrorOnUnknownValue
Test case failure representing a out-of-enum range primitive value still being interpreted as one of enum variants
Tuple Fields of UnknownDecodesToVariant
0: u8
Value which was decoded into an enum variant
1: T
Enum variant resulting from decoding wrong value
Test case failure due to wrong PartialEq
or Eq
implementation:
enum variant is not equal to itself
Test case failure due to wrong PartialEq
or Eq
implementation:
two distinct enum variants are still equal
Tuple Fields of FailedNe
Test case failure due to wrong PartialOrd
or Ord
implementation
happening when enum variants ordering is broken
Tuple Fields of FailedOrd
Trait Implementations
Performs the conversion.
impl<T: PartialEq> PartialEq<EnumEncodingTestFailure<T>> for EnumEncodingTestFailure<T> where
T: Clone + PartialEq + Debug,
impl<T: PartialEq> PartialEq<EnumEncodingTestFailure<T>> for EnumEncodingTestFailure<T> where
T: Clone + PartialEq + Debug,
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<T> RefUnwindSafe for EnumEncodingTestFailure<T> where
T: RefUnwindSafe,
impl<T> Send for EnumEncodingTestFailure<T> where
T: Send,
impl<T> Sync for EnumEncodingTestFailure<T> where
T: Sync,
impl<T> Unpin for EnumEncodingTestFailure<T> where
T: Unpin,
impl<T> UnwindSafe for EnumEncodingTestFailure<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more