Skip to content

Commit

Permalink
Add a test for repeated field orderings demonstrating that MessageDif…
Browse files Browse the repository at this point in the history
…ferencer::Equals and MessageDifferencer::Equivalent treat these cases in the same way.

PiperOrigin-RevId: 619712729
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Mar 28, 2024
1 parent 9b2b61c commit 6262097
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/google/protobuf/util/message_differencer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6262097

Please sign in to comment.