Re: [PATCH] Tests for File::Compare
[p5sagit/p5-mst-13.2.git] / t / lib / cpan-vcmp.t
CommitLineData
2787609a 1# -*- Mode: cperl; coding: utf-8; -*-
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8use strict;
9use CPAN;
10use vars qw($D $N);
11
12while (<DATA>) {
13 next if /^v/ && $]<5.006; # v-string tests are not for pre-5.6.0
14 chomp;
15 s/\s*#.*//;
16 push @$D, [ split ];
17}
18
19$N = scalar @$D;
20print "1..$N\n";
21
22while (@$D) {
23 my($l,$r,$exp) = @{shift @$D};
24 my $res = CPAN::Version->vcmp($l,$r);
25 if ($res != $exp){
26 print "# l[$l]r[$r]exp[$exp]res[$res]\n";
27 print "not ";
28 }
29 print "ok ", $N-@$D, "\n";
30}
31
32__END__
330 0 0
341 0 1
350 1 -1
361 1 0
371.1 0.0a 1
381.1a 0.0 1
391.2.3 1.1.1 1
40v1.2.3 v1.1.1 1
41v1.2.3 v1.2.1 1
42v1.2.3 v1.2.11 -1
431.2.3 1.2.11 1 # not what they wanted
441.9 1.10 1
45VERSION VERSION 0
460.02 undef 1
471.57_00 1.57 1
481.5700 1.57 1
491.57_01 1.57 1
500.2.10 0.2 1
5120000000.00 19990108 1
521.00 0.96 1
530.7.02 0.7 1
541.3a5 1.3 1
55undef 1.00 -1
56v1.0 undef 1
57v0.2.4 0.24 -1
58v1.0.22 122 -1
595.00556 v5.5.560 0
605.005056 v5.5.56 0
615.00557 v5.5.560 1
625.00056 v5.0.561 -1