Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECB: updated hard-coded known dates; simplified/improved implementation; completed test coverage #1865

Merged
merged 21 commits into from
Dec 28, 2023

Conversation

PaulXiCao
Copy link
Contributor

The known maintenance dates were updated for 2018..2024.

The implementation of ECB functions were simplified (e.g. large switch blocks replaced) and optimized for memory allocations (e.g. temporary strings were replaced by string_views).

The test coverage is also completed for ECB functions.

@CLAassistant
Copy link

CLAassistant commented Dec 21, 2023

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

coveralls commented Dec 21, 2023

Coverage Status

coverage: 72.305%. first build
when pulling 7c5fb92 on PaulXiCao:ecbTests
into 42c3a24 on lballabio:master.

ql/time/ecb.cpp Outdated
Comment on lines 154 to 160
char upperMonthCode[3];
to_upper_copy(upperMonthCode, boost::string_view(ecbCode.data(), 3));
const auto it = std::find(MONTHS.begin(), MONTHS.end(), boost::string_view(upperMonthCode, 3));
QL_ASSERT(it != MONTHS.end() ,"not an ECB month (and it should have been). code: " + ecbCode);

// QuantLib::Month is 1-based!
const Month m = static_cast<QuantLib::Month>(std::distance(MONTHS.begin(), it) + 1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, this is shorter than the switch but not simpler.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a static std::map?

@lballabio lballabio added this to the Release 1.33 milestone Dec 28, 2023
@lballabio lballabio merged commit 9f29f97 into lballabio:master Dec 28, 2023
51 checks passed
@PaulXiCao PaulXiCao deleted the ecbTests branch December 30, 2023 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants