Add failing boolean bitfield test

This commit is contained in:
Paul Hauner 2018-12-03 17:13:39 +11:00
parent 25364c337e
commit bedc1abec0
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -153,7 +153,7 @@ impl ssz::Decodable for BooleanBitfield {
#[cfg(test)]
mod tests {
use super::*;
use ssz::SszStream;
use ssz::{ssz_encode, Decodable, SszStream};
#[test]
fn test_new_bitfield() {
@ -341,4 +341,12 @@ mod tests {
let expected = BooleanBitfield::from_elem(18, true);
assert_eq!(field, expected);
}
#[test]
fn test_ssz_round_trip() {
let original = BooleanBitfield::from_bytes(&vec![18; 12][..]);
let ssz = ssz_encode(&original);
let (decoded, _) = BooleanBitfield::ssz_decode(&ssz, 0).unwrap();
assert_eq!(original, decoded);
}
}