Skip to content

Commit 35874fc

Browse files
committed
Refactor the tests
1 parent d3f5078 commit 35874fc

8 files changed

Lines changed: 20 additions & 18 deletions

tests/shared.rs renamed to tests/common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,5 @@ pub fn distance_2d(a: &Point2D<impl std::fmt::Debug>, b: &Point2D<impl std::fmt:
137137
pub fn distance_3d(a: &Point3D<impl std::fmt::Debug>, b: &Point3D<impl std::fmt::Debug>) -> f64 {
138138
((a.x - b.x).powi(2) + (a.y - b.y).powi(2) + (a.z - b.z).powi(2)).sqrt()
139139
}
140+
141+
pub type Anyhow = anyhow::Result<()>;

tests/helpers.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/test_integration_kdtree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#[path = "shared.rs"]
2-
mod shared;
3-
use shared::*;
1+
#[path = "common.rs"]
2+
mod common;
3+
use common::*;
44

55
use spart::geometry::{EuclideanDistance, Point2D, Point3D};
66
use spart::kdtree::KdTree;

tests/test_integration_octree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#[path = "shared.rs"]
2-
mod shared;
3-
use shared::*;
1+
#[path = "common.rs"]
2+
mod common;
3+
use common::*;
44

55
use spart::geometry::EuclideanDistance;
66
use spart::octree::Octree;

tests/test_integration_quadtree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#[path = "shared.rs"]
2-
mod shared;
3-
use shared::*;
1+
#[path = "common.rs"]
2+
mod common;
3+
use common::*;
44

55
use spart::geometry::EuclideanDistance;
66
use spart::quadtree::Quadtree;

tests/test_integration_rstar_tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#[path = "shared.rs"]
2-
mod shared;
3-
use shared::*;
1+
#[path = "common.rs"]
2+
mod common;
3+
use common::*;
44

55
use spart::geometry::{EuclideanDistance, Point2D, Point3D};
66
use spart::rstar_tree::RStarTree;

tests/test_integration_rtree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#[path = "shared.rs"]
2-
mod shared;
3-
use shared::*;
1+
#[path = "common.rs"]
2+
mod common;
3+
use common::*;
44

55
use spart::geometry::{EuclideanDistance, Point2D, Point3D};
66
use spart::rtree::RTree;

tests/test_serialization.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
mod helpers;
1+
#[path = "common.rs"]
2+
mod common;
23

34
#[cfg(test)]
45
mod tests {
5-
use super::helpers::Anyhow;
6+
use crate::common::Anyhow;
67
use spart::geometry::{Cube, Point2D, Point3D, Rectangle};
78
use spart::kdtree::KdTree;
89
use spart::octree::Octree;

0 commit comments

Comments
 (0)