my @a = @{ $v1->version };
my @b = @{ $v2->version };
- while (@a or @b) {
- my $x = shift(@a) || 0;
- my $y = shift(@b) || 0;
+ while (@a and @b) {
+ my $x = shift @a;
+ my $y = shift @b;
my $c = $x <=> $y;
return $c if $c;
}
+
+ return 1 if @a;
+ return -1 if @b;
}
{
use strict;
use warnings;
-use Test::More tests => 3 + (2 + 2 * 3) * (50 + 4 * 7);
+use Test::More tests => 3 + (2 + 2 * 3) * (52 + 4 * 7);
use CPANPLUS::Dist::Gentoo::Version;
[ 0, 1 => -1 ],
[ 1, 1 => 0 ],
- [ '1.0', 1 => 0 ],
+ [ '1.0', 1 => 1 ], # Yes, 1.0 > 1. Deal with it
+ [ '1.0', '1.0' => 0 ],
[ '1.1', 1 => 1 ],
[ '1.1', '1.0' => 1 ],
- [ 1, '1.0' => 0 ],
- [ 1, '1.1' => -1 ],
[ '1.0', '1.1' => -1 ],
+ [ '1.0.0', 1 => 1 ], # Ditto
+ [ '1.0.0', '1.0' => 1 ], # Tritto
+ [ '1.0.0', '1.0.0' => 0 ],
[ '1.0.1', '1.1' => -1 ],
[ '1.0.1', '1.0.0' => 1 ],
[ '1a', 1 => 1 ],
[ '1.0a', 1 => 1 ],
- [ '1.0', '1a' => -1 ],
+ [ '1.0', '1a' => 1 ], # Same
[ '1a', '1b' => -1 ],
[ '1.1a', '1.0b' => 1 ],