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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/usr/bin/perl
# $Id$
use Test::More;
use Youri::Check::Input::Updates;
use strict;
my @differents = (
[ '3.0.0', '1.0.0' ],
[ '3.0.0', '1.99.9' ],
[ '3.0.1', '3.0' ],
[ '3.0pl1', '3.0' ],
[ '3.0', '3.0beta1' ],
[ '3.0', '3.0beta' ],
[ '3.0', '3.0alpha1' ],
[ '3.0', '3.0alpha' ],
[ '3.0', '3.0pre1' ],
[ '3.0', '3.0pre' ],
[ '3.0pre', '3.0beta' ],
[ '3.0beta', '3.0alpha' ],
[ '1.0.0-p1', '1.0.0RC1' ],
[ '0.9.7f', '0.9.7e' ],
[ '10', '9' ],
);
my @equals = (
[ '1.0.0', '1.0.0' ],
[ '0.9Beta1', '0.9beta1' ],
[ '0.9beta1', '0.9 beta 1' ],
[ '0.3-alpha', '0.3_alpha' ],
[ '0.02', '.02' ],
[ '2.0.11', '15aug2000' ],
[ '2.0.11', '20060401' ],
[ '20', '20060401' ],
);
plan tests => 2 * @differents + 2 * @equals;
foreach my $different (@differents) {
ok(
Youri::Check::Input::Updates::is_newer(
$different->[0],
$different->[1]
),
"$different->[0] is newer as $different->[1]"
);
ok(
!Youri::Check::Input::Updates::is_newer(
$different->[1],
$different->[0]
),
"$different->[1] is older as $different->[0]"
);
}
foreach my $equal (@equals) {
ok(
!Youri::Check::Input::Updates::is_newer(
$equal->[0],
$equal->[1]
),
"$equal->[0] is equal as $equal->[1]"
);
ok(
!Youri::Check::Input::Updates::is_newer(
$equal->[1],
$equal->[0]
),
"$equal->[1] is equal as $equal->[0]"
);
}
|