2626#include " common-options.hpp"
2727#include " common-pg.hpp"
2828
29- static testing::pg::tempdb_t db;
30-
3129namespace {
3230
31+ testing::pg::tempdb_t db;
32+
3333void check_locations_are_equal (osmium::Location a, osmium::Location b)
3434{
3535 CHECK (a.lat () == Approx (b.lat ()));
3636 CHECK (a.lon () == Approx (b.lon ()));
3737}
3838
39- } // namespace
39+ } // anonymous namespace
4040
4141struct options_slim_default
4242{
@@ -323,11 +323,13 @@ TEMPLATE_TEST_CASE("middle import", "", options_slim_default,
323323 }
324324}
325325
326+ namespace {
327+
326328/* *
327329 * Check that the node is in the mid with the right id and location.
328330 */
329- static void check_node (std::shared_ptr<middle_pgsql_t > const &mid,
330- osmium::Node const &node)
331+ void check_node (std::shared_ptr<middle_pgsql_t > const &mid,
332+ osmium::Node const &node)
331333{
332334 test_buffer_t buffer;
333335 auto &nodes = buffer.add_way (999 , {node.id ()}).nodes ();
@@ -338,14 +340,16 @@ static void check_node(std::shared_ptr<middle_pgsql_t> const &mid,
338340}
339341
340342// / Return true if the node with the specified id is not in the mid.
341- static bool no_node (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t id)
343+ bool no_node (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t id)
342344{
343345 test_buffer_t buffer;
344346 auto &nodes = buffer.add_way (999 , {id}).nodes ();
345347 auto const mid_q = mid->get_query_instance ();
346348 return mid_q->nodes_get_list (&nodes) == 0 ;
347349}
348350
351+ } // anonymous namespace
352+
349353TEMPLATE_TEST_CASE (" middle: add, delete and update node" , " " ,
350354 options_slim_default, options_flat_node_cache)
351355{
@@ -490,12 +494,14 @@ TEMPLATE_TEST_CASE("middle: add, delete and update node", "",
490494 }
491495}
492496
497+ namespace {
498+
493499/* *
494500 * Check that the way is in the mid with the right attributes and tags.
495501 * Does not check node locations.
496502 */
497- static void check_way (std::shared_ptr<middle_pgsql_t > const &mid,
498- osmium::Way const &orig_way)
503+ void check_way (std::shared_ptr<middle_pgsql_t > const &mid,
504+ osmium::Way const &orig_way)
499505{
500506 auto const mid_q = mid->get_query_instance ();
501507
@@ -535,9 +541,8 @@ static void check_way(std::shared_ptr<middle_pgsql_t> const &mid,
535541 * Check that the nodes (ids and locations) of the way with the way_id in the
536542 * mid are identical to the nodes in the nodes vector.
537543 */
538- static void check_way_nodes (std::shared_ptr<middle_pgsql_t > const &mid,
539- osmid_t way_id,
540- std::vector<osmium::Node const *> const &nodes)
544+ void check_way_nodes (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t way_id,
545+ std::vector<osmium::Node const *> const &nodes)
541546{
542547 auto const mid_q = mid->get_query_instance ();
543548
@@ -556,13 +561,15 @@ static void check_way_nodes(std::shared_ptr<middle_pgsql_t> const &mid,
556561}
557562
558563// / Return true if the way with the specified id is not in the mid.
559- static bool no_way (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t id)
564+ bool no_way (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t id)
560565{
561566 auto const mid_q = mid->get_query_instance ();
562567 osmium::memory::Buffer outbuf{4096 , osmium::memory::Buffer::auto_grow::yes};
563568 return !mid_q->way_get (id, &outbuf);
564569}
565570
571+ } // anonymous namespace
572+
566573TEMPLATE_TEST_CASE (" middle: add, delete and update way" , " " ,
567574 options_slim_default, options_flat_node_cache)
568575{
@@ -762,12 +769,14 @@ TEMPLATE_TEST_CASE("middle: add way with attributes", "", options_slim_default,
762769 }
763770}
764771
772+ namespace {
773+
765774/* *
766775 * Check that the relation is in the mid with the right attributes, members
767776 * and tags. Only checks the relation, does not recurse into members.
768777 */
769- static void check_relation (std::shared_ptr<middle_pgsql_t > const &mid,
770- osmium::Relation const &orig_relation)
778+ void check_relation (std::shared_ptr<middle_pgsql_t > const &mid,
779+ osmium::Relation const &orig_relation)
771780{
772781 auto const mid_q = mid->get_query_instance ();
773782
@@ -807,13 +816,15 @@ static void check_relation(std::shared_ptr<middle_pgsql_t> const &mid,
807816}
808817
809818// / Return true if the relation with the specified id is not in the mid.
810- static bool no_relation (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t id)
819+ bool no_relation (std::shared_ptr<middle_pgsql_t > const &mid, osmid_t id)
811820{
812821 auto const mid_q = mid->get_query_instance ();
813822 osmium::memory::Buffer outbuf{4096 , osmium::memory::Buffer::auto_grow::yes};
814823 return !mid_q->relation_get (id, &outbuf);
815824}
816825
826+ } // anonymous namespace
827+
817828TEMPLATE_TEST_CASE (" middle: add, delete and update relation" , " " ,
818829 options_slim_default, options_flat_node_cache)
819830{
0 commit comments