Skip to content

Commit 8d2b4e4

Browse files
afarberjoto
authored andcommitted
Add integration tests for show command output formats
1 parent c472706 commit 8d2b4e4

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

test/show/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#-----------------------------------------------------------------------------
2+
#
3+
# CMake Config
4+
#
5+
# Osmium Tool Tests - show
6+
#
7+
#-----------------------------------------------------------------------------
8+
9+
function(check_show _name _input _output _options)
10+
check_output(show ${_name} "show ${_options} show/${_input}" "show/${_output}")
11+
endfunction()
12+
13+
14+
#-----------------------------------------------------------------------------
15+
16+
check_show(debug input.osm output-debug.txt "-f debug")
17+
check_show(opl input.osm output-opl.opl "-f opl")
18+
check_show(xml input.osm output-xml.osm "-f xml")
19+
20+
21+
#-----------------------------------------------------------------------------

test/show/input.osm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<osm version="0.6" upload="false" generator="testdata">
3+
<node id="1" version="1" timestamp="2021-01-01T00:00:00Z" changeset="1" uid="1" user="test" lat="52.5" lon="13.4">
4+
<tag k="name" v="Test Node"/>
5+
<tag k="amenity" v="restaurant"/>
6+
</node>
7+
<way id="2" version="1" timestamp="2021-01-01T00:00:00Z" changeset="1" uid="1" user="test">
8+
<nd ref="1"/>
9+
<nd ref="3"/>
10+
<tag k="highway" v="primary"/>
11+
<tag k="name" v="Test Way"/>
12+
</way>
13+
</osm>

test/show/output-debug.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
header
2+
multiple object versions: no
3+
bounding boxes:
4+
options:
5+
generator = testdata
6+
version = 0.6
7+
xml_josm_upload = false
8+
9+
=============================================
10+
11+
node 1 visible
12+
version: 1
13+
changeset: 1
14+
timestamp: 2021-01-01T00:00:00Z (1609459200)
15+
user: 1 "test"
16+
lon/lat: 13.4,52.5
17+
tags: 2
18+
"name" = "Test Node"
19+
"amenity" = "restaurant"
20+
21+
way 2 visible
22+
version: 1
23+
changeset: 1
24+
timestamp: 2021-01-01T00:00:00Z (1609459200)
25+
user: 1 "test"
26+
tags: 2
27+
"highway" = "primary"
28+
"name" = "Test Way"
29+
nodes: 2 (open)
30+
0: 1
31+
1: 3
32+

test/show/output-opl.opl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
n1 v1 dV c1 t2021-01-01T00:00:00Z i1 utest Tname=Test%20%Node,amenity=restaurant x13.4 y52.5
2+
w2 v1 dV c1 t2021-01-01T00:00:00Z i1 utest Thighway=primary,name=Test%20%Way Nn1,n3

test/show/output-xml.osm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<osm version="0.6" upload="false" generator="testdata">
3+
<node id="1" version="1" timestamp="2021-01-01T00:00:00Z" uid="1" user="test" changeset="1" lat="52.5" lon="13.4">
4+
<tag k="name" v="Test Node"/>
5+
<tag k="amenity" v="restaurant"/>
6+
</node>
7+
<way id="2" version="1" timestamp="2021-01-01T00:00:00Z" uid="1" user="test" changeset="1">
8+
<nd ref="1"/>
9+
<nd ref="3"/>
10+
<tag k="highway" v="primary"/>
11+
<tag k="name" v="Test Way"/>
12+
</way>
13+
</osm>

0 commit comments

Comments
 (0)