|
|
|
@ -14,6 +14,11 @@ |
|
|
|
|
#include "google/protobuf/unittest.pb.h" |
|
|
|
|
#include "google/protobuf/wire_format_lite.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
|
#include "google/protobuf/port_def.inc" |
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
|
|
namespace google { |
|
|
|
|
namespace protobuf { |
|
|
|
|
namespace internal { |
|
|
|
@ -83,6 +88,9 @@ TEST(FastVarints, NameHere) { |
|
|
|
|
offsetof(decltype(parse_table), field_names), // no aux_entries
|
|
|
|
|
nullptr, // default instance
|
|
|
|
|
FastParserGaveUp, // fallback
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
// Fast Table:
|
|
|
|
|
{{ |
|
|
|
@ -274,6 +282,9 @@ TEST(IsEntryForFieldNumTest, Matcher) { |
|
|
|
|
0, 0, // num_aux_entries, aux_offset,
|
|
|
|
|
nullptr, // default instance
|
|
|
|
|
nullptr, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}}; |
|
|
|
|
// clang-format on
|
|
|
|
|
int table_field_numbers[] = {1, 2, 3}; |
|
|
|
@ -342,6 +353,9 @@ TEST_F(FindFieldEntryTest, SequentialFieldRange) { |
|
|
|
|
0, 0, // num_aux_entries, aux_offset,
|
|
|
|
|
nullptr, // default instance
|
|
|
|
|
{}, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
{}, // fast_entries
|
|
|
|
|
// field_lookup_table for 2, 3, 4, 5, 111:
|
|
|
|
@ -382,6 +396,9 @@ TEST_F(FindFieldEntryTest, SmallScanRange) { |
|
|
|
|
0, 0, // num_aux_entries, aux_offset,
|
|
|
|
|
nullptr, // default instance
|
|
|
|
|
{}, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
{}, // fast_entries
|
|
|
|
|
// field_lookup_table for 1, 3, 4, 5, 7, 111:
|
|
|
|
@ -430,6 +447,9 @@ TEST_F(FindFieldEntryTest, BinarySearchRange) { |
|
|
|
|
0, 0, // num_aux_entries, aux_offset,
|
|
|
|
|
nullptr, // default instance
|
|
|
|
|
{}, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
{}, // fast_entries
|
|
|
|
|
// field_lookup_table for 1, 3, 4, 5, 6, 8, 9, 11, 12, 70
|
|
|
|
@ -475,6 +495,9 @@ TEST_F(FindFieldEntryTest, OutOfRange) { |
|
|
|
|
offsetof(decltype(table), field_names), // no aux_entries
|
|
|
|
|
nullptr, // default instance
|
|
|
|
|
{}, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
{}, // fast_entries
|
|
|
|
|
{{// field lookup table
|
|
|
|
@ -525,6 +548,9 @@ TEST_F(FindFieldEntryTest, EmptyMessage) { |
|
|
|
|
offsetof(TableType, field_names), |
|
|
|
|
nullptr, // default instance
|
|
|
|
|
nullptr, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
{}, // fast_entries
|
|
|
|
|
{{// empty field lookup table
|
|
|
|
@ -575,6 +601,9 @@ const TcParseTable<5, 134, 5, 2176, 55> test_all_types_table = { |
|
|
|
|
offsetof(decltype(test_all_types_table), aux_entries), |
|
|
|
|
nullptr, // default instance
|
|
|
|
|
nullptr, // fallback function
|
|
|
|
|
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE |
|
|
|
|
nullptr, // to_prefetch
|
|
|
|
|
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
|
|
|
|
}, |
|
|
|
|
{{ |
|
|
|
|
// tail-call table
|
|
|
|
|