Added hints/dragonfly.sh for #27189
[p5sagit/p5-mst-13.2.git] / lib / CPAN / t / 10version.t
1 # -*- Mode: cperl; coding: utf-8; -*-
2
3 use strict;
4 use CPAN::Version;
5 use vars qw($D $N);
6
7 while (<DATA>) {
8   next if tr/.// > 1 && $]<5.006; # multidot tests are not for pre-5.6.0
9   last if /^__END__$/;
10   chomp;
11   s/\s*#.*//;
12   push @$D, [ split ];
13 }
14
15 $N = scalar @$D;
16 print "1..$N\n";
17
18 my $has_sort_versions = eval { require Sort::Versions; 1 };
19 my $has_versionpm = eval { require version; 1 };
20 while (@$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   }
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;
35     my $vpack = "version"; # hide the name from 5.004
36     my $vres = $vpack->new($l) cmp $vpack->new($r);
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;
43   die "Panic" if CPAN::Version->vgt($l,$r) && CPAN::Version->vlt($l,$r);
44 }
45
46 __END__
47 0 0 0
48 1 0 1
49 0 1 -1
50 1 1 0
51 1.1 0.0a 1
52 1.1a 0.0 1
53 1.2.3 1.1.1 1
54 v1.2.3 v1.1.1 1
55 v1.2.3 v1.2.1 1
56 v1.2.3 v1.2.11 -1
57 1.2.3 1.2.11 -1
58 1.9 1.10 1
59 VERSION VERSION 0
60 0.02 undef 1
61 1.57_00 1.57 1
62 1.5700 1.57 1
63 1.57_01 1.57 1
64 0.2.10 0.2 -1
65 20000000.00 19990108 1
66 1.00 0.96 1
67 0.7.2 0.7 -1
68 0.7.02 0.7 -1
69 0.07.02 0.7 -1
70 1.3a5 1.3 1
71 undef 1.00 -1
72 v1.0 undef 1
73 v0.2.4 0.24 -1
74 v1.0.22 122 -1
75 1.0.22 122 -1
76 5.00556 v5.5.560 0
77 5.005056 v5.5.56 0
78 5.00557 v5.5.560 1
79 5.00056 v5.0.561 -1
80 0.0.2 0.000002 0
81 1.0.3 1.000003 0
82 1.0.1 1.000001 0
83 0.0.1 0.000001 0
84 0.01.04 0.001004 0
85 0.05.18 0.005018 0
86 4.08.00 4.008000 0
87 0.001.004 0.001004 0
88 0.005.018 0.005018 0
89 4.008.000 4.008000 0
90 4.008.000 4.008 1
91 __END__
92
93 # Local Variables:
94 # mode: cperl
95 # cperl-indent-level: 2
96 # End: