From 09a77d7250afb5085a5046e44ee325542d5b8674 Mon Sep 17 00:00:00 2001 From: javiber Date: Fri, 12 Apr 2024 14:36:10 -0300 Subject: [PATCH] Avoid using optional .value in cpp This method fails on older macos so we need to replace it by the * operator --- temporian/implementation/numpy_cc/operators/tick_calendar.cc | 4 ++-- .../numpy_cc/operators/tick_calendar_utils_test.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/temporian/implementation/numpy_cc/operators/tick_calendar.cc b/temporian/implementation/numpy_cc/operators/tick_calendar.cc index 893bce71d..bfcbf87d6 100644 --- a/temporian/implementation/numpy_cc/operators/tick_calendar.cc +++ b/temporian/implementation/numpy_cc/operators/tick_calendar.cc @@ -39,7 +39,7 @@ std::vector find_ticks( const std::optional end_t = end_timestamp.has_value() ? std::optional{static_cast( - std::floor(end_timestamp.value()))} + std::floor(*end_timestamp))} : std::nullopt; // Start time @@ -86,7 +86,7 @@ std::vector find_ticks( // Finish conditions if (end_t.has_value() && - cur_time.seconds_since_epoch > end_t.value()) { + cur_time.seconds_since_epoch > *end_t) { keep_looking = false; break; } diff --git a/temporian/implementation/numpy_cc/operators/tick_calendar_utils_test.cc b/temporian/implementation/numpy_cc/operators/tick_calendar_utils_test.cc index c4ed52d2d..7fae0fb02 100644 --- a/temporian/implementation/numpy_cc/operators/tick_calendar_utils_test.cc +++ b/temporian/implementation/numpy_cc/operators/tick_calendar_utils_test.cc @@ -30,9 +30,9 @@ TEST_P(UTCMkTimeTest, MatchExpected) { UTCMkTime(test_case.year, test_case.month, test_case.day, test_case.hour, test_case.minute, test_case.second); EXPECT_TRUE(result.has_value()); - EXPECT_EQ(result.value().seconds_since_epoch, + EXPECT_EQ((*result).seconds_since_epoch, test_case.expected_seconds_since_epoch); - EXPECT_EQ(result.value().wday, test_case.expected_wday); + EXPECT_EQ((*result).wday, test_case.expected_wday); } INSTANTIATE_TEST_SUITE_P(UTCMkTimeTestBase, UTCMkTimeTest,