Compare commits

...

2 Commits

Author SHA1 Message Date
Dr. Nicholas J. Kinar
aa3d4368d5
Update CronScheduleTest.cpp (#38)
* Update CronScheduleTest.cpp

* Update CronScheduleTest.cpp

Edited code that was causing test to fail.

---------

Co-authored-by: Per Malmberg <PerMalmberg@users.noreply.github.com>
2024-08-02 18:49:19 +02:00
Dr. Nicholas J. Kinar
7c7d290792
Update README.md (#37)
In the Examples section, added an expression for every minute and a note providing a comment on the expression formatting.
2024-07-31 10:57:29 +02:00
2 changed files with 15 additions and 1 deletions

View File

@ -188,11 +188,16 @@ the '?'-character to ensure that it is not possible to specify a statement which
|Expression | Meaning
| --- | --- |
| * * * * * ? | Every second
| 0 * * * * ? | Every minute
| 0 0 12 * * MON-FRI | Every Weekday at noon
| 0 0 12 1/2 * ? | Every 2 days, starting on the 1st at noon
| 0 0 */12 ? * * | Every twelve hours
| @hourly | Every hour
Note that the expression formatting has a part for seconds and the day of week.
For the day of week part, a question mark ? is utilized. This format
may not be parsed by all online crontab calculators or expression generators.
## Convenience scheduling
These special time specification tokens which replace the 5 initial time and date fields, and are prefixed with the '@' character, are supported:

View File

@ -184,6 +184,15 @@ SCENARIO("Examples from README.md")
DT(2018_y / 03 / 1, hours{12}, minutes{13}, seconds{48})
}));
REQUIRE(test("0 * * * * ?", DT(2018_y / 03 / 1, hours{ 12 }, minutes{ 0 }, seconds{ 10 }),
{
DT(2018_y / 03 / 1, hours{12}, minutes{1}, seconds{0}),
DT(2018_y / 03 / 1, hours{12}, minutes{2}, seconds{0}),
DT(2018_y / 03 / 1, hours{12}, minutes{3}, seconds{0}),
DT(2018_y / 03 / 1, hours{12}, minutes{4}, seconds{0})
}));
REQUIRE(test("0 0 12 * * MON-FRI", DT(2018_y / 03 / 10, hours{12}, minutes{13}, seconds{45}),
{
DT(2018_y / 03 / 12, hours{12}),
@ -212,4 +221,4 @@ SCENARIO("Examples from README.md")
SCENARIO("Unable to calculate time point")
{
REQUIRE_FALSE(test( "0 0 * 31 FEB *", DT(2021_y / 1 / 1), DT(2022_y / 1 / 1)));
}
}