Skip to content

Commit

Permalink
Do not ask width in endless loop on segments of road tagged with traf…
Browse files Browse the repository at this point in the history
…fic_calming=choker (#5578)

* do not ask for width if it is choker which already has maxwidth

* traffic_calming=choker related tests
  • Loading branch information
mnalis authored Apr 13, 2024
1 parent da815f8 commit 6388c57
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class AddRoadWidth(
)
and area != yes
and (!width or source:width ~ ".*estimat.*")
and (traffic_calming !~ ${ROAD_NARROWERS.joinToString("|")} or !maxwidth or source:maxwidth ~".*estimat.*")
and (surface ~ ${ANYTHING_PAVED.joinToString("|")} or highway ~ ${ROADS_ASSUMED_TO_BE_PAVED.joinToString("|")})
and (access !~ private|no or (foot and foot !~ private|no))
and foot != no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ class AddRoadWidthTest {
))))
}

@Test fun `is applicable to road with choker`() {
assertTrue(quest.isApplicableTo(way(tags = mapOf(
"maxspeed" to "DE:zone30",
"highway" to "residential",
"surface" to "asphalt",
"traffic_calming" to "choker"
))))
}

@Test fun `is not applicable to road with choker and maxwidth`() {
assertFalse(quest.isApplicableTo(way(tags = mapOf(
"maxspeed" to "DE:zone30",
"highway" to "residential",
"surface" to "asphalt",
"traffic_calming" to "choker",
"maxwidth" to "3"
))))
assertFalse(quest.isApplicableTo(way(tags = mapOf(
"maxspeed" to "DE:zone30",
"highway" to "residential",
"surface" to "asphalt",
"traffic_calming" to "choker",
"width" to "3"
))))
}

@Test fun `apply to street`() {
assertEquals(
setOf(StringMapEntryAdd("width", "3")),
Expand Down

0 comments on commit 6388c57

Please sign in to comment.