Commit 96136783 by Abseil Team Committed by vslashg

- 60c1f40a5e0bc33f93392ff6827528072d749a29 Move ExceptionSafetyTester from the…

  - 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
parent 28f5b890
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "absl/meta/type_traits.h" #include "absl/meta/type_traits.h"
namespace absl { namespace testing {
exceptions_internal::NoThrowTag no_throw_ctor; exceptions_internal::NoThrowTag no_throw_ctor;
exceptions_internal::StrongGuaranteeTagType strong_guarantee; exceptions_internal::StrongGuaranteeTagType strong_guarantee;
...@@ -37,5 +37,7 @@ testing::AssertionResult FailureMessage(const TestException& e, ...@@ -37,5 +37,7 @@ testing::AssertionResult FailureMessage(const TestException& e,
int countdown) noexcept { int countdown) noexcept {
return testing::AssertionFailure() << "Exception thrown from " << e.what(); return testing::AssertionFailure() << "Exception thrown from " << e.what();
} }
} // namespace exceptions_internal } // namespace exceptions_internal
} // namespace absl
} // namespace testing
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>
#include "absl/base/attributes.h"
#include "absl/debugging/internal/address_is_readable.h" #include "absl/debugging/internal/address_is_readable.h"
#include "absl/debugging/internal/vdso_support.h" // a no-op on non-elf or non-glibc systems #include "absl/debugging/internal/vdso_support.h" // a no-op on non-elf or non-glibc systems
#include "absl/debugging/stacktrace.h" #include "absl/debugging/stacktrace.h"
...@@ -24,7 +25,7 @@ static const uintptr_t kUnknownFrameSize = 0; ...@@ -24,7 +25,7 @@ static const uintptr_t kUnknownFrameSize = 0;
// Returns the address of the VDSO __kernel_rt_sigreturn function, if present. // Returns the address of the VDSO __kernel_rt_sigreturn function, if present.
static const unsigned char* GetKernelRtSigreturnAddress() { static const unsigned char* GetKernelRtSigreturnAddress() {
constexpr uintptr_t kImpossibleAddress = 1; constexpr uintptr_t kImpossibleAddress = 1;
static std::atomic<uintptr_t> memoized{kImpossibleAddress}; ABSL_CONST_INIT static std::atomic<uintptr_t> memoized{kImpossibleAddress};
uintptr_t address = memoized.load(std::memory_order_relaxed); uintptr_t address = memoized.load(std::memory_order_relaxed);
if (address != kImpossibleAddress) { if (address != kImpossibleAddress) {
return reinterpret_cast<const unsigned char*>(address); return reinterpret_cast<const unsigned char*>(address);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <atomic> #include <atomic>
#include "absl/base/attributes.h"
#include "absl/debugging/internal/elf_mem_image.h" #include "absl/debugging/internal/elf_mem_image.h"
#ifdef ABSL_HAVE_ELF_MEM_IMAGE #ifdef ABSL_HAVE_ELF_MEM_IMAGE
...@@ -132,7 +133,7 @@ class VDSOSupport { ...@@ -132,7 +133,7 @@ class VDSOSupport {
// This function pointer may point to InitAndGetCPU, // This function pointer may point to InitAndGetCPU,
// GetCPUViaSyscall, or __vdso_getcpu at different stages of initialization. // GetCPUViaSyscall, or __vdso_getcpu at different stages of initialization.
static std::atomic<GetCpuFn> getcpu_fn_; ABSL_CONST_INIT static std::atomic<GetCpuFn> getcpu_fn_;
friend int GetCPU(void); // Needs access to getcpu_fn_. friend int GetCPU(void); // Needs access to getcpu_fn_.
......
...@@ -51,6 +51,7 @@ cc_library( ...@@ -51,6 +51,7 @@ cc_library(
cc_library( cc_library(
name = "test_util", name = "test_util",
testonly = 1,
srcs = [ srcs = [
"internal/test_util.cc", "internal/test_util.cc",
"internal/zoneinfo.inc", "internal/zoneinfo.inc",
...@@ -64,6 +65,7 @@ cc_library( ...@@ -64,6 +65,7 @@ cc_library(
":time", ":time",
"//absl/base", "//absl/base",
"//absl/time/internal/cctz:time_zone", "//absl/time/internal/cctz:time_zone",
"@com_google_googletest//:gtest",
], ],
) )
......
...@@ -155,8 +155,7 @@ TEST(ParseTime, Basics) { ...@@ -155,8 +155,7 @@ TEST(ParseTime, Basics) {
"2013-06-28 19:08:09 -0800", &t, &err)) "2013-06-28 19:08:09 -0800", &t, &err))
<< err; << err;
absl::Time::Breakdown bd = t.In(absl::FixedTimeZone(-8 * 60 * 60)); absl::Time::Breakdown bd = t.In(absl::FixedTimeZone(-8 * 60 * 60));
ABSL_INTERNAL_EXPECT_TIME(bd, 2013, 6, 28, 19, 8, 9, -8 * 60 * 60, false, ABSL_INTERNAL_EXPECT_TIME(bd, 2013, 6, 28, 19, 8, 9, -8 * 60 * 60, false);
"UTC-8");
EXPECT_EQ(absl::ZeroDuration(), bd.subsecond); EXPECT_EQ(absl::ZeroDuration(), bd.subsecond);
} }
...@@ -179,8 +178,7 @@ TEST(ParseTime, WithTimeZone) { ...@@ -179,8 +178,7 @@ TEST(ParseTime, WithTimeZone) {
absl::ParseTime("%Y-%m-%d %H:%M:%S", "2013-06-28 19:08:09", tz, &t, &e)) absl::ParseTime("%Y-%m-%d %H:%M:%S", "2013-06-28 19:08:09", tz, &t, &e))
<< e; << e;
absl::Time::Breakdown bd = t.In(tz); absl::Time::Breakdown bd = t.In(tz);
ABSL_INTERNAL_EXPECT_TIME(bd, 2013, 6, 28, 19, 8, 9, -7 * 60 * 60, true, ABSL_INTERNAL_EXPECT_TIME(bd, 2013, 6, 28, 19, 8, 9, -7 * 60 * 60, true);
"PDT");
EXPECT_EQ(absl::ZeroDuration(), bd.subsecond); EXPECT_EQ(absl::ZeroDuration(), bd.subsecond);
// But the timezone is ignored when a UTC offset is present. // But the timezone is ignored when a UTC offset is present.
...@@ -188,8 +186,7 @@ TEST(ParseTime, WithTimeZone) { ...@@ -188,8 +186,7 @@ TEST(ParseTime, WithTimeZone) {
"2013-06-28 19:08:09 +0800", tz, &t, &e)) "2013-06-28 19:08:09 +0800", tz, &t, &e))
<< e; << e;
bd = t.In(absl::FixedTimeZone(8 * 60 * 60)); bd = t.In(absl::FixedTimeZone(8 * 60 * 60));
ABSL_INTERNAL_EXPECT_TIME(bd, 2013, 6, 28, 19, 8, 9, 8 * 60 * 60, false, ABSL_INTERNAL_EXPECT_TIME(bd, 2013, 6, 28, 19, 8, 9, 8 * 60 * 60, false);
"UTC+8");
EXPECT_EQ(absl::ZeroDuration(), bd.subsecond); EXPECT_EQ(absl::ZeroDuration(), bd.subsecond);
} }
......
...@@ -26,6 +26,13 @@ namespace cctz = absl::time_internal::cctz; ...@@ -26,6 +26,13 @@ namespace cctz = absl::time_internal::cctz;
namespace absl { namespace absl {
namespace time_internal { namespace time_internal {
// TODO(bww): Reinstate when the FixedTimeZone() abbreviations are updated.
#if 1 || GTEST_USES_SIMPLE_RE
extern const char kZoneAbbrRE[] = ".*"; // just punt
#else
extern const char kZoneAbbrRE[] = "[A-Za-z]{3,4}|[-+][0-9]{2}([0-9]{2})?";
#endif
TimeZone LoadTimeZone(const std::string& name) { TimeZone LoadTimeZone(const std::string& name) {
TimeZone tz; TimeZone tz;
ABSL_RAW_CHECK(LoadTimeZone(name, &tz), name.c_str()); ABSL_RAW_CHECK(LoadTimeZone(name, &tz), name.c_str());
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <string> #include <string>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/time/time.h" #include "absl/time/time.h"
// This helper is a macro so that failed expectations show up with the // This helper is a macro so that failed expectations show up with the
...@@ -24,22 +26,26 @@ ...@@ -24,22 +26,26 @@
// //
// This is for internal testing of the Base Time library itself. This is not // This is for internal testing of the Base Time library itself. This is not
// part of a public API. // part of a public API.
#define ABSL_INTERNAL_EXPECT_TIME(bd, y, m, d, h, min, s, off, isdst, zone) \ #define ABSL_INTERNAL_EXPECT_TIME(bd, y, m, d, h, min, s, off, isdst) \
do { \ do { \
EXPECT_EQ(y, bd.year); \ EXPECT_EQ(y, bd.year); \
EXPECT_EQ(m, bd.month); \ EXPECT_EQ(m, bd.month); \
EXPECT_EQ(d, bd.day); \ EXPECT_EQ(d, bd.day); \
EXPECT_EQ(h, bd.hour); \ EXPECT_EQ(h, bd.hour); \
EXPECT_EQ(min, bd.minute); \ EXPECT_EQ(min, bd.minute); \
EXPECT_EQ(s, bd.second); \ EXPECT_EQ(s, bd.second); \
EXPECT_EQ(off, bd.offset); \ EXPECT_EQ(off, bd.offset); \
EXPECT_EQ(isdst, bd.is_dst); \ EXPECT_EQ(isdst, bd.is_dst); \
EXPECT_STREQ(zone, bd.zone_abbr); \ EXPECT_THAT(bd.zone_abbr, \
testing::MatchesRegex(absl::time_internal::kZoneAbbrRE)); \
} while (0) } while (0)
namespace absl { namespace absl {
namespace time_internal { namespace time_internal {
// A regular expression that matches all zone abbreviations (%Z).
extern const char kZoneAbbrRE[];
// Loads the named timezone, but dies on any failure. // Loads the named timezone, but dies on any failure.
absl::TimeZone LoadTimeZone(const std::string& name); absl::TimeZone LoadTimeZone(const std::string& name);
......
...@@ -71,7 +71,7 @@ inline absl::Time::Breakdown InfiniteFutureBreakdown() { ...@@ -71,7 +71,7 @@ inline absl::Time::Breakdown InfiniteFutureBreakdown() {
bd.yearday = 365; bd.yearday = 365;
bd.offset = 0; bd.offset = 0;
bd.is_dst = false; bd.is_dst = false;
bd.zone_abbr = "-0000"; bd.zone_abbr = "-00";
return bd; return bd;
} }
...@@ -88,7 +88,7 @@ inline Time::Breakdown InfinitePastBreakdown() { ...@@ -88,7 +88,7 @@ inline Time::Breakdown InfinitePastBreakdown() {
bd.yearday = 1; bd.yearday = 1;
bd.offset = 0; bd.offset = 0;
bd.is_dst = false; bd.is_dst = false;
bd.zone_abbr = "-0000"; bd.zone_abbr = "-00";
return bd; return bd;
} }
......
...@@ -85,7 +85,7 @@ TEST(Time, ValueSemantics) { ...@@ -85,7 +85,7 @@ TEST(Time, ValueSemantics) {
TEST(Time, UnixEpoch) { TEST(Time, UnixEpoch) {
absl::Time::Breakdown bd = absl::UnixEpoch().In(absl::UTCTimeZone()); absl::Time::Breakdown bd = absl::UnixEpoch().In(absl::UTCTimeZone());
ABSL_INTERNAL_EXPECT_TIME(bd, 1970, 1, 1, 0, 0, 0, 0, false, "UTC"); ABSL_INTERNAL_EXPECT_TIME(bd, 1970, 1, 1, 0, 0, 0, 0, false);
EXPECT_EQ(absl::ZeroDuration(), bd.subsecond); EXPECT_EQ(absl::ZeroDuration(), bd.subsecond);
EXPECT_EQ(4, bd.weekday); // Thursday EXPECT_EQ(4, bd.weekday); // Thursday
} }
...@@ -96,14 +96,14 @@ TEST(Time, Breakdown) { ...@@ -96,14 +96,14 @@ TEST(Time, Breakdown) {
// The Unix epoch as seen in NYC. // The Unix epoch as seen in NYC.
absl::Time::Breakdown bd = t.In(tz); absl::Time::Breakdown bd = t.In(tz);
ABSL_INTERNAL_EXPECT_TIME(bd, 1969, 12, 31, 19, 0, 0, -18000, false, "EST"); ABSL_INTERNAL_EXPECT_TIME(bd, 1969, 12, 31, 19, 0, 0, -18000, false);
EXPECT_EQ(absl::ZeroDuration(), bd.subsecond); EXPECT_EQ(absl::ZeroDuration(), bd.subsecond);
EXPECT_EQ(3, bd.weekday); // Wednesday EXPECT_EQ(3, bd.weekday); // Wednesday
// Just before the epoch. // Just before the epoch.
t -= absl::Nanoseconds(1); t -= absl::Nanoseconds(1);
bd = t.In(tz); bd = t.In(tz);
ABSL_INTERNAL_EXPECT_TIME(bd, 1969, 12, 31, 18, 59, 59, -18000, false, "EST"); ABSL_INTERNAL_EXPECT_TIME(bd, 1969, 12, 31, 18, 59, 59, -18000, false);
EXPECT_EQ(absl::Nanoseconds(999999999), bd.subsecond); EXPECT_EQ(absl::Nanoseconds(999999999), bd.subsecond);
EXPECT_EQ(3, bd.weekday); // Wednesday EXPECT_EQ(3, bd.weekday); // Wednesday
...@@ -112,7 +112,7 @@ TEST(Time, Breakdown) { ...@@ -112,7 +112,7 @@ TEST(Time, Breakdown) {
t += absl::Hours(18) + absl::Minutes(30) + absl::Seconds(15) + t += absl::Hours(18) + absl::Minutes(30) + absl::Seconds(15) +
absl::Nanoseconds(9); absl::Nanoseconds(9);
bd = t.In(tz); bd = t.In(tz);
ABSL_INTERNAL_EXPECT_TIME(bd, 1977, 6, 28, 14, 30, 15, -14400, true, "EDT"); ABSL_INTERNAL_EXPECT_TIME(bd, 1977, 6, 28, 14, 30, 15, -14400, true);
EXPECT_EQ(8, bd.subsecond / absl::Nanoseconds(1)); EXPECT_EQ(8, bd.subsecond / absl::Nanoseconds(1));
EXPECT_EQ(2, bd.weekday); // Tuesday EXPECT_EQ(2, bd.weekday); // Tuesday
} }
...@@ -983,16 +983,18 @@ TEST(Time, ConversionSaturation) { ...@@ -983,16 +983,18 @@ TEST(Time, ConversionSaturation) {
// Checks how Time::In() saturates on infinities. // Checks how Time::In() saturates on infinities.
absl::Time::Breakdown bd = absl::InfiniteFuture().In(utc); absl::Time::Breakdown bd = absl::InfiniteFuture().In(utc);
ABSL_INTERNAL_EXPECT_TIME(bd, std::numeric_limits<int64_t>::max(), 12, 31, 23, ABSL_INTERNAL_EXPECT_TIME(bd, std::numeric_limits<int64_t>::max(), 12, 31, 23,
59, 59, 0, false, "-0000"); 59, 59, 0, false);
EXPECT_EQ(absl::InfiniteDuration(), bd.subsecond); EXPECT_EQ(absl::InfiniteDuration(), bd.subsecond);
EXPECT_EQ(4, bd.weekday); // Thursday EXPECT_EQ(4, bd.weekday); // Thursday
EXPECT_EQ(365, bd.yearday); EXPECT_EQ(365, bd.yearday);
EXPECT_STREQ("-00", bd.zone_abbr); // artifact of absl::Time::In()
bd = absl::InfinitePast().In(utc); bd = absl::InfinitePast().In(utc);
ABSL_INTERNAL_EXPECT_TIME(bd, std::numeric_limits<int64_t>::min(), 1, 1, 0, 0, ABSL_INTERNAL_EXPECT_TIME(bd, std::numeric_limits<int64_t>::min(), 1, 1, 0, 0,
0, 0, false, "-0000"); 0, 0, false);
EXPECT_EQ(-absl::InfiniteDuration(), bd.subsecond); EXPECT_EQ(-absl::InfiniteDuration(), bd.subsecond);
EXPECT_EQ(7, bd.weekday); // Sunday EXPECT_EQ(7, bd.weekday); // Sunday
EXPECT_EQ(1, bd.yearday); EXPECT_EQ(1, bd.yearday);
EXPECT_STREQ("-00", bd.zone_abbr); // artifact of absl::Time::In()
// Approach the maximal Time value from below. // Approach the maximal Time value from below.
t = absl::FromDateTime(292277026596, 12, 4, 15, 30, 6, utc); t = absl::FromDateTime(292277026596, 12, 4, 15, 30, 6, utc);
...@@ -1054,13 +1056,11 @@ TEST(Time, ExtendedConversionSaturation) { ...@@ -1054,13 +1056,11 @@ TEST(Time, ExtendedConversionSaturation) {
// The maximal time converted in each zone. // The maximal time converted in each zone.
bd = max.In(syd); bd = max.In(syd);
ABSL_INTERNAL_EXPECT_TIME(bd, 292277026596, 12, 5, 2, 30, 7, 39600, true, ABSL_INTERNAL_EXPECT_TIME(bd, 292277026596, 12, 5, 2, 30, 7, 39600, true);
"AEDT");
t = absl::FromDateTime(292277026596, 12, 5, 2, 30, 7, syd); t = absl::FromDateTime(292277026596, 12, 5, 2, 30, 7, syd);
EXPECT_EQ(max, t); EXPECT_EQ(max, t);
bd = max.In(nyc); bd = max.In(nyc);
ABSL_INTERNAL_EXPECT_TIME(bd, 292277026596, 12, 4, 10, 30, 7, -18000, false, ABSL_INTERNAL_EXPECT_TIME(bd, 292277026596, 12, 4, 10, 30, 7, -18000, false);
"EST");
t = absl::FromDateTime(292277026596, 12, 4, 10, 30, 7, nyc); t = absl::FromDateTime(292277026596, 12, 4, 10, 30, 7, nyc);
EXPECT_EQ(max, t); EXPECT_EQ(max, t);
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "absl/base/internal/exception_safety_testing.h" #include "absl/base/internal/exception_safety_testing.h"
using Thrower = absl::ThrowingValue<>; using Thrower = testing::ThrowingValue<>;
using NoThrowMoveThrower = using NoThrowMoveThrower =
absl::ThrowingValue<absl::NoThrow::kMoveCtor | absl::NoThrow::kMoveAssign>; testing::ThrowingValue<testing::TypeSpec::kNoThrowMove>;
using ThrowerList = std::initializer_list<Thrower>; using ThrowerList = std::initializer_list<Thrower>;
using ThrowerVec = std::vector<Thrower>; using ThrowerVec = std::vector<Thrower>;
using ThrowingAlloc = absl::ThrowingAllocator<Thrower>; using ThrowingAlloc = testing::ThrowingAllocator<Thrower>;
using ThrowingThrowerVec = std::vector<Thrower, ThrowingAlloc>; using ThrowingThrowerVec = std::vector<Thrower, ThrowingAlloc>;
namespace { namespace {
...@@ -81,30 +81,31 @@ testing::AssertionResult AnyIsEmpty(absl::any* a) { ...@@ -81,30 +81,31 @@ testing::AssertionResult AnyIsEmpty(absl::any* a) {
TEST(AnyExceptionSafety, Ctors) { TEST(AnyExceptionSafety, Ctors) {
Thrower val(1); Thrower val(1);
absl::TestThrowingCtor<absl::any>(val); testing::TestThrowingCtor<absl::any>(val);
Thrower copy(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>(), testing::TestThrowingCtor<absl::any>(absl::in_place_type_t<ThrowerVec>(),
ThrowerList{val}); ThrowerList{val});
absl::TestThrowingCtor<absl::any, absl::in_place_type_t<ThrowingThrowerVec>, testing::TestThrowingCtor<absl::any,
ThrowerList, ThrowingAlloc>( absl::in_place_type_t<ThrowingThrowerVec>,
ThrowerList, ThrowingAlloc>(
absl::in_place_type_t<ThrowingThrowerVec>(), {val}, ThrowingAlloc()); absl::in_place_type_t<ThrowingThrowerVec>(), {val}, ThrowingAlloc());
} }
TEST(AnyExceptionSafety, Assignment) { TEST(AnyExceptionSafety, Assignment) {
auto original = 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) { auto any_is_strong = [original](absl::any* ap) {
return testing::AssertionResult(ap->has_value() && return testing::AssertionResult(ap->has_value() &&
absl::any_cast<Thrower>(original) == absl::any_cast<Thrower>(original) ==
absl::any_cast<Thrower>(*ap)); absl::any_cast<Thrower>(*ap));
}; };
auto any_strong_tester = absl::MakeExceptionSafetyTester() auto any_strong_tester = testing::MakeExceptionSafetyTester()
.WithInitialValue(original) .WithInitialValue(original)
.WithInvariants(AnyInvariants, any_is_strong); .WithInvariants(AnyInvariants, any_is_strong);
...@@ -126,7 +127,7 @@ TEST(AnyExceptionSafety, Assignment) { ...@@ -126,7 +127,7 @@ TEST(AnyExceptionSafety, Assignment) {
return testing::AssertionResult{!ap->has_value()}; return testing::AssertionResult{!ap->has_value()};
}; };
auto strong_empty_any_tester = auto strong_empty_any_tester =
absl::MakeExceptionSafetyTester() testing::MakeExceptionSafetyTester()
.WithInitialValue(absl::any{}) .WithInitialValue(absl::any{})
.WithInvariants(AnyInvariants, empty_any_is_strong); .WithInvariants(AnyInvariants, empty_any_is_strong);
...@@ -138,14 +139,14 @@ TEST(AnyExceptionSafety, Assignment) { ...@@ -138,14 +139,14 @@ TEST(AnyExceptionSafety, Assignment) {
#if !defined(ABSL_HAVE_STD_ANY) #if !defined(ABSL_HAVE_STD_ANY)
TEST(AnyExceptionSafety, Emplace) { TEST(AnyExceptionSafety, Emplace) {
auto initial_val = auto initial_val =
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 one_tester = absl::MakeExceptionSafetyTester() auto one_tester = testing::MakeExceptionSafetyTester()
.WithInitialValue(initial_val) .WithInitialValue(initial_val)
.WithInvariants(AnyInvariants, AnyIsEmpty); .WithInvariants(AnyInvariants, AnyIsEmpty);
auto emp_thrower = [](absl::any* ap) { ap->emplace<Thrower>(2); }; auto emp_thrower = [](absl::any* ap) { ap->emplace<Thrower>(2); };
auto emp_throwervec = [](absl::any* ap) { 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); ap->emplace<ThrowerVec>(il);
}; };
auto emp_movethrower = [](absl::any* ap) { auto emp_movethrower = [](absl::any* ap) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment