#1 Updated readme, added test cases for examples.

This commit is contained in:
Per Malmberg
2019-03-15 11:18:10 +01:00
parent 18dc065f00
commit 802d8e724e
3 changed files with 48 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ void test(const char* const random_schedule)
libcron::CronRandomization cr;
std::unordered_map<int, std::unordered_map<int, int>> results{};
for (int i = 0; i < 50000; ++i)
for (int i = 0; i < 5000; ++i)
{
auto res = cr.parse(random_schedule);
REQUIRE(std::get<0>(res));
@@ -76,3 +76,30 @@ SCENARIO("Randomize all the things with reverse ranges - day of week")
}
}
}
SCENARIO("Test readme examples")
{
GIVEN("0 0 R(13-20) * * ?")
{
THEN("Valid schedule generated")
{
test("0 0 R(13-20) * * ?");
}
}
GIVEN("0 0 0 ? * R(0-6)")
{
THEN("Valid schedule generated")
{
test("0 0 0 ? * R(0-6)");
}
}
GIVEN("0 R(45-15) */12 ? * *")
{
THEN("Valid schedule generated")
{
test("0 R(45-15) */12 ? * *");
}
}
}

Binary file not shown.