@@ -213,6 +213,14 @@ TEMPLATE_TEST_CASE("middle import", "", options_slim_default,
213213 // set the relation
214214 auto const &relation =
215215 buffer.add_relation (" r123 Mw11@,w10@outer,n1@,w12@inner" );
216+
217+ std::vector<std::pair<osmium::item_type, osmid_t >> const expected = {
218+ {osmium::item_type::way, 11 },
219+ {osmium::item_type::way, 10 },
220+ {osmium::item_type::node, 1 },
221+ {osmium::item_type::way, 12 },
222+ };
223+
216224 osmium::CRC<osmium::CRC_zlib> orig_crc;
217225 orig_crc.update (relation);
218226
@@ -232,17 +240,62 @@ TEMPLATE_TEST_CASE("middle import", "", options_slim_default,
232240 crc.update (rel);
233241 CHECK (orig_crc ().checksum () == crc ().checksum ());
234242
235- // retrieve the supporting ways
236- REQUIRE (mid_q->rel_members_get (rel, &outbuf,
243+ // retrieve node members only
244+ osmium::memory::Buffer memberbuf{
245+ 4096 , osmium::memory::Buffer::auto_grow::yes};
246+ REQUIRE (mid_q->rel_members_get (rel, &memberbuf,
247+ osmium::osm_entity_bits::node) == 1 );
248+
249+ {
250+ auto const objects = memberbuf.select <osmium::OSMObject>();
251+ auto it = objects.cbegin ();
252+ auto const end = objects.cend ();
253+ for (auto const &p : expected) {
254+ if (p.first == osmium::item_type::node) {
255+ REQUIRE (it != end);
256+ REQUIRE (it->type () == p.first );
257+ REQUIRE (it->id () == p.second );
258+ ++it;
259+ }
260+ }
261+ }
262+
263+ memberbuf.clear ();
264+
265+ // retrieve way members only
266+ REQUIRE (mid_q->rel_members_get (rel, &memberbuf,
237267 osmium::osm_entity_bits::way) == 3 );
238268
239- for (auto &w : outbuf.select <osmium::Way>()) {
240- REQUIRE (w.id () >= 10 );
241- REQUIRE (w.id () <= 12 );
242- auto const &expected = nds[w.id () - 10 ];
243- REQUIRE (w.nodes ().size () == expected.size ());
244- for (size_t i = 0 ; i < expected.size (); ++i) {
245- REQUIRE (w.nodes ()[i].ref () == expected[i]);
269+ {
270+ auto const objects = memberbuf.select <osmium::OSMObject>();
271+ auto it = objects.cbegin ();
272+ auto const end = objects.cend ();
273+ for (auto const &p : expected) {
274+ if (p.first == osmium::item_type::way) {
275+ REQUIRE (it != end);
276+ REQUIRE (it->type () == p.first );
277+ REQUIRE (it->id () == p.second );
278+ ++it;
279+ }
280+ }
281+ }
282+
283+ memberbuf.clear ();
284+
285+ // retrieve all members
286+ REQUIRE (mid_q->rel_members_get (rel, &memberbuf,
287+ osmium::osm_entity_bits::node |
288+ osmium::osm_entity_bits::way) == 4 );
289+
290+ {
291+ auto const objects = memberbuf.select <osmium::OSMObject>();
292+ auto it = objects.cbegin ();
293+ auto const end = objects.cend ();
294+ for (auto const &p : expected) {
295+ REQUIRE (it != end);
296+ REQUIRE (it->type () == p.first );
297+ REQUIRE (it->id () == p.second );
298+ ++it;
246299 }
247300 }
248301
0 commit comments