-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_cases.rb
25 lines (24 loc) · 1.93 KB
/
test_cases.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
assert_equal cron_to_words('* * * * *'), 'every minute, every hour, every day'
assert_equal cron_to_words('*/15 * * * *'), 'every 15 minutes, every hour, every day'
assert_equal cron_to_words('*/15,45 * * * *'), 'every 15,45 minutes, every hour, every day'
assert_equal cron_to_words('0 0 * * *'), 'at 12:00am, every day'
assert_equal cron_to_words('15 6 * * *'), 'at 06:15am, every day'
assert_equal cron_to_words('30 3,6,9 * * *'), 'at 03:30am, 06:30am and 09:30am, every day'
assert_equal cron_to_words('0 13 * * Fri'), 'at 01:00pm, only on friday'
assert_equal cron_to_words('1,2,3 * * * *'), 'at 1, 2, and 3 minutes past the hour, every hour, every day'
assert_equal cron_to_words('0 0 * * 1-3'), 'at 12:00am, monday through wednesday'
assert_equal cron_to_words('0 24 * * Mon-Fri'), 'at 12:00pm, monday through friday'
assert_equal cron_to_words('56 1 * * 2-3,6-7'), 'at 01:56am, tuesday through wednesday and saturday through sunday'
assert_equal cron_to_words('13 6 * 1-3,6 mon'), 'at 06:13am, every monday, january through march and june'
assert_equal cron_to_words('* * 12 * *'), 'every minute, every hour, on day 12 of the month'
assert_equal cron_to_words('0 0 15 jun *'), 'at 12:00am, on day 15 of the month, only in june'
assert_equal cron_to_words('1 2 3 4 5'), 'at 02:01am, on day 3 of the month, only on friday, only in april'
assert_equal cron_to_words('1 2 3 4 5 6'), 'at 03:02:01am, on day 4 of the month, only on Saturday, only in may'
assert_equal cron_to_words('1 2 3 4 5 6 2024-2030'), 'at 03:02:01am, on day 4 of the month, only on Saturday, only in may, 2024 through 2030'
assert_equal cron_to_words('1 2 3 4 5 6 7 8'), 'invalid cron'
assert_equal cron_to_words('* * * * * * * *'), 'invalid cron'
assert_equal cron_to_words('* * * *'), 'invalid cron'
assert_equal cron_to_words('-1 * * * *'), 'invalid cron'
assert_equal cron_to_words('61 * * * *'), 'invalid cron'
assert_equal cron_to_words('0 * * * ? *'), 'invalid cron'
# add more if you want ...