mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Urgency
- Corrected unit tests for urgency. - Modified default 'blocked' coefficient to be negative, to compensate for the bug fix for #707 that inverted the test.
This commit is contained in:
parent
19582dd139
commit
f1525df48a
2 changed files with 89 additions and 89 deletions
176
test/urgency.t
176
test/urgency.t
|
@ -61,37 +61,37 @@ qx{../src/task rc:urgency.rc add 1a pri:H}; # 2
|
|||
qx{../src/task rc:urgency.rc add 1b pri:M}; # 3
|
||||
qx{../src/task rc:urgency.rc add 1c pri:L}; # 4
|
||||
|
||||
# priority: 10 (pending) + 10 (unblocked)
|
||||
# priority: 10 (pending)
|
||||
my $output = qx{../src/task rc:urgency.rc 1 _urgency};
|
||||
like ($output, qr/urgency 20$/ms, 'Control = 20');
|
||||
like ($output, qr/urgency 10$/ms, 'Control = 10');
|
||||
|
||||
# priority: 10 (pri:H) + 10 (pending) + 10 (unblocked)
|
||||
# priority: 10 (pri:H) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 2 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, 'pri:H = 30');
|
||||
like ($output, qr/urgency 20$/ms, 'pri:H = 20');
|
||||
|
||||
# priority: 6.5 (pri:M) + 10 (pending) + 10 (unblocked)
|
||||
# priority: 6.5 (pri:M) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 3 _urgency};
|
||||
like ($output, qr/urgency 26\.5$/ms, 'pri:M = 26.5');
|
||||
like ($output, qr/urgency 16\.5$/ms, 'pri:M = 16.5');
|
||||
|
||||
# priority: 3 (pri:L) + 10 (pending) + 10 (unblocked)
|
||||
# priority: 3 (pri:L) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 4 _urgency};
|
||||
like ($output, qr/urgency 23$/ms, 'pri:L = 23');
|
||||
like ($output, qr/urgency 13$/ms, 'pri:L = 13');
|
||||
|
||||
# project: 10 (project) + 10 (pending) + 10 (unblocked)
|
||||
# project: 10 (project) + 10 (pending)
|
||||
qx{../src/task rc:urgency.rc add 2a project:P}; # 5
|
||||
$output = qx{../src/task rc:urgency.rc 5 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, 'pro:P = 30');
|
||||
like ($output, qr/urgency 20$/ms, 'pro:P = 20');
|
||||
|
||||
# active: 10 (active) + 10 (pending) + 10 (unblocked)
|
||||
# active: 10 (active) + 10 (pending)
|
||||
qx{../src/task rc:urgency.rc add 3a}; # 6
|
||||
qx{../src/task rc:urgency.rc 6 start};
|
||||
$output = qx{../src/task rc:urgency.rc 6 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, 'active = 30');
|
||||
like ($output, qr/urgency 20$/ms, 'active = 20');
|
||||
|
||||
# next: 10 (+next) + 8 (1 tag) + 10 (pending) + 10 (unblocked)
|
||||
# next: 10 (+next) + 8 (1 tag) + 10 (pending)
|
||||
qx{../src/task rc:urgency.rc add 4a +next}; # 7
|
||||
$output = qx{../src/task rc:urgency.rc 7 _urgency};
|
||||
like ($output, qr/urgency 38$/ms, '+next = 38');
|
||||
like ($output, qr/urgency 28$/ms, '+next = 28');
|
||||
|
||||
# tags
|
||||
qx{../src/task rc:urgency.rc add 5a +one}; # 8
|
||||
|
@ -99,21 +99,21 @@ qx{../src/task rc:urgency.rc add 5b +one +two}; # 9
|
|||
qx{../src/task rc:urgency.rc add 5c +one +two +three}; # 10
|
||||
qx{../src/task rc:urgency.rc add 5d +one +two +three +four}; # 11
|
||||
|
||||
# tags: 8 (1 tag) + 10 (pending) + 10 (unblocked)
|
||||
# tags: 8 (1 tag) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 8 _urgency};
|
||||
like ($output, qr/urgency 28$/ms, '+one = 28');
|
||||
like ($output, qr/urgency 18$/ms, '+one = 18');
|
||||
|
||||
# tags: 9 (2 tags) + 10 (pending) + 10 (unblocked)
|
||||
# tags: 9 (2 tags) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 9 _urgency};
|
||||
like ($output, qr/urgency 29$/ms, '+one +two = 29');
|
||||
like ($output, qr/urgency 19$/ms, '+one +two = 19');
|
||||
|
||||
# tags: 10 (3 tags) + 10 (pending) + 10 (unblocked)
|
||||
# tags: 10 (3 tags) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 10 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, '+one +two +three = 30');
|
||||
like ($output, qr/urgency 20$/ms, '+one +two +three = 20');
|
||||
|
||||
# tags: 10 (4 tags) + 10 (pending) + 10 (unblocked)
|
||||
# tags: 10 (4 tags) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 10 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, '+one +two +three +four = 30');
|
||||
like ($output, qr/urgency 20$/ms, '+one +two +three +four = 20');
|
||||
|
||||
# annotations
|
||||
qx{../src/task rc:urgency.rc add 6a}; # 12
|
||||
|
@ -138,35 +138,35 @@ qx{../src/task rc:urgency.rc 15 annotate C};
|
|||
sleep 1;
|
||||
qx{../src/task rc:urgency.rc 15 annotate D};
|
||||
|
||||
# annotations: 8 (1 annotation) + 10 (pending) + 10 (unblocked)
|
||||
# annotations: 8 (1 annotation) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 12 _urgency};
|
||||
like ($output, qr/urgency 28$/ms, '1 annotation = 28');
|
||||
like ($output, qr/urgency 18$/ms, '1 annotation = 18');
|
||||
|
||||
# annotations: 9 (2 annotations) + 10 (pending) + 10 (unblocked)
|
||||
# annotations: 9 (2 annotations) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 13 _urgency};
|
||||
like ($output, qr/urgency 29$/ms, '2 annotations = 29');
|
||||
like ($output, qr/urgency 19$/ms, '2 annotations = 19');
|
||||
|
||||
# annotations: 10 (3 annotations) + 10 (pending) + 10 (unblocked)
|
||||
# annotations: 10 (3 annotations) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 14 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, '3 annotations = 30');
|
||||
like ($output, qr/urgency 20$/ms, '3 annotations = 20');
|
||||
|
||||
# annotations: 10 (4 annotations) + 10 (pending) + 10 (unblocked)
|
||||
# annotations: 10 (4 annotations) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 15 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, '4 annotations = 30');
|
||||
like ($output, qr/urgency 20$/ms, '4 annotations = 20');
|
||||
|
||||
# waiting: 10 (unblocked)
|
||||
# waiting: 10
|
||||
qx{../src/task rc:urgency.rc add 7a wait:10s}; # 16
|
||||
$output = qx{../src/task rc:urgency.rc 16 _urgency};
|
||||
like ($output, qr/urgency 10$/ms, 'waiting = 10');
|
||||
like ($output, qr/urgency 0$/ms, 'waiting = 0');
|
||||
|
||||
# blocked: 10 (pending)
|
||||
# blocked: 10 (pending) + 10 (blocked)
|
||||
qx{../src/task rc:urgency.rc add 8a depends:1}; # 17
|
||||
$output = qx{../src/task rc:urgency.rc 17 _urgency};
|
||||
like ($output, qr/urgency 10$/ms, 'blocked = 10');
|
||||
like ($output, qr/urgency 20$/ms, 'blocked = 20');
|
||||
|
||||
# blocking: 10 (blocking) + 10 (pending) + 10 (unblocked)
|
||||
# blocking: 10 (blocking) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 1 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, 'blocking = 30');
|
||||
like ($output, qr/urgency 20$/ms, 'blocking = 20');
|
||||
|
||||
# due
|
||||
#
|
||||
|
@ -201,111 +201,111 @@ qx{../src/task rc:urgency.rc add 9v due:313h}; # 39
|
|||
qx{../src/task rc:urgency.rc add 9w due:337h}; # 40
|
||||
qx{../src/task rc:urgency.rc add 9x due:361h}; # 41
|
||||
|
||||
# due: 10 (due:-10d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 10 (due:-10d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 18 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, 'due:-10d = 30');
|
||||
like ($output, qr/urgency 20$/ms, 'due:-10d = 20');
|
||||
|
||||
# due: 10 (due:-7d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 10 (due:-7d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 19 _urgency};
|
||||
like ($output, qr/urgency 30$/ms, 'due:-7d = 30');
|
||||
like ($output, qr/urgency 20$/ms, 'due:-7d = 20');
|
||||
|
||||
# due: 9.6 (due:-6d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 9.6 (due:-6d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 20 _urgency};
|
||||
like ($output, qr/urgency 29.6/ms, 'due:-6d = 29.6');
|
||||
like ($output, qr/urgency 19.6/ms, 'due:-6d = 19.6');
|
||||
|
||||
# due: 9.2 (due:-5d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 9.2 (due:-5d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 21 _urgency};
|
||||
like ($output, qr/urgency 29.2/ms, 'due:-5d = 29.2');
|
||||
like ($output, qr/urgency 19.2/ms, 'due:-5d = 19.2');
|
||||
|
||||
# due: 8.8 (due:-4d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 8.8 (due:-4d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 22 _urgency};
|
||||
like ($output, qr/urgency 28.8/ms, 'due:-4d = 28.8');
|
||||
like ($output, qr/urgency 18.8/ms, 'due:-4d = 18.8');
|
||||
|
||||
# due: 8.4 (due:-3d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 8.4 (due:-3d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 23 _urgency};
|
||||
like ($output, qr/urgency 28.4/ms, 'due:-3d = 28.4');
|
||||
like ($output, qr/urgency 18.4/ms, 'due:-3d = 18.4');
|
||||
|
||||
# due: 8 (due:-2d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 8 (due:-2d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 24 _urgency};
|
||||
like ($output, qr/urgency 28/ms, 'due:-2d = 28');
|
||||
like ($output, qr/urgency 18/ms, 'due:-2d = 18');
|
||||
|
||||
# due: 7.6 (due:-1d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 7.6 (due:-1d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 25 _urgency};
|
||||
like ($output, qr/urgency 27.6/ms, 'due:-1d = 27.6');
|
||||
like ($output, qr/urgency 17.6/ms, 'due:-1d = 17.6');
|
||||
|
||||
# due: 7.2 (due:now) + 10 (pending) + 10 (unblocked)
|
||||
# due: 7.2 (due:now) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 26 _urgency};
|
||||
like ($output, qr/urgency 27.2$/ms, 'due:now = 27.2');
|
||||
like ($output, qr/urgency 17.2$/ms, 'due:now = 17.2');
|
||||
|
||||
# due: 6.8 (due:1d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 6.8 (due:1d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 27 _urgency};
|
||||
like ($output, qr/urgency 26.8/ms, 'due:1d = 26.8');
|
||||
like ($output, qr/urgency 16.8/ms, 'due:1d = 16.8');
|
||||
|
||||
# due: 6.4 (due:2d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 6.4 (due:2d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 28 _urgency};
|
||||
like ($output, qr/urgency 26.4/ms, 'due:2d = 26.4');
|
||||
like ($output, qr/urgency 16.4/ms, 'due:2d = 16.4');
|
||||
|
||||
# due: 6 (due:3d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 6 (due:3d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 29 _urgency};
|
||||
like ($output, qr/urgency 26/ms, 'due:3d = 26');
|
||||
like ($output, qr/urgency 16/ms, 'due:3d = 16');
|
||||
|
||||
# due: 5.6 (due:4d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 5.6 (due:4d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 30 _urgency};
|
||||
like ($output, qr/urgency 25.6/ms, 'due:4d = 25.6');
|
||||
like ($output, qr/urgency 15.6/ms, 'due:4d = 15.6');
|
||||
|
||||
# due: 5.2 (due:5d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 5.2 (due:5d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 31 _urgency};
|
||||
like ($output, qr/urgency 25.2/ms, 'due:5d = 25.2');
|
||||
like ($output, qr/urgency 15.2/ms, 'due:5d = 15.2');
|
||||
|
||||
# due: 4.8 (due:6d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 4.8 (due:6d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 32 _urgency};
|
||||
like ($output, qr/urgency 24.8/ms, 'due:6d = 24.8');
|
||||
like ($output, qr/urgency 14.8/ms, 'due:6d = 14.8');
|
||||
|
||||
# due: 4.4 (due:7d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 4.4 (due:7d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 33 _urgency};
|
||||
like ($output, qr/urgency 24.4/ms, 'due:7d = 24.4');
|
||||
like ($output, qr/urgency 14.4/ms, 'due:7d = 14.4');
|
||||
|
||||
# due: 4 (due:8d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 4 (due:8d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 34 _urgency};
|
||||
like ($output, qr/urgency 24/ms, 'due:8d = 24');
|
||||
like ($output, qr/urgency 14/ms, 'due:8d = 14');
|
||||
|
||||
# due: 3.6 (due:9d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 3.6 (due:9d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 35 _urgency};
|
||||
like ($output, qr/urgency 23.6/ms, 'due:9d = 23.6');
|
||||
like ($output, qr/urgency 13.6/ms, 'due:9d = 13.6');
|
||||
|
||||
# due: 3.2 (due:10d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 3.2 (due:10d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 36 _urgency};
|
||||
like ($output, qr/urgency 23.2/ms, 'due:10d = 23.2');
|
||||
like ($output, qr/urgency 13.2/ms, 'due:10d = 13.2');
|
||||
|
||||
# due: 2.8 (due:11d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 2.8 (due:11d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 37 _urgency};
|
||||
like ($output, qr/urgency 22.8/ms, 'due:11d = 22.8');
|
||||
like ($output, qr/urgency 12.8/ms, 'due:11d = 12.8');
|
||||
|
||||
# due: 2.4 (due:12d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 2.4 (due:12d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 38 _urgency};
|
||||
like ($output, qr/urgency 22.4/ms, 'due:12d = 22.4');
|
||||
like ($output, qr/urgency 12.4/ms, 'due:12d = 12.4');
|
||||
|
||||
# due: 2 (due:13d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 2 (due:13d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 39 _urgency};
|
||||
like ($output, qr/urgency 22/ms, 'due:13d = 22');
|
||||
like ($output, qr/urgency 12/ms, 'due:13d = 12');
|
||||
|
||||
# due: 1.6 (due:14d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 1.6 (due:14d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 40 _urgency};
|
||||
like ($output, qr/urgency 21.6/ms, 'due:14d = 21.6');
|
||||
like ($output, qr/urgency 11.6/ms, 'due:14d = 11.6');
|
||||
|
||||
# due: 1.6 (due:20d) + 10 (pending) + 10 (unblocked)
|
||||
# due: 1.6 (due:20d) + 10 (pending)
|
||||
$output = qx{../src/task rc:urgency.rc 41 _urgency};
|
||||
like ($output, qr/urgency 21.6$/ms, 'due:20d = 21.6');
|
||||
like ($output, qr/urgency 11.6$/ms, 'due:20d = 11.6');
|
||||
|
||||
# user.project: 10 (pro:PROJECT) + 10 (project) + 10 (pending) + 10 (unblocked)
|
||||
# user.project: 10 (pro:PROJECT) + 10 (project) + 10 (pending)
|
||||
qx{../src/task rc:urgency.rc add 10a project:PROJECT}; # 42
|
||||
$output = qx{../src/task rc:urgency.rc 42 _urgency};
|
||||
like ($output, qr/urgency 40$/ms, 'pro:PROJECT = 40');
|
||||
like ($output, qr/urgency 30$/ms, 'pro:PROJECT = 30');
|
||||
|
||||
# user.tag: 10 (+TAG) + 8 (1 tag) + 10 (pending) + 10 (unblocked)
|
||||
# user.tag: 10 (+TAG) + 8 (1 tag) + 10 (pending)
|
||||
qx{../src/task rc:urgency.rc add 11a +TAG}; # 43
|
||||
$output = qx{../src/task rc:urgency.rc 43 _urgency};
|
||||
like ($output, qr/urgency 38$/ms, '+TAG = 38');
|
||||
like ($output, qr/urgency 28$/ms, '+TAG = 28');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue