From 844822277da0d5fb6bb01dcb3e4f77d87e0fee9c Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Thu, 5 May 2016 11:32:08 +0900 Subject: [PATCH] blop --- src/postings/mod.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/postings/mod.rs b/src/postings/mod.rs index ef5874369..38bf17db5 100644 --- a/src/postings/mod.rs +++ b/src/postings/mod.rs @@ -3,6 +3,7 @@ mod recorder; mod serializer; mod writer; mod term_info; +mod chained_postings; mod vec_postings; pub use self::recorder::{Recorder, NothingRecorder, TermFrequencyRecorder, TFAndPositionRecorder}; @@ -11,8 +12,29 @@ pub use self::writer::PostingsWriter; pub use self::term_info::TermInfo; pub use self::postings::Postings; pub use self::vec_postings::VecPostings; +pub use self::chained_postings::ChainedPostings; - +#[cfg(test)] +mod tests { + + use super::*; + + fn test_chained_postings() { + let left = VecPostings::new(vec!(1u32, 3u32, 7u32)); + let right = VecPostings::new(vec!(0u32, 13u32)); + let mut chain = ChainedPostings::new(left, right, 16u32); + assert!(chain.next()); + assert_eq!(chain.doc(), 1u32); + assert!(chain.next()); + assert_eq!(chain.doc(), 3u32); + assert!(chain.next()); + assert_eq!(chain.doc(), 7u32); + assert!(chain.next()); + assert_eq!(chain.doc(), 16u32); + assert!(chain.next()); + assert_eq!(chain.doc(), 29u32); + } +} // #[cfg(test)] // mod tests {