From a51ecb6e9d2446d68d64244ac9a73259f45cee57 Mon Sep 17 00:00:00 2001 From: vmarc Date: Sat, 13 Jul 2024 16:56:42 +0200 Subject: [PATCH] #368 migrate structure tests --- .../route/RouteDetailMainAnalyzerImpl.scala | 2 - .../domain/RouteDetailAnalysisContext.scala | 4 - .../route/report/RoutePathReport.scala | 12 +- .../route/report/RouteSegmentReport.scala | 8 - .../NewRouteSegmentElementFragment.scala | 3 +- .../route/structure/RoutePathAnalyzer.scala | 168 ------------------ .../structure/RouteSegmentAnalyzer.scala | 6 +- .../route/structure/StructureAnalyzer.scala | 131 +++++--------- .../route/structure/StructurePath.scala | 2 +- .../structure/StructurePathElement.scala | 14 +- .../RouteDetailAnalysisTestContext.scala | 33 ++-- ...ucture_01_SingleWayBidirectionalTest.scala | 42 +---- .../Structure_02_SingleWayForwardTest.scala | 36 +--- .../Structure_03_SingleWayBackwardTest.scala | 36 +--- ...cture_04_SingleWayRoundaboutLoopTest.scala | 46 +---- ...e_05_SingleWayRoundaboutNotALoopTest.scala | 38 +--- .../Structure_11_DerivedDirectionTest.scala | 44 +---- ...cture_12_DerivedDirectionReverseTest.scala | 44 +---- ...cture_13_DerivedDirectionForwardTest.scala | 48 +---- ...ture_14_DerivedDirectionBackwardTest.scala | 48 +---- ...DerivedDirectionBackwardBackwardTest.scala | 48 +---- .../Structure_21_ContinuousTest.scala | 46 +---- ...re_22_ContinuousFirstWayReversedTest.scala | 46 +---- ...tinuousSecondAndThirdWayReversedTest.scala | 46 +---- ...tructure_31_GapSecondWayBackwardTest.scala | 48 +---- .../structure/Structure_32_GapTest.scala | 44 +---- .../structure/Structure_33_GapTest.scala | 55 +----- .../structure/Structure_34_GapTest.scala | 55 +----- ...ructure_41_ForwardNoBackwardPathTest.scala | 48 +---- .../Structure_42_ForwardGapTest.scala | 42 +---- .../Structure_43_ForwardBackwardTest.scala | 64 ++----- .../Structure_44_ForwardBackwardTest.scala | 64 ++----- .../Structure_45_ForwardForwardTest.scala | 64 ++----- .../Structure_46_ForwardForwardGapTest.scala | 68 ++----- .../Structure_51_RoundaboutTest.scala | 46 +---- ...tructure_52_RoundaboutRoundaboutTest.scala | 58 +----- .../Structure_53_WayRoundaboutTest.scala | 48 +---- .../Structure_54_WayRoundaboutWayTest.scala | 60 +------ .../Structure_55_DoubleRoundaboutTest.scala | 72 ++------ ...ructure_61_NonCircularRoundaboutTest.scala | 45 +---- ...ructure_62_NonCircularRoundaboutTest.scala | 62 +------ .../structure/Structure_71_5444896_Test.scala | 70 ++------ .../Structure_72_SplitRoundabout_Test.scala | 90 ++-------- .../structure/Structure_73_Split_Test.scala | 52 +----- .../structure/Structure_75_Split_Test.scala | 62 ++----- .../structure/Structure_76_Split_Test.scala | 52 +----- .../structure/Structure_77_Split_Test.scala | 72 ++------ .../route/structure/Structure_N01_Test.scala | 10 +- .../route/structure/Structure_N02_Test.scala | 10 +- .../route/structure/Structure_N03_Test.scala | 14 +- .../route/structure/Structure_N04_Test.scala | 17 +- .../route/structure/Structure_N05_Test.scala | 19 +- .../route/structure/Structure_N06_Test.scala | 23 +-- .../route/structure/Structure_N07_Test.scala | 30 ++-- .../route/structure/Structure_N08_Test.scala | 30 ++-- .../route/structure/Structure_N09_Test.scala | 37 ++-- .../route/structure/Structure_N10_Test.scala | 37 ++-- .../route/structure/Structure_N11_Test.scala | 25 +-- .../route/structure/Structure_N12_Test.scala | 17 +- .../route/structure/Structure_N13_Test.scala | 17 +- .../route/structure/Structure_N14_Test.scala | 42 ++--- .../route/structure/Structure_N15_Test.scala | 42 ++--- .../route/structure/Structure_N16_Test.scala | 21 +-- .../route/structure/Structure_N17_Test.scala | 21 +-- .../route/structure/Structure_N18_Test.scala | 10 +- .../route/structure/Structure_N19_Test.scala | 13 +- .../route/structure/Structure_N20_Test.scala | 13 +- .../route/structure/Structure_N21_Test.scala | 13 +- .../route/structure/Structure_N22_Test.scala | 13 +- .../route/structure/Structure_N23_Test.scala | 13 +- .../route/structure/Structure_N24_Test.scala | 13 +- 71 files changed, 472 insertions(+), 2320 deletions(-) delete mode 100644 server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RoutePathAnalyzer.scala diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/RouteDetailMainAnalyzerImpl.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/RouteDetailMainAnalyzerImpl.scala index b902a18bd..fdc510ed4 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/RouteDetailMainAnalyzerImpl.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/RouteDetailMainAnalyzerImpl.scala @@ -47,7 +47,6 @@ import kpn.server.analyzer.engine.analysis.route.analyzers.UnexpectedRelationRou import kpn.server.analyzer.engine.analysis.route.analyzers.WithoutWaysRouteAnalyzer import kpn.server.analyzer.engine.analysis.route.domain.RouteDetailAnalysisContext import kpn.server.analyzer.engine.analysis.route.structure.RouteLinkAnalyzer -import kpn.server.analyzer.engine.analysis.route.structure.RoutePathAnalyzer import kpn.server.analyzer.engine.analysis.route.structure.RouteSegmentAnalyzer import org.springframework.stereotype.Component @@ -92,7 +91,6 @@ class RouteDetailMainAnalyzerImpl( RouteNodeAnalyzer, RouteLinkAnalyzer, RouteSegmentAnalyzer, - RoutePathAnalyzer, OldRouteSegmentAnalyzer, RouteStructureAnalyzer, diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/domain/RouteDetailAnalysisContext.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/domain/RouteDetailAnalysisContext.scala index d3e27c566..07e500228 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/domain/RouteDetailAnalysisContext.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/domain/RouteDetailAnalysisContext.scala @@ -25,7 +25,6 @@ import kpn.server.analyzer.engine.analysis.route.analyzers.RouteAnalysisBuilder import kpn.server.analyzer.engine.analysis.route.segment.FragmentMap import kpn.server.analyzer.engine.analysis.route.structure.NewRouteSegment import kpn.server.analyzer.engine.analysis.route.structure.RouteLinks -import kpn.server.analyzer.engine.analysis.route.structure.RoutePath import kpn.server.analyzer.engine.analysis.route.structure.Structure import kpn.server.analyzer.engine.context.ElementIds import kpn.server.analyzer.engine.context.PreconditionMissingException @@ -44,7 +43,6 @@ case class RouteDetailAnalysisContext( country: Option[Country] = None, _links: Option[RouteLinks] = None, _segments: Option[Seq[NewRouteSegment]] = None, - _paths: Option[Seq[RoutePath]] = None, _segmentAnalysis: Option[RouteSegmentAnalysis] = None, routeNodeInfos: Map[Long, RouteNodeInfo] = Map.empty, facts: Seq[Fact] = Seq.empty, @@ -173,8 +171,6 @@ case class RouteDetailAnalysisContext( def segments: Seq[NewRouteSegment] = _segments.getOrElse(throw new PreconditionMissingException) - def paths: Seq[RoutePath] = _paths.getOrElse(throw new PreconditionMissingException) - def segmentAnalysis: RouteSegmentAnalysis = _segmentAnalysis.getOrElse(throw new PreconditionMissingException) def routeNameAnalysis: RouteNameAnalysis = _routeNameAnalysis.getOrElse(throw new PreconditionMissingException) diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RoutePathReport.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RoutePathReport.scala index c8459bd77..f83290143 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RoutePathReport.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RoutePathReport.scala @@ -24,19 +24,19 @@ class RoutePathReport(context: RouteDetailAnalysisContext) { } private def paths(): String = { - context.paths.map { path => - val fromNode = path.elements.head.fromNetworkNode - val toNode = path.elements.last.toNetworkNode + context.segments.flatMap(_.elements).map { element => + val fromNode = element.fromNetworkNode + val toNode = element.toNetworkNode val from = fromNode.map(n => s"${ReportUtil.osmNodeLink(n.node.id)}(${n.name})").getOrElse("") val to = toNode.map(n => s"${ReportUtil.osmNodeLink(n.node.id)}(${n.name})").getOrElse("") - val elementIds = path.elements.map(element => element.id).mkString(", ") + val elementIds = "" + element.id s""" | - | Path ${path.id} + | Path ${element.id} | | - | ${path.direction.toString.toLowerCase} + | ${element.direction.toString.toLowerCase} | | | $from diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RouteSegmentReport.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RouteSegmentReport.scala index 86390fd30..005fff186 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RouteSegmentReport.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/report/RouteSegmentReport.scala @@ -25,7 +25,6 @@ class RouteSegmentReport(context: RouteDetailAnalysisContext) { | from | to | network nodes - | paths | |${segments()} | @@ -46,8 +45,6 @@ class RouteSegmentReport(context: RouteDetailAnalysisContext) { | | | - | - | | |${segmentElements(segment)} |""".stripMargin @@ -70,8 +67,6 @@ class RouteSegmentReport(context: RouteDetailAnalysisContext) { | | | - | - | | |${elementFragments(element)} |""".stripMargin @@ -115,9 +110,6 @@ class RouteSegmentReport(context: RouteDetailAnalysisContext) { | $to | | ${networkNodeString(fragment.nodeIds)} - | - | ${fragment.pathIds.mkString(", ")} - | | |""".stripMargin } diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/NewRouteSegmentElementFragment.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/NewRouteSegmentElementFragment.scala index 7af90a133..44924ded1 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/NewRouteSegmentElementFragment.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/NewRouteSegmentElementFragment.scala @@ -7,8 +7,7 @@ case class NewRouteSegmentElementFragment( wayId: Long, link: Link, role: Option[String], - nodeIds: Seq[Long], - pathIds: Seq[Long] + nodeIds: Seq[Long] ) { def fromNodeId: Long = nodeIds.head diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RoutePathAnalyzer.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RoutePathAnalyzer.scala deleted file mode 100644 index 7ec5908c3..000000000 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RoutePathAnalyzer.scala +++ /dev/null @@ -1,168 +0,0 @@ -package kpn.server.analyzer.engine.analysis.route.structure - -import kpn.core.util.Util -import kpn.server.analyzer.engine.analysis.route.analyzers.RouteAnalyzer -import kpn.server.analyzer.engine.analysis.route.domain.RouteDetailAnalysisContext - -object RoutePathAnalyzer extends RouteAnalyzer { - override def analyze(context: RouteDetailAnalysisContext): RouteDetailAnalysisContext = { - val paths = new RoutePathAnalyzer(context).analyze() - val updatedSegments = updateSegmentPaths(context.segments, paths) - context.copy( - _segments = Some(updatedSegments), - _paths = Some(paths), - ) - } - - private def updateSegmentPaths(segments: Seq[NewRouteSegment], paths: Seq[RoutePath]): Seq[NewRouteSegment] = { - segments.map { segment => - segment.copy( - elements = segment.elements.map { element => - element.copy( - fragments = element.fragments.map { fragment => - val pathIds = paths.filter { path => - path.elements.exists { element => - element.fragments.exists { elementFragment => - elementFragment.id == fragment.id - } - } - }.map(_.id) - fragment.copy( - pathIds = pathIds - ) - } - ) - } - ) - } - } -} - -class RoutePathAnalyzer(context: RouteDetailAnalysisContext) { - - private val pathIds = Util.ids - - def analyze(): Seq[RoutePath] = { - context.segments.flatMap { segment => - segment.elements.map { element => - RoutePath(pathIds.next(), element.direction, Seq(element)) - } - } - // val paths = context.segments.flatMap { segment => - // findPaths(segment.elements) - // } - // val pathSegmentElementIds = paths.flatMap(_.elements.map(_.id)) - // val otherSegmentElements = context.segments.flatMap(_.elements).filterNot(el => pathSegmentElementIds.contains(el.id)) - // val otherPaths = otherSegmentElements.map { element => - // RoutePath(pathIds.next(), element.direction, Seq(element)) - // } - // - // paths ++ otherPaths - } - - private def findPaths(remainingElements: Seq[NewRouteSegmentElement]): Seq[RoutePath] = { - if (remainingElements.isEmpty) { - Seq.empty - } - else { - val element = remainingElements.head - if (element.fromNetworkNode.isDefined && element.toNetworkNode.isDefined) { - val path = RoutePath(pathIds.next(), element.direction, Seq(element)) - Seq(path) ++ findPaths(remainingElements.tail) - } - else { - if (element.fromNetworkNode.isDefined) { - val resultElements = lookforNextConnectingElements(element, remainingElements.tail) - if (resultElements.nonEmpty) { - val direction = if (resultElements.exists(_.direction == RoutePathDirection.Forward)) { - RoutePathDirection.Forward - } else if (resultElements.exists(_.direction == RoutePathDirection.Backward)) { - RoutePathDirection.Backward - } - else { - RoutePathDirection.Bidirectional - } - val path1 = RoutePath(pathIds.next(), direction, Seq(element) ++ resultElements) - - val path2Option = { - val resultELementIds = resultElements.map(_.id) - val otherRemaining = remainingElements.tail.filterNot(el => resultELementIds.contains(el.id)) - val resultElements2 = lookforNextConnectingElements(element, otherRemaining) - if (resultElements2.nonEmpty) { - val direction = if (resultElements2.exists(_.direction == RoutePathDirection.Forward)) { - RoutePathDirection.Forward - } else if (resultElements2.exists(_.direction == RoutePathDirection.Backward)) { - RoutePathDirection.Backward - } - else { - RoutePathDirection.Bidirectional - } - Some(RoutePath(pathIds.next(), direction, Seq(element) ++ resultElements2)) - } - else { - None - } - } - - val usedElementIds = path1.elements.map(_.id) ++ path2Option.toSeq.flatMap(_.elements.map(_.id)) - val newRemaing = remainingElements.tail.filterNot(el => usedElementIds.contains(el.id)) - - Seq(path1) ++ path2Option.toSeq ++ findPaths(remainingElements.tail) - } - else { - // TODO redesign - not sure what to do here... - findPaths(remainingElements.tail) - } - } - else { - // TODO redesign - not sure what to do here... add to unusedSegmentElements? - findPaths(remainingElements.tail) - } - } - } - } - - private def lookforNextConnectingElements(element: NewRouteSegmentElement, remainingElements: Seq[NewRouteSegmentElement]): Seq[NewRouteSegmentElement] = { - if (element.direction == RoutePathDirection.Bidirectional) { - remainingElements.find(candidateNextElement => element.toNodeId == candidateNextElement.fromNodeId) match { - case None => Seq.empty - case Some(element) => - if (element.toNetworkNode.isDefined) { - Seq(element) - } - else { - val furtherElements = remainingElements.filterNot(_.id == element.id) - val connectingElements = lookforNextConnectingElements(element, furtherElements) - if (connectingElements.isEmpty) { - Seq.empty - } - else { - Seq(element) ++ connectingElements - } - } - } - } - else { - remainingElements.find(candidateNextElement => - element.toNodeId == candidateNextElement.fromNodeId && - element.direction == candidateNextElement.direction - ) match { - case None => Seq.empty - case Some(element) => - if (element.toNetworkNode.isDefined) { - Seq(element) - } - else { - val furtherElements = remainingElements.filterNot(_.id == element.id) - val connectingElements = lookforNextConnectingElements(element, furtherElements) - if (connectingElements.isEmpty) { - Seq.empty - } - else { - Seq(element) ++ connectingElements - } - } - } - } - } -} diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteSegmentAnalyzer.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteSegmentAnalyzer.scala index 133b4c7d7..8f9d2f315 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteSegmentAnalyzer.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteSegmentAnalyzer.scala @@ -231,8 +231,7 @@ class RouteSegmentAnalyzer(context: RouteDetailAnalysisContext) { routeLinkWay.way.id, routeLinkWay.link, routeLinkWay.role, - nodeIds, - Seq.empty // filled in later during path analysis + nodeIds ) val fromNetworkNode = context.routeNodeAnalysis.nodes.find(_.node.id == fragment.fromNodeId) @@ -255,8 +254,7 @@ class RouteSegmentAnalyzer(context: RouteDetailAnalysisContext) { routeLinkWay.way.id, routeLinkWay.link, routeLinkWay.role, - nodeIds, - Seq.empty // filled in later during path analysis + nodeIds ) } diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructureAnalyzer.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructureAnalyzer.scala index 586ee8e14..214c01aa6 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructureAnalyzer.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructureAnalyzer.scala @@ -20,7 +20,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole def analyzeNodeNetworkRoute(): Structure = { if (context.segments.size > 1) { - val otherPaths = context.paths.map { path => + val otherPaths = context.segments.flatMap(_.elements).map { path => StructurePath( path.fromNodeId, path.toNodeId, @@ -84,7 +84,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole val usedPathIds = forwardPath.toSeq.flatMap(_.pathIds) ++ backwardPath.toSeq.flatMap(_.pathIds) ++ startTentaclePaths.flatMap(_.pathIds) ++ endTentaclePaths.flatMap(_.pathIds) - val remainingPaths = context.paths.filterNot(path => usedPathIds.contains(path.id)) + val remainingPaths = context.segments.flatMap(_.elements).filterNot(path => usedPathIds.contains(path.id)) remainingPaths.map { path => StructurePath( path.nodeIds.head, @@ -103,50 +103,25 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole forwardPath: Option[StructurePath], backwardPath: Option[StructurePath], startTentaclePaths: Seq[StructurePath] - ) = { + ): Seq[StructurePath] = { context.routeNodeAnalysis.endTentacleToNodes.flatMap { toNode => val usedPathIds = forwardPath.toSeq.flatMap(_.pathIds) ++ backwardPath.toSeq.flatMap(_.pathIds) ++ startTentaclePaths.flatMap(_.pathIds) - val remainingPaths = context.paths.filterNot(path => usedPathIds.contains(path.id)) - remainingPaths.find { path => - if (path.direction == RoutePathDirection.Bidirectional || path.direction == RoutePathDirection.Forward) { - path.toNodeId == toNode.node.id - } else if (path.direction == RoutePathDirection.Backward) { - path.fromNodeId == toNode.node.id - } - else { - false - } - } match { + val remainingPaths = context.segments.flatMap(_.elements).filterNot(path => usedPathIds.contains(path.id)) + remainingPaths.find(_.toNodeId == toNode.node.id) match { case None => None case Some(firstPath) => - if (firstPath.direction == RoutePathDirection.Bidirectional || firstPath.direction == RoutePathDirection.Forward) { - Some( - StructurePath( - firstPath.fromNodeId, - firstPath.toNodeId, - Seq( - StructurePathElement( - firstPath, - reversed = false - ) - ) - ) - ) - } - else { - Some( - StructurePath( - firstPath.toNodeId, - firstPath.fromNodeId, - Seq( - StructurePathElement( - firstPath, - reversed = true - ) + Some( + StructurePath( + firstPath.fromNodeId, + firstPath.toNodeId, + Seq( + StructurePathElement( + firstPath, + reversed = false ) ) ) - } + ) } } } @@ -154,7 +129,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole private def nodeNetworkStartTentaclePaths(forwardPath: Option[StructurePath], backwardPath: Option[StructurePath]) = { val usedPathIds = forwardPath.toSeq.flatMap(_.pathIds) ++ backwardPath.toSeq.flatMap(_.pathIds) - val remainingPaths = context.paths.filterNot(path => usedPathIds.contains(path.id)) + val remainingPaths = context.segments.flatMap(_.elements).filterNot(path => usedPathIds.contains(path.id)) context.routeNodeAnalysis.startTentacleFromNodes.flatMap { fromNode => remainingPaths.find(_.nodeIds.head == fromNode.node.id) match { case None => None @@ -182,13 +157,12 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } else { - findFirstBackwardPathIndex(context.paths, mainEndNode.node.id).flatMap { index => - val lastBackwardPath = context.paths(index) - val remainingPaths = context.paths.take(index).reverse - val reversed = lastBackwardPath.direction != RoutePathDirection.Backward + nodeNetworkFindFirstBackwardPathIndex(context.segments.flatMap(_.elements), mainEndNode.node.id).flatMap { index => + val lastBackwardPath = context.segments.flatMap(_.elements)(index) + val remainingPaths = context.segments.flatMap(_.elements).take(index).reverse val element = StructurePathElement( lastBackwardPath, - reversed + reversed = true ) val elements = findNextBackwardPath(Seq(element), remainingPaths, mainStartNode.node.id) if (elements.nonEmpty) { @@ -209,14 +183,14 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole private def nodeNetworkForwardPath(mainStartNode: RouteNodeData, mainEndNode: RouteNodeData) = { - findFirstForwardPathIndex(context.paths, mainStartNode.node.id).flatMap { index => - val firstForwardPath = context.paths(index) + findFirstForwardPathIndex(context.segments.flatMap(_.elements), mainStartNode.node.id).flatMap { index => + val firstForwardPath = context.segments.flatMap(_.elements)(index) val element = StructurePathElement( firstForwardPath, reversed = false ) - val remainingPaths = context.paths.drop(index + 1) - val elements = findNextForwardPath(Seq(element), remainingPaths, mainEndNode.node.id) + val remainingPaths = context.segments.flatMap(_.elements).drop(index + 1) + val elements = nodeNetworkFindNextForwardPath(Seq(element), remainingPaths, mainEndNode.node.id) if (elements.nonEmpty) { Some( StructurePath( @@ -235,7 +209,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole private def analyzeNonNodeNetworkRoute(): Structure = { if (context.segments.size > 1) { - val otherPaths = context.paths.map { routePath => + val otherPaths = context.segments.flatMap(_.elements).map { routePath => StructurePath( routePath.nodeIds.head, routePath.nodeIds.last, @@ -253,7 +227,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole else { val forwardPath = { - val forwardPathElements = findNonNodeNetworkRouteForwardPath(Seq.empty, context.paths) + val forwardPathElements = findNonNodeNetworkRouteForwardPath(Seq.empty, context.segments.flatMap(_.elements)) if (forwardPathElements.nonEmpty) { Some( StructurePath( @@ -269,7 +243,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } val backwardPath = { - val backwardPathElements = findNonNodeNetworkRouteBackwardPath(Seq.empty, context.paths.reverse) + val backwardPathElements = findNonNodeNetworkRouteBackwardPath(Seq.empty, context.segments.flatMap(_.elements).reverse) if (backwardPathElements.nonEmpty) { Some( StructurePath( @@ -285,7 +259,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } val usedPathIds = (forwardPath.toSeq.flatMap(_.pathIds) ++ backwardPath.toSeq.flatMap(_.pathIds)).toSet - val otherPaths = context.paths.filterNot(path => usedPathIds.contains(path.id)).map { routePath => + val otherPaths = context.segments.flatMap(_.elements).filterNot(path => usedPathIds.contains(path.id)).map { routePath => StructurePath( routePath.nodeIds.head, routePath.nodeIds.last, @@ -302,7 +276,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } } - private def findNonNodeNetworkRouteForwardPath(paths: Seq[StructurePathElement], remainingPaths: Seq[RoutePath]): Seq[StructurePathElement] = { + private def findNonNodeNetworkRouteForwardPath(paths: Seq[StructurePathElement], remainingPaths: Seq[NewRouteSegmentElement]): Seq[StructurePathElement] = { if (remainingPaths.isEmpty) { paths } @@ -326,7 +300,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } } - private def findNonNodeNetworkRouteBackwardPath(paths: Seq[StructurePathElement], remainingPaths: Seq[RoutePath]): Seq[StructurePathElement] = { + private def findNonNodeNetworkRouteBackwardPath(paths: Seq[StructurePathElement], remainingPaths: Seq[NewRouteSegmentElement]): Seq[StructurePathElement] = { if (remainingPaths.isEmpty) { paths } @@ -335,19 +309,11 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole if (path.direction == RoutePathDirection.Bidirectional || path.direction == RoutePathDirection.Backward) { paths.lastOption match { case None => - val reversed = path.direction == RoutePathDirection.Bidirectional - val element = StructurePathElement(path, reversed) + val element = StructurePathElement(path, reversed = true) findNonNodeNetworkRouteBackwardPath(paths :+ element, remainingPaths.tail) case Some(last) => - val connectingNodeId = if (path.direction == RoutePathDirection.Bidirectional) { - path.toNodeId - } - else { - path.fromNodeId - } - if (last.endNodeId == connectingNodeId) { - val reversed = path.direction == RoutePathDirection.Bidirectional - val element = StructurePathElement(path, reversed) + if (last.endNodeId == path.toNodeId) { + val element = StructurePathElement(path, reversed = true) findNonNodeNetworkRouteBackwardPath(paths :+ element, remainingPaths.tail) } else { @@ -361,8 +327,8 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } } - private def findFirstForwardPathIndex(paths: Seq[RoutePath], startNodeId: Long): Option[Int] = { - val index = paths.indexWhere { path => + private def findFirstForwardPathIndex(elements: Seq[NewRouteSegmentElement], startNodeId: Long): Option[Int] = { + val index = elements.indexWhere { path => path.nodeIds.head == startNodeId } if (index >= 0) { @@ -374,38 +340,38 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } @tailrec - private def findNextForwardPath(pathElements: Seq[StructurePathElement], paths: Seq[RoutePath], endNodeId: Long): Seq[StructurePathElement] = { + private def nodeNetworkFindNextForwardPath(pathElements: Seq[StructurePathElement], segmentElements: Seq[NewRouteSegmentElement], endNodeId: Long): Seq[StructurePathElement] = { val lastEndNodeId = pathElements.last.endNodeId if (lastEndNodeId == endNodeId) { pathElements // found end of forward path } - else if (paths.isEmpty) { + else if (segmentElements.isEmpty) { Seq.empty // could not find forward path to end node } else { - paths.find { path => - (path.direction == RoutePathDirection.Bidirectional || path.direction == RoutePathDirection.Forward) && - path.nodeIds.head == lastEndNodeId + segmentElements.find { segmentElement => + (segmentElement.direction == RoutePathDirection.Bidirectional || segmentElement.direction == RoutePathDirection.Forward) && + segmentElement.nodeIds.head == lastEndNodeId } match { case None => Seq.empty // could not find forward path to end node - case Some(nextForwardPath) => - val remainingPaths = paths.filterNot(p => p.id == nextForwardPath.id) + case Some(nextSegmentElement) => + val remainingPaths = segmentElements.filterNot(p => p.id == nextSegmentElement.id) val element = StructurePathElement( - nextForwardPath, + nextSegmentElement, reversed = false ) - findNextForwardPath(pathElements :+ element, remainingPaths, endNodeId) + nodeNetworkFindNextForwardPath(pathElements :+ element, remainingPaths, endNodeId) } } } - private def findFirstBackwardPathIndex(paths: Seq[RoutePath], endNodeId: Long): Option[Int] = { + private def nodeNetworkFindFirstBackwardPathIndex(paths: Seq[NewRouteSegmentElement], endNodeId: Long): Option[Int] = { val index = paths.indexWhere { path => if (path.direction == RoutePathDirection.Bidirectional) { path.toNodeId == endNodeId } else if (path.direction == RoutePathDirection.Backward) { - path.fromNodeId == endNodeId + path.toNodeId == endNodeId } else { false @@ -420,7 +386,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole } @tailrec - private def findNextBackwardPath(pathElements: Seq[StructurePathElement], paths: Seq[RoutePath], startNodeId: Long): Seq[StructurePathElement] = { + private def findNextBackwardPath(pathElements: Seq[StructurePathElement], paths: Seq[NewRouteSegmentElement], startNodeId: Long): Seq[StructurePathElement] = { val connectingNodeId = pathElements.last.endNodeId if (connectingNodeId == startNodeId) { pathElements // found start of backward path @@ -433,7 +399,7 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole if (path.direction == RoutePathDirection.Bidirectional) { path.toNodeId == connectingNodeId } else if (path.direction == RoutePathDirection.Backward) { - path.fromNodeId == connectingNodeId + path.toNodeId == connectingNodeId } else { false @@ -442,10 +408,9 @@ class StructureAnalyzer(context: RouteDetailAnalysisContext, traceEnabled: Boole case None => Seq.empty // could not find forward path to end node case Some(nextBackwardPath) => val remainingPaths = paths.filterNot(p => p.id == nextBackwardPath.id) - val reversed = nextBackwardPath.direction == RoutePathDirection.Bidirectional val element = StructurePathElement( nextBackwardPath, - reversed + reversed = true ) findNextBackwardPath(pathElements :+ element, remainingPaths, startNodeId) } diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePath.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePath.scala index 9a433ac41..92f727b1b 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePath.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePath.scala @@ -13,6 +13,6 @@ case class StructurePath( } def pathIds: Seq[Long] = { - elements.map(_.path.id) + elements.map(_.element.id) } } diff --git a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePathElement.scala b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePathElement.scala index c6692fbb8..dff721ebd 100644 --- a/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePathElement.scala +++ b/server/src/main/scala/kpn/server/analyzer/engine/analysis/route/structure/StructurePathElement.scala @@ -1,34 +1,34 @@ package kpn.server.analyzer.engine.analysis.route.structure case class StructurePathElement( - path: RoutePath, + element: NewRouteSegmentElement, reversed: Boolean ) { def nodeIds: Seq[Long] = { if (reversed) { - path.nodeIds.reverse + element.nodeIds.reverse } else { - path.nodeIds + element.nodeIds } } def startNodeId: Long = { if (reversed) { - path.nodeIds.last + element.nodeIds.last } else { - path.nodeIds.head + element.nodeIds.head } } def endNodeId: Long = { if (reversed) { - path.nodeIds.head + element.nodeIds.head } else { - path.nodeIds.last + element.nodeIds.last } } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteDetailAnalysisTestContext.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteDetailAnalysisTestContext.scala index f03ae6129..504e3c941 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteDetailAnalysisTestContext.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/RouteDetailAnalysisTestContext.scala @@ -22,26 +22,9 @@ case class RouteDetailAnalysisTestContext(context: RouteDetailAnalysisContext) { ).flatten } - def paths: Seq[String] = { - context.paths.map { path => - val id = s"path-${path.id}" - val direction = if (path.direction == RoutePathDirection.Bidirectional) { - "↔" - } else if (path.direction == RoutePathDirection.Forward) { - "→" - } - else { - "←" - } - val elements = path.elements.map(_.id).mkString(", ") - val nodes = path.nodeIds.mkString(", ") - s"$id $direction elements=$elements, nodes=$nodes" - } - } - def facts: Set[Fact] = context.facts.toSet - def pathDetails: Seq[String] = { + def paths: Seq[String] = { Seq( context.newStructure.forwardPath.map(path => "forward=" + pathToString(path)).toSeq, context.newStructure.backwardPath.map(path => "backward=" + pathToString(path)).toSeq, @@ -65,14 +48,22 @@ case class RouteDetailAnalysisTestContext(context: RouteDetailAnalysisContext) { } private def elementToString(element: NewRouteSegmentElement): String = { - val direction = element.direction.entryName.toLowerCase + val direction = if (element.direction == RoutePathDirection.Bidirectional) { + "↔" + } else if (element.direction == RoutePathDirection.Forward) { + "→" + } + else { + "←" + } val from = element.fromNetworkNode.map(n => s" ${n.node.id}(${n.name})").getOrElse("") val to = element.toNetworkNode.map(n => s" ${n.node.id}(${n.name})").getOrElse("") - s""" element-${element.id} $direction ${element.fromNodeId}>${element.toNodeId}$from$to""" + val nodes = element.nodeIds.mkString(", ") + s""" element-${element.id} ${element.fromNodeId}>${element.toNodeId}$from$to $direction nodes=$nodes""" } private def fragmentToString(link: NewRouteSegmentElementFragment): String = { - s""" way-${link.wayId} ${link.link.reportString} paths=${link.pathIds.mkString(", ")}""" + s""" way-${link.wayId} ${link.link.reportString}""" } private def pathToString(path: StructurePath): String = { diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_01_SingleWayBidirectionalTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_01_SingleWayBidirectionalTest.scala index d25ac608f..a65fdbcc0 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_01_SingleWayBidirectionalTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_01_SingleWayBidirectionalTest.scala @@ -20,54 +20,16 @@ class Structure_01_SingleWayBidirectionalTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3", - " way-11 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=3>1 nodes=3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_02_SingleWayForwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_02_SingleWayForwardTest.scala index 653b9dd48..ac7dd1940 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_02_SingleWayForwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_02_SingleWayForwardTest.scala @@ -23,47 +23,15 @@ class Structure_02_SingleWayForwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 forward 1>3", - " way-11 p n loop fp ■ bp head ■ tail d forward paths=1", + " element-1 1>3 → nodes=1, 2, 3", + " way-11 p n loop fp ■ bp head ■ tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=1, 2, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3 (Forward)" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3) - ) - ), - backwardPath = None - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_03_SingleWayBackwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_03_SingleWayBackwardTest.scala index 012d93835..85afd15fc 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_03_SingleWayBackwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_03_SingleWayBackwardTest.scala @@ -23,47 +23,15 @@ class Structure_03_SingleWayBackwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 3>1", - " element-1 forward 3>1", - " way-11 p n loop fp ■ bp head ■ tail d backward paths=1", + " element-1 3>1 → nodes=3, 2, 1", + " way-11 p n loop fp ■ bp head ■ tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=3, 2, 1", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=3>1 nodes=3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "3>1 (Forward)" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 2, 1) - ) - ), - backwardPath = None - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_04_SingleWayRoundaboutLoopTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_04_SingleWayRoundaboutLoopTest.scala index 8644de662..58bb1cbe4 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_04_SingleWayRoundaboutLoopTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_04_SingleWayRoundaboutLoopTest.scala @@ -20,55 +20,17 @@ class Structure_04_SingleWayRoundaboutLoopTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>1", - " element-1 bidirectional 1>1", - " way-11 p n loop fp bp head tail d roundaboutright paths=1", + " element-1 1>1 ↔ nodes=1, 2, 3, 4, 1", + " way-11 p n loop fp bp head tail d roundaboutright", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 1", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>1 nodes=1, 2, 3, 4, 1", - "backward=1>1 nodes=1, 4, 3, 2, 1", - ) - ) - } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>1 (Forward)", - "1>1 (Backward)", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 1, - nodeIds = Seq(1, 2, 3, 4, 1) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 1, - nodeIds = Seq(1, 2, 3, 4, 1) - ) - ) + "backward=1>1 nodes=1, 4, 3, 2, 1", // TODO redesign - NOK ) ) + pending } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_05_SingleWayRoundaboutNotALoopTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_05_SingleWayRoundaboutNotALoopTest.scala index 3706e7f7f..f292b4ce3 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_05_SingleWayRoundaboutNotALoopTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_05_SingleWayRoundaboutNotALoopTest.scala @@ -20,47 +20,15 @@ class Structure_05_SingleWayRoundaboutNotALoopTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>4", - " element-1 bidirectional 1>4", - " way-11 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>4 ↔ nodes=1, 2, 3, 4", + " way-11 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>4 nodes=1, 2, 3, 4", - "backward=4>1 nodes=4, 3, 2, 1", - ) - ) - } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>4 (Forward)", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 4, - nodeIds = Seq(1, 2, 3, 4) - ) - ), - backwardPath = None + "backward=4>1 nodes=4, 3, 2, 1", // TODO redesign - NOK ) ) } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_11_DerivedDirectionTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_11_DerivedDirectionTest.scala index 74fdfbbc7..440ee8116 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_11_DerivedDirectionTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_11_DerivedDirectionTest.scala @@ -23,55 +23,17 @@ class Structure_11_DerivedDirectionTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>5", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>5 ↔ nodes=1, 2, 3, 4, 5", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=5>1 nodes=5, 4, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3>5" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 5, - nodeIds = Seq(1, 2, 3, 4, 5) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 5, - endNodeId = 1, - nodeIds = Seq(5, 4, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_12_DerivedDirectionReverseTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_12_DerivedDirectionReverseTest.scala index 7be887dce..7f3c2f41b 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_12_DerivedDirectionReverseTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_12_DerivedDirectionReverseTest.scala @@ -23,55 +23,17 @@ class Structure_12_DerivedDirectionReverseTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>5", - " way-11 p n ■ loop fp bp head tail d backward paths=1", - " way-12 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>5 ↔ nodes=1, 2, 3, 4, 5", + " way-11 p n ■ loop fp bp head tail d backward", + " way-12 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=5>1 nodes=5, 4, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3>5" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 5, - nodeIds = Seq(1, 2, 3, 4, 5) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 5, - endNodeId = 1, - nodeIds = Seq(5, 4, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_13_DerivedDirectionForwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_13_DerivedDirectionForwardTest.scala index 17119fe03..200579a12 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_13_DerivedDirectionForwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_13_DerivedDirectionForwardTest.scala @@ -23,58 +23,18 @@ class Structure_13_DerivedDirectionForwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d backward paths=1", - " element-2 forward 3>5", - " way-12 p ■ n loop fp ■ bp head ■ tail d forward paths=2", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d backward", + " element-2 3>5 → nodes=3, 4, 5", + " way-12 p ■ n loop fp ■ bp head ■ tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=3>1 nodes=3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 5, - nodeIds = Seq(1, 2, 3, 4, 5) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 2, 1) - ) - ), - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_14_DerivedDirectionBackwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_14_DerivedDirectionBackwardTest.scala index 44f7c3c1e..cb5bf7fec 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_14_DerivedDirectionBackwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_14_DerivedDirectionBackwardTest.scala @@ -23,58 +23,18 @@ class Structure_14_DerivedDirectionBackwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>5", - " way-12 p ■ n loop fp ■ bp head ■ tail d backward paths=2", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 3>5 → nodes=3, 4, 5", + " way-12 p ■ n loop fp ■ bp head ■ tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=3>1 nodes=3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 5, - nodeIds = Seq(1, 2, 3, 4, 5) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 2, 1) - ) - ), - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_15_DerivedDirectionBackwardBackwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_15_DerivedDirectionBackwardBackwardTest.scala index 4248f2343..2d9945fd3 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_15_DerivedDirectionBackwardBackwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_15_DerivedDirectionBackwardBackwardTest.scala @@ -23,58 +23,18 @@ class Structure_15_DerivedDirectionBackwardBackwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d backward paths=1", - " element-2 forward 3>5", - " way-12 p ■ n loop fp ■ bp head ■ tail d backward paths=2", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d backward", + " element-2 3>5 → nodes=3, 4, 5", + " way-12 p ■ n loop fp ■ bp head ■ tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=3>1 nodes=3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 5, - nodeIds = Seq(1, 2, 3, 4, 5) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 2, 1) - ) - ), - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_21_ContinuousTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_21_ContinuousTest.scala index d24c71269..1b2262d16 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_21_ContinuousTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_21_ContinuousTest.scala @@ -24,56 +24,18 @@ class Structure_21_ContinuousTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>7", - " element-1 bidirectional 1>7", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-13 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>7 ↔ nodes=1, 2, 3, 4, 5, 6, 7", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5, 6, 7", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>7 nodes=1, 2, 3, 4, 5, 6, 7", "backward=7>1 nodes=7, 6, 5, 4, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3>5>7" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 7, - nodeIds = Seq(1, 2, 3, 4, 5, 6, 7) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 7, - endNodeId = 1, - nodeIds = Seq(7, 6, 5, 4, 3, 2, 1) - ) - ), - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousFirstWayReversedTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousFirstWayReversedTest.scala index 66e33a3d0..e41c2e5ea 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousFirstWayReversedTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousFirstWayReversedTest.scala @@ -24,56 +24,18 @@ class Structure_22_ContinuousFirstWayReversedTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>7", - " element-1 bidirectional 1>7", - " way-11 p n ■ loop fp bp head tail d backward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-13 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>7 ↔ nodes=1, 2, 3, 4, 5, 6, 7", + " way-11 p n ■ loop fp bp head tail d backward", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5, 6, 7", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>7 nodes=1, 2, 3, 4, 5, 6, 7", "backward=7>1 nodes=7, 6, 5, 4, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3>5>7" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 7, - nodeIds = Seq(1, 2, 3, 4, 5, 6, 7) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 7, - endNodeId = 1, - nodeIds = Seq(7, 6, 5, 4, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousSecondAndThirdWayReversedTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousSecondAndThirdWayReversedTest.scala index 52fc4544a..c5f5cc516 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousSecondAndThirdWayReversedTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_22_ContinuousSecondAndThirdWayReversedTest.scala @@ -24,56 +24,18 @@ class Structure_22_ContinuousSecondAndThirdWayReversedTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>7", - " element-1 bidirectional 1>7", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d backward paths=1", - " way-13 p ■ n loop fp bp head tail d backward paths=1", + " element-1 1>7 ↔ nodes=1, 2, 3, 4, 5, 6, 7", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n ■ loop fp bp head tail d backward", + " way-13 p ■ n loop fp bp head tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5, 6, 7", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>7 nodes=1, 2, 3, 4, 5, 6, 7", "backward=7>1 nodes=7, 6, 5, 4, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3>5>7" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 7, - nodeIds = Seq(1, 2, 3, 4, 5, 6, 7) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 7, - endNodeId = 1, - nodeIds = Seq(7, 6, 5, 4, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_31_GapSecondWayBackwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_31_GapSecondWayBackwardTest.scala index 7cadfb80a..1fcd5e201 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_31_GapSecondWayBackwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_31_GapSecondWayBackwardTest.scala @@ -27,59 +27,19 @@ class Structure_31_GapSecondWayBackwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3", - " way-11 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n loop fp bp head tail d unconnected", "segment-2 5>3", - " element-2 forward 5>3", - " way-12 p n loop fp ■ bp head ■ tail d backward paths=2", + " element-2 5>3 → nodes=5, 4, 3", + " way-12 p n loop fp ■ bp head ■ tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=5, 4, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>3 nodes=1, 2, 3", "other=5>3 nodes=5, 4, 3", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "5>3 (Backward)" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 5, - endNodeId = 1, - nodeIds = Seq(5, 4, 3, 2, 1) // !!! this is wrong !!! - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_32_GapTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_32_GapTest.scala index 6deaaf65b..5fbd27732 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_32_GapTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_32_GapTest.scala @@ -29,54 +29,20 @@ class Structure_32_GapTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>5", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>5 ↔ nodes=1, 2, 3, 4, 5", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d forward", "segment-2 6>8", - " element-2 bidirectional 6>8", - " way-13 p n loop fp bp head tail d unconnected paths=2", + " element-2 6>8 ↔ nodes=6, 7, 8", + " way-13 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - "path-2 ↔ elements=2, nodes=6, 7, 8", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>5 nodes=1, 2, 3, 4, 5", "other=6>8 nodes=6, 7, 8", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3>5", - ), - Seq( - "6>8", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = None, - backwardPath = None, - Seq( - TestStructurePath(1, 5, Seq(1, 2, 3, 4, 5)), - TestStructurePath(6, 8, List(6, 7, 8)) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_33_GapTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_33_GapTest.scala index 74cc6b11a..059735c7c 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_33_GapTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_33_GapTest.scala @@ -36,28 +36,20 @@ class Structure_33_GapTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>2", - " element-1 bidirectional 1>2", - " way-11 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n loop fp bp head tail d unconnected", "segment-2 3>5", - " element-2 bidirectional 3>5", - " way-12 p n ■ loop fp bp head tail d forward paths=2", - " way-13 p ■ n loop fp bp head tail d forward paths=2", + " element-2 3>5 ↔ nodes=3, 4, 5", + " way-12 p n ■ loop fp bp head tail d forward", + " way-13 p ■ n loop fp bp head tail d forward", "segment-3 6>8", - " element-3 bidirectional 6>8", - " way-14 p n ■ loop fp bp head tail d forward paths=3", - " way-15 p ■ n loop fp bp head tail d forward paths=3", + " element-3 6>8 ↔ nodes=6, 7, 8", + " way-14 p n ■ loop fp bp head tail d forward", + " way-15 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 ↔ elements=2, nodes=3, 4, 5", - "path-3 ↔ elements=3, nodes=6, 7, 8", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>2 nodes=1, 2", "other=3>5 nodes=3, 4, 5", @@ -65,35 +57,4 @@ class Structure_33_GapTest extends UnitTest { ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - ), - Seq( - "3>4>5", - ), - Seq( - "6>7>8" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = None, - backwardPath = None, - Seq( - TestStructurePath(1, 2, Seq(1, 2)), - TestStructurePath(3, 5, Seq(3, 4, 5)), - TestStructurePath(6, 8, Seq(6, 7, 8)) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_34_GapTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_34_GapTest.scala index 6e5b7b2eb..28f2c9632 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_34_GapTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_34_GapTest.scala @@ -36,28 +36,20 @@ class Structure_34_GapTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d forward", "segment-2 4>6", - " element-2 bidirectional 4>6", - " way-13 p n ■ loop fp bp head tail d forward paths=2", - " way-14 p ■ n loop fp bp head tail d forward paths=2", + " element-2 4>6 ↔ nodes=4, 5, 6", + " way-13 p n ■ loop fp bp head tail d forward", + " way-14 p ■ n loop fp bp head tail d forward", "segment-3 7>8", - " element-3 bidirectional 7>8", - " way-15 p n loop fp bp head tail d unconnected paths=3", + " element-3 7>8 ↔ nodes=7, 8", + " way-15 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 ↔ elements=2, nodes=4, 5, 6", - "path-3 ↔ elements=3, nodes=7, 8", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>3 nodes=1, 2, 3", "other=4>6 nodes=4, 5, 6", @@ -65,35 +57,4 @@ class Structure_34_GapTest extends UnitTest { ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2>3", - ), - Seq( - "4>5>6", - ), - Seq( - "7>8" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = None, - backwardPath = None, - Seq( - TestStructurePath(1, 3, Seq(1, 2, 3)), - TestStructurePath(4, 6, Seq(4, 5, 6)), - TestStructurePath(7, 8, Seq(7, 8)) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_41_ForwardNoBackwardPathTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_41_ForwardNoBackwardPathTest.scala index e0a9bc307..216e1a7ca 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_41_ForwardNoBackwardPathTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_41_ForwardNoBackwardPathTest.scala @@ -22,58 +22,18 @@ class Structure_41_ForwardNoBackwardPathTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 forward 1>2", - " way-11 p n ■ loop fp ■ bp head ■ tail d forward paths=1", - " element-2 bidirectional 2>3", - " way-12 p ■ n loop fp bp head tail d backward paths=2", + " element-1 1>2 → nodes=1, 2", + " way-11 p n ■ loop fp ■ bp head ■ tail d forward", + " element-2 2>3 ↔ nodes=2, 3", + " way-12 p ■ n loop fp bp head tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=1, 2", - "path-2 ↔ elements=2, nodes=2, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=3>2 nodes=3, 2", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2 (Forward)", - "2>3" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 2, - nodeIds = Seq(3, 2) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_42_ForwardGapTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_42_ForwardGapTest.scala index 5e11ab036..0f352c8c7 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_42_ForwardGapTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_42_ForwardGapTest.scala @@ -27,53 +27,19 @@ class Structure_42_ForwardGapTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 2>1", - " element-1 forward 2>1", - " way-11 p n loop fp ■ bp head ■ tail d forward paths=1", + " element-1 2>1 → nodes=2, 1", + " way-11 p n loop fp ■ bp head ■ tail d forward", "segment-2 3>2", - " element-2 bidirectional 3>2", - " way-12 p n loop fp bp head tail d unconnected paths=2", + " element-2 3>2 ↔ nodes=3, 2", + " way-12 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=2, 1", - "path-2 ↔ elements=2, nodes=3, 2", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=2>1 nodes=2, 1", "other=3>2 nodes=3, 2", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "2>1 (Forward)", - ), - Seq( - "3>2" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = None, - backwardPath = None, - Seq( - TestStructurePath(2, 1, Seq(2, 1)), - TestStructurePath(3, 2, Seq(3, 2)) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_43_ForwardBackwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_43_ForwardBackwardTest.scala index a7d08665a..8c3173aa5 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_43_ForwardBackwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_43_ForwardBackwardTest.scala @@ -30,68 +30,24 @@ class Structure_43_ForwardBackwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>6", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 2>5", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-13 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 2>5", - " way-14 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " way-15 p ■ n ■ loop fp bp ■ head tail ■ d forward paths=3", - " element-4 bidirectional 5>6", - " way-16 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 2>5 → nodes=2, 3, 5", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-13 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 2>5 ← nodes=2, 4, 5", + " way-14 p ■ n ■ loop fp bp ■ head tail d forward", + " way-15 p ■ n ■ loop fp bp ■ head tail ■ d forward", + " element-4 5>6 ↔ nodes=5, 6", + " way-16 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 3, 5", - "path-3 ← elements=3, nodes=5, 4, 2", - "path-4 ↔ elements=4, nodes=5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>6 nodes=1, 2, 3, 5, 6", "backward=6>1 nodes=6, 5, 4, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>3>5 (Forward)", - "5>4>2 (Backward)", - "5>6" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 6, - nodeIds = Seq(1, 2, 3, 5, 6) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 6, - endNodeId = 1, - nodeIds = Seq(6, 5, 4, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_44_ForwardBackwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_44_ForwardBackwardTest.scala index f40499813..a44013ed7 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_44_ForwardBackwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_44_ForwardBackwardTest.scala @@ -30,68 +30,24 @@ class Structure_44_ForwardBackwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>6", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 2>5", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-13 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 2>5", - " way-14 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " way-15 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=3", - " element-4 bidirectional 5>6", - " way-16 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 2>5 → nodes=2, 3, 5", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-13 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 2>5 ← nodes=2, 4, 5", + " way-14 p ■ n ■ loop fp bp ■ head tail d forward", + " way-15 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-4 5>6 ↔ nodes=5, 6", + " way-16 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 3, 5", - "path-3 ← elements=3, nodes=5, 4, 2", - "path-4 ↔ elements=4, nodes=5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>6 nodes=1, 2, 3, 5, 6", "backward=6>1 nodes=6, 5, 4, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>3>5 (Forward)", - "5>4>2 (Backward)", - "5>6" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 6, - nodeIds = Seq(1, 2, 3, 5, 6) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 6, - endNodeId = 1, - nodeIds = Seq(6, 5, 4, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_45_ForwardForwardTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_45_ForwardForwardTest.scala index 26d7370de..b4cd06d50 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_45_ForwardForwardTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_45_ForwardForwardTest.scala @@ -30,68 +30,24 @@ class Structure_45_ForwardForwardTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>6", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 2>5", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-13 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 2>5", - " way-14 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-15 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=3", - " element-4 bidirectional 5>6", - " way-16 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 2>5 → nodes=2, 3, 5", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-13 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 2>5 ← nodes=2, 4, 5", + " way-14 p ■ n ■ loop fp bp ■ head tail d backward", + " way-15 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-4 5>6 ↔ nodes=5, 6", + " way-16 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 3, 5", - "path-3 ← elements=3, nodes=5, 4, 2", - "path-4 ↔ elements=4, nodes=5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>6 nodes=1, 2, 3, 5, 6", "backward=6>1 nodes=6, 5, 4, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>3>5 (Forward)", - "5>4>2 (Backward)", - "5>6" - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 6, - nodeIds = Seq(1, 2, 3, 5, 6) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 6, - endNodeId = 1, - nodeIds = Seq(6, 5, 4, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_46_ForwardForwardGapTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_46_ForwardForwardGapTest.scala index b2da15ebf..c1cab65ca 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_46_ForwardForwardGapTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_46_ForwardForwardGapTest.scala @@ -46,71 +46,31 @@ class Structure_46_ForwardForwardGapTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>9", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 2>8", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-13 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 2>8", - " way-14 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-15 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=3", - " element-4 bidirectional 8>9", - " way-16 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 2>8 → nodes=2, 3, 8", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-13 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 2>8 ← nodes=2, 7, 8", + " way-14 p ■ n ■ loop fp bp ■ head tail d backward", + " way-15 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-4 8>9 ↔ nodes=8, 9", + " way-16 p ■ n loop fp bp head tail d forward", "segment-2 10>12", - " element-5 bidirectional 10>12", - " way-17 p n ■ loop fp bp head tail d forward paths=5", - " way-18 p ■ n loop fp bp head tail d forward paths=5", + " element-5 10>12 ↔ nodes=10, 11, 12", + " way-17 p n ■ loop fp bp head tail d forward", + " way-18 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 3, 8", - "path-3 ← elements=3, nodes=8, 7, 2", - "path-4 ↔ elements=4, nodes=8, 9", - "path-5 ↔ elements=5, nodes=10, 11, 12", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>2 nodes=1, 2", "other=2>8 nodes=2, 3, 8", - "other=8>2 nodes=8, 7, 2", + "other=2>8 nodes=2, 7, 8", "other=8>9 nodes=8, 9", "other=10>12 nodes=10, 11, 12", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>3>8 (Forward)", - "8>7>2 (Backward)", - "8>9", - ), - Seq( - "10>11>12", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = None, - backwardPath = None, - Seq( - TestStructurePath(1, 9, Seq(1, 2, 2, 3, 8, 8, 7, 2, 8, 9)), - TestStructurePath(10, 12, Seq(10, 11, 12)) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_51_RoundaboutTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_51_RoundaboutTest.scala index 0392d811e..95434f0e0 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_51_RoundaboutTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_51_RoundaboutTest.scala @@ -20,55 +20,17 @@ class Structure_51_RoundaboutTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>1", - " element-1 bidirectional 1>1", - " way-11 p n loop fp bp head tail d roundaboutright paths=1", + " element-1 1>1 ↔ nodes=1, 2, 3, 4, 1", + " way-11 p n loop fp bp head tail d roundaboutright", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 1", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>1 nodes=1, 2, 3, 4, 1", - "backward=1>1 nodes=1, 4, 3, 2, 1", - ) - ) - } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>1 (Forward)", - "1>1 (Backward)", - ) - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 1, - nodeIds = Seq(1, 2, 3, 4, 1) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 1, - nodeIds = Seq(1, 2, 3, 4, 1) - ) - ) + "backward=1>1 nodes=1, 4, 3, 2, 1", // TODO redesign ) ) + pending } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_52_RoundaboutRoundaboutTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_52_RoundaboutRoundaboutTest.scala index 07289302f..a3a2267e5 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_52_RoundaboutRoundaboutTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_52_RoundaboutRoundaboutTest.scala @@ -22,63 +22,21 @@ class Structure_52_RoundaboutRoundaboutTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 forward 1>3", - " way-11 p n ■ loop ■ fp bp head tail d roundaboutright paths=1", - " element-2 backward 1>3", - " way-11 p n ■ loop ■ fp bp head tail d roundaboutright paths=2", - " element-3 bidirectional 3>3", - " way-12 p ■ n loop ■ fp bp head tail d roundaboutright paths=3", + " element-1 1>3 → nodes=1, 2, 3", + " way-11 p n ■ loop ■ fp bp head tail d roundaboutright", + " element-2 1>3 ← nodes=1, 4, 3", + " way-11 p n ■ loop ■ fp bp head tail d roundaboutright", + " element-3 3>3 ↔ nodes=3, 5, 6, 7, 3", + " way-12 p ■ n loop ■ fp bp head tail d roundaboutright", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=1, 2, 3", - "path-2 ← elements=2, nodes=3, 4, 1", - "path-3 ↔ elements=3, nodes=3, 5, 6, 7, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3, 5, 6, 7, 3", - "backward=3>1 nodes=3, 7, 6, 5, 3, 4, 1", - ) - ) - } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3 (Forward)", - "3>1 (Backward)", - "3>3 (Forward)", - "3>3 (Backward)", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3, 5, 6, 7, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 5, 6, 7, 3, 4, 1) - ) - ) + "backward=3>1 nodes=3, 7, 6, 5, 3, 4, 1", // TODO redesign nodeIds = Seq(3, 5, 6, 7, 3, 4, 1) ) ) + pending } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_53_WayRoundaboutTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_53_WayRoundaboutTest.scala index cbe4cc0fe..ed5ab6528 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_53_WayRoundaboutTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_53_WayRoundaboutTest.scala @@ -22,58 +22,18 @@ class Structure_53_WayRoundaboutTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n loop fp bp head tail d roundaboutright paths=1" + " element-1 1>3 ↔ nodes=1, 2, 3, 4, 5, 6, 3", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d roundaboutright" ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5, 6, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3, 4, 5, 6, 3", - "backward=3>1 nodes=3, 6, 5, 4, 3, 2, 1", // TODO redesign - this is NOK? + "backward=3>1 nodes=3, 6, 5, 4, 3, 2, 1", // TODO redesign - this is NOK? nodeIds = Seq(3, 4, 5, 6, 3, 2, 1) ) ) pending } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>3 (Forward)", - "3>3 (Backward)", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3, 4, 5, 6, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 4, 5, 6, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_54_WayRoundaboutWayTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_54_WayRoundaboutWayTest.scala index 1b62f92a9..e86f19cf8 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_54_WayRoundaboutWayTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_54_WayRoundaboutWayTest.scala @@ -24,66 +24,22 @@ class Structure_54_WayRoundaboutWayTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>8", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>5", - " way-12 p ■ n ■ loop fp bp head tail d roundaboutright paths=2", - " element-3 backward 3>5", - " way-12 p ■ n ■ loop fp bp head tail d roundaboutright paths=3", - " element-4 bidirectional 5>8", - " way-13 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 3>5 → nodes=3, 4, 5", + " way-12 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-3 3>5 ← nodes=3, 6, 5", + " way-12 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-4 5>8 ↔ nodes=5, 7, 8", + " way-13 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5", - "path-3 ← elements=3, nodes=5, 6, 3", - "path-4 ↔ elements=4, nodes=5, 7, 8", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>8 nodes=1, 2, 3, 4, 5, 7, 8", "backward=8>1 nodes=8, 7, 5, 6, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - "5>3 (Backward)", - "5>8", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 8, - nodeIds = Seq(1, 2, 3, 4, 5, 7, 8) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 8, - endNodeId = 1, - nodeIds = Seq(8, 7, 5, 6, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_55_DoubleRoundaboutTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_55_DoubleRoundaboutTest.scala index 6a617f0be..5666f262a 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_55_DoubleRoundaboutTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_55_DoubleRoundaboutTest.scala @@ -26,74 +26,26 @@ class Structure_55_DoubleRoundaboutTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>11", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>5", - " way-12 p ■ n ■ loop fp bp head tail d roundaboutright paths=2", - " element-3 backward 3>5", - " way-12 p ■ n ■ loop fp bp head tail d roundaboutright paths=3", - " element-4 forward 5>9", - " way-13 p ■ n ■ loop fp bp head tail d roundaboutright paths=4", - " element-5 backward 5>9", - " way-13 p ■ n ■ loop fp bp head tail d roundaboutright paths=5", - " element-6 bidirectional 9>11", - " way-14 p ■ n loop fp bp head tail d forward paths=6", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 3>5 → nodes=3, 4, 5", + " way-12 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-3 3>5 ← nodes=3, 6, 5", + " way-12 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-4 5>9 → nodes=5, 7, 9", + " way-13 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-5 5>9 ← nodes=5, 8, 9", + " way-13 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-6 9>11 ↔ nodes=9, 10, 11", + " way-14 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5", - "path-3 ← elements=3, nodes=5, 6, 3", - "path-4 → elements=4, nodes=5, 7, 9", - "path-5 ← elements=5, nodes=9, 8, 5", - "path-6 ↔ elements=6, nodes=9, 10, 11", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>11 nodes=1, 2, 3, 4, 5, 7, 9, 10, 11", "backward=11>1 nodes=11, 10, 9, 8, 5, 6, 3, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - "5>3 (Backward)", - "5>9 (Forward)", - "9>5 (Backward)", - "9>11", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 11, - nodeIds = Seq(1, 2, 3, 4, 5, 7, 9, 10, 11) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 11, - endNodeId = 1, - nodeIds = Seq(11, 10, 9, 8, 5, 6, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_61_NonCircularRoundaboutTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_61_NonCircularRoundaboutTest.scala index fa6d78847..308939522 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_61_NonCircularRoundaboutTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_61_NonCircularRoundaboutTest.scala @@ -24,52 +24,19 @@ class Structure_61_NonCircularRoundaboutTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>8", - " element-1 bidirectional 1>8", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-13 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>8 ↔ nodes=1, 2, 3, 4, 5, 7, 8", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5, 7, 8", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>8 nodes=1, 2, 3, 4, 5, 7, 8", - "backward=8>1 nodes=8, 7, 5, 4, 3, 2, 1", - ) - ) - } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - "5>8", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 8, - nodeIds = Seq(1, 2, 3, 4, 5, 7, 8) - ) - ), - backwardPath = None + "backward=8>1 nodes=8, 7, 5, 4, 3, 2, 1", // TODO redesign - there should be no backward path because of unidirectional roundabout section (at least for cycling) ) ) + pending } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_62_NonCircularRoundaboutTest.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_62_NonCircularRoundaboutTest.scala index d77961dc3..860b20231 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_62_NonCircularRoundaboutTest.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_62_NonCircularRoundaboutTest.scala @@ -27,68 +27,22 @@ class Structure_62_NonCircularRoundaboutTest extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>8", - " element-1 bidirectional 1>3", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>5", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " element-3 backward 3>5", - " way-13 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=3", - " element-4 bidirectional 5>8", - " way-14 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>3 ↔ nodes=1, 2, 3", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 3>5 → nodes=3, 4, 5", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " element-3 3>5 ← nodes=3, 6, 5", + " way-13 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-4 5>8 ↔ nodes=5, 7, 8", + " way-14 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5", - "path-3 ← elements=3, nodes=5, 6, 3", - "path-4 ↔ elements=4, nodes=5, 7, 8", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>8 nodes=1, 2, 3, 4, 5, 7, 8", "backward=8>1 nodes=8, 7, 5, 6, 3, 2, 1", ) ) } - - test("elements") { - pending - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>3", - "3>5 (Forward)", - "5>3 (Backward)", - "5>8", - ), - ) - ) - } - - test("structure") { - pending - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 8, - nodeIds = Seq(1, 2, 3, 4, 5, 7, 8) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 8, - endNodeId = 1, - nodeIds = Seq(8, 7, 5, 6, 3, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_71_5444896_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_71_5444896_Test.scala index cca6b49b2..b1406f59e 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_71_5444896_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_71_5444896_Test.scala @@ -40,71 +40,27 @@ class Structure_71_5444896_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>9", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d backward paths=1", - " element-2 forward 2>8", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d backward paths=2", - " way-13 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " way-14 p ■ n ■ loop fp ■ bp head tail d backward paths=2", - " way-15 p ■ n ■ loop fp ■ bp head tail d backward paths=2", - " element-3 backward 2>8", - " way-16 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-17 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-18 p ■ n ■ loop fp bp ■ head tail ■ d forward paths=3", - " element-4 bidirectional 8>9", - " way-19 p ■ n loop fp bp head tail d backward paths=4", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d backward", + " element-2 2>8 → nodes=2, 3, 4, 5, 8", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d backward", + " way-13 p ■ n ■ loop fp ■ bp head tail d forward", + " way-14 p ■ n ■ loop fp ■ bp head tail d backward", + " way-15 p ■ n ■ loop fp ■ bp head tail d backward", + " element-3 2>8 ← nodes=2, 6, 7, 8", + " way-16 p ■ n ■ loop fp bp ■ head tail d backward", + " way-17 p ■ n ■ loop fp bp ■ head tail d backward", + " way-18 p ■ n ■ loop fp bp ■ head tail ■ d forward", + " element-4 8>9 ↔ nodes=8, 9", + " way-19 p ■ n loop fp bp head tail d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 3, 4, 5, 8", - "path-3 ← elements=3, nodes=8, 7, 6, 2", - "path-4 ↔ elements=4, nodes=8, 9", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>9 nodes=1, 2, 3, 4, 5, 8, 9", "backward=9>1 nodes=9, 8, 7, 6, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>3>4>5>8 (Forward)", - "8>7>6>2 (Backward)", - "8>9", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 9, - nodeIds = Seq(1, 2, 3, 4, 5, 8, 9) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 9, - endNodeId = 1, - nodeIds = Seq(9, 8, 7, 6, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_72_SplitRoundabout_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_72_SplitRoundabout_Test.scala index e52f25986..06a5389a2 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_72_SplitRoundabout_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_72_SplitRoundabout_Test.scala @@ -46,85 +46,33 @@ class Structure_72_SplitRoundabout_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>12", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 2>5", - " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " element-3 backward 2>4", - " way-13 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-14 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " element-4 forward 5>6", - " way-15 p ■ n ■ loop fp ■ bp head tail ■ d roundaboutright paths=4", - " element-5 backward 4>7", - " way-15 p ■ n ■ loop fp ■ bp head tail ■ d roundaboutright paths=5", - " element-6 forward 6>10", - " way-16 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=6", - " way-17 p ■ n ■ loop fp ■ bp head tail d forward paths=6", - " element-7 backward 7>10", - " way-18 p ■ n ■ loop fp bp ■ head tail d backward paths=7", - " way-19 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=7", - " element-8 bidirectional 10>12", - " way-20 p ■ n loop fp bp head tail d forward paths=8", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 2>5 → nodes=2, 5", + " way-12 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " element-3 2>4 ← nodes=2, 8, 4", + " way-13 p ■ n ■ loop fp bp ■ head tail d backward", + " way-14 p ■ n ■ loop fp bp ■ head tail d backward", + " element-4 5>6 → nodes=5, 6", + " way-15 p ■ n ■ loop fp ■ bp head tail ■ d roundaboutright", + " element-5 4>7 ← nodes=4, 3, 7", + " way-15 p ■ n ■ loop fp ■ bp head tail ■ d roundaboutright", + " element-6 6>10 → nodes=6, 9, 10", + " way-16 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-17 p ■ n ■ loop fp ■ bp head tail d forward", + " element-7 7>10 ← nodes=7, 11, 10", + " way-18 p ■ n ■ loop fp bp ■ head tail d backward", + " way-19 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-8 10>12 ↔ nodes=10, 12", + " way-20 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 5", - "path-3 ← elements=3, nodes=4, 8, 2", - "path-4 → elements=4, nodes=5, 6", - "path-5 ← elements=5, nodes=7, 3, 4", - "path-6 → elements=6, nodes=6, 9, 10", - "path-7 ← elements=7, nodes=10, 11, 7", - "path-8 ↔ elements=8, nodes=10, 12", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>12 nodes=1, 2, 5, 6, 9, 10, 12", "backward=12>1 nodes=12, 10, 11, 7, 3, 4, 8, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>5 (Forward)", - "4>8>2 (Backward)", - "5>6 (Forward)", - "7>4 (Backward)", - "6>9>10 (Forward)", - "10>11>7 (Backward)", - "10>12", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 12, - nodeIds = Seq(1, 2, 5, 6, 9, 10, 12) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 12, - endNodeId = 1, - nodeIds = Seq(12, 10, 11, 7, 3, 4, 8, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_73_Split_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_73_Split_Test.scala index 4b28e84c2..e8b981184 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_73_Split_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_73_Split_Test.scala @@ -27,60 +27,20 @@ class Structure_73_Split_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 forward 1>3", - " way-11 p n ■ loop fp ■ bp head ■ tail d forward paths=1", - " way-12 p ■ n ■ loop fp ■ bp head tail d forward paths=1", - " element-2 backward 1>3", - " way-13 p ■ n ■ loop fp bp ■ head tail d forward paths=2", - " way-14 p ■ n loop fp bp ■ head tail ■ d forward paths=2", + " element-1 1>3 → nodes=1, 2, 3", + " way-11 p n ■ loop fp ■ bp head ■ tail d forward", + " way-12 p ■ n ■ loop fp ■ bp head tail d forward", + " element-2 1>3 ← nodes=1, 4, 3", + " way-13 p ■ n ■ loop fp bp ■ head tail d forward", + " way-14 p ■ n loop fp bp ■ head tail ■ d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=1, 2, 3", - "path-2 ← elements=2, nodes=3, 4, 1", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=3>1 nodes=3, 4, 1", ) ) } - - test("elements") { - setup.elementGroups(traceEnabled = true).shouldMatchTo( - Seq( - Seq( - "1>2>3 (Forward)", - "3>4>1 (Backward)", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 4, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_75_Split_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_75_Split_Test.scala index 1e00f10a8..c62d077ce 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_75_Split_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_75_Split_Test.scala @@ -33,66 +33,24 @@ class Structure_75_Split_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>7", - " element-1 forward 1>4", - " way-11 p n ■ loop fp ■ bp head ■ tail d forward paths=1", - " way-12 p ■ n ■ loop fp ■ bp head tail d forward paths=1", - " way-13 p ■ n ■ loop fp ■ bp head tail d forward paths=1", - " element-2 backward 1>4", - " way-14 p ■ n ■ loop fp bp ■ head tail d forward paths=2", - " way-15 p ■ n ■ loop fp bp ■ head tail d forward paths=2", - " way-16 p ■ n ■ loop fp bp ■ head tail ■ d forward paths=2", - " element-3 bidirectional 4>7", - " way-17 p ■ n loop fp bp head tail d forward paths=3", + " element-1 1>4 → nodes=1, 2, 3, 4", + " way-11 p n ■ loop fp ■ bp head ■ tail d forward", + " way-12 p ■ n ■ loop fp ■ bp head tail d forward", + " way-13 p ■ n ■ loop fp ■ bp head tail d forward", + " element-2 1>4 ← nodes=1, 5, 6, 4", + " way-14 p ■ n ■ loop fp bp ■ head tail d forward", + " way-15 p ■ n ■ loop fp bp ■ head tail d forward", + " way-16 p ■ n ■ loop fp bp ■ head tail ■ d forward", + " element-3 4>7 ↔ nodes=4, 7", + " way-17 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=1, 2, 3, 4", - "path-2 ← elements=2, nodes=4, 6, 5, 1", - "path-3 ↔ elements=3, nodes=4, 7", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>7 nodes=1, 2, 3, 4, 7", "backward=7>1 nodes=7, 4, 6, 5, 1", ) ) } - - test("elements") { - setup.elementGroups(traceEnabled = true).shouldMatchTo( - Seq( - Seq( - "1>2>3>4 (Forward)", - "4>6>5>1 (Backward)", - "4>7", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 7, - nodeIds = Seq(1, 2, 3, 4, 7) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 7, - endNodeId = 1, - nodeIds = Seq(7, 4, 6, 5, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_76_Split_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_76_Split_Test.scala index 972934e8b..1aff36eba 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_76_Split_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_76_Split_Test.scala @@ -27,60 +27,20 @@ class Structure_76_Split_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 forward 1>3", - " way-11 p n ■ loop fp ■ bp head ■ tail d backward paths=1", - " way-12 p ■ n ■ loop fp ■ bp head tail d forward paths=1", - " element-2 backward 1>3", - " way-13 p ■ n ■ loop fp bp ■ head tail d backward paths=2", - " way-14 p ■ n loop fp bp ■ head tail ■ d backward paths=2", + " element-1 1>3 → nodes=1, 2, 3", + " way-11 p n ■ loop fp ■ bp head ■ tail d backward", + " way-12 p ■ n ■ loop fp ■ bp head tail d forward", + " element-2 1>3 ← nodes=1, 4, 3", + " way-13 p ■ n ■ loop fp bp ■ head tail d backward", + " way-14 p ■ n loop fp bp ■ head tail ■ d backward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 → elements=1, nodes=1, 2, 3", - "path-2 ← elements=2, nodes=3, 4, 1", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=3>1 nodes=3, 4, 1", ) ) } - - test("elements") { - setup.elementGroups(traceEnabled = true).shouldMatchTo( - Seq( - Seq( - "1>2>3 (Forward)", - "3>4>1 (Backward)", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 3, - nodeIds = Seq(1, 2, 3) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 3, - endNodeId = 1, - nodeIds = Seq(3, 4, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_77_Split_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_77_Split_Test.scala index 0f7a3e435..126dd58dc 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_77_Split_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_77_Split_Test.scala @@ -29,74 +29,26 @@ class Structure_77_Split_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>7", - " element-1 bidirectional 1>2", - " way-11 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 2>4", - " way-12 p ■ n ■ loop fp bp head tail d roundaboutright paths=2", - " element-3 backward 2>4", - " way-12 p ■ n ■ loop fp bp head tail d roundaboutright paths=3", - " element-4 forward 4>6", - " way-13 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=4", - " element-5 backward 4>6", - " way-14 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=5", - " element-6 bidirectional 6>7", - " way-15 p ■ n loop fp bp head tail d forward paths=6", + " element-1 1>2 ↔ nodes=1, 2", + " way-11 p n ■ loop fp bp head tail d forward", + " element-2 2>4 → nodes=2, 3, 4", + " way-12 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-3 2>4 ← nodes=2, 5, 4", + " way-12 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-4 4>6 → nodes=4, 6", + " way-13 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " element-5 4>6 ← nodes=4, 6", + " way-14 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-6 6>7 ↔ nodes=6, 7", + " way-15 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 → elements=2, nodes=2, 3, 4", - "path-3 ← elements=3, nodes=4, 5, 2", - "path-4 → elements=4, nodes=4, 6", - "path-5 ← elements=5, nodes=6, 4", - "path-6 ↔ elements=6, nodes=6, 7", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>7 nodes=1, 2, 3, 4, 6, 7", "backward=7>1 nodes=7, 6, 4, 5, 2, 1", ) ) } - - test("elements") { - setup.elementGroups().shouldMatchTo( - Seq( - Seq( - "1>2", - "2>4 (Forward)", - "4>2 (Backward)", - "4>6 (Forward)", - "6>4 (Backward)", - "6>7", - ), - ) - ) - } - - test("structure") { - val structure = setup.structure() - structure.shouldMatchTo( - TestStructure( - forwardPath = Some( - TestStructurePath( - startNodeId = 1, - endNodeId = 7, - nodeIds = Seq(1, 2, 3, 4, 6, 7) - ) - ), - backwardPath = Some( - TestStructurePath( - startNodeId = 7, - endNodeId = 1, - nodeIds = Seq(7, 6, 4, 5, 2, 1) - ) - ) - ) - ) - } } diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N01_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N01_Test.scala index a2c230f47..2d4645501 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N01_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N01_Test.scala @@ -31,18 +31,12 @@ class Structure_N01_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>4", - " element-1 bidirectional 1>4 1(01) 4(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>4 1(01) 4(02) ↔ nodes=1, 2, 3, 4", + " way-10 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>4 nodes=1, 2, 3, 4", "backward=4>1 nodes=4, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N02_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N02_Test.scala index a2980bf2b..c87d55f4f 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N02_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N02_Test.scala @@ -35,18 +35,12 @@ class Structure_N02_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>4", - " element-1 bidirectional 1>4 1(01) 4(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>4 1(01) 4(02) ↔ nodes=1, 2, 3, 4", + " way-10 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>4 nodes=1, 2, 3, 4", "backward=4>1 nodes=4, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N03_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N03_Test.scala index 0514e639a..ca4004b65 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N03_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N03_Test.scala @@ -39,20 +39,14 @@ class Structure_N03_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>6", - " element-1 bidirectional 1>6 1(01) 6(02)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " way-11 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>6 1(01) 6(02) ↔ nodes=1, 2, 3, 4, 5, 6", + " way-10 p n ■ loop fp bp head tail d forward", + " way-11 p ■ n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>6 nodes=1, 2, 3, 4, 5, 6", "backward=6>1 nodes=6, 5, 4, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N04_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N04_Test.scala index a1620b581..608101b11 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N04_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N04_Test.scala @@ -37,22 +37,15 @@ class Structure_N04_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>6", - " element-1 bidirectional 1>4 1(01) 4(01)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " element-2 bidirectional 4>6 4(01) 6(02)", - " way-11 p ■ n ■ loop fp bp head tail d forward paths=2", - " way-12 p ■ n loop fp bp head tail d forward paths=2", + " element-1 1>4 1(01) 4(01) ↔ nodes=1, 2, 3, 4", + " way-10 p n ■ loop fp bp head tail d forward", + " element-2 4>6 4(01) 6(02) ↔ nodes=4, 5, 6", + " way-11 p ■ n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4", - "path-2 ↔ elements=2, nodes=4, 5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=4>6 nodes=4, 5, 6", "backward=6>4 nodes=6, 5, 4", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N05_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N05_Test.scala index 0567c5f9d..6810e8b10 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N05_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N05_Test.scala @@ -40,23 +40,16 @@ class Structure_N05_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>6", - " element-1 bidirectional 1>4 1(01) 4(01)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " way-11 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 bidirectional 4>6 4(01) 6(02)", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=2", - " way-13 p ■ n loop fp bp head tail d forward paths=2", + " element-1 1>4 1(01) 4(01) ↔ nodes=1, 2, 3, 4", + " way-10 p n ■ loop fp bp head tail d forward", + " way-11 p ■ n ■ loop fp bp head tail d forward", + " element-2 4>6 4(01) 6(02) ↔ nodes=4, 5, 6", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4", - "path-2 ↔ elements=2, nodes=4, 5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=4>6 nodes=4, 5, 6", "backward=6>4 nodes=6, 5, 4", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N06_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N06_Test.scala index 6d51bd648..061e482af 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N06_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N06_Test.scala @@ -44,25 +44,18 @@ class Structure_N06_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>7", - " element-1 bidirectional 1>5 1(01) 5(02)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " way-11 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-13 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 bidirectional 5>7 5(02) 7(02)", - " way-14 p ■ n ■ loop fp bp head tail d forward paths=2", - " way-15 p ■ n loop fp bp head tail d forward paths=2", + " element-1 1>5 1(01) 5(02) ↔ nodes=1, 2, 3, 4, 5", + " way-10 p n ■ loop fp bp head tail d forward", + " way-11 p ■ n ■ loop fp bp head tail d forward", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n ■ loop fp bp head tail d forward", + " element-2 5>7 5(02) 7(02) ↔ nodes=5, 6, 7", + " way-14 p ■ n ■ loop fp bp head tail d forward", + " way-15 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - "path-2 ↔ elements=2, nodes=5, 6, 7", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=5>1 nodes=5, 4, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N07_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N07_Test.scala index bf2deabc7..f61c21176 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N07_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N07_Test.scala @@ -50,29 +50,21 @@ class Structure_N07_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>9", - " element-1 bidirectional 1>5 1(01) 5(02)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " way-11 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-13 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 bidirectional 5>7 5(02) 7(02)", - " way-14 p ■ n ■ loop fp bp head tail d forward paths=2", - " way-15 p ■ n ■ loop fp bp head tail d forward paths=2", - " element-3 bidirectional 7>9 7(02) 9(02)", - " way-16 p ■ n ■ loop fp bp head tail d forward paths=3", - " way-17 p ■ n loop fp bp head tail d forward paths=3", + " element-1 1>5 1(01) 5(02) ↔ nodes=1, 2, 3, 4, 5", + " way-10 p n ■ loop fp bp head tail d forward", + " way-11 p ■ n ■ loop fp bp head tail d forward", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n ■ loop fp bp head tail d forward", + " element-2 5>7 5(02) 7(02) ↔ nodes=5, 6, 7", + " way-14 p ■ n ■ loop fp bp head tail d forward", + " way-15 p ■ n ■ loop fp bp head tail d forward", + " element-3 7>9 7(02) 9(02) ↔ nodes=7, 8, 9", + " way-16 p ■ n ■ loop fp bp head tail d forward", + " way-17 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - "path-2 ↔ elements=2, nodes=5, 6, 7", - "path-3 ↔ elements=3, nodes=7, 8, 9", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=5>1 nodes=5, 4, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N08_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N08_Test.scala index c85f7bce8..715c1be3b 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N08_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N08_Test.scala @@ -50,29 +50,21 @@ class Structure_N08_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>9", - " element-1 bidirectional 1>5 1(01) 5(02)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " way-11 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-12 p ■ n ■ loop fp bp head tail d forward paths=1", - " way-13 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 5>7 5(02) 7(02)", - " way-14 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-15 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 5>9 5(02) 9(02)", - " way-16 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " way-17 p ■ n loop fp bp ■ head tail d forward paths=3", + " element-1 1>5 1(01) 5(02) ↔ nodes=1, 2, 3, 4, 5", + " way-10 p n ■ loop fp bp head tail d forward", + " way-11 p ■ n ■ loop fp bp head tail d forward", + " way-12 p ■ n ■ loop fp bp head tail d forward", + " way-13 p ■ n ■ loop fp bp head tail d forward", + " element-2 5>7 5(02) 7(02) → nodes=5, 6, 7", + " way-14 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-15 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 5>9 5(02) 9(02) ← nodes=5, 8, 9", + " way-16 p ■ n ■ loop fp bp ■ head tail d forward", + " way-17 p ■ n loop fp bp ■ head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - "path-2 → elements=2, nodes=5, 6, 7", - "path-3 ← elements=3, nodes=9, 8, 5", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>5 nodes=1, 2, 3, 4, 5", "backward=5>1 nodes=5, 4, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N09_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N09_Test.scala index ce253305e..65e6969c3 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N09_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N09_Test.scala @@ -50,33 +50,24 @@ class Structure_N09_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>10", - " element-1 bidirectional 1>3 1(01)", - " way-101 p n ■ loop fp bp head tail d forward paths=1", - " way-102 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>6", - " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-104 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " way-105 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 3>6", - " way-106 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " way-107 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " way-108 p ■ n ■ loop fp bp ■ head tail ■ d forward paths=3", - " element-4 bidirectional 6>10 10(02)", - " way-109 p ■ n ■ loop fp bp head tail d forward paths=4", - " way-110 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>3 1(01) ↔ nodes=1, 2, 3", + " way-101 p n ■ loop fp bp head tail d forward", + " way-102 p ■ n ■ loop fp bp head tail d forward", + " element-2 3>6 → nodes=3, 4, 5, 6", + " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-104 p ■ n ■ loop fp ■ bp head tail d forward", + " way-105 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 3>6 ← nodes=3, 7, 8, 6", + " way-106 p ■ n ■ loop fp bp ■ head tail d forward", + " way-107 p ■ n ■ loop fp bp ■ head tail d forward", + " way-108 p ■ n ■ loop fp bp ■ head tail ■ d forward", + " element-4 6>10 10(02) ↔ nodes=6, 9, 10", + " way-109 p ■ n ■ loop fp bp head tail d forward", + " way-110 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5, 6", - "path-3 ← elements=3, nodes=6, 8, 7, 3", - "path-4 ↔ elements=4, nodes=6, 9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>10 nodes=1, 2, 3, 4, 5, 6, 9, 10", "backward=10>1 nodes=10, 9, 6, 8, 7, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N10_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N10_Test.scala index 001336f31..5c32d7900 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N10_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N10_Test.scala @@ -50,33 +50,24 @@ class Structure_N10_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>10", - " element-1 bidirectional 1>3 1(01)", - " way-101 p n ■ loop fp bp head tail d forward paths=1", - " way-102 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>6", - " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-104 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " way-105 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 3>6", - " way-106 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-107 p ■ n ■ loop fp bp ■ head tail d backward paths=3", - " way-108 p ■ n ■ loop fp bp ■ head tail ■ d backward paths=3", - " element-4 bidirectional 6>10 10(02)", - " way-109 p ■ n ■ loop fp bp head tail d forward paths=4", - " way-110 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>3 1(01) ↔ nodes=1, 2, 3", + " way-101 p n ■ loop fp bp head tail d forward", + " way-102 p ■ n ■ loop fp bp head tail d forward", + " element-2 3>6 → nodes=3, 4, 5, 6", + " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-104 p ■ n ■ loop fp ■ bp head tail d forward", + " way-105 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 3>6 ← nodes=3, 7, 8, 6", + " way-106 p ■ n ■ loop fp bp ■ head tail d backward", + " way-107 p ■ n ■ loop fp bp ■ head tail d backward", + " way-108 p ■ n ■ loop fp bp ■ head tail ■ d backward", + " element-4 6>10 10(02) ↔ nodes=6, 9, 10", + " way-109 p ■ n ■ loop fp bp head tail d forward", + " way-110 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5, 6", - "path-3 ← elements=3, nodes=6, 8, 7, 3", - "path-4 ↔ elements=4, nodes=6, 9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>10 nodes=1, 2, 3, 4, 5, 6, 9, 10", "backward=10>1 nodes=10, 9, 6, 8, 7, 3, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N11_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N11_Test.scala index f7d82a041..d3b0a4f73 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N11_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N11_Test.scala @@ -35,27 +35,18 @@ class Structure_N11_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>10", - " element-1 bidirectional 1>4 1(01)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 4>7", - " way-11 p ■ n ■ loop fp bp head tail d roundaboutright paths=2", - " element-3 backward 4>7", - " way-11 p ■ n ■ loop fp bp head tail d roundaboutright paths=3", - " element-4 bidirectional 7>10 10(02)", - " way-12 p ■ n loop fp bp head tail d forward paths=4", + " element-1 1>4 1(01) ↔ nodes=1, 2, 4", + " way-10 p n ■ loop fp bp head tail d forward", + " element-2 4>7 → nodes=4, 5, 6, 7", + " way-11 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-3 4>7 ← nodes=4, 3, 8, 7", + " way-11 p ■ n ■ loop fp bp head tail d roundaboutright", + " element-4 7>10 10(02) ↔ nodes=7, 9, 10", + " way-12 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 4", - "path-2 → elements=2, nodes=4, 5, 6, 7", - "path-3 ← elements=3, nodes=7, 8, 3, 4", - "path-4 ↔ elements=4, nodes=7, 9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>10 nodes=1, 2, 4, 5, 6, 7, 9, 10", "backward=10>1 nodes=10, 9, 7, 8, 3, 4, 2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N12_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N12_Test.scala index 80fa1b9d4..5135c2266 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N12_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N12_Test.scala @@ -43,23 +43,16 @@ class Structure_N12_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3 1(01)", - " way-10 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>3 1(01) ↔ nodes=1, 2, 3", + " way-10 p n loop fp bp head tail d unconnected", "segment-2 4>6", - " element-2 bidirectional 4>6 6(02)", - " way-11 p n ■ loop fp bp head tail d forward paths=2", - " way-12 p ■ n loop fp bp head tail d forward paths=2", + " element-2 4>6 6(02) ↔ nodes=4, 5, 6", + " way-11 p n ■ loop fp bp head tail d forward", + " way-12 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 ↔ elements=2, nodes=4, 5, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>3 nodes=1, 2, 3", "other=4>6 nodes=4, 5, 6", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N13_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N13_Test.scala index 0e51c0d2f..084c4be7e 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N13_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N13_Test.scala @@ -39,23 +39,16 @@ class Structure_N13_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>5", - " element-1 bidirectional 1>5 1(01)", - " way-10 p n ■ loop fp bp head tail d forward paths=1", - " way-11 p ■ n loop fp bp head tail d forward paths=1", + " element-1 1>5 1(01) ↔ nodes=1, 2, 3, 4, 5", + " way-10 p n ■ loop fp bp head tail d forward", + " way-11 p ■ n loop fp bp head tail d forward", "segment-2 3>6", - " element-2 bidirectional 3>6 6(02)", - " way-12 p n loop fp bp head tail d unconnected paths=2", + " element-2 3>6 6(02) ↔ nodes=3, 6", + " way-12 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3, 4, 5", - "path-2 ↔ elements=2, nodes=3, 6", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>5 nodes=1, 2, 3, 4, 5", "other=3>6 nodes=3, 6", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N14_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N14_Test.scala index 6f34014c1..77001cc8d 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N14_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N14_Test.scala @@ -53,41 +53,31 @@ class Structure_N14_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>11", - " element-1 bidirectional 1>3 1(01)", - " way-101 p n ■ loop fp bp head tail d forward paths=1", - " way-102 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>11", - " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-104 p ■ n loop fp ■ bp head tail d forward paths=2", + " element-1 1>3 1(01) ↔ nodes=1, 2, 3", + " way-101 p n ■ loop fp bp head tail d forward", + " way-102 p ■ n ■ loop fp bp head tail d forward", + " element-2 3>11 → nodes=3, 4, 11", + " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-104 p ■ n loop fp ■ bp head tail d forward", "segment-2 5>10", - " element-3 forward 5>6", - " way-105 p n ■ loop fp ■ bp head tail d forward paths=3", - " element-4 backward 3>6", - " way-106 p ■ n ■ loop fp bp ■ head tail d forward paths=4", - " way-107 p ■ n ■ loop fp bp ■ head tail d forward paths=4", - " way-108 p ■ n ■ loop fp bp ■ head tail ■ d forward paths=4", - " element-5 bidirectional 6>10 10(02)", - " way-109 p ■ n ■ loop fp bp head tail d forward paths=5", - " way-110 p ■ n loop fp bp head tail d forward paths=5", + " element-3 5>6 → nodes=5, 6", + " way-105 p n ■ loop fp ■ bp head tail d forward", + " element-4 3>6 ← nodes=3, 7, 8, 6", + " way-106 p ■ n ■ loop fp bp ■ head tail d forward", + " way-107 p ■ n ■ loop fp bp ■ head tail d forward", + " way-108 p ■ n ■ loop fp bp ■ head tail ■ d forward", + " element-5 6>10 10(02) ↔ nodes=6, 9, 10", + " way-109 p ■ n ■ loop fp bp head tail d forward", + " way-110 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 11", - "path-3 → elements=3, nodes=5, 6", - "path-4 ← elements=4, nodes=6, 8, 7, 3", - "path-5 ↔ elements=5, nodes=6, 9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>3 nodes=1, 2, 3", "other=3>11 nodes=3, 4, 11", "other=5>6 nodes=5, 6", - "other=6>3 nodes=6, 8, 7, 3", + "other=3>6 nodes=3, 7, 8, 6", "other=6>10 nodes=6, 9, 10", ) ) diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N15_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N15_Test.scala index 77f54b2bc..f81c91d12 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N15_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N15_Test.scala @@ -53,40 +53,30 @@ class Structure_N15_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>8", - " element-1 bidirectional 1>3 1(01)", - " way-101 p n ■ loop fp bp head tail d forward paths=1", - " way-102 p ■ n ■ loop fp bp head tail d forward paths=1", - " element-2 forward 3>6", - " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward paths=2", - " way-104 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " way-105 p ■ n ■ loop fp ■ bp head tail d forward paths=2", - " element-3 backward 3>11", - " way-106 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " way-107 p ■ n ■ loop fp bp ■ head tail d forward paths=3", - " element-4 forward 6>8", - " way-108 p ■ n loop fp ■ bp head tail d backward paths=4", + " element-1 1>3 1(01) ↔ nodes=1, 2, 3", + " way-101 p n ■ loop fp bp head tail d forward", + " way-102 p ■ n ■ loop fp bp head tail d forward", + " element-2 3>6 → nodes=3, 4, 5, 6", + " way-103 p ■ n ■ loop fp ■ bp head ■ tail d forward", + " way-104 p ■ n ■ loop fp ■ bp head tail d forward", + " way-105 p ■ n ■ loop fp ■ bp head tail d forward", + " element-3 3>11 ← nodes=3, 7, 11", + " way-106 p ■ n ■ loop fp bp ■ head tail d forward", + " way-107 p ■ n ■ loop fp bp ■ head tail d forward", + " element-4 6>8 → nodes=6, 8", + " way-108 p ■ n loop fp ■ bp head tail d backward", "segment-2 6>10", - " element-5 bidirectional 6>10 10(02)", - " way-109 p n ■ loop fp bp head tail d forward paths=5", - " way-110 p ■ n loop fp bp head tail d forward paths=5", + " element-5 6>10 10(02) ↔ nodes=6, 9, 10", + " way-109 p n ■ loop fp bp head tail d forward", + " way-110 p ■ n loop fp bp head tail d forward", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - "path-2 → elements=2, nodes=3, 4, 5, 6", - "path-3 ← elements=3, nodes=11, 7, 3", - "path-4 → elements=4, nodes=6, 8", - "path-5 ↔ elements=5, nodes=6, 9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>3 nodes=1, 2, 3", "other=3>6 nodes=3, 4, 5, 6", - "other=11>3 nodes=11, 7, 3", + "other=3>11 nodes=3, 7, 11", "other=6>8 nodes=6, 8", "other=6>10 nodes=6, 9, 10", ) diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N16_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N16_Test.scala index e85d780a8..6b3b02919 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N16_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N16_Test.scala @@ -26,7 +26,6 @@ class Structure_N16_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) context.facts.shouldMatchTo(Set(RouteNotForward, RouteNotBackward, RouteNotContinious, RouteBroken)) context.links.shouldMatchTo( @@ -47,26 +46,18 @@ class Structure_N16_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>2", - " element-1 bidirectional 1>2 1(01)", - " way-10 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>2 1(01) ↔ nodes=1, 2", + " way-10 p n loop fp bp head tail d unconnected", "segment-2 3>8", - " element-2 bidirectional 3>8", - " way-11 p n loop fp bp head tail d unconnected paths=2", + " element-2 3>8 ↔ nodes=3, 4, 5, 6, 7, 8", + " way-11 p n loop fp bp head tail d unconnected", "segment-3 7>10", - " element-3 bidirectional 7>10 10(02)", - " way-12 p n loop fp bp head tail d unconnected paths=3", + " element-3 7>10 10(02) ↔ nodes=7, 9, 10", + " way-12 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", - "path-2 ↔ elements=2, nodes=3, 4, 5, 6, 7, 8", - "path-3 ↔ elements=3, nodes=7, 9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>2 nodes=1, 2", "other=3>8 nodes=3, 4, 5, 6, 7, 8", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N17_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N17_Test.scala index 3662f9ecf..76fc7544b 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N17_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N17_Test.scala @@ -26,7 +26,6 @@ class Structure_N17_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) context.facts.shouldMatchTo(Set(RouteNotForward, RouteNotBackward, RouteNotContinious, RouteBroken)) context.links.shouldMatchTo( @@ -47,26 +46,18 @@ class Structure_N17_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>4", - " element-1 bidirectional 1>4 1(01)", - " way-10 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>4 1(01) ↔ nodes=1, 2, 4", + " way-10 p n loop fp bp head tail d unconnected", "segment-2 3>8", - " element-2 bidirectional 3>8", - " way-11 p n loop fp bp head tail d unconnected paths=2", + " element-2 3>8 ↔ nodes=3, 4, 5, 6, 7, 8", + " way-11 p n loop fp bp head tail d unconnected", "segment-3 9>10", - " element-3 bidirectional 9>10 10(02)", - " way-12 p n loop fp bp head tail d unconnected paths=3", + " element-3 9>10 10(02) ↔ nodes=9, 10", + " way-12 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 4", - "path-2 ↔ elements=2, nodes=3, 4, 5, 6, 7, 8", - "path-3 ↔ elements=3, nodes=9, 10", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "other=1>4 nodes=1, 2, 4", "other=3>8 nodes=3, 4, 5, 6, 7, 8", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N18_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N18_Test.scala index 7b2bce2d7..d9f6cdc20 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N18_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N18_Test.scala @@ -34,18 +34,12 @@ class Structure_N18_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3 1(01) 3(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", + " element-1 1>3 1(01) 3(02) ↔ nodes=1, 2, 3", + " way-10 p n loop fp bp head tail d unconnected", ) ) context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", - ) - ) - - context.pathDetails.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", ) diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N19_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N19_Test.scala index 070edd488..bc0e44e4e 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N19_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N19_Test.scala @@ -22,7 +22,6 @@ class Structure_N19_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) // TODO context.facts.shouldMatchTo(Set(RouteOneWay)) context.links.shouldMatchTo( @@ -41,19 +40,13 @@ class Structure_N19_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3 1(01) 3(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", - ) - ) - - context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", + " element-1 1>3 1(01) 3(02) ↔ nodes=1, 2, 3", + " way-10 p n loop fp bp head tail d unconnected", ) ) pending - context.pathDetails.shouldMatchTo( + context.paths.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=1>3 nodes=3, 2, 1", // TODO there should be no backward path diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N20_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N20_Test.scala index 391a1bd8f..d14e93fb1 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N20_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N20_Test.scala @@ -22,7 +22,6 @@ class Structure_N20_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) pending @@ -43,19 +42,13 @@ class Structure_N20_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3 1(01) 3(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", - ) - ) - - context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", + " element-1 1>3 1(01) 3(02) ↔ nodes=1, 2, 3", + " way-10 p n loop fp bp head tail d unconnected", ) ) pending - context.pathDetails.shouldMatchTo( + context.paths.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=1>3 nodes=3, 2, 1", // TODO there should be no backward path diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N21_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N21_Test.scala index 6db63daff..302f88773 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N21_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N21_Test.scala @@ -21,7 +21,6 @@ class Structure_N21_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) // TODO context.facts.shouldMatchTo(Set(RouteOneWay)) context.links.shouldMatchTo( @@ -40,19 +39,13 @@ class Structure_N21_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 3>1", - " element-1 bidirectional 3>1 3(02) 1(01)", - " way-10 p n loop fp bp head tail d unconnected paths=1", - ) - ) - - context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=3, 2, 1", + " element-1 3>1 3(02) 1(01) ↔ nodes=3, 2, 1", + " way-10 p n loop fp bp head tail d unconnected", ) ) pending - context.pathDetails.shouldMatchTo( + context.paths.shouldMatchTo( Seq( "forward=3>1 nodes=3, 2, 1", // TODO there should be no forward (or backward?) path "backward=3>1 nodes=1, 2, 3", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N22_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N22_Test.scala index fea92bc5f..2d045416b 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N22_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N22_Test.scala @@ -22,7 +22,6 @@ class Structure_N22_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) pending @@ -43,19 +42,13 @@ class Structure_N22_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>2", - " element-1 bidirectional 1>2 1(01) 2(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", - ) - ) - - context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2", + " element-1 1>2 1(01) 2(02) ↔ nodes=1, 2", + " way-10 p n loop fp bp head tail d unconnected", ) ) pending - context.pathDetails.shouldMatchTo( + context.paths.shouldMatchTo( Seq( "forward=1>2 nodes=1, 2", "backward=1>2 nodes=2, 1", diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N23_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N23_Test.scala index 9c10979e3..b275c353c 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N23_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N23_Test.scala @@ -22,7 +22,6 @@ class Structure_N23_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) pending @@ -43,19 +42,13 @@ class Structure_N23_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 3>1", - " element-1 bidirectional 3>1 3(02) 1(01)", - " way-10 p n loop fp bp head tail d unconnected paths=1", - ) - ) - - context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=3, 2, 1", + " element-1 3>1 3(02) 1(01) ↔ nodes=3, 2, 1", + " way-10 p n loop fp bp head tail d unconnected", ) ) pending - context.pathDetails.shouldMatchTo( + context.paths.shouldMatchTo( Seq( "forward=3>1 nodes=3, 2, 1", "backward=3>1 nodes=1, 2, 3", // TODO there should be only forward or backward diff --git a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N24_Test.scala b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N24_Test.scala index 9d813ed88..2e203a323 100644 --- a/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N24_Test.scala +++ b/server/src/test/scala/kpn/server/analyzer/engine/analysis/route/structure/Structure_N24_Test.scala @@ -22,7 +22,6 @@ class Structure_N24_Test extends UnitTest { context.nodes.foreach(a => println(s""""$a",""")) context.segments.foreach(a => println(s""""$a",""")) context.paths.foreach(a => println(s""""$a",""")) - context.pathDetails.foreach(a => println(s""""$a",""")) pending @@ -43,19 +42,13 @@ class Structure_N24_Test extends UnitTest { context.segments.shouldMatchTo( Seq( "segment-1 1>3", - " element-1 bidirectional 1>3 1(01) 3(02)", - " way-10 p n loop fp bp head tail d unconnected paths=1", - ) - ) - - context.paths.shouldMatchTo( - Seq( - "path-1 ↔ elements=1, nodes=1, 2, 3", + " element-1 1>3 1(01) 3(02) ↔ nodes=1, 2, 3", + " way-10 p n loop fp bp head tail d unconnected", ) ) pending - context.pathDetails.shouldMatchTo( + context.paths.shouldMatchTo( Seq( "forward=1>3 nodes=1, 2, 3", "backward=1>3 nodes=3, 2, 1", // TODO there should be no backward path