Skip to content

Commit f1026bc

Browse files
committed
add basic block_flags unit test
1 parent cbb1195 commit f1026bc

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/elements.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,52 @@ mod tests {
495495
const mkv: &[u8] = include_bytes!("../assets/single_stream.mkv");
496496
const webm: &[u8] = include_bytes!("../assets/big-buck-bunny_trailer.webm");
497497

498+
#[test]
499+
fn block_flags() {
500+
let test = [
501+
(
502+
0b1000_1011,
503+
Some(BlockFlags {
504+
keyframe: true,
505+
invisible: true,
506+
lacing: Lacing::Xiph,
507+
discardable: true,
508+
}),
509+
),
510+
(
511+
0b0000_0000,
512+
Some(BlockFlags {
513+
keyframe: false,
514+
invisible: false,
515+
lacing: Lacing::None,
516+
discardable: false,
517+
}),
518+
),
519+
(
520+
0b0000_0110,
521+
Some(BlockFlags {
522+
keyframe: false,
523+
invisible: false,
524+
lacing: Lacing::EBML,
525+
discardable: false,
526+
}),
527+
),
528+
(
529+
0b0000_0101,
530+
Some(BlockFlags {
531+
keyframe: false,
532+
invisible: false,
533+
lacing: Lacing::FixedSize,
534+
discardable: true,
535+
}),
536+
),
537+
];
538+
539+
for (data, flags) in test {
540+
assert_eq!(super::block_flags(data), flags);
541+
}
542+
}
543+
498544
#[test]
499545
fn mkv_segment_root() {
500546
let res = segment(&mkv[47..100]);

0 commit comments

Comments
 (0)