Upgrade libosmium to v2.15.6

This commit is contained in:
Desone Burns II
2020-11-17 14:59:06 -07:00
parent 98fd17589d
commit dfc1bfc27e
319 changed files with 6268 additions and 3946 deletions
@@ -1,11 +1,18 @@
#include "catch.hpp"
#include <stdexcept>
// Define assert() to throw this error. This enables the tests to check that
// the assert() fails.
struct assert_error : public std::runtime_error {
explicit assert_error(const char* what_arg) : std::runtime_error(what_arg) {
}
};
#ifdef assert
#undef assert
#endif
#define assert(x) if (!(x)) { throw assert_error{#x}; }
#include <osmium/util/cast.hpp>
+1 -1
View File
@@ -68,7 +68,7 @@ TEST_CASE("use_pool_threads_for_pbf_parsing") {
TEST_CASE("get_max_queue_size") {
osmium::detail::env = nullptr;
REQUIRE(osmium::config::get_max_queue_size("NAME", 0) == 0);
REQUIRE(osmium::config::get_max_queue_size("NAME", 0) == 2);
REQUIRE(osmium::detail::name == "OSMIUM_MAX_NAME_QUEUE_SIZE");
REQUIRE(osmium::config::get_max_queue_size("NAME", 7) == 7);
+2
View File
@@ -2,6 +2,8 @@
#include <osmium/util/double.hpp>
#include <string>
TEST_CASE("Check double2string function") {
std::string s1;
osmium::double2string(s1, 1.123, 7);
+3
View File
@@ -5,6 +5,9 @@
#include <osmium/io/detail/read_write.hpp>
#include <osmium/util/file.hpp>
#include <stdexcept>
#include <string>
TEST_CASE("file_size(int) and file_offset() of known file") {
std::string file_name{with_data_dir("t/util/known_file_size")};
const int fd = osmium::io::detail::open_for_reading(file_name);
+2 -20
View File
@@ -2,31 +2,13 @@
#include <osmium/util/memory.hpp>
#include <vector>
TEST_CASE("Check memory usage") {
#ifdef __linux__
const int size_in_mbytes = 10;
osmium::MemoryUsage m1;
REQUIRE(m1.current() > 1);
REQUIRE(m1.peak() > 1);
// Memory reporting on M68k architecture doesn't work properly.
# ifndef __m68k__
{
std::vector<int> v;
v.reserve(size_in_mbytes * 1024 * 1024);
osmium::MemoryUsage m2;
REQUIRE(m2.current() >= m1.current() + size_in_mbytes);
REQUIRE(m2.peak() >= m1.peak() + size_in_mbytes);
REQUIRE(m2.peak() - m2.current() <= 1);
}
osmium::MemoryUsage m3;
REQUIRE(m3.current() > 1);
REQUIRE(m3.current() <= m3.peak());
REQUIRE(m3.peak() >= m1.peak() + size_in_mbytes);
# endif
#else
osmium::MemoryUsage m;
REQUIRE(m.current() == 0);
+2 -2
View File
@@ -46,7 +46,7 @@ TEST_CASE("Anonymous mapping: moving a memory mapping should work") {
osmium::MemoryMapping mapping2{std::move(mapping1)};
REQUIRE(!!mapping2);
REQUIRE(!mapping1); // NOLINT(bugprone-use-after-move,misc-use-after-move) okay here, we are checking our own code
mapping1.unmap();
mapping1.unmap(); // NOLINT(clang-analyzer-cplusplus.Move) okay here, we are checking our own code
const auto* addr2 = mapping2.get_addr<int>();
REQUIRE(*addr2 == 42);
@@ -271,7 +271,7 @@ TEST_CASE("Typed anonymous mapping: moving a memory mapping should work") {
osmium::TypedMemoryMapping<uint32_t> mapping2{std::move(mapping1)};
REQUIRE(!!mapping2);
REQUIRE(!mapping1); // NOLINT(bugprone-use-after-move,misc-use-after-move) okay here, we are checking our own code
mapping1.unmap();
mapping1.unmap(); // NOLINT(clang-analyzer-cplusplus.Move) okay here, we are checking our own code
const auto addr2 = mapping2.begin();
REQUIRE(*addr2 == 42);
+2
View File
@@ -3,6 +3,8 @@
#include <osmium/osm/timestamp.hpp>
#include <osmium/util/minmax.hpp>
#include <limits>
TEST_CASE("min_op numeric") {
osmium::min_op<int> x;
REQUIRE(x() == std::numeric_limits<int>::max());
+4 -4
View File
@@ -46,22 +46,22 @@ TEST_CASE("string to integer conversion") {
REQUIRE(osmium::detail::str_to_int<uint16_t>("65536") == 0);
test_conv<int32_t>();
REQUIRE(osmium::detail::str_to_int<int32_t>("2147483646") == 2147483646ll);
REQUIRE(osmium::detail::str_to_int<int32_t>("2147483646") == 2147483646LL);
REQUIRE(osmium::detail::str_to_int<int32_t>("2147483647") == 0);
REQUIRE(osmium::detail::str_to_int<int32_t>("2147483648") == 0);
test_conv<uint32_t>();
REQUIRE(osmium::detail::str_to_int<uint32_t>("4294967294") == 4294967294ull);
REQUIRE(osmium::detail::str_to_int<uint32_t>("4294967294") == 4294967294ULL);
REQUIRE(osmium::detail::str_to_int<uint32_t>("4294967295") == 0);
REQUIRE(osmium::detail::str_to_int<uint32_t>("4294967296") == 0);
test_conv<int64_t>();
REQUIRE(osmium::detail::str_to_int<int64_t>("9223372036854775806") == 9223372036854775806ll);
REQUIRE(osmium::detail::str_to_int<int64_t>("9223372036854775806") == 9223372036854775806LL);
REQUIRE(osmium::detail::str_to_int<int64_t>("9223372036854775807") == 0);
REQUIRE(osmium::detail::str_to_int<int64_t>("9223372036854775808") == 0);
test_conv<uint64_t>();
REQUIRE(osmium::detail::str_to_int<uint64_t>("9223372036854775806") == 9223372036854775806ull);
REQUIRE(osmium::detail::str_to_int<uint64_t>("9223372036854775806") == 9223372036854775806ULL);
REQUIRE(osmium::detail::str_to_int<uint64_t>("9223372036854775807") == 0);
REQUIRE(osmium::detail::str_to_int<uint64_t>("9223372036854775808") == 0);
}
+3
View File
@@ -5,6 +5,8 @@
TEST_CASE("Set a single option value from string") {
osmium::Options o;
REQUIRE(o.empty());
o.set("foo", "bar");
REQUIRE("bar" == o.get("foo"));
REQUIRE(o.get("empty").empty());
@@ -17,6 +19,7 @@ TEST_CASE("Set a single option value from string") {
REQUIRE(o.is_not_false("empty"));
REQUIRE(1 == o.size());
REQUIRE_FALSE(o.empty());
}
TEST_CASE("Set option values from booleans") {
+3
View File
@@ -2,6 +2,9 @@
#include <osmium/util/string.hpp>
#include <string>
#include <vector>
TEST_CASE("split_string string") {
const std::string str{"foo,baramba,baz"};
const std::vector<std::string> result = {"foo", "baramba", "baz"};
@@ -3,7 +3,13 @@
#include <osmium/util/string_matcher.hpp>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#ifdef OSMIUM_WITH_REGEX
#include <regex>
#endif
static_assert(std::is_default_constructible<osmium::StringMatcher>::value, "StringMatcher should be default constructible");
static_assert(std::is_copy_constructible<osmium::StringMatcher>::value, "StringMatcher should be copy constructible");