diff options
Diffstat (limited to 'absl/base/exception_safety_testing_test.cc')
-rw-r--r-- | absl/base/exception_safety_testing_test.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc index f8baf20c9360..9c52f249ee16 100644 --- a/absl/base/exception_safety_testing_test.cc +++ b/absl/base/exception_safety_testing_test.cc @@ -44,7 +44,7 @@ class ThrowingValueTest : public ::testing::Test { void SetUp() override { UnsetCountdown(); } private: - AllocInspector clouseau_; + ConstructorTracker clouseau_; }; TEST_F(ThrowingValueTest, Throws) { @@ -279,7 +279,7 @@ class ThrowingAllocatorTest : public ::testing::Test { void SetUp() override { UnsetCountdown(); } private: - AllocInspector borlu_; + ConstructorTracker borlu_; }; TEST_F(ThrowingAllocatorTest, MemoryManagement) { @@ -652,22 +652,22 @@ struct Tracked : private exceptions_internal::TrackedObject { Tracked() : TrackedObject(ABSL_PRETTY_FUNCTION) {} }; -TEST(AllocInspectorTest, Pass) { - AllocInspector javert; +TEST(ConstructorTrackerTest, Pass) { + ConstructorTracker javert; Tracked t; } -TEST(AllocInspectorTest, NotDestroyed) { +TEST(ConstructorTrackerTest, NotDestroyed) { absl::aligned_storage_t<sizeof(Tracked), alignof(Tracked)> storage; EXPECT_NONFATAL_FAILURE( { - AllocInspector gadget; + ConstructorTracker gadget; new (&storage) Tracked; }, "not destroyed"); } -TEST(AllocInspectorTest, DestroyedTwice) { +TEST(ConstructorTrackerTest, DestroyedTwice) { EXPECT_NONFATAL_FAILURE( { Tracked t; @@ -676,7 +676,7 @@ TEST(AllocInspectorTest, DestroyedTwice) { "destroyed improperly"); } -TEST(AllocInspectorTest, ConstructedTwice) { +TEST(ConstructorTrackerTest, ConstructedTwice) { absl::aligned_storage_t<sizeof(Tracked), alignof(Tracked)> storage; EXPECT_NONFATAL_FAILURE( { @@ -697,5 +697,12 @@ TEST(ThrowingValueTraitsTest, RelationalOperators) { EXPECT_TRUE((std::is_convertible<decltype(a >= b), bool>::value)); } +TEST(ThrowingAllocatorTraitsTest, Assignablility) { + EXPECT_TRUE(std::is_move_assignable<ThrowingAllocator<int>>::value); + EXPECT_TRUE(std::is_copy_assignable<ThrowingAllocator<int>>::value); + EXPECT_TRUE(std::is_nothrow_move_assignable<ThrowingAllocator<int>>::value); + EXPECT_TRUE(std::is_nothrow_copy_assignable<ThrowingAllocator<int>>::value); +} + } // namespace } // namespace absl |