@@ -584,52 +584,35 @@ TEST_CASE("middle: add node with attributes")
584584 buffer.add_node (" n10 v123 c456 t2009-02-13T23:31:30Z i789 usomebody"
585585 " x1.1 y2.2 Tamenity=bench,name=Blue" );
586586
587- auto const check = [&](std::shared_ptr<middle_pgsql_t > const &mid) {
588- auto const mid_q = mid->get_query_instance ();
589- osmium::memory::Buffer outbuf{4096 ,
590- osmium::memory::Buffer::auto_grow::yes};
591- REQUIRE (mid_q->node_get (10 , &outbuf));
592- auto const &node = outbuf.get <osmium::Node>(0 );
593-
594- CHECK (node.id () == 10 );
595- CHECK (node.location () == node10.location ());
596- if (options.extra_attributes ) {
597- CHECK (node.timestamp () == node10.timestamp ());
598- CHECK (node.version () == node10.version ());
599- CHECK (node.changeset () == node10.changeset ());
600- CHECK (node.uid () == node10.uid ());
601- CHECK (std::strcmp (node.user (), node10.user ()) == 0 );
602- } else {
603- CHECK (node.version () == 0 );
604- CHECK (node.changeset () == 0 );
605- CHECK (node.uid () == 0 );
606- }
607- REQUIRE (node.tags ().size () == 2 );
608- CHECK (std::strcmp (node.tags ()[" amenity" ], " bench" ) == 0 );
609- CHECK (std::strcmp (node.tags ()[" name" ], " Blue" ) == 0 );
610- };
611-
612- {
613- auto mid = std::make_shared<middle_pgsql_t >(thread_pool, &options);
614- mid->start ();
615-
616- mid->node (node10);
617- mid->after_nodes ();
618- mid->after_ways ();
619- mid->after_relations ();
620-
621- check (mid);
622- }
587+ auto mid = std::make_shared<middle_pgsql_t >(thread_pool, &options);
588+ mid->start ();
623589
624- // From now on use append mode to not destroy the data we just added.
625- options.append = true ;
590+ mid->node (node10);
591+ mid->after_nodes ();
592+ mid->after_ways ();
593+ mid->after_relations ();
626594
627- {
628- auto mid = std::make_shared<middle_pgsql_t >(thread_pool, &options);
629- mid->start ();
630-
631- check (mid);
595+ auto const mid_q = mid->get_query_instance ();
596+ osmium::memory::Buffer outbuf{4096 , osmium::memory::Buffer::auto_grow::yes};
597+ REQUIRE (mid_q->node_get (10 , &outbuf));
598+ auto const &node = outbuf.get <osmium::Node>(0 );
599+
600+ CHECK (node.id () == 10 );
601+ CHECK (node.location () == node10.location ());
602+ if (options.extra_attributes ) {
603+ CHECK (node.timestamp () == node10.timestamp ());
604+ CHECK (node.version () == node10.version ());
605+ CHECK (node.changeset () == node10.changeset ());
606+ CHECK (node.uid () == node10.uid ());
607+ CHECK (std::strcmp (node.user (), node10.user ()) == 0 );
608+ } else {
609+ CHECK (node.version () == 0 );
610+ CHECK (node.changeset () == 0 );
611+ CHECK (node.uid () == 0 );
632612 }
613+ REQUIRE (node.tags ().size () == 2 );
614+ CHECK (std::strcmp (node.tags ()[" amenity" ], " bench" ) == 0 );
615+ CHECK (std::strcmp (node.tags ()[" name" ], " Blue" ) == 0 );
633616}
634617
635618TEMPLATE_TEST_CASE (" middle: add, delete and update way" , " " ,
0 commit comments