summaryrefslogtreecommitdiff
path: root/absl/time
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-03-03 20:39:13 -0800
committerGravatar dinord <dino.radakovich@gmail.com>2022-03-04 10:22:54 -0500
commit04bde89e5cb33bf4a714a5496fac715481fc4831 (patch)
tree835273aa4de1d08c88928df407e7305049bb4d91 /absl/time
parentec33f404bb16564a9aea3044cd8504d6885165b0 (diff)
Export of internal Abseil changes
-- 3358c3cca1c3770fb5d50e743ac56547af813561 by Dino Radakovic <dinor@google.com>: Add ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT guard to TEST(Duration, Multiplication) PiperOrigin-RevId: 432350431 Change-Id: I28a26a12665e3e9a9ebdf50d0249eafa8336c585 -- af631611681a298c305578d5049757ec8ced03ab by Dino Radakovic <dinor@google.com>: Add config macro for optional skipping absl/time:time_test cases that fail on MSVC optimized builds PiperOrigin-RevId: 432252533 Change-Id: Ic3879ccdd8e30945a1a2e980e9ae246bcef8d7bd GitOrigin-RevId: 3358c3cca1c3770fb5d50e743ac56547af813561
Diffstat (limited to 'absl/time')
-rw-r--r--absl/time/duration_test.cc35
-rw-r--r--absl/time/time_test.cc10
2 files changed, 45 insertions, 0 deletions
diff --git a/absl/time/duration_test.cc b/absl/time/duration_test.cc
index b7209e1c..b7abf4ba 100644
--- a/absl/time/duration_test.cc
+++ b/absl/time/duration_test.cc
@@ -349,6 +349,11 @@ TEST(Duration, ToChrono) {
}
TEST(Duration, FactoryOverloads) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
enum E { kOne = 1 };
#define TEST_FACTORY_OVERLOADS(NAME) \
EXPECT_EQ(1, NAME(kOne) / NAME(kOne)); \
@@ -879,6 +884,11 @@ TEST(Duration, RelationalOperators) {
}
TEST(Duration, Addition) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
#define TEST_ADD_OPS(UNIT) \
do { \
EXPECT_EQ(UNIT(2), UNIT(1) + UNIT(1)); \
@@ -972,6 +982,11 @@ TEST(Duration, Negation) {
}
TEST(Duration, AbsoluteValue) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
EXPECT_EQ(absl::ZeroDuration(), AbsDuration(absl::ZeroDuration()));
EXPECT_EQ(absl::Seconds(1), AbsDuration(absl::Seconds(1)));
EXPECT_EQ(absl::Seconds(1), AbsDuration(absl::Seconds(-1)));
@@ -989,6 +1004,11 @@ TEST(Duration, AbsoluteValue) {
}
TEST(Duration, Multiplication) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
#define TEST_MUL_OPS(UNIT) \
do { \
EXPECT_EQ(UNIT(5), UNIT(2) * 2.5); \
@@ -1241,6 +1261,11 @@ TEST(Duration, RoundTripUnits) {
}
TEST(Duration, TruncConversions) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
// Tests ToTimespec()/DurationFromTimespec()
const struct {
absl::Duration d;
@@ -1537,6 +1562,11 @@ TEST(Duration, ConversionSaturation) {
}
TEST(Duration, FormatDuration) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
// Example from Go's docs.
EXPECT_EQ("72h3m0.5s",
absl::FormatDuration(absl::Hours(72) + absl::Minutes(3) +
@@ -1671,6 +1701,11 @@ TEST(Duration, FormatDuration) {
}
TEST(Duration, ParseDuration) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
absl::Duration d;
// No specified unit. Should only work for zero and infinity.
diff --git a/absl/time/time_test.cc b/absl/time/time_test.cc
index cde9423f..d235e9ad 100644
--- a/absl/time/time_test.cc
+++ b/absl/time/time_test.cc
@@ -377,6 +377,11 @@ TEST(Time, FloorConversion) {
}
TEST(Time, RoundtripConversion) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
#define TEST_CONVERSION_ROUND_TRIP(SOURCE, FROM, TO, MATCHER) \
EXPECT_THAT(TO(FROM(SOURCE)), MATCHER(SOURCE))
@@ -558,6 +563,11 @@ TEST(Time, FromChrono) {
}
TEST(Time, ToChronoTime) {
+#if defined(ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT) && \
+ ABSL_SKIP_TIME_TESTS_BROKEN_ON_MSVC_OPT
+ GTEST_SKIP();
+#endif
+
EXPECT_EQ(std::chrono::system_clock::from_time_t(-1),
absl::ToChronoTime(absl::FromTimeT(-1)));
EXPECT_EQ(std::chrono::system_clock::from_time_t(0),