Skip to content

Commit 8f7e9e5

Browse files
committed
convert test-output-flex-way-change.cpp to BDD test
1 parent 859964f commit 8f7e9e5

File tree

3 files changed

+260
-230
lines changed

3 files changed

+260
-230
lines changed

tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ if (WITH_LUA)
9595
set_test(test-output-flex-types)
9696
set_test(test-output-flex-update)
9797
set_test(test-output-flex-validgeom)
98-
set_test(test-output-flex-way-change)
9998
set_test(test-output-flex-way-del)
10099
set_test(test-output-flex-way-relation-add)
101100
set_test(test-output-flex-way-relation-del)

tests/bdd/flex/way-change.feature

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
Feature: Changing ways in a flex database
2+
3+
Background:
4+
Given the style file 'test_output_flex_way.lua'
5+
6+
Given the 0.1 grid with origin 10.0 10.1
7+
| 11 | 13 | 15 | 17 | 19 |
8+
| 10 | 12 | 14 | 16 | 18 |
9+
10+
Scenario Outline:
11+
Given the OSM data:
12+
"""
13+
w11 v1 dV Tt1=yes Nn12,n13
14+
w12 v1 dV Tt2=yes Nn14,n15
15+
w13 v1 dV Ttboth=yes Nn16,n17
16+
w14 v1 dV Ttboth=yes Nn18,n19
17+
w10 v1 dV Tt1=yes Nn10,n11
18+
r30 v1 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
19+
"""
20+
When running osm2pgsql flex with parameters
21+
| --slim |
22+
Then table osm2pgsql_test_t1 contains exactly
23+
| way_id |
24+
| 10 |
25+
| 11 |
26+
Then table osm2pgsql_test_t2 contains exactly
27+
| way_id |
28+
| 12 |
29+
Then table osm2pgsql_test_tboth contains exactly
30+
| way_id |
31+
| 13 |
32+
| 14 |
33+
34+
Given the OSM data
35+
"""
36+
<input>
37+
"""
38+
When running osm2pgsql flex with parameters
39+
| --slim | -a |
40+
Then table osm2pgsql_test_t1 contains
41+
| way_id |
42+
| 11 |
43+
And table osm2pgsql_test_t1 has <num_w10> rows with condition
44+
"""
45+
way_id = 10
46+
"""
47+
Then table osm2pgsql_test_t2 contains exactly
48+
| way_id |
49+
| 10 |
50+
| 12 |
51+
Then table osm2pgsql_test_tboth contains exactly
52+
| way_id |
53+
| 13 |
54+
| 14 |
55+
56+
Examples:
57+
| input | num_w10 |
58+
| w10 v1 dV Tt2=yes Nn10,n11 | 0 |
59+
| w10 v1 dV Tt1=yes,t2=yes Nn10,n11 | 1 |
60+
61+
62+
Scenario Outline: change way from t2
63+
Given the OSM data
64+
"""
65+
w11 v1 dV Tt1=yes Nn12,n13
66+
w12 v1 dV Tt2=yes Nn14,n15
67+
w13 v1 dV Ttboth=yes Nn16,n17
68+
w14 v1 dV Ttboth=yes Nn18,n19
69+
w10 v1 dV Tt2=yes Nn10,n11
70+
r30 v1 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
71+
"""
72+
When running osm2pgsql flex with parameters
73+
| --slim |
74+
Then table osm2pgsql_test_t1 contains exactly
75+
| way_id |
76+
| 11 |
77+
Then table osm2pgsql_test_t2 contains exactly
78+
| way_id |
79+
| 10 |
80+
| 12 |
81+
Then table osm2pgsql_test_tboth contains exactly
82+
| way_id |
83+
| 13 |
84+
| 14 |
85+
86+
Given the OSM data
87+
"""
88+
<input>
89+
"""
90+
When running osm2pgsql flex with parameters
91+
| --slim | -a |
92+
Then table osm2pgsql_test_t1 contains exactly
93+
| way_id |
94+
| 10 |
95+
| 11 |
96+
Then table osm2pgsql_test_t2 contains
97+
| way_id |
98+
| 12 |
99+
And table osm2pgsql_test_t2 has <num_w10> rows with condition
100+
"""
101+
way_id = 10
102+
"""
103+
Then table osm2pgsql_test_tboth contains exactly
104+
| way_id |
105+
| 13 |
106+
| 14 |
107+
108+
Examples:
109+
| input | num_w10 |
110+
| w10 v1 dV Tt1=yes Nn10,n11 | 0 |
111+
| w10 v1 dV Tt1=yes,t2=yes Nn10,n11 | 1 |
112+
113+
114+
Scenario Outline: change way from t1 and t2
115+
Given the OSM data
116+
"""
117+
w11 v1 dV Tt1=yes Nn12,n13
118+
w12 v1 dV Tt2=yes Nn14,n15
119+
w13 v1 dV Ttboth=yes Nn16,n17
120+
w14 v1 dV Ttboth=yes Nn18,n19
121+
w10 v1 dV Tt1=yes,t2=yes Nn10,n11
122+
r30 v1 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
123+
"""
124+
When running osm2pgsql flex with parameters
125+
| --slim |
126+
Then table osm2pgsql_test_t1 contains exactly
127+
| way_id |
128+
| 10 |
129+
| 11 |
130+
Then table osm2pgsql_test_t2 contains exactly
131+
| way_id |
132+
| 10 |
133+
| 12 |
134+
Then table osm2pgsql_test_tboth contains exactly
135+
| way_id |
136+
| 13 |
137+
| 14 |
138+
139+
Given the OSM data
140+
"""
141+
<input>
142+
"""
143+
When running osm2pgsql flex with parameters
144+
| --slim | -a |
145+
Then table osm2pgsql_test_t1 contains
146+
| way_id |
147+
| 11 |
148+
And table osm2pgsql_test_t1 has <num_t1> rows with condition
149+
"""
150+
way_id = 10
151+
"""
152+
Then table osm2pgsql_test_t2 contains
153+
| way_id |
154+
| 12 |
155+
And table osm2pgsql_test_t2 has <num_t2> rows with condition
156+
"""
157+
way_id = 10
158+
"""
159+
Then table osm2pgsql_test_tboth contains exactly
160+
| way_id |
161+
| 13 |
162+
| 14 |
163+
164+
Examples:
165+
| input | num_t1 | num_t2 |
166+
| w10 v1 dV Tt1=yes Nn10,n11 | 1 | 0 |
167+
| w10 v1 dV Tt2=yes Nn10,n11 | 0 | 1 |
168+
169+
170+
Scenario Outline: change valid geom to invalid geom
171+
Given the OSM data
172+
"""
173+
w11 v1 dV Tt1=yes Nn12,n13
174+
w12 v1 dV Tt2=yes Nn14,n15
175+
w13 v1 dV Ttboth=yes Nn16,n17
176+
w14 v1 dV Ttboth=yes Nn18,n19
177+
w10 v1 dV Tt1=yes,t2=yes,tboth=yes Nn10,n11
178+
r30 v1 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
179+
"""
180+
When running osm2pgsql flex with parameters
181+
| --slim |
182+
Then table osm2pgsql_test_t1 contains exactly
183+
| way_id |
184+
| 10 |
185+
| 11 |
186+
Then table osm2pgsql_test_t2 contains exactly
187+
| way_id | rel_ids |
188+
| 10 | {30} |
189+
| 12 | {30} |
190+
Then table osm2pgsql_test_tboth contains exactly
191+
| way_id | rel_ids |
192+
| 10 | {30} |
193+
| 13 | NULL |
194+
| 14 | {30} |
195+
196+
Given the OSM data
197+
"""
198+
<input>
199+
"""
200+
When running osm2pgsql flex with parameters
201+
| --slim | -a |
202+
Then table osm2pgsql_test_t1 contains
203+
| way_id |
204+
| 11 |
205+
Then table osm2pgsql_test_t2 contains
206+
| way_id |
207+
| 12 |
208+
Then table osm2pgsql_test_tboth contains exactly
209+
| way_id |
210+
| 13 |
211+
| 14 |
212+
213+
Examples:
214+
| input |
215+
| w10 v2 dV Tt1=yes,t2=yes,tboth=yes Nn10 |
216+
| n11 v2 dV x10.0 y10.0 |
217+
218+
219+
Scenario: change invalid geom to valid geom
220+
Given the OSM data
221+
"""
222+
w11 v1 dV Tt1=yes Nn12,n13
223+
w12 v1 dV Tt2=yes Nn14,n15
224+
w13 v1 dV Ttboth=yes Nn16,n17
225+
w14 v1 dV Ttboth=yes Nn18,n19
226+
w10 v1 dV Tt1=yes,t2=yes,tboth=yes Nn10
227+
r30 v1 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
228+
"""
229+
When running osm2pgsql flex with parameters
230+
| --slim |
231+
Then table osm2pgsql_test_t1 contains exactly
232+
| way_id |
233+
| 11 |
234+
Then table osm2pgsql_test_t2 contains exactly
235+
| way_id | rel_ids |
236+
| 12 | {30} |
237+
Then table osm2pgsql_test_tboth contains exactly
238+
| way_id | rel_ids |
239+
| 13 | NULL |
240+
| 14 | {30} |
241+
242+
Given the OSM data
243+
"""
244+
w10 v2 dV Tt1=yes,t2=yes,tboth=yes Nn10,n11
245+
"""
246+
When running osm2pgsql flex with parameters
247+
| --slim | -a |
248+
Then table osm2pgsql_test_t1 contains exactly
249+
| way_id |
250+
| 10 |
251+
| 11 |
252+
Then table osm2pgsql_test_t2 contains exactly
253+
| way_id | rel_ids |
254+
| 10 | {30} |
255+
| 12 | {30} |
256+
Then table osm2pgsql_test_tboth contains exactly
257+
| way_id | rel_ids |
258+
| 10 | {30} |
259+
| 13 | NULL |
260+
| 14 | {30} |

0 commit comments

Comments
 (0)