tests: move all under the same hierarchy ('tests/' directory)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 18 Jan 2012 11:17:11 +0000 (12:17 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 18 Jan 2012 12:31:55 +0000 (13:31 +0100)
This simplifies the organization of the Automake source tree and
reduces the (lamentably high) number of Makefiles in the Automake
build system by one.  It also makes the maintainer check that
verifies the consistency of list of tests more self-contained and
simpler.  Finally, it might be a first step forward the transition
to a non-recursive build system for automake (if we ever decide to
go down that road fully some day).

* lib/Automake/tests: All the '*.pl' tests in here moved ...
* tests/pm: ... into this new directory.
* lib/Automake/tests/Makefile.am: Remove, its meaningful
contents moved ...
* tests/Makefile.am: ... here, with obvious adjustments.
(test_subdirs): New variable, for the sake of the recipe
of 'maintainer-check-list-of-tests'.
* CheckListOfTests (maintainer-check-list-of-tests): Enhance
its recipe to make it able to deal with test script residing
in subdirectories.
* Makefile.am (maintainer-check-list-of-tests): Simplified.
(TEST_SUBDIRS): Remove, no more needed.
* tests/list-of-tests.mk (perl_TESTS): New variable, lists
the '.pl' tests just moved into 'tests/pm'.
(handwritten_TESTS): Add the contents of '$(perl_TESTS)'.
* lib/Automake/Makefile.am (SUBDIRS): Remove.
* configure.ac (AC_CONFIG_FILES): Update.
* .gitignore: Adjust.

20 files changed:
.gitignore
CheckListOfTests.am
Makefile.am
configure.ac
lib/Automake/Makefile.am
lib/Automake/tests/Condition-t.pl [deleted file]
lib/Automake/tests/Condition.pl [deleted file]
lib/Automake/tests/DisjConditions-t.pl [deleted file]
lib/Automake/tests/DisjConditions.pl [deleted file]
lib/Automake/tests/Makefile.am [deleted file]
lib/Automake/tests/Version.pl [deleted file]
lib/Automake/tests/Wrap.pl [deleted file]
tests/Makefile.am
tests/list-of-tests.mk
tests/pm/Condition-t.pl [new file with mode: 0644]
tests/pm/Condition.pl [new file with mode: 0644]
tests/pm/DisjConditions-t.pl [new file with mode: 0644]
tests/pm/DisjConditions.pl [new file with mode: 0644]
tests/pm/Version.pl [new file with mode: 0644]
tests/pm/Wrap.pl [new file with mode: 0644]

index 33e3827fc13e00138737f958bc5b7bc1a22b7250..f21915354671c1f3a28937763093dd520a7a208d 100644 (file)
@@ -47,10 +47,10 @@ Makefile
 /doc/amhello/install-sh
 /doc/amhello/missing
 /lib/Automake/Config.pm
-/lib/Automake/tests/*.log
-/lib/Automake/tests/*.log-t
 /tests/*.log
 /tests/*.log-t
+/tests/pm/*.log
+/tests/pm/*.log-t
 /tests/*.dir
 /tests/*-p.test
 /tests/aclocal-1.*
index 0a484470e9f0946b1e313cd9425d9130d5d68fec..c71c7fc0d322f7fd8af5df5b6600483c77608cf1 100644 (file)
@@ -37,13 +37,18 @@ maintainer-check-list-of-tests:
         for t in $$lst; do \
           echo "$$t"; \
         done | sort >$(am__tmk); \
+## List of subdirs where to look for tests.
+        dirs='$(test_subdirs)'; \
+        test -n "$$dirs" || dirs=.; \
 ## List of tests on filesystem.  Be careful to cater for VPATH builds too.
         for ext in $(TEST_EXTENSIONS); do \
-          ls *$$ext 2>/dev/null; \
-          if test $(srcdir) != $(builddir); then \
-            (cd $(srcdir) && ls *$$ext 2>/dev/null); \
-          fi; \
-        done | sort | uniq >$(am__tfs); \
+          for dir in $$dirs; do \
+            ls $$dir/*$$ext 2>/dev/null; \
+            if test $(srcdir) != $(builddir); then \
+              (cd $(srcdir) && ls $$dir/*$$ext 2>/dev/null); \
+            fi; \
+          done; \
+        done | sed 's,^\./,,' | sort | uniq >$(am__tfs); \
 ## Compare the two lists, complain if they differ.
         if $$diff $(am__tmk) $(am__tfs) >$(am__tdf); then \
            result=0; \
index 7ad3b921f0c7a9e62c5553ccd19165c1bec08322..b9166dbaa8aefd5aed7250ff08b5d355f8007830 100644 (file)
@@ -25,8 +25,6 @@
 ## run aclocal and automake.
 SUBDIRS = lib . contrib doc m4 tests
 
-TEST_SUBDIRS = tests lib/Automake/tests
-
 bin_SCRIPTS = automake aclocal
 
 CLEANFILES = $(bin_SCRIPTS)
@@ -203,18 +201,7 @@ maintainer-check: $(syntax_check_rules)
 ## list of all test scripts in the Automake testsuite.
 .PHONY: maintainer-check-list-of-tests
 maintainer-check-list-of-tests:
-       @fail= failcom='exit 1'; \
-       for f in x $$MAKEFLAGS; do \
-         case $$f in \
-           *=* | --[!k]*);; \
-           *k*) failcom='fail=yes';; \
-         esac; \
-       done; \
-       for subdir in $(TEST_SUBDIRS); do \
-         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
-       done; \
-       test -z "$$fail"
-
+       $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
 maintainer-check: maintainer-check-list-of-tests
 
 ## Look for test whose names can cause spurious failures when used as
index bcd28fda632dc5e550740a9f2488f6d51382d2b8..18dbd8aa2be3bd5fb443edf6ed8d85a432bd23c0 100644 (file)
@@ -209,7 +209,6 @@ AC_CONFIG_FILES([
   contrib/Makefile
   doc/Makefile
   lib/Automake/Makefile
-  lib/Automake/tests/Makefile
   lib/Makefile
   lib/am/Makefile
   m4/Makefile
index cfc7272b8d50882f02e1d1a75f286ded6c19e477..9805024622341a3a197533de242198035d7a6b2a 100644 (file)
@@ -1,7 +1,7 @@
 ## Process this file with automake to create Makefile.in
 
-# Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2010, 2012 Free
+# Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# `make clean check' should build Config.pm first.
-SUBDIRS = . tests
-
 perllibdir = $(pkgvdatadir)/Automake
 dist_perllib_DATA = \
   ChannelDefs.pm \
diff --git a/lib/Automake/tests/Condition-t.pl b/lib/Automake/tests/Condition-t.pl
deleted file mode 100644 (file)
index 06eb34e..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-BEGIN {
-  use Config;
-  if (eval { require 5.007_002; }      # for CLONE support
-      && $Config{useithreads})
-    {
-      require threads;
-      import threads;
-    }
-  else
-    {
-      exit 77;
-    }
-}
-use Automake::Condition qw/TRUE FALSE/;
-
-sub test_basics ()
-{
-  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string]
-              [[], 1, 0, 'TRUE', ''],
-              [['TRUE'], 1, 0, 'TRUE', ''],
-              [['FALSE'], 0, 1, 'FALSE', '#'],
-              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@'],
-              [['A_TRUE', 'B_FALSE'],
-               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@'],
-              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#'],
-              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#']);
-
-  for (@tests)
-    {
-      my $a = new Automake::Condition @{$_->[0]};
-      return 1
-        if threads->new(sub {
-         return 1 if $_->[1] != $a->true;
-         return 1 if $_->[1] != ($a == TRUE);
-         return 1 if $_->[2] != $a->false;
-         return 1 if $_->[2] != ($a == FALSE);
-         return 1 if $_->[3] ne $a->string;
-         return 1 if $_->[4] ne $a->subst_string;
-       })->join;
-    }
-  return 0;
-}
-
-sub test_true_when ()
-{
-  my $failed = 0;
-
-  my @tests = (# [When,
-              #  [Implied-Conditions],
-              #  [Not-Implied-Conditions]]
-              [['TRUE'],
-               [['TRUE']],
-               [['A_TRUE'], ['A_TRUE', 'B_FALSE'], ['FALSE']]],
-              [['A_TRUE'],
-               [['TRUE'], ['A_TRUE']],
-               [['A_TRUE', 'B_FALSE'], ['FALSE']]],
-              [['A_TRUE', 'B_FALSE'],
-               [['TRUE'], ['A_TRUE'], ['B_FALSE'], ['A_TRUE', 'B_FALSE']],
-               [['FALSE'], ['C_FALSE'], ['C_FALSE', 'A_TRUE']]]);
-
-  for my $t (@tests)
-    {
-      my $a = new Automake::Condition @{$t->[0]};
-      return 1
-        if threads->new(sub {
-         for my $u (@{$t->[1]})
-           {
-             my $b = new Automake::Condition @$u;
-             return threads->new(sub {
-               if (! $b->true_when ($a))
-                 {
-                   print "`" . $b->string .
-                     "' not implied by `" . $a->string . "'?\n";
-                   $failed = 1;
-                 }
-             })->join;
-           }
-         for my $u (@{$t->[2]})
-           {
-             my $b = new Automake::Condition @$u;
-             return threads->new(sub {
-               if ($b->true_when ($a))
-                 {
-                   print "`" . $b->string .
-                     "' implied by `" . $a->string . "'?\n";
-                   $failed = 1;
-                 }
-
-               return threads->new(sub {
-                 return 1 if $b->true_when ($a);
-               })->join;
-             })->join;
-           }
-        })->join;
-    }
-  return $failed;
-}
-
-sub test_reduce_and ()
-{
-  my @tests = (# If no conditions are given, TRUE should be returned
-              [[], ["TRUE"]],
-              # An empty condition is TRUE
-              [[""], ["TRUE"]],
-              # A single condition should be passed through unchanged
-              [["FOO"], ["FOO"]],
-              [["FALSE"], ["FALSE"]],
-              [["TRUE"], ["TRUE"]],
-              # TRUE and false should be discarded and overwhelm
-              # the result, respectively
-              [["FOO", "TRUE"], ["FOO"]],
-              [["FOO", "FALSE"], ["FALSE"]],
-              # Repetitions should be removed
-              [["FOO", "FOO"], ["FOO"]],
-              [["TRUE", "FOO", "FOO"], ["FOO"]],
-              [["FOO", "TRUE", "FOO"], ["FOO"]],
-              [["FOO", "FOO", "TRUE"], ["FOO"]],
-              # Two different conditions should be preserved,
-              # but TRUEs should be removed
-              [["FOO", "BAR"], ["BAR,FOO"]],
-              [["TRUE", "FOO", "BAR"], ["BAR,FOO"]],
-              [["FOO", "TRUE", "BAR"], ["BAR,FOO"]],
-              [["FOO", "BAR", "TRUE"], ["BAR,FOO"]],
-              # A condition implied by another condition should be removed.
-              [["FOO BAR", "BAR"], ["FOO BAR"]],
-              [["BAR", "FOO BAR"], ["FOO BAR"]],
-              [["TRUE", "FOO BAR", "BAR"], ["FOO BAR"]],
-              [["FOO BAR", "TRUE", "BAR"], ["FOO BAR"]],
-              [["FOO BAR", "BAR", "TRUE"], ["FOO BAR"]],
-
-              [["BAR FOO", "BAR"], ["BAR FOO"]],
-              [["BAR", "BAR FOO"], ["BAR FOO"]],
-              [["TRUE", "BAR FOO", "BAR"], ["BAR FOO"]],
-              [["BAR FOO", "TRUE", "BAR"], ["BAR FOO"]],
-              [["BAR FOO", "BAR", "TRUE"], ["BAR FOO"]],
-
-              # Check that reduction happens even when there are
-              # two conditions to remove.
-              [["FOO", "FOO BAR", "BAR"], ["FOO BAR"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["FOO BAR", "FOO BAZ"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
-               ["FOO BAZ BAR"]],
-
-              # Duplicated conditionals should be removed.
-              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
-
-              # Equivalent conditions in different forms should be
-              # reduced: which one is left is unfortunately order
-              # dependent.
-              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
-              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
-
-  my $failed = 0;
-  foreach (@tests)
-    {
-      my ($inref, $outref) = @$_;
-      my @inconds = map { new Automake::Condition $_ } @$inref;
-      return 1
-        if threads->new(sub {
-         my @outconds = map { (new Automake::Condition $_)->string } @$outref;
-         return threads->new(sub {
-           my @res =
-             map { $_->string } (Automake::Condition::reduce_and (@inconds));
-           return threads->new(sub {
-             my $result = join (",", sort @res);
-             my $exresult = join (",", @outconds);
-
-             if ($result ne $exresult)
-               {
-                 print '"' . join(",", @$inref) . '" => "' .
-                   $result . '" expected "' .
-                     $exresult . '"' . "\n";
-                 $failed = 1;
-               }
-             return $failed;
-           })->join;
-         })->join;
-       })->join;
-    }
-  return $failed;
-}
-
-sub test_reduce_or ()
-{
-  my @tests = (# If no conditions are given, FALSE should be returned
-              [[], ["FALSE"]],
-              # An empty condition is TRUE
-              [[""], ["TRUE"]],
-              # A single condition should be passed through unchanged
-              [["FOO"], ["FOO"]],
-              [["FALSE"], ["FALSE"]],
-              [["TRUE"], ["TRUE"]],
-              # FALSE and TRUE should be discarded and overwhelm
-              # the result, respectively
-              [["FOO", "TRUE"], ["TRUE"]],
-              [["FOO", "FALSE"], ["FOO"]],
-              # Repetitions should be removed
-              [["FOO", "FOO"], ["FOO"]],
-              [["FALSE", "FOO", "FOO"], ["FOO"]],
-              [["FOO", "FALSE", "FOO"], ["FOO"]],
-              [["FOO", "FOO", "FALSE"], ["FOO"]],
-              # Two different conditions should be preserved,
-              # but FALSEs should be removed
-              [["FOO", "BAR"], ["BAR,FOO"]],
-              [["FALSE", "FOO", "BAR"], ["BAR,FOO"]],
-              [["FOO", "FALSE", "BAR"], ["BAR,FOO"]],
-              [["FOO", "BAR", "FALSE"], ["BAR,FOO"]],
-              # A condition implying another condition should be removed.
-              [["FOO BAR", "BAR"], ["BAR"]],
-              [["BAR", "FOO BAR"], ["BAR"]],
-              [["FALSE", "FOO BAR", "BAR"], ["BAR"]],
-              [["FOO BAR", "FALSE", "BAR"], ["BAR"]],
-              [["FOO BAR", "BAR", "FALSE"], ["BAR"]],
-
-              [["BAR FOO", "BAR"], ["BAR"]],
-              [["BAR", "BAR FOO"], ["BAR"]],
-              [["FALSE", "BAR FOO", "BAR"], ["BAR"]],
-              [["BAR FOO", "FALSE", "BAR"], ["BAR"]],
-              [["BAR FOO", "BAR", "FALSE"], ["BAR"]],
-
-              # Check that reduction happens even when there are
-              # two conditions to remove.
-              [["FOO", "FOO BAR", "BAR"], ["BAR,FOO"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["BAZ,FOO"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
-               ["BAZ,FOO"]],
-
-              # Duplicated conditionals should be removed.
-              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
-
-              # Equivalent conditions in different forms should be
-              # reduced: which one is left is unfortunately order
-              # dependent.
-              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
-              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
-
-  my $failed = 0;
-  foreach (@tests)
-    {
-      my ($inref, $outref) = @$_;
-      my @inconds = map { new Automake::Condition $_ } @$inref;
-      return 1
-        if threads->new(sub {
-         my @outconds = map { (new Automake::Condition $_)->string } @$outref;
-         return threads->new(sub {
-           my @res =
-             map { $_->string } (Automake::Condition::reduce_or (@inconds));
-           return threads->new(sub {
-             my $result = join (",", sort @res);
-             my $exresult = join (",", @outconds);
-
-             if ($result ne $exresult)
-               {
-                 print '"' . join(",", @$inref) . '" => "' .
-                   $result . '" expected "' .
-                     $exresult . '"' . "\n";
-                 $failed = 1;
-               }
-             return $failed;
-           })->join;
-         })->join;
-       })->join;
-    }
-  return $failed;
-}
-
-exit (test_basics || test_true_when || test_reduce_and || test_reduce_or);
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/lib/Automake/tests/Condition.pl b/lib/Automake/tests/Condition.pl
deleted file mode 100644 (file)
index 86f1745..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-use Automake::Condition qw/TRUE FALSE/;
-
-sub test_basics ()
-{
-  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string]
-              [[], 1, 0, 'TRUE', ''],
-              [['TRUE'], 1, 0, 'TRUE', ''],
-              [['FALSE'], 0, 1, 'FALSE', '#'],
-              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@'],
-              [['A_TRUE', 'B_FALSE'],
-               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@'],
-              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#'],
-              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#']);
-
-  for (@tests)
-    {
-      my $a = new Automake::Condition @{$_->[0]};
-      return 1 if $_->[1] != $a->true;
-      return 1 if $_->[1] != ($a == TRUE);
-      return 1 if $_->[2] != $a->false;
-      return 1 if $_->[2] != ($a == FALSE);
-      return 1 if $_->[3] ne $a->string;
-      return 1 if $_->[4] ne $a->subst_string;
-    }
-  return 0;
-}
-
-sub test_true_when ()
-{
-  my $failed = 0;
-
-  my @tests = (# [When,
-              #  [Implied-Conditions],
-              #  [Not-Implied-Conditions]]
-              [['TRUE'],
-               [['TRUE']],
-               [['A_TRUE'], ['A_TRUE', 'B_FALSE'], ['FALSE']]],
-              [['A_TRUE'],
-               [['TRUE'], ['A_TRUE']],
-               [['A_TRUE', 'B_FALSE'], ['FALSE']]],
-              [['A_TRUE', 'B_FALSE'],
-               [['TRUE'], ['A_TRUE'], ['B_FALSE'], ['A_TRUE', 'B_FALSE']],
-               [['FALSE'], ['C_FALSE'], ['C_FALSE', 'A_TRUE']]]);
-
-  for my $t (@tests)
-    {
-      my $a = new Automake::Condition @{$t->[0]};
-      for my $u (@{$t->[1]})
-       {
-         my $b = new Automake::Condition @$u;
-         if (! $b->true_when ($a))
-           {
-             print "`" . $b->string .
-               "' not implied by `" . $a->string . "'?\n";
-             $failed = 1;
-           }
-       }
-      for my $u (@{$t->[2]})
-       {
-         my $b = new Automake::Condition @$u;
-         if ($b->true_when ($a))
-           {
-             print "`" . $b->string .
-               "' implied by `" . $a->string . "'?\n";
-             $failed = 1;
-           }
-
-         return 1 if $b->true_when ($a);
-       }
-    }
-  return $failed;
-}
-
-sub test_reduce_and ()
-{
-  my @tests = (# If no conditions are given, TRUE should be returned
-              [[], ["TRUE"]],
-              # An empty condition is TRUE
-              [[""], ["TRUE"]],
-              # A single condition should be passed through unchanged
-              [["FOO"], ["FOO"]],
-              [["FALSE"], ["FALSE"]],
-              [["TRUE"], ["TRUE"]],
-              # TRUE and false should be discarded and overwhelm
-              # the result, respectively
-              [["FOO", "TRUE"], ["FOO"]],
-              [["FOO", "FALSE"], ["FALSE"]],
-              # Repetitions should be removed
-              [["FOO", "FOO"], ["FOO"]],
-              [["TRUE", "FOO", "FOO"], ["FOO"]],
-              [["FOO", "TRUE", "FOO"], ["FOO"]],
-              [["FOO", "FOO", "TRUE"], ["FOO"]],
-              # Two different conditions should be preserved,
-              # but TRUEs should be removed
-              [["FOO", "BAR"], ["BAR,FOO"]],
-              [["TRUE", "FOO", "BAR"], ["BAR,FOO"]],
-              [["FOO", "TRUE", "BAR"], ["BAR,FOO"]],
-              [["FOO", "BAR", "TRUE"], ["BAR,FOO"]],
-              # A condition implied by another condition should be removed.
-              [["FOO BAR", "BAR"], ["FOO BAR"]],
-              [["BAR", "FOO BAR"], ["FOO BAR"]],
-              [["TRUE", "FOO BAR", "BAR"], ["FOO BAR"]],
-              [["FOO BAR", "TRUE", "BAR"], ["FOO BAR"]],
-              [["FOO BAR", "BAR", "TRUE"], ["FOO BAR"]],
-
-              [["BAR FOO", "BAR"], ["BAR FOO"]],
-              [["BAR", "BAR FOO"], ["BAR FOO"]],
-              [["TRUE", "BAR FOO", "BAR"], ["BAR FOO"]],
-              [["BAR FOO", "TRUE", "BAR"], ["BAR FOO"]],
-              [["BAR FOO", "BAR", "TRUE"], ["BAR FOO"]],
-
-              # Check that reduction happens even when there are
-              # two conditions to remove.
-              [["FOO", "FOO BAR", "BAR"], ["FOO BAR"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["FOO BAR", "FOO BAZ"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
-               ["FOO BAZ BAR"]],
-
-              # Duplicated conditionals should be removed.
-              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
-
-              # Equivalent conditions in different forms should be
-              # reduced: which one is left is unfortunately order
-              # dependent.
-              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
-              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
-
-  my $failed = 0;
-  foreach (@tests)
-    {
-      my ($inref, $outref) = @$_;
-      my @inconds = map { new Automake::Condition $_ } @$inref;
-      my @outconds = map { (new Automake::Condition $_)->string } @$outref;
-      my @res =
-       map { $_->string } (Automake::Condition::reduce_and (@inconds));
-      my $result = join (",", sort @res);
-      my $exresult = join (",", @outconds);
-
-      if ($result ne $exresult)
-       {
-         print '"' . join(",", @$inref) . '" => "' .
-           $result . '" expected "' .
-             $exresult . '"' . "\n";
-         $failed = 1;
-       }
-    }
-  return $failed;
-}
-
-sub test_reduce_or ()
-{
-  my @tests = (# If no conditions are given, FALSE should be returned
-              [[], ["FALSE"]],
-              # An empty condition is TRUE
-              [[""], ["TRUE"]],
-              # A single condition should be passed through unchanged
-              [["FOO"], ["FOO"]],
-              [["FALSE"], ["FALSE"]],
-              [["TRUE"], ["TRUE"]],
-              # FALSE and TRUE should be discarded and overwhelm
-              # the result, respectively
-              [["FOO", "TRUE"], ["TRUE"]],
-              [["FOO", "FALSE"], ["FOO"]],
-              # Repetitions should be removed
-              [["FOO", "FOO"], ["FOO"]],
-              [["FALSE", "FOO", "FOO"], ["FOO"]],
-              [["FOO", "FALSE", "FOO"], ["FOO"]],
-              [["FOO", "FOO", "FALSE"], ["FOO"]],
-              # Two different conditions should be preserved,
-              # but FALSEs should be removed
-              [["FOO", "BAR"], ["BAR,FOO"]],
-              [["FALSE", "FOO", "BAR"], ["BAR,FOO"]],
-              [["FOO", "FALSE", "BAR"], ["BAR,FOO"]],
-              [["FOO", "BAR", "FALSE"], ["BAR,FOO"]],
-              # A condition implying another condition should be removed.
-              [["FOO BAR", "BAR"], ["BAR"]],
-              [["BAR", "FOO BAR"], ["BAR"]],
-              [["FALSE", "FOO BAR", "BAR"], ["BAR"]],
-              [["FOO BAR", "FALSE", "BAR"], ["BAR"]],
-              [["FOO BAR", "BAR", "FALSE"], ["BAR"]],
-
-              [["BAR FOO", "BAR"], ["BAR"]],
-              [["BAR", "BAR FOO"], ["BAR"]],
-              [["FALSE", "BAR FOO", "BAR"], ["BAR"]],
-              [["BAR FOO", "FALSE", "BAR"], ["BAR"]],
-              [["BAR FOO", "BAR", "FALSE"], ["BAR"]],
-
-              # Check that reduction happens even when there are
-              # two conditions to remove.
-              [["FOO", "FOO BAR", "BAR"], ["BAR,FOO"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["BAZ,FOO"]],
-              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
-               ["BAZ,FOO"]],
-
-              # Duplicated conditionals should be removed.
-              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
-
-              # Equivalent conditions in different forms should be
-              # reduced: which one is left is unfortunately order
-              # dependent.
-              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
-              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
-
-  my $failed = 0;
-  foreach (@tests)
-    {
-      my ($inref, $outref) = @$_;
-      my @inconds = map { new Automake::Condition $_ } @$inref;
-      my @outconds = map { (new Automake::Condition $_)->string } @$outref;
-      my @res =
-       map { $_->string } (Automake::Condition::reduce_or (@inconds));
-      my $result = join (",", sort @res);
-      my $exresult = join (",", @outconds);
-
-      if ($result ne $exresult)
-       {
-         print '"' . join(",", @$inref) . '" => "' .
-           $result . '" expected "' .
-             $exresult . '"' . "\n";
-         $failed = 1;
-       }
-    }
-  return $failed;
-}
-
-exit (test_basics || test_true_when || test_reduce_and || test_reduce_or);
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/lib/Automake/tests/DisjConditions-t.pl b/lib/Automake/tests/DisjConditions-t.pl
deleted file mode 100644 (file)
index 2fe275b..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-BEGIN {
-  use Config;
-  if (eval { require 5.007_002; }      # for CLONE support
-      && $Config{useithreads})
-    {
-      require threads;
-      import threads;
-    }
-  else
-    {
-      exit 77;
-    }
-}
-use Automake::Condition qw/TRUE FALSE/;
-use Automake::DisjConditions;
-
-sub test_basics ()
-{
-  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
-  return threads->new (sub {
-    my $other = new Automake::Condition "COND3_FALSE";
-    return threads->new (sub {
-      my $set1 = new Automake::DisjConditions $cond, $other;
-      return threads->new (sub {
-       my $set2 = new Automake::DisjConditions $other, $cond;
-       return 1 unless $set1 == $set2;
-       return 1 if $set1->false;
-       return 1 if $set1->true;
-       return 1 unless (new Automake::DisjConditions)->false;
-       return 1 if (new Automake::DisjConditions)->true;
-      })->join;
-    })->join;
-  })->join;
-}
-
-sub build_set (@)
-{
-  my @conds = @_;
-  my @set = ();
-  for my $cond (@conds)
-    {
-      push @set, new Automake::Condition @$cond;
-    }
-  return new Automake::DisjConditions @set;
-}
-
-sub test_invert ()
-{
-  my @tests = ([[["FALSE"]],
-               [["TRUE"]]],
-
-              [[["TRUE"]],
-               [["FALSE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["COND3_FALSE", "COND2_TRUE"]],
-               [["COND2_FALSE"],
-                ["COND1_FALSE", "COND3_TRUE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["TRUE"]],
-               [["FALSE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["FALSE"]],
-               [["COND1_FALSE"],
-                ["COND2_FALSE"]]],
-
-              [[["COND1_TRUE"],
-                ["COND2_FALSE"]],
-               [["COND1_FALSE", "COND2_TRUE"]]]
-              );
-
-  for my $t (@tests)
-    {
-      my $set = build_set @{$t->[0]};
-      return 1
-        if threads->new(sub {
-         my $res = build_set @{$t->[1]};
-         my $inv = $set->invert;
-         if ($inv != $res)
-           {
-             print " (I) " . $set->string . "\n\t"
-               . $inv->string . ' != ' . $res->string . "\n";
-             return 1;
-           }
-         return 0
-       })-> join;
-    }
-  return 0;
-}
-
-sub test_simplify ()
-{
-  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"]],
-               [["FOO_TRUE", "BAR_FALSE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_TRUE", "BAR_TRUE"]],
-               [["FOO_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_TRUE", "BAR_TRUE"],
-                ["FOO_FALSE"]],
-               [["TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                            ["BAR_TRUE",  "BAZ_TRUE"],
-                            ["BAR_FALSE", "BAZ_TRUE"]],
-               [["BAZ_TRUE"], ["FOO_TRUE", "BAR_FALSE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                            ["BAR_TRUE",  "BAZ_TRUE"],
-                            ["BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               [["FOO_FALSE"], ["BAZ_TRUE"], ["BAR_FALSE"]]],
-
-              [[["B_TRUE"],
-                ["A_FALSE", "B_TRUE"]],
-               [["B_TRUE"]]],
-
-              [[["B_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_FALSE"]],
-               [["A_FALSE"], ["B_TRUE"]]],
-
-              [[["B_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_FALSE"],
-                ["A_TRUE", "B_FALSE"]],
-               [["TRUE"]]],
-
-              [[["A_TRUE", "B_TRUE"],
-                ["A_TRUE", "B_FALSE"],
-                ["A_TRUE", "C_FALSE", "D_FALSE"]],
-               [["A_TRUE"]]],
-
-              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"]],
-               [           ["B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                           ["B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                           ["B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                           ["B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"]]],
-
-              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"]],
-               [["C_FALSE", "E_FALSE"],
-                ["C_TRUE", "E_TRUE"]]],
-
-              [[["A_FALSE"],
-                ["A_TRUE", "B_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE", "F_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"]],
-               [["TRUE"]]],
-
-              # Simplify should work with up to 31 variables.
-              [[["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_TRUE"],
-                ["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_FALSE"],
-                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_TRUE"],
-                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_FALSE"]],
-               [[            "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE"
-                 ]]]);
-
-  for my $t (@tests)
-    {
-      my $set = build_set @{$t->[0]};
-      return 1
-       if threads->new(sub {
-         my $res = build_set @{$t->[1]};
-         return threads->new(sub {
-
-           # Make sure simplify() yields the expected result.
-           my $sim = $set->simplify;
-           return threads->new(sub {
-             if ($sim != $res)
-               {
-                 print " (S1) " . $set->string . "\n\t"
-                   . $sim->string . ' != ' . $res->string . "\n";
-                 return 1;
-               }
-
-             # Make sure simplify() is idempotent.
-             my $sim2 = $sim->simplify;
-             return threads->new(sub {
-               if ($sim2 != $sim)
-                 {
-                   print " (S2) " . $sim->string . "\n\t"
-                     . $sim2->string . ' != ' . $sim->string . "\n";
-                   return 1;
-                 }
-
-               # Also exercise invert() while we are at it.
-
-               my $inv1 = $set->invert->simplify;
-               return threads->new(sub {
-                 my $inv2 = $sim->invert->simplify;
-                 return threads->new(sub {
-                   if ($inv1 != $inv2)
-                     {
-                       print " (S3) " . $set->string . ", " . $sim->string . "\n\t"
-                         . $inv1->string . ' -= ' . $inv2->string . "\n";
-                       return 1;
-                     }
-                 })->join;
-               })->join;
-             })->join;
-           })->join;
-         })->join;
-       })->join;
-    }
-
-  return 0;
-}
-
-sub test_sub_conditions ()
-{
-  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE"],
-               [["BAR_FALSE", "BAZ_FALSE"],
-                ["BAR_FALSE", "BAZ_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE", "BAR_FALSE"],
-               [["BAZ_FALSE"],
-                ["BAZ_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE", "BAR_TRUE"],
-               [["FALSE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE", "BAR_TRUE"],
-               [["BAZ_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE"],
-                ["FOO_TRUE", "BAR_TRUE"]],
-               ["FOO_TRUE", "BAR_TRUE"],
-               [["TRUE"]]],
-
-              [[["TRUE"]],
-               ["TRUE"],
-               [["TRUE"]]],
-
-              [[["FALSE"]],
-               ["TRUE"],
-               [["FALSE"]]],
-
-              [[["FALSE"]],
-               ["FALSE"],
-               [["FALSE"]]]);
-
-  for my $t (@tests)
-    {
-      my $t1 = build_set @{$t->[0]};
-      return 1
-        if threads->new(sub {
-         my $t2 = new Automake::Condition @{$t->[1]};
-         return threads->new(sub {
-           my $t3 = build_set @{$t->[2]};
-           return threads->new(sub {
-
-             # Make sure sub_conditions() yields the expected result.
-             my $s = $t1->sub_conditions ($t2);
-             threads->new(sub {
-               if ($s != $t3)
-                 {
-                   print " (SC) " . $t1->string . "\n\t"
-                     . $s->string . ' != ' . $t3->string . "\n";
-                   return 1;
-                 }
-             })->join;
-           })->join;
-         })->join;
-       })->join;
-    }
-}
-
-sub test_ambig ()
-{
-  my @tests = ([[["TRUE"]],
-               ["TRUE"],
-               "multiply defined"],
-              [[["C1_TRUE"]],
-               ["C1_TRUE"],
-               "multiply defined"],
-              [[["TRUE"]],
-                ["C1_FALSE"],
-               "which includes"],
-              [[["C1_TRUE"]],
-               ["C1_TRUE", "C2_TRUE"],
-               "which includes"],
-              [[["C1_TRUE", "C2_TRUE"]],
-               ["C2_TRUE"],
-               "which is included in"],
-              [[["C1_TRUE"]],
-               ["C2_TRUE"],
-               ''],
-              [[["C1_TRUE"],
-                ["C2_FALSE"]],
-               ["C1_FALSE", "C2_TRUE"],
-               '']);
-
-  my $failed = 0;
-  for my $t (@tests)
-    {
-      my $t1 = build_set @{$t->[0]};
-      $failed = 1
-        if threads->new(sub {
-         my $t2 = new Automake::Condition @{$t->[1]};
-         my $t3 = $t->[2];
-         return threads->new(sub {
-           my ($ans, $cond) = $t1->ambiguous_p ("FOO", $t2);
-           return threads->new(sub {
-             if ($t3 && $ans !~ /FOO.*$t3/)
-               {
-                 print " (A1) " . $t1->string . " vs. " . $t2->string . "\n\t"
-                   . "Error message '$ans' does not match '$t3'\n";
-                 return 1;
-               }
-             if (!$t3 && $ans ne '')
-               {
-                 print " (A2) " . $t1->string . " vs. " . $t2->string . "\n\t"
-                   . "Unexpected error message: $ans\n";
-                 return 1;
-               }
-           })->join;
-         })->join;
-       })->join;
-    }
-  return $failed;
-}
-
-exit (test_basics
-      || test_invert
-      || test_simplify
-      || test_sub_conditions
-      || test_ambig);
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/lib/Automake/tests/DisjConditions.pl b/lib/Automake/tests/DisjConditions.pl
deleted file mode 100644 (file)
index 47dea83..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-use Automake::Condition qw/TRUE FALSE/;
-use Automake::DisjConditions;
-
-sub test_basics ()
-{
-  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
-  my $other = new Automake::Condition "COND3_FALSE";
-  my $set1 = new Automake::DisjConditions $cond, $other;
-  my $set2 = new Automake::DisjConditions $other, $cond;
-  return 1 unless $set1 == $set2;
-  return 1 if $set1->false;
-  return 1 if $set1->true;
-  return 1 unless (new Automake::DisjConditions)->false;
-  return 1 if (new Automake::DisjConditions)->true;
-}
-
-sub build_set (@)
-{
-  my @conds = @_;
-  my @set = ();
-  for my $cond (@conds)
-    {
-      push @set, new Automake::Condition @$cond;
-    }
-  return new Automake::DisjConditions @set;
-}
-
-sub test_invert ()
-{
-  my @tests = ([[["FALSE"]],
-               [["TRUE"]]],
-
-              [[["TRUE"]],
-               [["FALSE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["COND3_FALSE", "COND2_TRUE"]],
-               [["COND2_FALSE"],
-                ["COND1_FALSE", "COND3_TRUE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["TRUE"]],
-               [["FALSE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["FALSE"]],
-               [["COND1_FALSE"],
-                ["COND2_FALSE"]]],
-
-              [[["COND1_TRUE"],
-                ["COND2_FALSE"]],
-               [["COND1_FALSE", "COND2_TRUE"]]]
-              );
-
-  for my $t (@tests)
-    {
-      my $set = build_set @{$t->[0]};
-      my $res = build_set @{$t->[1]};
-      my $inv = $set->invert;
-      if ($inv != $res)
-       {
-         print " (I) " . $set->string . "\n\t"
-           . $inv->string . ' != ' . $res->string . "\n";
-         return 1;
-       }
-    }
-  return 0;
-}
-
-sub test_simplify ()
-{
-  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"]],
-               [["FOO_TRUE", "BAR_FALSE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_TRUE", "BAR_TRUE"]],
-               [["FOO_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_TRUE", "BAR_TRUE"],
-                ["FOO_FALSE"]],
-               [["TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                            ["BAR_TRUE",  "BAZ_TRUE"],
-                            ["BAR_FALSE", "BAZ_TRUE"]],
-               [["BAZ_TRUE"], ["FOO_TRUE", "BAR_FALSE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                            ["BAR_TRUE",  "BAZ_TRUE"],
-                            ["BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               [["FOO_FALSE"], ["BAZ_TRUE"], ["BAR_FALSE"]]],
-
-              [[["B_TRUE"],
-                ["A_FALSE", "B_TRUE"]],
-               [["B_TRUE"]]],
-
-              [[["B_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_FALSE"]],
-               [["A_FALSE"], ["B_TRUE"]]],
-
-              [[["B_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE"],
-                ["A_FALSE", "B_FALSE", "C_FALSE"],
-                ["A_TRUE", "B_FALSE"]],
-               [["TRUE"]]],
-
-              [[["A_TRUE", "B_TRUE"],
-                ["A_TRUE", "B_FALSE"],
-                ["A_TRUE", "C_FALSE", "D_FALSE"]],
-               [["A_TRUE"]]],
-
-              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"]],
-               [           ["B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                           ["B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                           ["B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                           ["B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"]]],
-
-              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"],
-                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
-                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
-                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"]],
-               [["C_FALSE", "E_FALSE"],
-                ["C_TRUE", "E_TRUE"]]],
-
-              [[["A_FALSE"],
-                ["A_TRUE", "B_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE", "F_FALSE"],
-                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"]],
-               [["TRUE"]]],
-
-              # Simplify should work with up to 31 variables.
-              [[["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_TRUE"],
-                ["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_FALSE"],
-                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_TRUE"],
-                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
-                 "V31_FALSE"]],
-               [[            "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
-                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
-                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
-                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
-                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
-                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE"
-                 ]]]);
-
-  for my $t (@tests)
-    {
-      my $set = build_set @{$t->[0]};
-      my $res = build_set @{$t->[1]};
-
-      # Make sure simplify() yields the expected result.
-      my $sim = $set->simplify;
-      if ($sim != $res)
-       {
-         print " (S1) " . $set->string . "\n\t"
-           . $sim->string . ' != ' . $res->string . "\n";
-         return 1;
-       }
-
-      # Make sure simplify() is idempotent.
-      my $sim2 = $sim->simplify;
-      if ($sim2 != $sim)
-       {
-         print " (S2) " . $sim->string . "\n\t"
-           . $sim2->string . ' != ' . $sim->string . "\n";
-         return 1;
-       }
-
-      # Also exercise invert() while we are at it.
-
-      my $inv1 = $set->invert->simplify;
-      my $inv2 = $sim->invert->simplify;
-      if ($inv1 != $inv2)
-       {
-         print " (S3) " . $set->string . ", " . $sim->string . "\n\t"
-           . $inv1->string . ' != ' . $inv2->string . "\n";
-         return 1;
-       }
-    }
-
-  return 0;
-}
-
-sub test_sub_conditions ()
-{
-  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE"],
-               [["BAR_FALSE", "BAZ_FALSE"],
-                ["BAR_FALSE", "BAZ_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE", "BAR_FALSE"],
-               [["BAZ_FALSE"],
-                ["BAZ_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE", "BAR_TRUE"],
-               [["FALSE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
-                ["FOO_TRUE", "BAZ_TRUE"],
-                ["FOO_FALSE"]],
-               ["FOO_TRUE", "BAR_TRUE"],
-               [["BAZ_TRUE"]]],
-
-              [[["FOO_TRUE", "BAR_FALSE"],
-                ["FOO_TRUE", "BAR_TRUE"]],
-               ["FOO_TRUE", "BAR_TRUE"],
-               [["TRUE"]]],
-
-              [[["TRUE"]],
-               ["TRUE"],
-               [["TRUE"]]],
-
-              [[["FALSE"]],
-               ["TRUE"],
-               [["FALSE"]]],
-
-              [[["FALSE"]],
-               ["FALSE"],
-               [["FALSE"]]]);
-
-  for my $t (@tests)
-    {
-      my $t1 = build_set @{$t->[0]};
-      my $t2 = new Automake::Condition @{$t->[1]};
-      my $t3 = build_set @{$t->[2]};
-
-      # Make sure sub_conditions() yields the expected result.
-      my $s = $t1->sub_conditions ($t2);
-      if ($s != $t3)
-       {
-         print " (SC) " . $t1->string . "\n\t"
-           . $s->string . ' != ' . $t3->string . "\n";
-         return 1;
-       }
-    }
-}
-
-sub test_ambig ()
-{
-  my @tests = ([[["TRUE"]],
-               ["TRUE"],
-               "multiply defined"],
-              [[["C1_TRUE"]],
-               ["C1_TRUE"],
-               "multiply defined"],
-              [[["TRUE"]],
-                ["C1_FALSE"],
-               "which includes"],
-              [[["C1_TRUE"]],
-               ["C1_TRUE", "C2_TRUE"],
-               "which includes"],
-              [[["C1_TRUE", "C2_TRUE"]],
-               ["C2_TRUE"],
-               "which is included in"],
-              [[["C1_TRUE"]],
-               ["C2_TRUE"],
-               ''],
-              [[["C1_TRUE"],
-                ["C2_FALSE"]],
-               ["C1_FALSE", "C2_TRUE"],
-               '']);
-
-  for my $t (@tests)
-    {
-      my $t1 = build_set @{$t->[0]};
-      my $t2 = new Automake::Condition @{$t->[1]};
-      my $t3 = $t->[2];
-      my ($ans, $cond) = $t1->ambiguous_p ("FOO", $t2);
-      if ($t3 && $ans !~ /FOO.*$t3/)
-       {
-         print " (A1) " . $t1->string . " vs. " . $t2->string . "\n\t"
-           . "Error message '$ans' does not match '$t3'\n";
-         return 1;
-       }
-      if (!$t3 && $ans ne '')
-       {
-         print " (A2) " . $t1->string . " vs. " . $t2->string . "\n\t"
-           . "Unexpected error message: $ans\n";
-         return 1;
-       }
-    }
-  return 0;
-}
-
-exit (test_basics
-      || test_invert
-      || test_simplify
-      || test_sub_conditions
-      || test_ambig);
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/lib/Automake/tests/Makefile.am b/lib/Automake/tests/Makefile.am
deleted file mode 100644 (file)
index a537fd1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to create Makefile.in
-
-# Copyright (C) 2002, 2003, 2008, 2009, 2012 Free Software Foundation,
-# Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-PL_LOG_COMPILER = $(PERL)
-AM_PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w
-TEST_EXTENSIONS = .pl
-
-TESTS = \
-Condition.pl \
-Condition-t.pl \
-DisjConditions.pl \
-DisjConditions-t.pl \
-Version.pl \
-Wrap.pl
-
-EXTRA_DIST = $(TESTS)
-
-include $(top_srcdir)/CheckListOfTests.am
diff --git a/lib/Automake/tests/Version.pl b/lib/Automake/tests/Version.pl
deleted file mode 100644 (file)
index e496435..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-use Automake::Version;
-
-my $failed = 0;
-
-sub test_version_compare
-{
-  my ($left, $right, $result) = @_;
-  my @leftver = Automake::Version::split ($left);
-  my @rightver = Automake::Version::split ($right);
-  if ($#leftver == -1)
-  {
-    print "can't grok \"$left\"\n";
-    $failed = 1;
-    return;
-  }
-  if ($#rightver == -1)
-  {
-    print "can't grok \"$right\"\n";
-    $failed = 1;
-    return;
-  }
-  my $res = Automake::Version::compare (@leftver, @rightver);
-  if ($res != $result)
-  {
-    print "compare (\"$left\", \"$right\") = $res! (not $result?)\n";
-    $failed = 1;
-  }
-}
-
-my @tests = (
-# basics
-  ['1.0', '2.0', -1],
-  ['2.0', '1.0', 1],
-  ['1.2', '1.2', 0],
-  ['1.1', '1.2', -1],
-  ['1.2', '1.1', 1],
-# alphas
-  ['1.4', '1.4g', -1],
-  ['1.4g', '1.5', -1],
-  ['1.4g', '1.4', 1],
-  ['1.5', '1.4g', 1],
-  ['1.4a', '1.4g', -1],
-  ['1.5a', '1.3g', 1],
-  ['1.6a', '1.6a', 0],
-# micros
-  ['1.5.1', '1.5', 1],
-  ['1.5.0', '1.5', 0],
-  ['1.5.4', '1.6.1', -1],
-# micros and alphas
-  ['1.5a', '1.5.1', 1],
-  ['1.5a', '1.5.1a', 1],
-  ['1.5a', '1.5.1f', 1],
-  ['1.5', '1.5.1a', -1],
-  ['1.5.1a', '1.5.1f', -1],
-# special exceptions
-  ['1.6-p5a', '1.6.5a', 0],
-  ['1.6', '1.6-p5a', -1],
-  ['1.6-p4b', '1.6-p5a', -1],
-  ['1.6-p4b', '1.6-foo', 1],
-  ['1.6-p4b', '1.6a-foo', -1]
-);
-
-test_version_compare (@{$_}) foreach @tests;
-
-exit $failed;
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/lib/Automake/tests/Wrap.pl b/lib/Automake/tests/Wrap.pl
deleted file mode 100644 (file)
index 8d840fc..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright (C) 2003  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-use Automake::Wrap 'wrap';
-
-my $failed = 0;
-
-sub test_wrap
-{
-  my ($in, $exp_out) = @_;
-
-  my $out = &wrap (@$in);
-  if ($out ne $exp_out)
-    {
-      print STDERR "For: @$in\nGot:\n$out\nInstead of:\n$exp_out\n---\n";
-      ++$failed;
-    }
-}
-
-my @tests = (
-  [["HEAD:", "NEXT:", "CONT", 13, "v" ,"a", "l", "ue", "s", "values"],
-"HEAD:v aCONT
-NEXT:l ueCONT
-NEXT:sCONT
-NEXT:values
-"],
-  [["rule: ", "\t", " \\", 20, "dep1" ,"dep2", "dep3", "dep4", "dep5",
-    "dep06", "dep07", "dep08"],
-"rule: dep1 dep2 \\
-\tdep3 dep4 \\
-\tdep5 dep06 \\
-\tdep07 \\
-\tdep08
-"],
-  [["big header:", "big continuation:", " END", 5, "diag1", "diag2", "diag3"],
-"big header:diag1 END
-big continuation:diag2 END
-big continuation:diag3
-"],
-  [["big header:", "cont: ", " END", 16, "word1", "word2"],
-"big header: END
-cont: word1 END
-cont: word2
-"]);
-
-
-test_wrap (@{$_}) foreach @tests;
-
-exit $failed;
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
index c2daff4fbe1b991d38f05a0fd81d3959dbf67bf8..4939aab972499f3a145d456352c4272d4070bb82 100644 (file)
@@ -52,6 +52,11 @@ TESTS_ENVIRONMENT = \
   test x"$$required" = x || unset required; \
   test x"$$parallel_tests" = x || unset parallel_tests;
 
+TEST_EXTENSIONS = .pl .test
+
+PL_LOG_COMPILER = $(PERL)
+AM_PL_LOG_FLAGS = -Mstrict -I $(top_builddir)/lib -I $(top_srcdir)/lib -w
+
 include $(srcdir)/list-of-tests.mk
 
 TESTS = $(handwritten_TESTS) $(parallel_tests)
@@ -128,6 +133,7 @@ EXTRA_DIST += distcheck-hook-m4.am
 check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
 
 ## Checking the list of tests.
+test_subdirs = . pm
 include $(top_srcdir)/CheckListOfTests.am
 maintainer-check-list-of-tests: $(parallel_tests)
 
index 6e4412f5dd11ba2b9e603d797cca1df51784c47c..7585e2bc0b96e7a48721d9d7735877431ad9de1b 100644 (file)
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+perl_TESTS = \
+pm/Condition.pl \
+pm/Condition-t.pl \
+pm/DisjConditions.pl \
+pm/DisjConditions-t.pl \
+pm/Version.pl \
+pm/Wrap.pl
+
 # The order here is mostly alphabetical, with the deliberate exception
 # that tests having a high runtime (especially TAP tests that run various
 # checks sequentially) are listed early; this improves performance on
 # concurrent testsuite runs.
 handwritten_TESTS = \
 get-sysconf.test \
+$(perl_TESTS) \
 self-check-env-sanitize.test \
 self-check-report.test \
 aclibobj.test \
diff --git a/tests/pm/Condition-t.pl b/tests/pm/Condition-t.pl
new file mode 100644 (file)
index 0000000..06eb34e
--- /dev/null
@@ -0,0 +1,301 @@
+# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+BEGIN {
+  use Config;
+  if (eval { require 5.007_002; }      # for CLONE support
+      && $Config{useithreads})
+    {
+      require threads;
+      import threads;
+    }
+  else
+    {
+      exit 77;
+    }
+}
+use Automake::Condition qw/TRUE FALSE/;
+
+sub test_basics ()
+{
+  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string]
+              [[], 1, 0, 'TRUE', ''],
+              [['TRUE'], 1, 0, 'TRUE', ''],
+              [['FALSE'], 0, 1, 'FALSE', '#'],
+              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@'],
+              [['A_TRUE', 'B_FALSE'],
+               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@'],
+              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#'],
+              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#']);
+
+  for (@tests)
+    {
+      my $a = new Automake::Condition @{$_->[0]};
+      return 1
+        if threads->new(sub {
+         return 1 if $_->[1] != $a->true;
+         return 1 if $_->[1] != ($a == TRUE);
+         return 1 if $_->[2] != $a->false;
+         return 1 if $_->[2] != ($a == FALSE);
+         return 1 if $_->[3] ne $a->string;
+         return 1 if $_->[4] ne $a->subst_string;
+       })->join;
+    }
+  return 0;
+}
+
+sub test_true_when ()
+{
+  my $failed = 0;
+
+  my @tests = (# [When,
+              #  [Implied-Conditions],
+              #  [Not-Implied-Conditions]]
+              [['TRUE'],
+               [['TRUE']],
+               [['A_TRUE'], ['A_TRUE', 'B_FALSE'], ['FALSE']]],
+              [['A_TRUE'],
+               [['TRUE'], ['A_TRUE']],
+               [['A_TRUE', 'B_FALSE'], ['FALSE']]],
+              [['A_TRUE', 'B_FALSE'],
+               [['TRUE'], ['A_TRUE'], ['B_FALSE'], ['A_TRUE', 'B_FALSE']],
+               [['FALSE'], ['C_FALSE'], ['C_FALSE', 'A_TRUE']]]);
+
+  for my $t (@tests)
+    {
+      my $a = new Automake::Condition @{$t->[0]};
+      return 1
+        if threads->new(sub {
+         for my $u (@{$t->[1]})
+           {
+             my $b = new Automake::Condition @$u;
+             return threads->new(sub {
+               if (! $b->true_when ($a))
+                 {
+                   print "`" . $b->string .
+                     "' not implied by `" . $a->string . "'?\n";
+                   $failed = 1;
+                 }
+             })->join;
+           }
+         for my $u (@{$t->[2]})
+           {
+             my $b = new Automake::Condition @$u;
+             return threads->new(sub {
+               if ($b->true_when ($a))
+                 {
+                   print "`" . $b->string .
+                     "' implied by `" . $a->string . "'?\n";
+                   $failed = 1;
+                 }
+
+               return threads->new(sub {
+                 return 1 if $b->true_when ($a);
+               })->join;
+             })->join;
+           }
+        })->join;
+    }
+  return $failed;
+}
+
+sub test_reduce_and ()
+{
+  my @tests = (# If no conditions are given, TRUE should be returned
+              [[], ["TRUE"]],
+              # An empty condition is TRUE
+              [[""], ["TRUE"]],
+              # A single condition should be passed through unchanged
+              [["FOO"], ["FOO"]],
+              [["FALSE"], ["FALSE"]],
+              [["TRUE"], ["TRUE"]],
+              # TRUE and false should be discarded and overwhelm
+              # the result, respectively
+              [["FOO", "TRUE"], ["FOO"]],
+              [["FOO", "FALSE"], ["FALSE"]],
+              # Repetitions should be removed
+              [["FOO", "FOO"], ["FOO"]],
+              [["TRUE", "FOO", "FOO"], ["FOO"]],
+              [["FOO", "TRUE", "FOO"], ["FOO"]],
+              [["FOO", "FOO", "TRUE"], ["FOO"]],
+              # Two different conditions should be preserved,
+              # but TRUEs should be removed
+              [["FOO", "BAR"], ["BAR,FOO"]],
+              [["TRUE", "FOO", "BAR"], ["BAR,FOO"]],
+              [["FOO", "TRUE", "BAR"], ["BAR,FOO"]],
+              [["FOO", "BAR", "TRUE"], ["BAR,FOO"]],
+              # A condition implied by another condition should be removed.
+              [["FOO BAR", "BAR"], ["FOO BAR"]],
+              [["BAR", "FOO BAR"], ["FOO BAR"]],
+              [["TRUE", "FOO BAR", "BAR"], ["FOO BAR"]],
+              [["FOO BAR", "TRUE", "BAR"], ["FOO BAR"]],
+              [["FOO BAR", "BAR", "TRUE"], ["FOO BAR"]],
+
+              [["BAR FOO", "BAR"], ["BAR FOO"]],
+              [["BAR", "BAR FOO"], ["BAR FOO"]],
+              [["TRUE", "BAR FOO", "BAR"], ["BAR FOO"]],
+              [["BAR FOO", "TRUE", "BAR"], ["BAR FOO"]],
+              [["BAR FOO", "BAR", "TRUE"], ["BAR FOO"]],
+
+              # Check that reduction happens even when there are
+              # two conditions to remove.
+              [["FOO", "FOO BAR", "BAR"], ["FOO BAR"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["FOO BAR", "FOO BAZ"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
+               ["FOO BAZ BAR"]],
+
+              # Duplicated conditionals should be removed.
+              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
+
+              # Equivalent conditions in different forms should be
+              # reduced: which one is left is unfortunately order
+              # dependent.
+              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
+              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
+
+  my $failed = 0;
+  foreach (@tests)
+    {
+      my ($inref, $outref) = @$_;
+      my @inconds = map { new Automake::Condition $_ } @$inref;
+      return 1
+        if threads->new(sub {
+         my @outconds = map { (new Automake::Condition $_)->string } @$outref;
+         return threads->new(sub {
+           my @res =
+             map { $_->string } (Automake::Condition::reduce_and (@inconds));
+           return threads->new(sub {
+             my $result = join (",", sort @res);
+             my $exresult = join (",", @outconds);
+
+             if ($result ne $exresult)
+               {
+                 print '"' . join(",", @$inref) . '" => "' .
+                   $result . '" expected "' .
+                     $exresult . '"' . "\n";
+                 $failed = 1;
+               }
+             return $failed;
+           })->join;
+         })->join;
+       })->join;
+    }
+  return $failed;
+}
+
+sub test_reduce_or ()
+{
+  my @tests = (# If no conditions are given, FALSE should be returned
+              [[], ["FALSE"]],
+              # An empty condition is TRUE
+              [[""], ["TRUE"]],
+              # A single condition should be passed through unchanged
+              [["FOO"], ["FOO"]],
+              [["FALSE"], ["FALSE"]],
+              [["TRUE"], ["TRUE"]],
+              # FALSE and TRUE should be discarded and overwhelm
+              # the result, respectively
+              [["FOO", "TRUE"], ["TRUE"]],
+              [["FOO", "FALSE"], ["FOO"]],
+              # Repetitions should be removed
+              [["FOO", "FOO"], ["FOO"]],
+              [["FALSE", "FOO", "FOO"], ["FOO"]],
+              [["FOO", "FALSE", "FOO"], ["FOO"]],
+              [["FOO", "FOO", "FALSE"], ["FOO"]],
+              # Two different conditions should be preserved,
+              # but FALSEs should be removed
+              [["FOO", "BAR"], ["BAR,FOO"]],
+              [["FALSE", "FOO", "BAR"], ["BAR,FOO"]],
+              [["FOO", "FALSE", "BAR"], ["BAR,FOO"]],
+              [["FOO", "BAR", "FALSE"], ["BAR,FOO"]],
+              # A condition implying another condition should be removed.
+              [["FOO BAR", "BAR"], ["BAR"]],
+              [["BAR", "FOO BAR"], ["BAR"]],
+              [["FALSE", "FOO BAR", "BAR"], ["BAR"]],
+              [["FOO BAR", "FALSE", "BAR"], ["BAR"]],
+              [["FOO BAR", "BAR", "FALSE"], ["BAR"]],
+
+              [["BAR FOO", "BAR"], ["BAR"]],
+              [["BAR", "BAR FOO"], ["BAR"]],
+              [["FALSE", "BAR FOO", "BAR"], ["BAR"]],
+              [["BAR FOO", "FALSE", "BAR"], ["BAR"]],
+              [["BAR FOO", "BAR", "FALSE"], ["BAR"]],
+
+              # Check that reduction happens even when there are
+              # two conditions to remove.
+              [["FOO", "FOO BAR", "BAR"], ["BAR,FOO"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["BAZ,FOO"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
+               ["BAZ,FOO"]],
+
+              # Duplicated conditionals should be removed.
+              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
+
+              # Equivalent conditions in different forms should be
+              # reduced: which one is left is unfortunately order
+              # dependent.
+              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
+              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
+
+  my $failed = 0;
+  foreach (@tests)
+    {
+      my ($inref, $outref) = @$_;
+      my @inconds = map { new Automake::Condition $_ } @$inref;
+      return 1
+        if threads->new(sub {
+         my @outconds = map { (new Automake::Condition $_)->string } @$outref;
+         return threads->new(sub {
+           my @res =
+             map { $_->string } (Automake::Condition::reduce_or (@inconds));
+           return threads->new(sub {
+             my $result = join (",", sort @res);
+             my $exresult = join (",", @outconds);
+
+             if ($result ne $exresult)
+               {
+                 print '"' . join(",", @$inref) . '" => "' .
+                   $result . '" expected "' .
+                     $exresult . '"' . "\n";
+                 $failed = 1;
+               }
+             return $failed;
+           })->join;
+         })->join;
+       })->join;
+    }
+  return $failed;
+}
+
+exit (test_basics || test_true_when || test_reduce_and || test_reduce_or);
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/tests/pm/Condition.pl b/tests/pm/Condition.pl
new file mode 100644 (file)
index 0000000..86f1745
--- /dev/null
@@ -0,0 +1,260 @@
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use Automake::Condition qw/TRUE FALSE/;
+
+sub test_basics ()
+{
+  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string]
+              [[], 1, 0, 'TRUE', ''],
+              [['TRUE'], 1, 0, 'TRUE', ''],
+              [['FALSE'], 0, 1, 'FALSE', '#'],
+              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@'],
+              [['A_TRUE', 'B_FALSE'],
+               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@'],
+              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#'],
+              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#']);
+
+  for (@tests)
+    {
+      my $a = new Automake::Condition @{$_->[0]};
+      return 1 if $_->[1] != $a->true;
+      return 1 if $_->[1] != ($a == TRUE);
+      return 1 if $_->[2] != $a->false;
+      return 1 if $_->[2] != ($a == FALSE);
+      return 1 if $_->[3] ne $a->string;
+      return 1 if $_->[4] ne $a->subst_string;
+    }
+  return 0;
+}
+
+sub test_true_when ()
+{
+  my $failed = 0;
+
+  my @tests = (# [When,
+              #  [Implied-Conditions],
+              #  [Not-Implied-Conditions]]
+              [['TRUE'],
+               [['TRUE']],
+               [['A_TRUE'], ['A_TRUE', 'B_FALSE'], ['FALSE']]],
+              [['A_TRUE'],
+               [['TRUE'], ['A_TRUE']],
+               [['A_TRUE', 'B_FALSE'], ['FALSE']]],
+              [['A_TRUE', 'B_FALSE'],
+               [['TRUE'], ['A_TRUE'], ['B_FALSE'], ['A_TRUE', 'B_FALSE']],
+               [['FALSE'], ['C_FALSE'], ['C_FALSE', 'A_TRUE']]]);
+
+  for my $t (@tests)
+    {
+      my $a = new Automake::Condition @{$t->[0]};
+      for my $u (@{$t->[1]})
+       {
+         my $b = new Automake::Condition @$u;
+         if (! $b->true_when ($a))
+           {
+             print "`" . $b->string .
+               "' not implied by `" . $a->string . "'?\n";
+             $failed = 1;
+           }
+       }
+      for my $u (@{$t->[2]})
+       {
+         my $b = new Automake::Condition @$u;
+         if ($b->true_when ($a))
+           {
+             print "`" . $b->string .
+               "' implied by `" . $a->string . "'?\n";
+             $failed = 1;
+           }
+
+         return 1 if $b->true_when ($a);
+       }
+    }
+  return $failed;
+}
+
+sub test_reduce_and ()
+{
+  my @tests = (# If no conditions are given, TRUE should be returned
+              [[], ["TRUE"]],
+              # An empty condition is TRUE
+              [[""], ["TRUE"]],
+              # A single condition should be passed through unchanged
+              [["FOO"], ["FOO"]],
+              [["FALSE"], ["FALSE"]],
+              [["TRUE"], ["TRUE"]],
+              # TRUE and false should be discarded and overwhelm
+              # the result, respectively
+              [["FOO", "TRUE"], ["FOO"]],
+              [["FOO", "FALSE"], ["FALSE"]],
+              # Repetitions should be removed
+              [["FOO", "FOO"], ["FOO"]],
+              [["TRUE", "FOO", "FOO"], ["FOO"]],
+              [["FOO", "TRUE", "FOO"], ["FOO"]],
+              [["FOO", "FOO", "TRUE"], ["FOO"]],
+              # Two different conditions should be preserved,
+              # but TRUEs should be removed
+              [["FOO", "BAR"], ["BAR,FOO"]],
+              [["TRUE", "FOO", "BAR"], ["BAR,FOO"]],
+              [["FOO", "TRUE", "BAR"], ["BAR,FOO"]],
+              [["FOO", "BAR", "TRUE"], ["BAR,FOO"]],
+              # A condition implied by another condition should be removed.
+              [["FOO BAR", "BAR"], ["FOO BAR"]],
+              [["BAR", "FOO BAR"], ["FOO BAR"]],
+              [["TRUE", "FOO BAR", "BAR"], ["FOO BAR"]],
+              [["FOO BAR", "TRUE", "BAR"], ["FOO BAR"]],
+              [["FOO BAR", "BAR", "TRUE"], ["FOO BAR"]],
+
+              [["BAR FOO", "BAR"], ["BAR FOO"]],
+              [["BAR", "BAR FOO"], ["BAR FOO"]],
+              [["TRUE", "BAR FOO", "BAR"], ["BAR FOO"]],
+              [["BAR FOO", "TRUE", "BAR"], ["BAR FOO"]],
+              [["BAR FOO", "BAR", "TRUE"], ["BAR FOO"]],
+
+              # Check that reduction happens even when there are
+              # two conditions to remove.
+              [["FOO", "FOO BAR", "BAR"], ["FOO BAR"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["FOO BAR", "FOO BAZ"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
+               ["FOO BAZ BAR"]],
+
+              # Duplicated conditionals should be removed.
+              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
+
+              # Equivalent conditions in different forms should be
+              # reduced: which one is left is unfortunately order
+              # dependent.
+              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
+              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
+
+  my $failed = 0;
+  foreach (@tests)
+    {
+      my ($inref, $outref) = @$_;
+      my @inconds = map { new Automake::Condition $_ } @$inref;
+      my @outconds = map { (new Automake::Condition $_)->string } @$outref;
+      my @res =
+       map { $_->string } (Automake::Condition::reduce_and (@inconds));
+      my $result = join (",", sort @res);
+      my $exresult = join (",", @outconds);
+
+      if ($result ne $exresult)
+       {
+         print '"' . join(",", @$inref) . '" => "' .
+           $result . '" expected "' .
+             $exresult . '"' . "\n";
+         $failed = 1;
+       }
+    }
+  return $failed;
+}
+
+sub test_reduce_or ()
+{
+  my @tests = (# If no conditions are given, FALSE should be returned
+              [[], ["FALSE"]],
+              # An empty condition is TRUE
+              [[""], ["TRUE"]],
+              # A single condition should be passed through unchanged
+              [["FOO"], ["FOO"]],
+              [["FALSE"], ["FALSE"]],
+              [["TRUE"], ["TRUE"]],
+              # FALSE and TRUE should be discarded and overwhelm
+              # the result, respectively
+              [["FOO", "TRUE"], ["TRUE"]],
+              [["FOO", "FALSE"], ["FOO"]],
+              # Repetitions should be removed
+              [["FOO", "FOO"], ["FOO"]],
+              [["FALSE", "FOO", "FOO"], ["FOO"]],
+              [["FOO", "FALSE", "FOO"], ["FOO"]],
+              [["FOO", "FOO", "FALSE"], ["FOO"]],
+              # Two different conditions should be preserved,
+              # but FALSEs should be removed
+              [["FOO", "BAR"], ["BAR,FOO"]],
+              [["FALSE", "FOO", "BAR"], ["BAR,FOO"]],
+              [["FOO", "FALSE", "BAR"], ["BAR,FOO"]],
+              [["FOO", "BAR", "FALSE"], ["BAR,FOO"]],
+              # A condition implying another condition should be removed.
+              [["FOO BAR", "BAR"], ["BAR"]],
+              [["BAR", "FOO BAR"], ["BAR"]],
+              [["FALSE", "FOO BAR", "BAR"], ["BAR"]],
+              [["FOO BAR", "FALSE", "BAR"], ["BAR"]],
+              [["FOO BAR", "BAR", "FALSE"], ["BAR"]],
+
+              [["BAR FOO", "BAR"], ["BAR"]],
+              [["BAR", "BAR FOO"], ["BAR"]],
+              [["FALSE", "BAR FOO", "BAR"], ["BAR"]],
+              [["BAR FOO", "FALSE", "BAR"], ["BAR"]],
+              [["BAR FOO", "BAR", "FALSE"], ["BAR"]],
+
+              # Check that reduction happens even when there are
+              # two conditions to remove.
+              [["FOO", "FOO BAR", "BAR"], ["BAR,FOO"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["BAZ,FOO"]],
+              [["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
+               ["BAZ,FOO"]],
+
+              # Duplicated conditionals should be removed.
+              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
+
+              # Equivalent conditions in different forms should be
+              # reduced: which one is left is unfortunately order
+              # dependent.
+              [["BAR FOO", "FOO BAR"], ["FOO BAR"]],
+              [["FOO BAR", "BAR FOO"], ["BAR FOO"]]);
+
+  my $failed = 0;
+  foreach (@tests)
+    {
+      my ($inref, $outref) = @$_;
+      my @inconds = map { new Automake::Condition $_ } @$inref;
+      my @outconds = map { (new Automake::Condition $_)->string } @$outref;
+      my @res =
+       map { $_->string } (Automake::Condition::reduce_or (@inconds));
+      my $result = join (",", sort @res);
+      my $exresult = join (",", @outconds);
+
+      if ($result ne $exresult)
+       {
+         print '"' . join(",", @$inref) . '" => "' .
+           $result . '" expected "' .
+             $exresult . '"' . "\n";
+         $failed = 1;
+       }
+    }
+  return $failed;
+}
+
+exit (test_basics || test_true_when || test_reduce_and || test_reduce_or);
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/tests/pm/DisjConditions-t.pl b/tests/pm/DisjConditions-t.pl
new file mode 100644 (file)
index 0000000..2fe275b
--- /dev/null
@@ -0,0 +1,436 @@
+# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+BEGIN {
+  use Config;
+  if (eval { require 5.007_002; }      # for CLONE support
+      && $Config{useithreads})
+    {
+      require threads;
+      import threads;
+    }
+  else
+    {
+      exit 77;
+    }
+}
+use Automake::Condition qw/TRUE FALSE/;
+use Automake::DisjConditions;
+
+sub test_basics ()
+{
+  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+  return threads->new (sub {
+    my $other = new Automake::Condition "COND3_FALSE";
+    return threads->new (sub {
+      my $set1 = new Automake::DisjConditions $cond, $other;
+      return threads->new (sub {
+       my $set2 = new Automake::DisjConditions $other, $cond;
+       return 1 unless $set1 == $set2;
+       return 1 if $set1->false;
+       return 1 if $set1->true;
+       return 1 unless (new Automake::DisjConditions)->false;
+       return 1 if (new Automake::DisjConditions)->true;
+      })->join;
+    })->join;
+  })->join;
+}
+
+sub build_set (@)
+{
+  my @conds = @_;
+  my @set = ();
+  for my $cond (@conds)
+    {
+      push @set, new Automake::Condition @$cond;
+    }
+  return new Automake::DisjConditions @set;
+}
+
+sub test_invert ()
+{
+  my @tests = ([[["FALSE"]],
+               [["TRUE"]]],
+
+              [[["TRUE"]],
+               [["FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["COND3_FALSE", "COND2_TRUE"]],
+               [["COND2_FALSE"],
+                ["COND1_FALSE", "COND3_TRUE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["TRUE"]],
+               [["FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["FALSE"]],
+               [["COND1_FALSE"],
+                ["COND2_FALSE"]]],
+
+              [[["COND1_TRUE"],
+                ["COND2_FALSE"]],
+               [["COND1_FALSE", "COND2_TRUE"]]]
+              );
+
+  for my $t (@tests)
+    {
+      my $set = build_set @{$t->[0]};
+      return 1
+        if threads->new(sub {
+         my $res = build_set @{$t->[1]};
+         my $inv = $set->invert;
+         if ($inv != $res)
+           {
+             print " (I) " . $set->string . "\n\t"
+               . $inv->string . ' != ' . $res->string . "\n";
+             return 1;
+           }
+         return 0
+       })-> join;
+    }
+  return 0;
+}
+
+sub test_simplify ()
+{
+  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"]],
+               [["FOO_TRUE", "BAR_FALSE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_TRUE", "BAR_TRUE"]],
+               [["FOO_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_TRUE", "BAR_TRUE"],
+                ["FOO_FALSE"]],
+               [["TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                            ["BAR_TRUE",  "BAZ_TRUE"],
+                            ["BAR_FALSE", "BAZ_TRUE"]],
+               [["BAZ_TRUE"], ["FOO_TRUE", "BAR_FALSE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                            ["BAR_TRUE",  "BAZ_TRUE"],
+                            ["BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               [["FOO_FALSE"], ["BAZ_TRUE"], ["BAR_FALSE"]]],
+
+              [[["B_TRUE"],
+                ["A_FALSE", "B_TRUE"]],
+               [["B_TRUE"]]],
+
+              [[["B_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_FALSE"]],
+               [["A_FALSE"], ["B_TRUE"]]],
+
+              [[["B_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_FALSE"],
+                ["A_TRUE", "B_FALSE"]],
+               [["TRUE"]]],
+
+              [[["A_TRUE", "B_TRUE"],
+                ["A_TRUE", "B_FALSE"],
+                ["A_TRUE", "C_FALSE", "D_FALSE"]],
+               [["A_TRUE"]]],
+
+              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"]],
+               [           ["B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                           ["B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                           ["B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                           ["B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"]]],
+
+              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"]],
+               [["C_FALSE", "E_FALSE"],
+                ["C_TRUE", "E_TRUE"]]],
+
+              [[["A_FALSE"],
+                ["A_TRUE", "B_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE", "F_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"]],
+               [["TRUE"]]],
+
+              # Simplify should work with up to 31 variables.
+              [[["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_TRUE"],
+                ["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_FALSE"],
+                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_TRUE"],
+                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_FALSE"]],
+               [[            "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE"
+                 ]]]);
+
+  for my $t (@tests)
+    {
+      my $set = build_set @{$t->[0]};
+      return 1
+       if threads->new(sub {
+         my $res = build_set @{$t->[1]};
+         return threads->new(sub {
+
+           # Make sure simplify() yields the expected result.
+           my $sim = $set->simplify;
+           return threads->new(sub {
+             if ($sim != $res)
+               {
+                 print " (S1) " . $set->string . "\n\t"
+                   . $sim->string . ' != ' . $res->string . "\n";
+                 return 1;
+               }
+
+             # Make sure simplify() is idempotent.
+             my $sim2 = $sim->simplify;
+             return threads->new(sub {
+               if ($sim2 != $sim)
+                 {
+                   print " (S2) " . $sim->string . "\n\t"
+                     . $sim2->string . ' != ' . $sim->string . "\n";
+                   return 1;
+                 }
+
+               # Also exercise invert() while we are at it.
+
+               my $inv1 = $set->invert->simplify;
+               return threads->new(sub {
+                 my $inv2 = $sim->invert->simplify;
+                 return threads->new(sub {
+                   if ($inv1 != $inv2)
+                     {
+                       print " (S3) " . $set->string . ", " . $sim->string . "\n\t"
+                         . $inv1->string . ' -= ' . $inv2->string . "\n";
+                       return 1;
+                     }
+                 })->join;
+               })->join;
+             })->join;
+           })->join;
+         })->join;
+       })->join;
+    }
+
+  return 0;
+}
+
+sub test_sub_conditions ()
+{
+  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE"],
+               [["BAR_FALSE", "BAZ_FALSE"],
+                ["BAR_FALSE", "BAZ_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE", "BAR_FALSE"],
+               [["BAZ_FALSE"],
+                ["BAZ_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE", "BAR_TRUE"],
+               [["FALSE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE", "BAR_TRUE"],
+               [["BAZ_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE"],
+                ["FOO_TRUE", "BAR_TRUE"]],
+               ["FOO_TRUE", "BAR_TRUE"],
+               [["TRUE"]]],
+
+              [[["TRUE"]],
+               ["TRUE"],
+               [["TRUE"]]],
+
+              [[["FALSE"]],
+               ["TRUE"],
+               [["FALSE"]]],
+
+              [[["FALSE"]],
+               ["FALSE"],
+               [["FALSE"]]]);
+
+  for my $t (@tests)
+    {
+      my $t1 = build_set @{$t->[0]};
+      return 1
+        if threads->new(sub {
+         my $t2 = new Automake::Condition @{$t->[1]};
+         return threads->new(sub {
+           my $t3 = build_set @{$t->[2]};
+           return threads->new(sub {
+
+             # Make sure sub_conditions() yields the expected result.
+             my $s = $t1->sub_conditions ($t2);
+             threads->new(sub {
+               if ($s != $t3)
+                 {
+                   print " (SC) " . $t1->string . "\n\t"
+                     . $s->string . ' != ' . $t3->string . "\n";
+                   return 1;
+                 }
+             })->join;
+           })->join;
+         })->join;
+       })->join;
+    }
+}
+
+sub test_ambig ()
+{
+  my @tests = ([[["TRUE"]],
+               ["TRUE"],
+               "multiply defined"],
+              [[["C1_TRUE"]],
+               ["C1_TRUE"],
+               "multiply defined"],
+              [[["TRUE"]],
+                ["C1_FALSE"],
+               "which includes"],
+              [[["C1_TRUE"]],
+               ["C1_TRUE", "C2_TRUE"],
+               "which includes"],
+              [[["C1_TRUE", "C2_TRUE"]],
+               ["C2_TRUE"],
+               "which is included in"],
+              [[["C1_TRUE"]],
+               ["C2_TRUE"],
+               ''],
+              [[["C1_TRUE"],
+                ["C2_FALSE"]],
+               ["C1_FALSE", "C2_TRUE"],
+               '']);
+
+  my $failed = 0;
+  for my $t (@tests)
+    {
+      my $t1 = build_set @{$t->[0]};
+      $failed = 1
+        if threads->new(sub {
+         my $t2 = new Automake::Condition @{$t->[1]};
+         my $t3 = $t->[2];
+         return threads->new(sub {
+           my ($ans, $cond) = $t1->ambiguous_p ("FOO", $t2);
+           return threads->new(sub {
+             if ($t3 && $ans !~ /FOO.*$t3/)
+               {
+                 print " (A1) " . $t1->string . " vs. " . $t2->string . "\n\t"
+                   . "Error message '$ans' does not match '$t3'\n";
+                 return 1;
+               }
+             if (!$t3 && $ans ne '')
+               {
+                 print " (A2) " . $t1->string . " vs. " . $t2->string . "\n\t"
+                   . "Unexpected error message: $ans\n";
+                 return 1;
+               }
+           })->join;
+         })->join;
+       })->join;
+    }
+  return $failed;
+}
+
+exit (test_basics
+      || test_invert
+      || test_simplify
+      || test_sub_conditions
+      || test_ambig);
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/tests/pm/DisjConditions.pl b/tests/pm/DisjConditions.pl
new file mode 100644 (file)
index 0000000..47dea83
--- /dev/null
@@ -0,0 +1,383 @@
+# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use Automake::Condition qw/TRUE FALSE/;
+use Automake::DisjConditions;
+
+sub test_basics ()
+{
+  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+  my $other = new Automake::Condition "COND3_FALSE";
+  my $set1 = new Automake::DisjConditions $cond, $other;
+  my $set2 = new Automake::DisjConditions $other, $cond;
+  return 1 unless $set1 == $set2;
+  return 1 if $set1->false;
+  return 1 if $set1->true;
+  return 1 unless (new Automake::DisjConditions)->false;
+  return 1 if (new Automake::DisjConditions)->true;
+}
+
+sub build_set (@)
+{
+  my @conds = @_;
+  my @set = ();
+  for my $cond (@conds)
+    {
+      push @set, new Automake::Condition @$cond;
+    }
+  return new Automake::DisjConditions @set;
+}
+
+sub test_invert ()
+{
+  my @tests = ([[["FALSE"]],
+               [["TRUE"]]],
+
+              [[["TRUE"]],
+               [["FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["COND3_FALSE", "COND2_TRUE"]],
+               [["COND2_FALSE"],
+                ["COND1_FALSE", "COND3_TRUE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["TRUE"]],
+               [["FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["FALSE"]],
+               [["COND1_FALSE"],
+                ["COND2_FALSE"]]],
+
+              [[["COND1_TRUE"],
+                ["COND2_FALSE"]],
+               [["COND1_FALSE", "COND2_TRUE"]]]
+              );
+
+  for my $t (@tests)
+    {
+      my $set = build_set @{$t->[0]};
+      my $res = build_set @{$t->[1]};
+      my $inv = $set->invert;
+      if ($inv != $res)
+       {
+         print " (I) " . $set->string . "\n\t"
+           . $inv->string . ' != ' . $res->string . "\n";
+         return 1;
+       }
+    }
+  return 0;
+}
+
+sub test_simplify ()
+{
+  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"]],
+               [["FOO_TRUE", "BAR_FALSE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_TRUE", "BAR_TRUE"]],
+               [["FOO_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_TRUE", "BAR_TRUE"],
+                ["FOO_FALSE"]],
+               [["TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                            ["BAR_TRUE",  "BAZ_TRUE"],
+                            ["BAR_FALSE", "BAZ_TRUE"]],
+               [["BAZ_TRUE"], ["FOO_TRUE", "BAR_FALSE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                            ["BAR_TRUE",  "BAZ_TRUE"],
+                            ["BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               [["FOO_FALSE"], ["BAZ_TRUE"], ["BAR_FALSE"]]],
+
+              [[["B_TRUE"],
+                ["A_FALSE", "B_TRUE"]],
+               [["B_TRUE"]]],
+
+              [[["B_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_FALSE"]],
+               [["A_FALSE"], ["B_TRUE"]]],
+
+              [[["B_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE"],
+                ["A_FALSE", "B_FALSE", "C_FALSE"],
+                ["A_TRUE", "B_FALSE"]],
+               [["TRUE"]]],
+
+              [[["A_TRUE", "B_TRUE"],
+                ["A_TRUE", "B_FALSE"],
+                ["A_TRUE", "C_FALSE", "D_FALSE"]],
+               [["A_TRUE"]]],
+
+              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"]],
+               [           ["B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                           ["B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                           ["B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                           ["B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"]]],
+
+              [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"],
+                ["A_FALSE", "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_FALSE", "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_FALSE", "D_TRUE",  "E_FALSE"],
+                ["A_TRUE",  "B_TRUE",  "C_TRUE",  "D_TRUE",  "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_TRUE",  "D_FALSE", "E_TRUE"],
+                ["A_TRUE",  "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"]],
+               [["C_FALSE", "E_FALSE"],
+                ["C_TRUE", "E_TRUE"]]],
+
+              [[["A_FALSE"],
+                ["A_TRUE", "B_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE", "F_FALSE"],
+                ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"]],
+               [["TRUE"]]],
+
+              # Simplify should work with up to 31 variables.
+              [[["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_TRUE"],
+                ["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_FALSE"],
+                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_TRUE"],
+                ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
+                 "V31_FALSE"]],
+               [[            "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
+                 "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
+                 "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
+                 "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
+                 "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
+                 "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE"
+                 ]]]);
+
+  for my $t (@tests)
+    {
+      my $set = build_set @{$t->[0]};
+      my $res = build_set @{$t->[1]};
+
+      # Make sure simplify() yields the expected result.
+      my $sim = $set->simplify;
+      if ($sim != $res)
+       {
+         print " (S1) " . $set->string . "\n\t"
+           . $sim->string . ' != ' . $res->string . "\n";
+         return 1;
+       }
+
+      # Make sure simplify() is idempotent.
+      my $sim2 = $sim->simplify;
+      if ($sim2 != $sim)
+       {
+         print " (S2) " . $sim->string . "\n\t"
+           . $sim2->string . ' != ' . $sim->string . "\n";
+         return 1;
+       }
+
+      # Also exercise invert() while we are at it.
+
+      my $inv1 = $set->invert->simplify;
+      my $inv2 = $sim->invert->simplify;
+      if ($inv1 != $inv2)
+       {
+         print " (S3) " . $set->string . ", " . $sim->string . "\n\t"
+           . $inv1->string . ' != ' . $inv2->string . "\n";
+         return 1;
+       }
+    }
+
+  return 0;
+}
+
+sub test_sub_conditions ()
+{
+  my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE"],
+               [["BAR_FALSE", "BAZ_FALSE"],
+                ["BAR_FALSE", "BAZ_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE", "BAR_FALSE"],
+               [["BAZ_FALSE"],
+                ["BAZ_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE", "BAR_TRUE"],
+               [["FALSE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
+                ["FOO_TRUE", "BAZ_TRUE"],
+                ["FOO_FALSE"]],
+               ["FOO_TRUE", "BAR_TRUE"],
+               [["BAZ_TRUE"]]],
+
+              [[["FOO_TRUE", "BAR_FALSE"],
+                ["FOO_TRUE", "BAR_TRUE"]],
+               ["FOO_TRUE", "BAR_TRUE"],
+               [["TRUE"]]],
+
+              [[["TRUE"]],
+               ["TRUE"],
+               [["TRUE"]]],
+
+              [[["FALSE"]],
+               ["TRUE"],
+               [["FALSE"]]],
+
+              [[["FALSE"]],
+               ["FALSE"],
+               [["FALSE"]]]);
+
+  for my $t (@tests)
+    {
+      my $t1 = build_set @{$t->[0]};
+      my $t2 = new Automake::Condition @{$t->[1]};
+      my $t3 = build_set @{$t->[2]};
+
+      # Make sure sub_conditions() yields the expected result.
+      my $s = $t1->sub_conditions ($t2);
+      if ($s != $t3)
+       {
+         print " (SC) " . $t1->string . "\n\t"
+           . $s->string . ' != ' . $t3->string . "\n";
+         return 1;
+       }
+    }
+}
+
+sub test_ambig ()
+{
+  my @tests = ([[["TRUE"]],
+               ["TRUE"],
+               "multiply defined"],
+              [[["C1_TRUE"]],
+               ["C1_TRUE"],
+               "multiply defined"],
+              [[["TRUE"]],
+                ["C1_FALSE"],
+               "which includes"],
+              [[["C1_TRUE"]],
+               ["C1_TRUE", "C2_TRUE"],
+               "which includes"],
+              [[["C1_TRUE", "C2_TRUE"]],
+               ["C2_TRUE"],
+               "which is included in"],
+              [[["C1_TRUE"]],
+               ["C2_TRUE"],
+               ''],
+              [[["C1_TRUE"],
+                ["C2_FALSE"]],
+               ["C1_FALSE", "C2_TRUE"],
+               '']);
+
+  for my $t (@tests)
+    {
+      my $t1 = build_set @{$t->[0]};
+      my $t2 = new Automake::Condition @{$t->[1]};
+      my $t3 = $t->[2];
+      my ($ans, $cond) = $t1->ambiguous_p ("FOO", $t2);
+      if ($t3 && $ans !~ /FOO.*$t3/)
+       {
+         print " (A1) " . $t1->string . " vs. " . $t2->string . "\n\t"
+           . "Error message '$ans' does not match '$t3'\n";
+         return 1;
+       }
+      if (!$t3 && $ans ne '')
+       {
+         print " (A2) " . $t1->string . " vs. " . $t2->string . "\n\t"
+           . "Unexpected error message: $ans\n";
+         return 1;
+       }
+    }
+  return 0;
+}
+
+exit (test_basics
+      || test_invert
+      || test_simplify
+      || test_sub_conditions
+      || test_ambig);
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/tests/pm/Version.pl b/tests/pm/Version.pl
new file mode 100644 (file)
index 0000000..e496435
--- /dev/null
@@ -0,0 +1,99 @@
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use Automake::Version;
+
+my $failed = 0;
+
+sub test_version_compare
+{
+  my ($left, $right, $result) = @_;
+  my @leftver = Automake::Version::split ($left);
+  my @rightver = Automake::Version::split ($right);
+  if ($#leftver == -1)
+  {
+    print "can't grok \"$left\"\n";
+    $failed = 1;
+    return;
+  }
+  if ($#rightver == -1)
+  {
+    print "can't grok \"$right\"\n";
+    $failed = 1;
+    return;
+  }
+  my $res = Automake::Version::compare (@leftver, @rightver);
+  if ($res != $result)
+  {
+    print "compare (\"$left\", \"$right\") = $res! (not $result?)\n";
+    $failed = 1;
+  }
+}
+
+my @tests = (
+# basics
+  ['1.0', '2.0', -1],
+  ['2.0', '1.0', 1],
+  ['1.2', '1.2', 0],
+  ['1.1', '1.2', -1],
+  ['1.2', '1.1', 1],
+# alphas
+  ['1.4', '1.4g', -1],
+  ['1.4g', '1.5', -1],
+  ['1.4g', '1.4', 1],
+  ['1.5', '1.4g', 1],
+  ['1.4a', '1.4g', -1],
+  ['1.5a', '1.3g', 1],
+  ['1.6a', '1.6a', 0],
+# micros
+  ['1.5.1', '1.5', 1],
+  ['1.5.0', '1.5', 0],
+  ['1.5.4', '1.6.1', -1],
+# micros and alphas
+  ['1.5a', '1.5.1', 1],
+  ['1.5a', '1.5.1a', 1],
+  ['1.5a', '1.5.1f', 1],
+  ['1.5', '1.5.1a', -1],
+  ['1.5.1a', '1.5.1f', -1],
+# special exceptions
+  ['1.6-p5a', '1.6.5a', 0],
+  ['1.6', '1.6-p5a', -1],
+  ['1.6-p4b', '1.6-p5a', -1],
+  ['1.6-p4b', '1.6-foo', 1],
+  ['1.6-p4b', '1.6a-foo', -1]
+);
+
+test_version_compare (@{$_}) foreach @tests;
+
+exit $failed;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/tests/pm/Wrap.pl b/tests/pm/Wrap.pl
new file mode 100644 (file)
index 0000000..8d840fc
--- /dev/null
@@ -0,0 +1,80 @@
+# Copyright (C) 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use Automake::Wrap 'wrap';
+
+my $failed = 0;
+
+sub test_wrap
+{
+  my ($in, $exp_out) = @_;
+
+  my $out = &wrap (@$in);
+  if ($out ne $exp_out)
+    {
+      print STDERR "For: @$in\nGot:\n$out\nInstead of:\n$exp_out\n---\n";
+      ++$failed;
+    }
+}
+
+my @tests = (
+  [["HEAD:", "NEXT:", "CONT", 13, "v" ,"a", "l", "ue", "s", "values"],
+"HEAD:v aCONT
+NEXT:l ueCONT
+NEXT:sCONT
+NEXT:values
+"],
+  [["rule: ", "\t", " \\", 20, "dep1" ,"dep2", "dep3", "dep4", "dep5",
+    "dep06", "dep07", "dep08"],
+"rule: dep1 dep2 \\
+\tdep3 dep4 \\
+\tdep5 dep06 \\
+\tdep07 \\
+\tdep08
+"],
+  [["big header:", "big continuation:", " END", 5, "diag1", "diag2", "diag3"],
+"big header:diag1 END
+big continuation:diag2 END
+big continuation:diag3
+"],
+  [["big header:", "cont: ", " END", 16, "word1", "word2"],
+"big header: END
+cont: word1 END
+cont: word2
+"]);
+
+
+test_wrap (@{$_}) foreach @tests;
+
+exit $failed;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End: