File: test-102.cpp

package info (click to toggle)
libosmium 2.22.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,544 kB
  • sloc: cpp: 52,804; sh: 148; makefile: 19
file content (44 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

#include <stdexcept>

#include "common.hpp"

class TestHandler102 : public osmium::handler::Handler {

    osmium::Location location;

public:

    TestHandler102() :
        osmium::handler::Handler() {
    }

    void node(const osmium::Node& node) {
        constexpr const double epsilon = 0.00000001;
        if (node.id() == 102000) {
            REQUIRE(node.version() == 1);
            REQUIRE(node.location().lon() == Approx(1.24).epsilon(epsilon));
            REQUIRE(node.location().lat() == Approx(1.02).epsilon(epsilon));
            location = node.location();
        } else if (node.id() == 102001) {
            REQUIRE(node.version() == 1);
            REQUIRE(node.location().lon() == Approx(1.24).epsilon(epsilon));
            REQUIRE(node.location().lat() == Approx(1.02).epsilon(epsilon));
            REQUIRE(node.location() == location);
        } else {
            throw std::runtime_error{"Unknown ID"};
        }
    }

}; // class TestHandler102

TEST_CASE("102") {
    osmium::io::Reader reader{dirname + "/1/102/data.osm"};

    CheckBasicsHandler check_basics_handler{102, 2, 0, 0};
    CheckWKTHandler check_wkt_handler{dirname, 102};
    TestHandler102 test_handler;

    osmium::apply(reader, check_basics_handler, check_wkt_handler, test_handler);
}