From e41a3822a6c525179a8d585e2d260175acec4c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 2 Oct 2020 16:52:36 +0200 Subject: [PATCH] Add a simple test for the CboRoaringBitmapCodec --- src/heed_codec/cbo_roaring_bitmap_codec.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/heed_codec/cbo_roaring_bitmap_codec.rs b/src/heed_codec/cbo_roaring_bitmap_codec.rs index 337f4df48..b9b802a38 100644 --- a/src/heed_codec/cbo_roaring_bitmap_codec.rs +++ b/src/heed_codec/cbo_roaring_bitmap_codec.rs @@ -67,3 +67,18 @@ impl heed::BytesEncode<'_> for CboRoaringBitmapCodec { Some(Cow::Owned(vec)) } } + +#[cfg(test)] +mod tests { + use std::iter::FromIterator; + use heed::{BytesEncode, BytesDecode}; + use super::*; + + #[test] + fn limit_four() { + let input = RoaringBitmap::from_iter(vec![0, 1, 2, 3]); + let bytes = CboRoaringBitmapCodec::bytes_encode(&input).unwrap(); + let output = CboRoaringBitmapCodec::bytes_decode(&bytes).unwrap(); + assert_eq!(input, output); + } +}