コード例 #1
0
void test_func_real(TIndex& index) {
    const osmium::unsigned_object_id_type id1 = 12;
    const osmium::unsigned_object_id_type id2 = 3;
    const osmium::Location loc1{1.2, 4.5};
    const osmium::Location loc2{3.5, -7.2};

    index.set(id1, loc1);
    index.set(id2, loc2);

    index.sort();

    REQUIRE(loc1 == index.get(id1));
    REQUIRE(loc2 == index.get(id2));

    REQUIRE(loc1 == index.get_noexcept(id1));
    REQUIRE(loc2 == index.get_noexcept(id2));

    REQUIRE_THROWS_AS(index.get(0), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(1), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(5), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(100), const osmium::not_found&);

    REQUIRE(index.get_noexcept(0) == osmium::Location{});
    REQUIRE(index.get_noexcept(1) == osmium::Location{});
    REQUIRE(index.get_noexcept(5) == osmium::Location{});
    REQUIRE(index.get_noexcept(100) == osmium::Location{});

    index.clear();

    REQUIRE_THROWS_AS(index.get(id1), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(id2), const osmium::not_found&);

    REQUIRE_THROWS_AS(index.get(0), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(1), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(5), const osmium::not_found&);
    REQUIRE_THROWS_AS(index.get(100), const osmium::not_found&);

    REQUIRE(index.get_noexcept(id1) == osmium::Location{});
    REQUIRE(index.get_noexcept(id2) == osmium::Location{});
    REQUIRE(index.get_noexcept(0) == osmium::Location{});
    REQUIRE(index.get_noexcept(1) == osmium::Location{});
    REQUIRE(index.get_noexcept(5) == osmium::Location{});
    REQUIRE(index.get_noexcept(100) == osmium::Location{});
}
コード例 #2
0
void test_func_real(TIndex& index) {
    osmium::object_id_type id1 = 12;
    osmium::object_id_type id2 = 3;
    osmium::Location loc1(1.2, 4.5);
    osmium::Location loc2(3.5, -7.2);

    index.set(id1, loc1);
    index.set(id2, loc2);

    index.sort();

    BOOST_CHECK_EQUAL(loc1, index.get(id1));
    BOOST_CHECK_EQUAL(loc2, index.get(id2));

    BOOST_CHECK_THROW(index.get(5), osmium::not_found);
    BOOST_CHECK_THROW(index.get(100), osmium::not_found);

    index.clear();

    BOOST_CHECK_THROW(index.get(id1), osmium::not_found);
}