@ -18,9 +18,10 @@
#include < sys / types . h >
#include < sys / types . h >
#include < cmath >
#include < cmath >
#include < functional >
#include < cstddef >
#include < cstdint >
#include < limits >
#include < limits >
#include < vector >
#include < string >
#ifndef _MSC_VER
#ifndef _MSC_VER
#include < unistd.h >
#include < unistd.h >
@ -825,14 +826,23 @@ TEST(MESSAGE_TEST_NAME, DownCastMessageInvalidPointerType) {
TEST(MESSAGE_TEST_NAME, DownCastMessageInvalidReferenceType) {
TEST(MESSAGE_TEST_NAME, DownCastMessageInvalidReferenceType) {
UNITTEST::TestAllTypes test_all_types;
UNITTEST::TestAllTypes test_all_types;
MessageLite& test_all_types_pointe r = test_all_types;
MessageLite& test_all_types_ref = test_all_types;
ASSERT_DEBUG_DEATH(
ASSERT_DEBUG_DEATH(
DownCastMessage< UNITTEST::TestRequired > (test_all_types_pointe r),
DownCastMessage< UNITTEST::TestRequired > (test_all_types_ref ),
"Cannot downcast " + test_all_types.GetTypeName() + " to " +
"Cannot downcast " + test_all_types.GetTypeName() + " to " +
UNITTEST::TestRequired::default_instance().GetTypeName());
UNITTEST::TestRequired::default_instance().GetTypeName());
}
}
TEST(MESSAGE_TEST_NAME, MessageDebugStringMatchesBehindPointerAndLitePointer) {
UNITTEST::TestAllTypes test_all_types;
test_all_types.set_optional_string("foo");
Message* msg_full_pointer = &test_all_types;
MessageLite* msg_lite_pointer = &test_all_types;
ASSERT_EQ(test_all_types.DebugString(), msg_full_pointer->DebugString());
ASSERT_EQ(test_all_types.DebugString(), msg_lite_pointer->DebugString());
}
#if GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet.
#if GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet.
TEST(MESSAGE_TEST_NAME, SerializeFailsIfNotInitialized) {
TEST(MESSAGE_TEST_NAME, SerializeFailsIfNotInitialized) {