xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/CPAN/t/vcmp.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate# -*- Mode: cperl; coding: utf-8; -*-
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateuse strict;
4*0Sstevel@tonic-gateuse CPAN;
5*0Sstevel@tonic-gateuse vars qw($D $N);
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gatewhile (<DATA>) {
8*0Sstevel@tonic-gate  next if /^v/ && $]<5.006; # v-string tests are not for pre-5.6.0
9*0Sstevel@tonic-gate  chomp;
10*0Sstevel@tonic-gate  s/\s*#.*//;
11*0Sstevel@tonic-gate  push @$D, [ split ];
12*0Sstevel@tonic-gate}
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gate$N = scalar @$D;
15*0Sstevel@tonic-gateprint "1..$N\n";
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gatewhile (@$D) {
18*0Sstevel@tonic-gate  my($l,$r,$exp) = @{shift @$D};
19*0Sstevel@tonic-gate  my $res = CPAN::Version->vcmp($l,$r);
20*0Sstevel@tonic-gate  if ($res != $exp){
21*0Sstevel@tonic-gate    print "# l[$l]r[$r]exp[$exp]res[$res]\n";
22*0Sstevel@tonic-gate    print "not ";
23*0Sstevel@tonic-gate  }
24*0Sstevel@tonic-gate  print "ok ", $N-@$D, "\n";
25*0Sstevel@tonic-gate}
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate__END__
28*0Sstevel@tonic-gate0 0 0
29*0Sstevel@tonic-gate1 0 1
30*0Sstevel@tonic-gate0 1 -1
31*0Sstevel@tonic-gate1 1 0
32*0Sstevel@tonic-gate1.1 0.0a 1
33*0Sstevel@tonic-gate1.1a 0.0 1
34*0Sstevel@tonic-gate1.2.3 1.1.1 1
35*0Sstevel@tonic-gatev1.2.3 v1.1.1 1
36*0Sstevel@tonic-gatev1.2.3 v1.2.1 1
37*0Sstevel@tonic-gatev1.2.3 v1.2.11 -1
38*0Sstevel@tonic-gate1.2.3 1.2.11 1 # not what they wanted
39*0Sstevel@tonic-gate1.9 1.10 1
40*0Sstevel@tonic-gateVERSION VERSION 0
41*0Sstevel@tonic-gate0.02 undef 1
42*0Sstevel@tonic-gate1.57_00 1.57 1
43*0Sstevel@tonic-gate1.5700 1.57 1
44*0Sstevel@tonic-gate1.57_01 1.57 1
45*0Sstevel@tonic-gate0.2.10 0.2 1
46*0Sstevel@tonic-gate20000000.00 19990108 1
47*0Sstevel@tonic-gate1.00 0.96 1
48*0Sstevel@tonic-gate0.7.02 0.7 1
49*0Sstevel@tonic-gate1.3a5 1.3 1
50*0Sstevel@tonic-gateundef 1.00 -1
51*0Sstevel@tonic-gatev1.0 undef 1
52*0Sstevel@tonic-gatev0.2.4 0.24 -1
53*0Sstevel@tonic-gatev1.0.22 122 -1
54*0Sstevel@tonic-gate5.00556 v5.5.560 0
55*0Sstevel@tonic-gate5.005056 v5.5.56 0
56*0Sstevel@tonic-gate5.00557 v5.5.560 1
57*0Sstevel@tonic-gate5.00056 v5.0.561 -1
58