X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=test%2Fcalendar_event_test.pl;h=0defafa220fdc24bb0b72054a52d908db1e10f8f;hp=f16393d4b78fe66c34cc243505cb0f259bcb2f54;hb=968bcf45be81faba6dbcb3357de725a94a34d09d;hpb=3ebebd191d67f02aa63ac52df3d9f6b904285bc3 diff --git a/test/calendar_event_test.pl b/test/calendar_event_test.pl index f16393d..0defafa 100755 --- a/test/calendar_event_test.pl +++ b/test/calendar_event_test.pl @@ -106,6 +106,75 @@ my $tests = [ 'mon */15', { h => '*', m => [0, 15, 30, 45], dow => [1]}, ], + [ + '22/1:0', + { h => [22, 23], m => [0], dow => $alldays }, + [ + [0, 22*60*60], + [22*60*60, 23*60*60], + [22*60*60 + 59*60, 23*60*60] + ], + ], + [ + '*/2:*', + { h => [0,2,4,6,8,10,12,14,16,18,20,22], m => '*', dow => $alldays }, + [ + [0, 60], + [60*60, 2*60*60], + [2*60*60, 2*60*60 + 60] + ] + ], + [ + '20..22:*/30', + { h => [20,21,22], m => [0,30], dow => $alldays }, + [ + [0, 20*60*60], + [20*60*60, 20*60*60 + 30*60], + [22*60*60 + 30*60, 44*60*60] + ] + ], + [ + '61', + { error => "value '61' out of range" }, + ], + [ + '*/61', + { error => "repetition '61' out of range" }, + ], + [ + '0..80', + { error => "range end '80' out of range" }, + ], + [ + ' mon 0 0 0', + { error => "unable to parse calendar event - unused parts" }, + ], + [ + '', + { error => "unable to parse calendar event - event is empty" }, + ], + [ + ' mon 0 0', + { error => "unable to parse calendar event - unused parts" }, + ], + [ + '0,1,3..5', + { h => '*', m => [0,1,3,4,5], dow => $alldays }, + [ + [0, 60], + [60, 3*60], + [5*60, 60*60] + ] + ], + [ + '2,4:0,1,3..5', + { h => [2,4], m => [0,1,3,4,5], dow => $alldays }, + [ + [0, 2*60*60], + [2*60*60 + 60, 2*60*60 + 3*60], + [2*60*60 + 5*60, 4*60*60] + ] + ], ]; foreach my $test (@$tests) {