Skip to content

Commit

Permalink
WIP: lrs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristramg committed Apr 15, 2024
1 parent b7aa702 commit 1b4233d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lrm_scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
64 changes: 64 additions & 0 deletions src/lrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,67 @@ impl<CurveImpl: Curve> Lrs<CurveImpl> {
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<LineStringCurve> {
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<LrmHandle>;
fn get_traversal(&self, traversal_id: String) -> Option<TraversalHandle>;
fn lookup(&self, point: Point, lrm: LrmHandle) -> Vec<LrmProjection>;
fn lookup_lrms(&self, point: Point) -> Vec<LrmProjection>;
fn lookup_traversals(&self, point: Point) -> Vec<TraversalProjection>;
fn locate_traversal(&self, position: TraversalPosition) -> Result<Point, LrsError>;
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<TraversalProjection, LrsError>;
fn traversal_project_range(
&self,
range: TraversalRange,
onto: TraversalHandle,
) -> Result<TraversalRange, LrsError>;
fn lrm_project(
&self,
position: TraversalPosition,
onto: LrmHandle,
) -> Result<LrmProjection, LrsError>;
fn lrm_project_range(
&self,
range: TraversalRange,
onto: LrmHandle,
) -> Result<LrmRange, LrsError>;
fn lrm_get_measure(&self, position: LrmPosition) -> Result<LrmMeasure, LrsError>;
fn lrm_get_position(&self, measure: LrmMeasure) -> Result<LrmPosition, LrsError>;*/
}

0 comments on commit 1b4233d

Please sign in to comment.