[PAUSE] CPAN Upload: A/AN/ANDK/CPAN-1.84.tar.gz
[p5sagit/p5-mst-13.2.git] / lib / CPAN / t / 10version.t
CommitLineData
2787609a 1# -*- Mode: cperl; coding: utf-8; -*-
2
2787609a 3use strict;
554a9ef5 4use CPAN::Version;
2787609a 5use vars qw($D $N);
6
7while (<DATA>) {
0a78cd5d 8 next if tr/.// > 1 && $]<5.006; # multidot tests are not for pre-5.6.0
554a9ef5 9 last if /^__END__$/;
2787609a 10 chomp;
11 s/\s*#.*//;
12 push @$D, [ split ];
13}
14
15$N = scalar @$D;
16print "1..$N\n";
17
c9869e1c 18my $has_sort_versions = eval { require Sort::Versions; 1 };
19my $has_versionpm = eval { require version; 1 };
2787609a 20while (@$D) {
21 my($l,$r,$exp) = @{shift @$D};
22 my $res = CPAN::Version->vcmp($l,$r);
23 if ($res != $exp){
24 print "# l[$l]r[$r]exp[$exp]res[$res]\n";
25 print "not ";
26 }
c9869e1c 27 my @other = ();
28 if ($has_sort_versions) {
29 if (Sort::Versions::versioncmp($l,$r) != $res) {
30 push @other, sprintf "SV: %d", Sort::Versions::versioncmp($l,$r);
31 }
32 }
33 if ($has_versionpm) {
34 local $^W;
4d1321a7 35 my $vpack = "version"; # hide the name from 5.004
36 my $vres = $vpack->new($l) cmp $vpack->new($r);
c9869e1c 37 if ($vres != $res) {
38 push @other, sprintf "v.pm: %d", $vres;
39 }
40 }
41 my $other = @other ? " (".join("; ", @other).")" : "";
42 printf "ok %2d # %12s %12s %3d%s\n", $N-@$D, $l, $r, $res, $other;
4d1321a7 43 die "Panic" if CPAN::Version->vgt($l,$r) && CPAN::Version->vlt($l,$r);
2787609a 44}
45
46__END__
470 0 0
481 0 1
490 1 -1
501 1 0
511.1 0.0a 1
521.1a 0.0 1
531.2.3 1.1.1 1
54v1.2.3 v1.1.1 1
55v1.2.3 v1.2.1 1
56v1.2.3 v1.2.11 -1
554a9ef5 571.2.3 1.2.11 -1
2787609a 581.9 1.10 1
59VERSION VERSION 0
600.02 undef 1
611.57_00 1.57 1
621.5700 1.57 1
631.57_01 1.57 1
554a9ef5 640.2.10 0.2 -1
2787609a 6520000000.00 19990108 1
661.00 0.96 1
c9869e1c 670.7.2 0.7 -1
554a9ef5 680.7.02 0.7 -1
c9869e1c 690.07.02 0.7 -1
2787609a 701.3a5 1.3 1
71undef 1.00 -1
72v1.0 undef 1
73v0.2.4 0.24 -1
74v1.0.22 122 -1
c9869e1c 751.0.22 122 -1
2787609a 765.00556 v5.5.560 0
775.005056 v5.5.56 0
785.00557 v5.5.560 1
795.00056 v5.0.561 -1
554a9ef5 800.0.2 0.000002 0
811.0.3 1.000003 0
821.0.1 1.000001 0
830.0.1 0.000001 0
840.01.04 0.001004 0
850.05.18 0.005018 0
864.08.00 4.008000 0
c9869e1c 870.001.004 0.001004 0
880.005.018 0.005018 0
894.008.000 4.008000 0
904.008.000 4.008 1
554a9ef5 91__END__
92
93# Local Variables:
94# mode: cperl
95# cperl-indent-level: 2
96# End: