Skip to content

Commit

Permalink
added sumolib test refs #21
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 26, 2024
1 parent c137aa0 commit 422eace
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 0 deletions.
Empty file.
14 changes: 14 additions & 0 deletions tests/tools/sumolib/net_and_additional/input_additional.add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<additional>

<tlLogic id="C" type="static" programID="extra" offset="0">
<phase duration="31" state="GGGggrrrrGGGggrrrr"/>
<phase duration="4" state="yyyyyrrrryyyyyrrrr"/>
<phase duration="31" state="rrrrrGGggrrrrrGGgg"/>
<phase duration="4" state="rrrrryyyyrrrrryyyy"/>
<param key="tk3" value="tv3"/>
</tlLogic>


</additional>
268 changes: 268 additions & 0 deletions tests/tools/sumolib/net_and_additional/input_net.net.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/tools/sumolib/net_and_additional/options.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
input_net.net.xml input_additional.add.xml tests/tools/sumolib/net_and_additional/runner.py
2 changes: 2 additions & 0 deletions tests/tools/sumolib/net_and_additional/output.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tlsParams tk1:tv1 tk2:tv2
tlsExtraParams tk3:tv3
41 changes: 41 additions & 0 deletions tests/tools/sumolib/net_and_additional/runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2008-2024 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

# @file runner.py
# @author Jakob Erdmann
# @date

from __future__ import absolute_import
from __future__ import print_function


import os
import sys
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
else:
sys.exit("please declare environment variable 'SUMO_HOME'")
import sumolib.net # noqa


def printSorted(d):
return ' '.join(["%s:%s" % (k, d[k]) for k in sorted(d.keys())])


net = sumolib.net.readNet(sys.argv[1], withInternal=True, withLatestPrograms=True)
net = sumolib.net.readNet(sys.argv[2], withPrograms=True, net=net)

print("tlsParams", printSorted(net.getTLS("C").getPrograms()["0"].getParams()))
print("tlsExtraParams", printSorted(net.getTLS("C").getPrograms()["extra"].getParams()))

3 changes: 3 additions & 0 deletions tests/tools/sumolib/testsuite.tools
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ statistics

# read polygons
shapes

# parsing a network and an additional file with tls
net_and_additional

0 comments on commit 422eace

Please sign in to comment.