aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/wire_format_unittest.cc
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2018-08-08 17:00:41 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2018-08-08 17:00:41 -0700
commit6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 (patch)
treee575738adf52d24b883cca5e8928a5ded31caba1 /src/google/protobuf/wire_format_unittest.cc
parente7746f487cb9cca685ffb1b3d7dccc5554b618a4 (diff)
downloadprotobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.gz
protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.bz2
protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.zip
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/wire_format_unittest.cc')
-rw-r--r--src/google/protobuf/wire_format_unittest.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/google/protobuf/wire_format_unittest.cc b/src/google/protobuf/wire_format_unittest.cc
index 736a1282..9dfd13b5 100644
--- a/src/google/protobuf/wire_format_unittest.cc
+++ b/src/google/protobuf/wire_format_unittest.cc
@@ -48,6 +48,7 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
+#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/stl_util.h>
namespace google {
@@ -59,17 +60,16 @@ TEST(WireFormatTest, EnumsInSync) {
// Verify that WireFormatLite::FieldType and WireFormatLite::CppType match
// FieldDescriptor::Type and FieldDescriptor::CppType.
- EXPECT_EQ(implicit_cast<int>(FieldDescriptor::MAX_TYPE),
- implicit_cast<int>(WireFormatLite::MAX_FIELD_TYPE));
- EXPECT_EQ(implicit_cast<int>(FieldDescriptor::MAX_CPPTYPE),
- implicit_cast<int>(WireFormatLite::MAX_CPPTYPE));
+ EXPECT_EQ(::google::protobuf::implicit_cast<int>(FieldDescriptor::MAX_TYPE),
+ ::google::protobuf::implicit_cast<int>(WireFormatLite::MAX_FIELD_TYPE));
+ EXPECT_EQ(::google::protobuf::implicit_cast<int>(FieldDescriptor::MAX_CPPTYPE),
+ ::google::protobuf::implicit_cast<int>(WireFormatLite::MAX_CPPTYPE));
for (int i = 1; i <= WireFormatLite::MAX_FIELD_TYPE; i++) {
- EXPECT_EQ(
- implicit_cast<int>(FieldDescriptor::TypeToCppType(
- static_cast<FieldDescriptor::Type>(i))),
- implicit_cast<int>(WireFormatLite::FieldTypeToCppType(
- static_cast<WireFormatLite::FieldType>(i))));
+ EXPECT_EQ(::google::protobuf::implicit_cast<int>(FieldDescriptor::TypeToCppType(
+ static_cast<FieldDescriptor::Type>(i))),
+ ::google::protobuf::implicit_cast<int>(WireFormatLite::FieldTypeToCppType(
+ static_cast<WireFormatLite::FieldType>(i))));
}
}
@@ -485,14 +485,15 @@ TEST(WireFormatTest, SerializeMessageSetVariousWaysAreEqual) {
// Serialize to flat array
{
- uint8* target = reinterpret_cast<uint8*>(string_as_array(&flat_data));
+ uint8* target = reinterpret_cast<uint8*>(::google::protobuf::string_as_array(&flat_data));
uint8* end = message_set.SerializeWithCachedSizesToArray(target);
EXPECT_EQ(size, end - target);
}
// Serialize to buffer
{
- io::ArrayOutputStream array_stream(string_as_array(&stream_data), size, 1);
+ io::ArrayOutputStream array_stream(::google::protobuf::string_as_array(&stream_data), size,
+ 1);
io::CodedOutputStream output_stream(&array_stream);
message_set.SerializeWithCachedSizes(&output_stream);
ASSERT_FALSE(output_stream.HadError());
@@ -745,8 +746,8 @@ TEST(WireFormatTest, RepeatedScalarsDifferentTagSizes) {
}
// Make sure that we have a variety of tag sizes.
- const google::protobuf::Descriptor* desc = msg1.GetDescriptor();
- const google::protobuf::FieldDescriptor* field;
+ const Descriptor* desc = msg1.GetDescriptor();
+ const FieldDescriptor* field;
field = desc->FindFieldByName("repeated_fixed32");
ASSERT_TRUE(field != NULL);
ASSERT_EQ(1, WireFormat::TagSize(field->number(), field->type()));