diff --git a/tests/common-import.hpp b/tests/common-import.hpp index bf6c8716..e75d6085 100644 --- a/tests/common-import.hpp +++ b/tests/common-import.hpp @@ -216,12 +216,12 @@ public: {out_test}, file); } - pg::conn_t connect() { return m_db.connect(); } + testing::pg::conn_t connect() { return m_db.connect(); } - pg::tempdb_t const &db() const { return m_db; } + testing::pg::tempdb_t const &db() const { return m_db; } private: - pg::tempdb_t m_db; + testing::pg::tempdb_t m_db; }; } // namespace db diff --git a/tests/common-options.hpp b/tests/common-options.hpp index a4aaa099..81d758e1 100644 --- a/tests/common-options.hpp +++ b/tests/common-options.hpp @@ -28,7 +28,7 @@ public: return *this; } - opt_t &slim(pg::tempdb_t const &db) + opt_t &slim(testing::pg::tempdb_t const &db) { m_opt.slim = true; m_opt.database_options = db.db_options(); diff --git a/tests/common-pg.hpp b/tests/common-pg.hpp index a3a388e2..8080f3f7 100644 --- a/tests/common-pg.hpp +++ b/tests/common-pg.hpp @@ -19,6 +19,7 @@ #define getpid _getpid #endif +namespace testing { /// Helper classes for postgres connections namespace pg { @@ -141,5 +142,6 @@ private: }; } // namespace pg +} // namespace testing #endif // OSM2PGSQL_TEST_COMMON_PG_HPP diff --git a/tests/test-db-copy-mgr.cpp b/tests/test-db-copy-mgr.cpp index 854a9750..b3e84d96 100644 --- a/tests/test-db-copy-mgr.cpp +++ b/tests/test-db-copy-mgr.cpp @@ -7,7 +7,7 @@ #include "common-pg.hpp" #include "db-copy-mgr.hpp" -static pg::tempdb_t db; +static testing::pg::tempdb_t db; using copy_mgr_t = db_copy_mgr_t; diff --git a/tests/test-db-copy-thread.cpp b/tests/test-db-copy-thread.cpp index 74872fe2..30806bab 100644 --- a/tests/test-db-copy-thread.cpp +++ b/tests/test-db-copy-thread.cpp @@ -4,9 +4,10 @@ #include "db-copy.hpp" #include "gazetteer-style.hpp" -static pg::tempdb_t db; +static testing::pg::tempdb_t db; -static int table_count(pg::conn_t const &conn, std::string const &where = "") +static int table_count(testing::pg::conn_t const &conn, + std::string const &where = "") { return conn.require_scalar("SELECT count(*) FROM test_copy_thread " + where); diff --git a/tests/test-middle.cpp b/tests/test-middle.cpp index a69db0a8..767c96b4 100644 --- a/tests/test-middle.cpp +++ b/tests/test-middle.cpp @@ -13,7 +13,7 @@ #include -static pg::tempdb_t db; +static testing::pg::tempdb_t db; namespace { @@ -106,7 +106,7 @@ void expect_location(osmium::Location loc, osmium::Node const &expected) struct options_slim_default { - static options_t options(pg::tempdb_t const &tmpdb) + static options_t options(testing::pg::tempdb_t const &tmpdb) { return testing::opt_t().slim(tmpdb); } @@ -114,7 +114,7 @@ struct options_slim_default struct options_slim_with_schema { - static options_t options(pg::tempdb_t const &tmpdb) + static options_t options(testing::pg::tempdb_t const &tmpdb) { options_t o = testing::opt_t().slim(tmpdb); o.middle_dbschema = "osm"; @@ -124,7 +124,7 @@ struct options_slim_with_schema struct options_slim_dense_cache { - static options_t options(pg::tempdb_t const &tmpdb) + static options_t options(testing::pg::tempdb_t const &tmpdb) { options_t o = options_slim_default::options(tmpdb); o.alloc_chunkwise = ALLOC_DENSE; @@ -134,7 +134,7 @@ struct options_slim_dense_cache struct options_flat_node_cache { - static options_t options(pg::tempdb_t const &tmpdb) + static options_t options(testing::pg::tempdb_t const &tmpdb) { return testing::opt_t().slim(tmpdb).flatnodes(); } @@ -142,7 +142,7 @@ struct options_flat_node_cache struct options_ram_optimized { - static options_t options(pg::tempdb_t const &) + static options_t options(testing::pg::tempdb_t const &) { options_t o = testing::opt_t(); o.alloc_chunkwise = ALLOC_SPARSE | ALLOC_DENSE; @@ -152,7 +152,7 @@ struct options_ram_optimized struct options_ram_flatnode { - static options_t options(pg::tempdb_t const &) + static options_t options(testing::pg::tempdb_t const &) { options_t o = testing::opt_t().flatnodes(); o.alloc_chunkwise = ALLOC_SPARSE | ALLOC_DENSE; diff --git a/tests/test-output-gazetteer.cpp b/tests/test-output-gazetteer.cpp index 485a5a41..20ae69d7 100644 --- a/tests/test-output-gazetteer.cpp +++ b/tests/test-output-gazetteer.cpp @@ -191,7 +191,8 @@ public: REQUIRE_NOTHROW(db.run_import(opt, opl.c_str())); } - unsigned long obj_count(pg::conn_t const &conn, osmid_t id, char const *cls) + unsigned long obj_count(testing::pg::conn_t const &conn, osmid_t id, + char const *cls) { char const tchar = m_opl_factory.type(); return conn.get_count("place", @@ -200,26 +201,26 @@ public: "AND class = '{}'"_format(tchar, id, cls)); } - void obj_names(pg::conn_t const &conn, osmid_t id, char const *cls, + void obj_names(testing::pg::conn_t const &conn, osmid_t id, char const *cls, hstore_list const &names) { hstore_compare(conn, id, cls, "name", names); } - void obj_address(pg::conn_t const &conn, osmid_t id, char const *cls, - hstore_list const &names) + void obj_address(testing::pg::conn_t const &conn, osmid_t id, + char const *cls, hstore_list const &names) { hstore_compare(conn, id, cls, "address", names); } - void obj_extratags(pg::conn_t const &conn, osmid_t id, char const *cls, - hstore_list const &names) + void obj_extratags(testing::pg::conn_t const &conn, osmid_t id, + char const *cls, hstore_list const &names) { hstore_compare(conn, id, cls, "extratags", names); } - std::string obj_field(pg::conn_t const &conn, osmid_t id, char const *cls, - char const *column) + std::string obj_field(testing::pg::conn_t const &conn, osmid_t id, + char const *cls, char const *column) { char const tchar = m_opl_factory.type(); return conn.require_scalar( @@ -228,8 +229,9 @@ public: } private: - void hstore_compare(pg::conn_t const &conn, osmid_t id, char const *cls, - char const *column, hstore_list const &names) + void hstore_compare(testing::pg::conn_t const &conn, osmid_t id, + char const *cls, char const *column, + hstore_list const &names) { char const tchar = m_opl_factory.type(); auto const sql = diff --git a/tests/test-output-pgsql-tablespace.cpp b/tests/test-output-pgsql-tablespace.cpp index 0a5b20e7..4eb2b44d 100644 --- a/tests/test-output-pgsql-tablespace.cpp +++ b/tests/test-output-pgsql-tablespace.cpp @@ -5,7 +5,7 @@ static testing::db::import_t db; -static void require_tables(pg::conn_t const &conn) +static void require_tables(testing::pg::conn_t const &conn) { conn.require_has_table("osm2pgsql_test_point"); conn.require_has_table("osm2pgsql_test_line"); diff --git a/tests/test-output-pgsql.cpp b/tests/test-output-pgsql.cpp index edfa8e7f..2fc712d3 100644 --- a/tests/test-output-pgsql.cpp +++ b/tests/test-output-pgsql.cpp @@ -5,7 +5,7 @@ static testing::db::import_t db; -static void require_tables(pg::conn_t const &conn) +static void require_tables(testing::pg::conn_t const &conn) { conn.require_has_table("osm2pgsql_test_point"); conn.require_has_table("osm2pgsql_test_line");