diff --git a/src/tests/countdown.t b/src/tests/countdown.t new file mode 100755 index 000000000..16b77d79d --- /dev/null +++ b/src/tests/countdown.t @@ -0,0 +1,96 @@ +#! /usr/bin/perl +################################################################################ +## task - a command line task list manager. +## +## Copyright 2006 - 2010, Paul Beckingham. +## All rights reserved. +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, write to the +## +## Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, +## Boston, MA +## 02110-1301 +## USA +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 12; + +# Create the rc file. +if (open my $fh, '>', 'countdown.rc') +{ + print $fh "data.location=.\n"; + print $fh "report.countdown.description=Countdown report\n"; + print $fh "report.countdown.columns=id,countdown,description\n"; + print $fh "report.countdown.labels=ID,Countdown,Description\n"; + print $fh "report.countdown.sort=countdown-"; + + close $fh; + ok (-r 'countdown.rc', 'Created countdown.rc'); +} + +# Create a variety of pending tasks with increasingly higher due dates +# and ensure sort order. + +my @timeArray = localtime(time); +my $now = time (); + +my $nowminusone = $now - 3600; +my $nowplusone = $now + 3600; +my $nowplusseven = $now + 7 * 3600; +my $nowplustwelve = $now + 12 * 3600; +my $nowplusthirtysix = $now + 36 * 3600; +my $nowplusseventytwo = $now + 72 * 3600; + +if (open my $fh, '>', 'pending.data') +{ + print $fh <