From 1b4233d9eb4e24726571138760a3a42452c00dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristram=20Gr=C3=A4bener?= Date: Fri, 5 Apr 2024 09:24:42 +0200 Subject: [PATCH] WIP: lrs tests --- src/lrm_scale.rs | 4 +-- src/lrs.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/src/lrm_scale.rs b/src/lrm_scale.rs index 0d1c72d..85b2d3d 100644 --- a/src/lrm_scale.rs +++ b/src/lrm_scale.rs @@ -270,9 +270,9 @@ impl LrmScale { } #[cfg(test)] -mod tests { +pub mod tests { use super::*; - fn scale() -> LrmScale { + pub fn scale() -> LrmScale { ScaleBuilder::new(Anchor::new("a", 0., 0.)) .add_named("b", 10., 100.) .build("id") diff --git a/src/lrs.rs b/src/lrs.rs index 8e0524d..1205fb1 100644 --- a/src/lrs.rs +++ b/src/lrs.rs @@ -553,3 +553,67 @@ impl Lrs { Ok(geo::Line::new(start, end)) } } + +#[cfg(test)] +mod tests { + use geo::line_string; + + use crate::{curves::LineStringCurve, lrm_scale::LrmScale}; + + use super::*; + + fn lrs() -> Lrs { + let lrm = Lrm { + reference_traversal: TraversalHandle(0), + scale: crate::lrm_scale::tests::scale(), + traversals: vec![TraversalHandle(0)], + }; + + let traversal = Traversal { + curve: LineStringCurve::new(line_string![(x: 0., y:0.), (x: 1., y:1.)], 1.), + id: "curve".to_owned(), + lrms: vec![LrmHandle(0)], + }; + + Lrs { + lrms: vec![lrm], + traversals: vec![traversal], + } + } + + #[test] + fn get_lrm() { + //let lrs = lrs(); + } + /*fn get_lrm(&self, lrm_id: String) -> Option; + fn get_traversal(&self, traversal_id: String) -> Option; + fn lookup(&self, point: Point, lrm: LrmHandle) -> Vec; + fn lookup_lrms(&self, point: Point) -> Vec; + fn lookup_traversals(&self, point: Point) -> Vec; + fn locate_traversal(&self, position: TraversalPosition) -> Result; + fn get_lrm_applicable_traversals(&self, lrm: LrmHandle) -> &[TraversalHandle]; + fn get_lrm_reference_traversal(&self, lrm: LrmHandle) -> TraversalHandle; + fn get_traversal_lrms(&self, traversal: TraversalHandle) -> &[LrmHandle]; + fn traversal_project( + &self, + position: TraversalPosition, + onto: TraversalHandle, + ) -> Result; + fn traversal_project_range( + &self, + range: TraversalRange, + onto: TraversalHandle, + ) -> Result; + fn lrm_project( + &self, + position: TraversalPosition, + onto: LrmHandle, + ) -> Result; + fn lrm_project_range( + &self, + range: TraversalRange, + onto: LrmHandle, + ) -> Result; + fn lrm_get_measure(&self, position: LrmPosition) -> Result; + fn lrm_get_position(&self, measure: LrmMeasure) -> Result;*/ +}