Skip to content

Commit

Permalink
did cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
abstractqqq committed Jan 2, 2024
1 parent 2798eb9 commit 59237b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
14 changes: 1 addition & 13 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ fn bench_nearest_from_kdtree_with_1k_3d_points(b: &mut Bencher) {

#[bench]
fn bench_within_2k_data_01_radius(b: &mut Bencher) {

let len = 2000usize;
let point = rand_data();
let mut points = vec![];
Expand All @@ -56,12 +55,10 @@ fn bench_within_2k_data_01_radius(b: &mut Bencher) {
}

b.iter(|| kdtree.within(&point.0, 0.1, &squared_euclidean).unwrap());

}

#[bench]
fn bench_within_2k_data_02_radius(b: &mut Bencher) {

let len = 2000usize;
let point = rand_data();
let mut points = vec![];
Expand All @@ -74,12 +71,10 @@ fn bench_within_2k_data_02_radius(b: &mut Bencher) {
}

b.iter(|| kdtree.within(&point.0, 0.2, &squared_euclidean).unwrap());

}

#[bench]
fn bench_within_unsorted_2k_data_01_radius(b: &mut Bencher) {

let len = 2000usize;
let point = rand_data();
let mut points = vec![];
Expand All @@ -92,12 +87,10 @@ fn bench_within_unsorted_2k_data_01_radius(b: &mut Bencher) {
}

b.iter(|| kdtree.within_unsorted(&point.0, 0.1, &squared_euclidean).unwrap());

}

#[bench]
fn bench_within_unsorted_2k_data_02_radius(b: &mut Bencher) {

let len = 2000usize;
let point = rand_data();
let mut points = vec![];
Expand All @@ -110,12 +103,10 @@ fn bench_within_unsorted_2k_data_02_radius(b: &mut Bencher) {
}

b.iter(|| kdtree.within_unsorted(&point.0, 0.2, &squared_euclidean).unwrap());

}

#[bench]
fn bench_within_count_2k_data_01_radius(b: &mut Bencher) {

let len = 2000usize;
let point = rand_data();
let mut points = vec![];
Expand All @@ -128,12 +119,10 @@ fn bench_within_count_2k_data_01_radius(b: &mut Bencher) {
}

b.iter(|| kdtree.within_count(&point.0, 0.1, &squared_euclidean).unwrap());

}

#[bench]
fn bench_within_count_2k_data_02_radius(b: &mut Bencher) {

let len = 2000usize;
let point = rand_data();
let mut points = vec![];
Expand All @@ -146,5 +135,4 @@ fn bench_within_count_2k_data_02_radius(b: &mut Bencher) {
}

b.iter(|| kdtree.within_count(&point.0, 0.2, &squared_euclidean).unwrap());

}
}
15 changes: 3 additions & 12 deletions tests/kdtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ fn it_works() {

let unsorted1 = kdtree.within_unsorted(&POINT_A.0, 0.0, &squared_euclidean).unwrap();
let ans1 = vec![(0.0, &0)];
assert_eq!(
unsorted1.len(),
ans1.len()
);
assert_eq!(unsorted1.len(), ans1.len());
assert_eq!(
kdtree.within_count(&POINT_A.0, 0.0, &squared_euclidean).unwrap(),
ans1.len()
Expand All @@ -76,10 +73,7 @@ fn it_works() {

let unsorted2 = kdtree.within_unsorted(&POINT_B.0, 1.0, &squared_euclidean).unwrap();
let ans2 = vec![(0.0, &1)];
assert_eq!(
unsorted2.len(),
ans2.len()
);
assert_eq!(unsorted2.len(), ans2.len());
assert_eq!(
kdtree.within_count(&POINT_B.0, 1.0, &squared_euclidean).unwrap(),
ans2.len()
Expand All @@ -90,10 +84,7 @@ fn it_works() {

let unsorted3 = kdtree.within_unsorted(&POINT_B.0, 2.0, &squared_euclidean).unwrap();
let ans3 = vec![(0.0, &1), (2.0, &2), (2.0, &0)];
assert_eq!(
unsorted3.len(),
ans3.len()
);
assert_eq!(unsorted3.len(), ans3.len());
assert_eq!(
kdtree.within_count(&POINT_B.0, 2.0, &squared_euclidean).unwrap(),
ans3.len()
Expand Down

0 comments on commit 59237b5

Please sign in to comment.