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

Update CronScheduleTest.cpp #38

Merged
merged 3 commits into from
Aug 2, 2024
Merged

Conversation

nkinar
Copy link
Contributor

@nkinar nkinar commented Jul 31, 2024

Added test for update to Readme: event occurring every minute.

@nkinar nkinar mentioned this pull request Jul 31, 2024
@PerMalmberg
Copy link
Owner

PerMalmberg commented Jul 31, 2024

The test fails, you're missing the initial timestamp.

@nkinar
Copy link
Contributor Author

nkinar commented Jul 31, 2024

@PerMalmberg can you elaborate on what is the initial timestamp that is missing? Thank you.

Is this

DT(2018_y / 03 / 1, hours{ 12 }, minutes{ 0 }, seconds{ 0 })

Maybe some documentation could be added to the CronScheduleTest.cpp file to indicate how to write an initial timestamp.

@PerMalmberg
Copy link
Owner

@nkinar The first test value needs to be the first calculated schedule, calculated based on the from argument (inclusive). In this case, as we're looking at the smallest unit, it has to be the same as the from point itself.

The test also shows what it calculates and expects: https://github.com/PerMalmberg/libcron/actions/runs/10177199677/job/28148138238?pr=38#step:4:8

Edited code that was causing test to fail.
@PerMalmberg
Copy link
Owner

Test passing, LGTM!

@nkinar
Copy link
Contributor Author

nkinar commented Aug 2, 2024

Thanks @PerMalmberg that makes more sense now. The from argument needs to be a time before the cron event occurs. The later comparisons are made at the time when the cron event should occur. All checks have now passed, and I've run the tests locally as well on my machine.

@PerMalmberg PerMalmberg merged commit aa3d436 into PerMalmberg:master Aug 2, 2024
1 check passed
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.

2 participants