1212#include < algorithm>
1313#include < cassert>
1414
15- #include < osmium/opl.hpp>
1615#include < osmium/osm/crc.hpp>
1716#include < osmium/osm/crc_zlib.hpp>
1817
1918#include " dependency-manager.hpp"
2019#include " middle-pgsql.hpp"
2120#include " middle-ram.hpp"
2221
22+ #include " common-buffer.hpp"
2323#include " common-cleanup.hpp"
2424#include " common-options.hpp"
2525#include " common-pg.hpp"
@@ -28,59 +28,12 @@ static testing::pg::tempdb_t db;
2828
2929namespace {
3030
31- /* *
32- * Wrapper around an Osmium buffer to create test objects in with some
33- * convenience.
34- */
35- class test_buffer_t
36- {
37- public:
38- osmium::Node const &add_node (std::string const &data)
39- {
40- return m_buffer.get <osmium::Node>(add_opl (data));
41- }
42-
43- osmium::Way &add_way (std::string const &data)
44- {
45- return m_buffer.get <osmium::Way>(add_opl (data));
46- }
47-
48- osmium::Way &add_way (osmid_t wid, idlist_t const &ids)
49- {
50- assert (!ids.empty ());
51- std::string nodes;
52-
53- for (auto const id : ids) {
54- nodes += " n{}," _format (id);
55- }
56-
57- nodes.resize (nodes.size () - 1 );
58-
59- return add_way (" w{} N{}" _format (wid, nodes));
60- }
61-
62- osmium::Relation const &add_relation (std::string const &data)
63- {
64- return m_buffer.get <osmium::Relation>(add_opl (data));
65- }
66-
67- private:
68- std::size_t add_opl (std::string const &data)
69- {
70- auto const offset = m_buffer.committed ();
71- osmium::opl_parse (data.c_str (), m_buffer);
72- return offset;
73- }
74-
75- osmium::memory::Buffer m_buffer{4096 ,
76- osmium::memory::Buffer::auto_grow::yes};
77- };
78-
7931void expect_location (osmium::Location loc, osmium::Node const &expected)
8032{
8133 CHECK (loc.lat () == Approx (expected.location ().lat ()));
8234 CHECK (loc.lon () == Approx (expected.location ().lon ()));
8335}
36+
8437} // namespace
8538
8639struct options_slim_default
0 commit comments