Simulation along the trip's route ("Simulate driving the route" when there is one, POST /api/sim/gnss {"trip": true}), random trips after it
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-12-01 01:45:38 +01:00
1 parent 07a4d363ec
commit 7fcac61c99
5 files changed
+38 -9

No files matched your search

+13
View File
@@ -22,6 +22,19 @@ class GnssSimTest < Minitest::Test
assert_in_delta (1000 / (36 / 3.6) / 2 + 500 / (45 / 3.6)) / Maptool::GnssSim::TICK_S, fixes.size, 3 # a fix every TICK_S
end
# Started with the trip's route: from its start along it, before any random trip.
def test_starts_along_a_given_route
fixes = Queue.new
sim = Maptool::GnssSim.new("http://valhalla", sleep: ->(_s) {}, router: ->(*) { raise Maptool::Routing::RouteError, "done" })
route = { geometry: { coordinates: [[18.0, 49.0], [18.0, 49.001]] }, properties: { speed_limits: [[0.0, 50]] } }
sim.start(route: route) { |fix| fixes << fix }
first = fixes.pop
assert_in_delta 49.0, first[:lat], 0.0001
assert_in_delta 18.0, first[:lon], 1e-9
ensure
sim&.stop
end
# No road at the first random place: another one, inside the bbox.
class FirstPlaceAtSea < Maptool::GnssSim
attr_reader :tried