Add a test for repeated field orderings demonstrating that MessageDifferencer::Equals and MessageDifferencer::Equivalent treat these cases in the same way.

PiperOrigin-RevId: 619712729
pull/16333/head
Protobuf Team Bot 2024-03-27 17:10:43 -07:00 committed by Copybara-Service
parent 9b2b61cfb4
commit 62620979c2
1 changed files with 15 additions and 0 deletions

View File

@ -1153,6 +1153,21 @@ TEST(MessageDifferencerTest, BasicFieldOrderingInequalityTest) {
EXPECT_FALSE(util::MessageDifferencer::Equals(msg1, msg2));
}
TEST(MessageDifferencerTest, BasicRepeatedFieldOrderingInequalityTest) {
// Create the testing protos
unittest::MoreString msg1;
unittest::MoreString msg2;
msg1.add_data("a");
msg1.add_data("b");
msg2.add_data("b");
msg2.add_data("a");
// Compare
EXPECT_FALSE(util::MessageDifferencer::Equals(msg1, msg2));
EXPECT_FALSE(util::MessageDifferencer::Equivalent(msg1, msg2));
}
TEST(MessageDifferencerTest, BasicExtensionTest) {
// Create the testing protos
unittest::TestAllExtensions msg1;