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 enum field: empty") {
const std::string buffer = load_data("repeated_packed_enum/data-empty");
@@ -46,7 +48,7 @@ TEST_CASE("read repeated packed enum field: end of buffer") {
for (std::string::size_type i = 1; i < buffer.size(); ++i) {
protozero::pbf_reader item{buffer.data(), i};
REQUIRE(item.next());
REQUIRE_THROWS_AS(item.get_packed_enum(), const protozero::end_of_buffer_exception&);
REQUIRE_THROWS_AS(item.get_packed_enum(), protozero::end_of_buffer_exception);
}
}
@@ -55,21 +57,21 @@ TEST_CASE("write repeated packed enum field") {
protozero::pbf_writer pw{buffer};
SECTION("empty") {
const int32_t data[] = { 0 /* BLACK */ };
const std::array<int32_t, 1> data = {{ 0 /* BLACK */ }};
pw.add_packed_enum(1, std::begin(data), std::begin(data) /* !!!! */);
REQUIRE(buffer == load_data("repeated_packed_enum/data-empty"));
}
SECTION("one") {
const int32_t data[] = { 0 /* BLACK */ };
const std::array<int32_t, 1> data = {{ 0 /* BLACK */ }};
pw.add_packed_enum(1, std::begin(data), std::end(data));
REQUIRE(buffer == load_data("repeated_packed_enum/data-one"));
}
SECTION("many") {
const int32_t data[] = { 0 /* BLACK */, 3 /* BLUE */, 2 /* GREEN */ };
const std::array<int32_t, 3> data = {{ 0 /* BLACK */, 3 /* BLUE */, 2 /* GREEN */ }};
pw.add_packed_enum(1, std::begin(data), std::end(data));
REQUIRE(buffer == load_data("repeated_packed_enum/data-many"));
@@ -1,8 +1,9 @@
#include <testcase.hpp>
#include "testcase.pb.h"
int main(int c, char *argv[]) {
int main() {
TestRepeatedPackedEnum::Test msg;
write_to_file(msg, "data-empty.pbf");