Anti-regression tests for starter byte
@@ -54,6 +54,11 @@ impl StarterByte {
mod tests {
use super::*;
+ #[test]
+ fn test_noprefix_consistency() {
+ assert_eq!(StarterByte::prefix(8), Ok(StarterByte::noprefix()));
+ }
+
#[test]
fn test_prefix_transform_to_mask() {
assert_eq!(StarterByte::prefix(6).unwrap().mask, 63);
@@ -79,4 +84,11 @@ mod tests {
assert_eq!(StarterByte::prefix(15), Err(Error::InvalidPrefix(15)));
}
+ #[test]
+ fn test_clear_bytes_bit_after_prefix() {
+ let starter = StarterByte::valued(6, 255)
+ .expect("valid starter byte");
+ assert_eq!(starter.safe_start(), 255 & (128 | 64));
+ }
+
}
