Skip to content

Commit a55995a

Browse files
committed
Moving obsolete unit tests
1 parent e092e93 commit a55995a

File tree

4 files changed

+151
-229
lines changed

4 files changed

+151
-229
lines changed

src/collector/sort_key/sort_by_score.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl SortKeyComputer for SortBySimilarityScore {
5454
}
5555

5656
Ok(top_n
57-
.into_sorted_vec()
57+
.into_vec()
5858
.into_iter()
5959
.map(|cid| (cid.sort_key, DocAddress::new(segment_ord, cid.doc)))
6060
.collect())

src/collector/sort_key_top_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ where
124124
let segment_ord = self.segment_ord;
125125
let segment_hits: Vec<(TSegmentSortKeyComputer::SortKey, DocAddress)> = self
126126
.topn_computer
127-
.into_sorted_vec()
127+
.into_vec()
128128
.into_iter()
129129
.map(|comparable_doc| {
130130
let sort_key = self

src/collector/top_collector.rs

Lines changed: 0 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -62,185 +62,3 @@ impl<T: PartialOrd, D: PartialOrd, const R: bool> PartialEq for ComparableDoc<T,
6262
}
6363

6464
impl<T: PartialOrd, D: PartialOrd, const R: bool> Eq for ComparableDoc<T, D, R> {}
65-
66-
// #[cfg(test)]
67-
// mod tests {
68-
// use super::TopSegmentCollector;
69-
// use crate::collector::sort_key::NaturalComparator;
70-
// use crate::DocAddress;
71-
72-
// #[test]
73-
// fn test_top_collector_not_at_capacity() {
74-
// let mut top_collector = TopSegmentCollector::new(0, 4, NaturalComparator);
75-
// top_collector.collect(1, 0.8);
76-
// top_collector.collect(3, 0.2);
77-
// top_collector.collect(5, 0.3);
78-
// assert_eq!(
79-
// top_collector.harvest(),
80-
// vec![
81-
// (0.8, DocAddress::new(0, 1)),
82-
// (0.3, DocAddress::new(0, 5)),
83-
// (0.2, DocAddress::new(0, 3))
84-
// ]
85-
// );
86-
// }
87-
88-
// #[test]
89-
// fn test_top_collector_at_capacity() {
90-
// let mut top_collector = TopSegmentCollector::new(0, 4, NaturalComparator);
91-
// top_collector.collect(1, 0.8);
92-
// top_collector.collect(3, 0.2);
93-
// top_collector.collect(5, 0.3);
94-
// top_collector.collect(7, 0.9);
95-
// top_collector.collect(9, -0.2);
96-
// assert_eq!(
97-
// top_collector.harvest(),
98-
// vec![
99-
// (0.9, DocAddress::new(0, 7)),
100-
// (0.8, DocAddress::new(0, 1)),
101-
// (0.3, DocAddress::new(0, 5)),
102-
// (0.2, DocAddress::new(0, 3))
103-
// ]
104-
// );
105-
// }
106-
107-
// #[test]
108-
// fn test_top_segment_collector_stable_ordering_for_equal_feature() {
109-
// // given that the documents are collected in ascending doc id order,
110-
// // when harvesting we have to guarantee stable sorting in case of a tie
111-
// // on the score
112-
// let doc_ids_collection = [4, 5, 6];
113-
// let score = 3.3f32;
114-
115-
// let mut top_collector_limit_2 = TopSegmentCollector::new(0, 2, NaturalComparator);
116-
// for id in &doc_ids_collection {
117-
// top_collector_limit_2.collect(*id, score);
118-
// }
119-
120-
// let mut top_collector_limit_3 = TopSegmentCollector::new(0, 3, NaturalComparator);
121-
// for id in &doc_ids_collection {
122-
// top_collector_limit_3.collect(*id, score);
123-
// }
124-
125-
// let docs_limit_2 = top_collector_limit_2.harvest();
126-
// let docs_limit_3 = top_collector_limit_3.harvest();
127-
// dbg!(&docs_limit_2);
128-
// dbg!(&docs_limit_3);
129-
130-
// assert_eq!(&docs_limit_2, &docs_limit_3[..2],);
131-
// }
132-
133-
// // #[test]
134-
// // fn test_top_collector_with_limit_and_offset() {
135-
// // let collector: TopCollector<f64> = TopDocs::with_limit(2).and_offset(1).into();
136-
137-
// // let results = collector
138-
// // .merge_fruits(vec![vec![
139-
// // (0.9, DocAddress::new(0, 1)),
140-
// // (0.8, DocAddress::new(0, 2)),
141-
// // (0.7, DocAddress::new(0, 3)),
142-
// // (0.6, DocAddress::new(0, 4)),
143-
// // (0.5, DocAddress::new(0, 5)),
144-
// // ]]);
145-
146-
// // assert_eq!(
147-
// // results,
148-
// // vec![(0.8, DocAddress::new(0, 2)), (0.7, DocAddress::new(0, 3)),]
149-
// // );
150-
// // }
151-
152-
// // #[test]
153-
// // fn test_top_collector_with_limit_larger_than_set_and_offset() {
154-
// // let collector: TopCollector<f64> = TopDocs::with_limit(2).and_offset(1).into();
155-
156-
// // let results = collector
157-
// // .merge_fruits(vec![vec![
158-
// // (0.9, DocAddress::new(0, 1)),
159-
// // (0.8, DocAddress::new(0, 2)),
160-
// // ]])
161-
// // .unwrap();
162-
163-
// // assert_eq!(results, vec![(0.8, DocAddress::new(0, 2)),]);
164-
// // }
165-
166-
// // #[test]
167-
// // fn test_top_collector_with_limit_and_offset_larger_than_set() {
168-
// // let collector: TopCollector<f64> = TopDocs::with_limit(2).and_offset(20).into();
169-
170-
// // let results = collector
171-
// // .merge_fruits(vec![vec![
172-
// // (0.9, DocAddress::new(0, 1)),
173-
// // (0.8, DocAddress::new(0, 2)),
174-
// // ]])
175-
// // .unwrap();
176-
177-
// // assert_eq!(results, vec![]);
178-
// // }
179-
// }
180-
181-
// #[cfg(all(test, feature = "unstable"))]
182-
// mod bench {
183-
// use test::Bencher;
184-
185-
// use super::TopSegmentCollector;
186-
187-
// #[bench]
188-
// fn bench_top_segment_collector_collect_not_at_capacity(b: &mut Bencher) {
189-
// let mut top_collector = TopSegmentCollector::new(0, 400);
190-
191-
// b.iter(|| {
192-
// for i in 0..100 {
193-
// top_collector.collect(i, 0.8);
194-
// }
195-
// });
196-
// }
197-
198-
// #[bench]
199-
// fn bench_top_segment_collector_collect_at_capacity(b: &mut Bencher) {
200-
// let mut top_collector = TopSegmentCollector::new(0, 100);
201-
202-
// for i in 0..100 {
203-
// top_collector.collect(i, 0.8);
204-
// }
205-
206-
// b.iter(|| {
207-
// for i in 0..100 {
208-
// top_collector.collect(i, 0.8);
209-
// }
210-
// });
211-
// }
212-
213-
// #[bench]
214-
// fn bench_top_segment_collector_collect_and_harvest_many_ties(b: &mut Bencher) {
215-
// b.iter(|| {
216-
// let mut top_collector = TopSegmentCollector::new(0, 100);
217-
218-
// for i in 0..100 {
219-
// top_collector.collect(i, 0.8);
220-
// }
221-
222-
// // it would be nice to be able to do the setup N times but still
223-
// // measure only harvest(). We can't since harvest() consumes
224-
// // the top_collector.
225-
// top_collector.harvest()
226-
// });
227-
// }
228-
229-
// #[bench]
230-
// fn bench_top_segment_collector_collect_and_harvest_no_tie(b: &mut Bencher) {
231-
// b.iter(|| {
232-
// let mut top_collector = TopSegmentCollector::new(0, 100);
233-
// let mut score = 1.0;
234-
235-
// for i in 0..100 {
236-
// score += 1.0;
237-
// top_collector.collect(i, score);
238-
// }
239-
240-
// // it would be nice to be able to do the setup N times but still
241-
// // measure only harvest(). We can't since harvest() consumes
242-
// // the top_collector.
243-
// top_collector.harvest()
244-
// });
245-
// }
246-
// }

0 commit comments

Comments
 (0)