Added unit test for exponential search

This commit is contained in:
Paul Masurel
2018-12-18 09:24:31 +09:00
parent 545a7ec8dd
commit 4565aba62a

View File

@@ -630,6 +630,7 @@ mod tests {
use schema::IndexRecordOption;
use schema::SchemaBuilder;
use schema::Term;
use super::exponential_search;
use schema::INT_INDEXED;
use DocId;
use SkipResult;
@@ -660,6 +661,13 @@ mod tests {
.0
}
#[test]
fn test_exponentiel_search() {
assert_eq!(exponential_search(0, &[1,2]), (0, 1));
assert_eq!(exponential_search(1, &[1,2]), (0, 1));
assert_eq!(exponential_search(7, &[1,2,3,4,5,6,7,8,9,10,11]), (3,7));
}
fn util_test_search_within_block(block: &[u32], target: u32) {
assert_eq!(
search_within_block(block, target),