<p>This PR adds <a href="https://github.com/catchorg/Catch2/">Catch2</a> to the project and ports all tests to use it instead of hand-crafted asserts. Some of the tests are heavily refactored, in particular, the node store and middle tests. They should still cover the same ground as before. There are also new tests for the new db-copy classes and the gazetteer backend.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/osm2pgsql/pull/966'>https://github.com/openstreetmap/osm2pgsql/pull/966</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>initial tests with catch</li>
  <li>start tests for middle</li>
  <li>more tests for gazetteer output</li>
  <li>add catch test for persistent cache</li>
  <li>add tests for ram cache</li>
  <li>create a directory for test data</li>
  <li>update catch to 2.9</li>
  <li>move test options to catch</li>
  <li>move database option tests to catch</li>
  <li>rewrite projection option test</li>
  <li>add pgsql output tests</li>
  <li>rewrite basic pgsql output test in catch</li>
  <li>port test_output_pgsql-area to catch</li>
  <li>port int4 tests to catch</li>
  <li>port schema tests to catch</li>
  <li>move tablespace test to catch</li>
  <li>port two remaining output-pgsql tests to catch</li>
  <li>reorganise options for testing</li>
  <li>port parsing tests to catch</li>
  <li>port trivial tests for multi backend to catch</li>
  <li>port multi output type tests to catch</li>
  <li>port expiry code to catch</li>
  <li>port remaining output tests to catch</li>
  <li>remove already ported middle tests</li>
  <li>remove old test boiler plates</li>
  <li>move regression tests to new catch directory</li>
  <li>move new tests into place</li>
  <li>adapt paths in cmake for new layout</li>
  <li>clang-format tests</li>
  <li>fix remaining path issues</li>
  <li>fix paths in regression script</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-0">node-ram-cache.cpp</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-1">tests/CMakeLists.txt</a>
    (85)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-2">tests/catch-main.cpp</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-3">tests/catch.hpp</a>
    (16864)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-4">tests/common-cleanup.cpp</a>
    (21)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-5">tests/common-cleanup.hpp</a>
    (46)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-6">tests/common-import.hpp</a>
    (145)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-7">tests/common-options.hpp</a>
    (85)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-8">tests/common-pg.cpp</a>
    (271)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-9">tests/common-pg.hpp</a>
    (246)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-10">tests/common.hpp</a>
    (48)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-11">tests/data/000466354.osc.gz</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-12">tests/data/008-ch.osc.gz</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-13">tests/data/gazetteer-test.style</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-14">tests/data/hstore-match-only.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-15">tests/data/hstore-match-only.style</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-16">tests/data/liechtenstein-2013-08-03.osm.pbf</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-17">tests/data/test_multipolygon.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-18">tests/data/test_multipolygon_diff.osc</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-19">tests/data/test_multipolygon_postdiff.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-20">tests/data/test_output_multi_line_storage.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-21">tests/data/test_output_multi_line_trivial.lua</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-22">tests/data/test_output_multi_line_trivial.style.json</a>
    (2)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-23">tests/data/test_output_multi_poly_trivial.lua</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-24">tests/data/test_output_multi_poly_trivial.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-25">tests/data/test_output_multi_poly_trivial.style.json</a>
    (2)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-26">tests/data/test_output_multi_tags.json</a>
    (12)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-27">tests/data/test_output_multi_tags.lua</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-28">tests/data/test_output_multi_tags.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-29">tests/data/test_output_pgsql_area.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-30">tests/data/test_output_pgsql_int4.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-31">tests/data/test_output_pgsql_int4.style</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-32">tests/data/test_output_pgsql_route_rel.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-33">tests/data/test_output_pgsql_validgeom.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-34">tests/data/test_output_pgsql_way_area.osm</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-35">tests/data/test_output_pgsql_z_order.osm</a>
    (0)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-36">tests/middle-tests.hpp</a>
    (324)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-37">tests/mockups.hpp</a>
    (82)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-38">tests/regression-test.py</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-39">tests/regression-test.sh</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-40">tests/test-db-copy-mgr.cpp</a>
    (192)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-41">tests/test-db-copy-thread.cpp</a>
    (139)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-42">tests/test-expire-tiles.cpp</a>
    (544)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-43">tests/test-hstore-match-only.cpp</a>
    (88)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-44">tests/test-middle-flat.cpp</a>
    (113)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-45">tests/test-middle-pgsql.cpp</a>
    (97)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-46">tests/test-middle-ram.cpp</a>
    (76)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-47">tests/test-middle.cpp</a>
    (235)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-48">tests/test-options-database.cpp</a>
    (71)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-49">tests/test-options-parse.cpp</a>
    (348)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-50">tests/test-options-projection.cpp</a>
    (153)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-51">tests/test-output-gazetteer.cpp</a>
    (82)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-52">tests/test-output-multi-line-storage.cpp</a>
    (87)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-53">tests/test-output-multi-line.cpp</a>
    (135)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-54">tests/test-output-multi-point-multi-table.cpp</a>
    (139)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-55">tests/test-output-multi-point.cpp</a>
    (107)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-56">tests/test-output-multi-poly-trivial.cpp</a>
    (127)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-57">tests/test-output-multi-polygon.cpp</a>
    (138)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-58">tests/test-output-multi-tags.cpp</a>
    (140)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-59">tests/test-output-pgsql-area.cpp</a>
    (126)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-60">tests/test-output-pgsql-hstore-match-only.cpp</a>
    (41)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-61">tests/test-output-pgsql-int4.cpp</a>
    (168)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-62">tests/test-output-pgsql-schema.cpp</a>
    (143)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-63">tests/test-output-pgsql-tablespace.cpp</a>
    (111)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-64">tests/test-output-pgsql-validgeom.cpp</a>
    (105)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-65">tests/test-output-pgsql-z_order.cpp</a>
    (110)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-66">tests/test-output-pgsql.cpp</a>
    (344)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-67">tests/test-parse-diff.cpp</a>
    (130)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-68">tests/test-parse-extra-args.cpp</a>
    (114)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-69">tests/test-parse-osmium.cpp</a>
    (233)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-70">tests/test-parse-xml2.cpp</a>
    (108)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-71">tests/test-persistent-cache.cpp</a>
    (93)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-72">tests/test-persistent-node-cache.cpp</a>
    (119)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-73">tests/test-ram-cache.cpp</a>
    (119)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/966/files#diff-74">tests/test-wildcard-match.cpp</a>
    (80)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/966.patch'>https://github.com/openstreetmap/osm2pgsql/pull/966.patch</a></li>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/966.diff'>https://github.com/openstreetmap/osm2pgsql/pull/966.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/966?email_source=notifications&email_token=AA6353U2Q4ES664OIBMMVRDQTHSNVA5CNFSM4JL4CPO2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HYRQY4Q">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353X7W2H27NHHJ4MLXITQTHSNVANCNFSM4JL4CPOQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353VFDYFBEHJ62RLITRDQTHSNVA5CNFSM4JL4CPO2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HYRQY4Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/966?email_source=notifications\u0026email_token=AA6353U2Q4ES664OIBMMVRDQTHSNVA5CNFSM4JL4CPO2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HYRQY4Q",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/966?email_source=notifications\u0026email_token=AA6353U2Q4ES664OIBMMVRDQTHSNVA5CNFSM4JL4CPO2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HYRQY4Q",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>