1 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3 # This file is part of GNU Automake.
5 # GNU Automake is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # GNU Automake is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Automake; see the file COPYING. If not, write to
17 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 # Boston, MA 02110-1301, USA.
20 use Automake::Version;
24 sub test_version_compare
26 my ($left, $right, $result) = @_;
27 my @leftver = Automake::Version::split ($left);
28 my @rightver = Automake::Version::split ($right);
31 print "can't grok \"$left\"\n";
37 print "can't grok \"$right\"\n";
41 my $res = Automake::Version::compare (@leftver, @rightver);
44 print "compare (\"$left\", \"$right\") = $res! (not $result?)\n";
67 ['1.5.4', '1.6.1', -1],
70 ['1.5a', '1.5.1a', 1],
71 ['1.5a', '1.5.1f', 1],
72 ['1.5', '1.5.1a', -1],
73 ['1.5.1a', '1.5.1f', -1],
75 ['1.6-p5a', '1.6.5a', 0],
76 ['1.6', '1.6-p5a', -1],
77 ['1.6-p4b', '1.6-p5a', -1],
78 ['1.6-p4b', '1.6-foo', 1],
79 ['1.6-p4b', '1.6a-foo', -1]
82 test_version_compare (@{$_}) foreach @tests;
86 ### Setup "GNU" style for perl-mode and cperl-mode.
88 ## perl-indent-level: 2
89 ## perl-continued-statement-offset: 2
90 ## perl-continued-brace-offset: 0
91 ## perl-brace-offset: 0
92 ## perl-brace-imaginary-offset: 0
93 ## perl-label-offset: -2
94 ## cperl-indent-level: 2
95 ## cperl-brace-offset: 0
96 ## cperl-continued-brace-offset: 0
97 ## cperl-label-offset: -2
98 ## cperl-extra-newline-before-brace: t
99 ## cperl-merge-trailing-else: nil
100 ## cperl-continued-statement-offset: 2