From f0f15c2778b0e4959244dd25e63f445a455870f5 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 9 Aug 2018 11:32:15 -0700 Subject: Export of internal Abseil changes. -- 7fb969986d7d5a1b30233a94ae7ea29e1abf8937 by Greg Falcon : Fix whitespace in str_join.h. PiperOrigin-RevId: 208082852 -- 85428003a8a29fbcd92c0b48708a69460eeb0e8f by Abseil Team : Add missing back-ticks to the comments. PiperOrigin-RevId: 207985417 -- 0bbac248d5649ac1d7bc71ff1025a11332fb2026 by Abseil Team : Internal change. PiperOrigin-RevId: 207927484 -- f587324b99570b403b4626fb03fce16f0d950b05 by Abseil Team : Update BaseCountedInstance to have comparison operators and allow them to be tracked by InstanceTracker. PiperOrigin-RevId: 207919218 -- d7f410e4f15328412941f16e25ba3735d5bdfda6 by Derek Mauro : Internal import of GitHub PR #153 Removed "warning treated as error" flag from MSVC PiperOrigin-RevId: 207908806 -- 59eefc78f8571ffc51cb636894015ce2580508d7 by Abseil Team : Fix namespace references in examples from 'std::' to 'absl::'. PiperOrigin-RevId: 207895230 -- 151df17b6544222e29913b034a1296c0e14374d5 by Abseil Team : Internal Change PiperOrigin-RevId: 207894949 GitOrigin-RevId: 7fb969986d7d5a1b30233a94ae7ea29e1abf8937 Change-Id: I00097afbe9610ddb3f2330a2a86dcffde7bb6675 --- .../internal/test_instance_tracker_test.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'absl/container/internal/test_instance_tracker_test.cc') diff --git a/absl/container/internal/test_instance_tracker_test.cc b/absl/container/internal/test_instance_tracker_test.cc index 9efb6771cf08..0ae57636df21 100644 --- a/absl/container/internal/test_instance_tracker_test.cc +++ b/absl/container/internal/test_instance_tracker_test.cc @@ -157,4 +157,26 @@ TEST(TestInstanceTracker, ExistingInstances) { EXPECT_EQ(1, tracker.moves()); } +TEST(TestInstanceTracker, Comparisons) { + InstanceTracker tracker; + MovableOnlyInstance one(1), two(2); + + EXPECT_EQ(0, tracker.comparisons()); + EXPECT_FALSE(one == two); + EXPECT_EQ(1, tracker.comparisons()); + EXPECT_TRUE(one != two); + EXPECT_EQ(2, tracker.comparisons()); + EXPECT_TRUE(one < two); + EXPECT_EQ(3, tracker.comparisons()); + EXPECT_FALSE(one > two); + EXPECT_EQ(4, tracker.comparisons()); + EXPECT_TRUE(one <= two); + EXPECT_EQ(5, tracker.comparisons()); + EXPECT_FALSE(one >= two); + EXPECT_EQ(6, tracker.comparisons()); + + tracker.ResetCopiesMovesSwaps(); + EXPECT_EQ(0, tracker.comparisons()); +} + } // namespace -- cgit 1.4.1