Skip to content

Commit

Permalink
Merge pull request #422 from google/fix-optional-macos
Browse files Browse the repository at this point in the history
Avoid using optional.value() in cpp
  • Loading branch information
javiber committed Apr 16, 2024
2 parents 52184fa + 09a77d7 commit dc8e17f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions temporian/implementation/numpy_cc/operators/tick_calendar.cc
Expand Up @@ -39,7 +39,7 @@ std::vector<double> find_ticks(
const std::optional<std::time_t> end_t =
end_timestamp.has_value()
? std::optional<std::time_t>{static_cast<std::time_t>(
std::floor(end_timestamp.value()))}
std::floor(*end_timestamp))}
: std::nullopt;

// Start time
Expand Down Expand Up @@ -86,7 +86,7 @@ std::vector<double> 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;
}
Expand Down
Expand Up @@ -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,
Expand Down

0 comments on commit dc8e17f

Please sign in to comment.