aboutsummaryrefslogtreecommitdiffhomepage
path: root/absl/types/any_exception_safety_test.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-04-30 11:44:26 -0700
committerGravatar vslashg <gfalcon@google.com>2018-04-30 15:07:44 -0400
commit9613678332c976568272c8f4a78631a29159271d (patch)
tree63cd33be6a3d663752065a321319407370ba762c /absl/types/any_exception_safety_test.cc
parent28f5b890702139effabf3576f20e1a4db4a90a80 (diff)
- 60c1f40a5e0bc33f93392ff6827528072d749a29 Move ExceptionSafetyTester from the absl:: namespace to t... by Abseil Team <absl-team@google.com>
- abd40a98f8ae746eb151e777ea8a8b5223d68a4b Splits the NoThrow flags into TypeSpec and AllocSpec flag... by Abseil Team <absl-team@google.com> - c16d0b5509b36679b384147b474135e7951afccf Change the abbreviation for the breakdowns of InfinitePas... by Abseil Team <absl-team@google.com> - 8ac104351764f23d666b52dce7536a34c05abf00 Use ABSL_CONST_INIT with std::atomic variables in static ... by Matt Armstrong <marmstrong@google.com> GitOrigin-RevId: 60c1f40a5e0bc33f93392ff6827528072d749a29 Change-Id: I9d45a6ed30ed32ae57e9eff93f4205dbcd71feb2
Diffstat (limited to 'absl/types/any_exception_safety_test.cc')
-rw-r--r--absl/types/any_exception_safety_test.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/absl/types/any_exception_safety_test.cc b/absl/types/any_exception_safety_test.cc
index 7a72e72..daa82e7 100644
--- a/absl/types/any_exception_safety_test.cc
+++ b/absl/types/any_exception_safety_test.cc
@@ -20,12 +20,12 @@
#include "gtest/gtest.h"
#include "absl/base/internal/exception_safety_testing.h"
-using Thrower = absl::ThrowingValue<>;
+using Thrower = testing::ThrowingValue<>;
using NoThrowMoveThrower =
- absl::ThrowingValue<absl::NoThrow::kMoveCtor | absl::NoThrow::kMoveAssign>;
+ testing::ThrowingValue<testing::TypeSpec::kNoThrowMove>;
using ThrowerList = std::initializer_list<Thrower>;
using ThrowerVec = std::vector<Thrower>;
-using ThrowingAlloc = absl::ThrowingAllocator<Thrower>;
+using ThrowingAlloc = testing::ThrowingAllocator<Thrower>;
using ThrowingThrowerVec = std::vector<Thrower, ThrowingAlloc>;
namespace {
@@ -81,30 +81,31 @@ testing::AssertionResult AnyIsEmpty(absl::any* a) {
TEST(AnyExceptionSafety, Ctors) {
Thrower val(1);
- absl::TestThrowingCtor<absl::any>(val);
+ testing::TestThrowingCtor<absl::any>(val);
Thrower copy(val);
- absl::TestThrowingCtor<absl::any>(copy);
+ testing::TestThrowingCtor<absl::any>(copy);
- absl::TestThrowingCtor<absl::any>(absl::in_place_type_t<Thrower>(), 1);
+ testing::TestThrowingCtor<absl::any>(absl::in_place_type_t<Thrower>(), 1);
- absl::TestThrowingCtor<absl::any>(absl::in_place_type_t<ThrowerVec>(),
- ThrowerList{val});
+ testing::TestThrowingCtor<absl::any>(absl::in_place_type_t<ThrowerVec>(),
+ ThrowerList{val});
- absl::TestThrowingCtor<absl::any, absl::in_place_type_t<ThrowingThrowerVec>,
- ThrowerList, ThrowingAlloc>(
+ testing::TestThrowingCtor<absl::any,
+ absl::in_place_type_t<ThrowingThrowerVec>,
+ ThrowerList, ThrowingAlloc>(
absl::in_place_type_t<ThrowingThrowerVec>(), {val}, ThrowingAlloc());
}
TEST(AnyExceptionSafety, Assignment) {
auto original =
- absl::any(absl::in_place_type_t<Thrower>(), 1, absl::no_throw_ctor);
+ absl::any(absl::in_place_type_t<Thrower>(), 1, testing::no_throw_ctor);
auto any_is_strong = [original](absl::any* ap) {
return testing::AssertionResult(ap->has_value() &&
absl::any_cast<Thrower>(original) ==
absl::any_cast<Thrower>(*ap));
};
- auto any_strong_tester = absl::MakeExceptionSafetyTester()
+ auto any_strong_tester = testing::MakeExceptionSafetyTester()
.WithInitialValue(original)
.WithInvariants(AnyInvariants, any_is_strong);
@@ -126,7 +127,7 @@ TEST(AnyExceptionSafety, Assignment) {
return testing::AssertionResult{!ap->has_value()};
};
auto strong_empty_any_tester =
- absl::MakeExceptionSafetyTester()
+ testing::MakeExceptionSafetyTester()
.WithInitialValue(absl::any{})
.WithInvariants(AnyInvariants, empty_any_is_strong);
@@ -138,14 +139,14 @@ TEST(AnyExceptionSafety, Assignment) {
#if !defined(ABSL_HAVE_STD_ANY)
TEST(AnyExceptionSafety, Emplace) {
auto initial_val =
- absl::any{absl::in_place_type_t<Thrower>(), 1, absl::no_throw_ctor};
- auto one_tester = absl::MakeExceptionSafetyTester()
+ absl::any{absl::in_place_type_t<Thrower>(), 1, testing::no_throw_ctor};
+ auto one_tester = testing::MakeExceptionSafetyTester()
.WithInitialValue(initial_val)
.WithInvariants(AnyInvariants, AnyIsEmpty);
auto emp_thrower = [](absl::any* ap) { ap->emplace<Thrower>(2); };
auto emp_throwervec = [](absl::any* ap) {
- std::initializer_list<Thrower> il{Thrower(2, absl::no_throw_ctor)};
+ std::initializer_list<Thrower> il{Thrower(2, testing::no_throw_ctor)};
ap->emplace<ThrowerVec>(il);
};
auto emp_movethrower = [](absl::any* ap) {