Updated bundled protozero to v1.7.0

This commit is contained in:
Denis Chaplygin
2020-10-16 10:25:52 +03:00
parent df3ed43d70
commit a8362d75b5
126 changed files with 18489 additions and 11079 deletions
@@ -1,6 +1,8 @@
#include <test.hpp>
#include <array>
TEST_CASE("read repeated packed double field") {
// Run these tests twice, the second time we basically move the data
// one byte down in the buffer. It doesn't matter how the data or buffer
@@ -82,7 +84,7 @@ TEST_CASE("read repeated packed double field") {
for (std::string::size_type i = 1; i < abuffer.size() - n; ++i) {
protozero::pbf_reader item{abuffer.data() + n, i};
REQUIRE(item.next());
REQUIRE_THROWS_AS(item.get_packed_double(), const protozero::end_of_buffer_exception&);
REQUIRE_THROWS_AS(item.get_packed_double(), protozero::end_of_buffer_exception);
}
}
}
@@ -93,21 +95,23 @@ TEST_CASE("write repeated packed double field") {
protozero::pbf_writer pw{buffer};
SECTION("empty") {
const double data[] = { 17.34 };
const std::array<double, 1> data = {{ 17.34 }};
pw.add_packed_double(1, std::begin(data), std::begin(data) /* !!!! */);
REQUIRE(buffer == load_data("repeated_packed_double/data-empty"));
}
SECTION("one") {
const double data[] = { 17.34 };
const std::array<double, 1> data = {{ 17.34 }};
pw.add_packed_double(1, std::begin(data), std::end(data));
REQUIRE(buffer == load_data("repeated_packed_double/data-one"));
}
SECTION("many") {
const double data[] = { 17.34, 0.0, 1.0, std::numeric_limits<double>::min(), std::numeric_limits<double>::max() };
const std::array<double, 5> data = {{ 17.34, 0.0, 1.0,
std::numeric_limits<double>::min(),
std::numeric_limits<double>::max() }};
pw.add_packed_double(1, std::begin(data), std::end(data));
REQUIRE(buffer == load_data("repeated_packed_double/data-many"));
@@ -1,8 +1,9 @@
#include <testcase.hpp>
#include "testcase.pb.h"
int main(int c, char *argv[]) {
int main() {
TestRepeatedPackedDouble::Test msg;
write_to_file(msg, "data-empty.pbf");