automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lib/Automake/ test suite


From: Alexandre Duret-Lutz
Subject: lib/Automake/ test suite
Date: Mon, 18 Nov 2002 13:04:51 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/20.7 (i386-debian-linux-gnu)

>>> "Raja" == Raja R Harinath <address@hidden> writes:

[...]

 Raja> Since this is purely a test of Automake::Conditional, should it be
 Raja> moved into 'lib/Automake'?

 Raja> Is it worth having an independent test directory for the Perl modules
 Raja> alone?  Maybe even using Perl's own testing infrastructure.

Here is my proposal for a lib/Automake/ test suite.  This also corrects
a few things in ConditionalSet.pm.

2002-11-18  Alexandre Duret-Lutz  <address@hidden>

        * lib/Automake/tests/Makefile.am, lib/Automake/tests/Conditional.pl,
        lib/Automake/tests/ConditionalSet.pl: New files.
        * lib/Automake/Makefile.am (SUBDIRS): New variable.
        * configure.in: Output lib/Automake/tests/Makefile.
        * lib/Automake/ConditionalSet.pm (by_conditions): Delete.
        (conds): Don't use by_conditions, sort alphabetically, and
        return sorted conds.
        (string): Call ->string on each Conditional.
        * tests/Makefile.am (TESTS): Remove cond12.test.
        * tests/cond12.test: Remove, moved to
        lib/Automake/tests/ConditionalSet.pl.
        * tests/cond3.test: Adjust conditional ordering.

Index: configure.in
===================================================================
RCS file: /cvs/automake/automake/configure.in,v
retrieving revision 1.121
diff -u -r1.121 configure.in
--- configure.in        25 Sep 2002 20:30:48 -0000      1.121
+++ configure.in        18 Nov 2002 12:02:34 -0000
@@ -89,6 +89,7 @@
 AC_CONFIG_FILES([
   Makefile
   lib/Automake/Makefile
+  lib/Automake/tests/Makefile
   lib/Makefile
   lib/am/Makefile
   m4/Makefile
Index: lib/Automake/ConditionalSet.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/ConditionalSet.pm,v
retrieving revision 1.3
diff -u -r1.3 ConditionalSet.pm
--- lib/Automake/ConditionalSet.pm      15 Nov 2002 10:12:12 -0000      1.3
+++ lib/Automake/ConditionalSet.pm      18 Nov 2002 12:02:38 -0000
@@ -143,24 +143,7 @@
   return $self;
 }
 
-# Compare condition names.
-# Issue them in alphabetical order, foo_TRUE before foo_FALSE.
-sub by_condition
-{
-    # Be careful we might be comparing `' or `#'.
-    $a->string =~ /^(.*)_(TRUE|FALSE)$/;
-    my ($aname, $abool) = ($1 || '', $2 || '');
-    $b->string =~ /^(.*)_(TRUE|FALSE)$/;
-    my ($bname, $bbool) = ($1 || '', $2 || '');
-    return ($aname cmp $bname
-           # Don't bother with IFs, given that TRUE is after FALSE
-           # just cmp in the reverse order.
-           || $bbool cmp $abool
-           # Just in case...
-           || $a cmp $b);
-}
-
-=item C<@conds = $set-$<gt>conds>
+=item C<@conds = $set-E<gt>conds>
 
 Return the list of C<Conditional> objects involved in C<$set>.
 
@@ -171,11 +154,12 @@
   my ($self) = @_;
   return @{$self->{'conds'}} if exists $self->{'conds'};
   my @conds = map { $self->{'hash'}{$_} } (keys %{$self->{'hash'}});
-  $self->{'conds'} = [sort by_condition @conds];
+  @conds = sort { $a->string cmp $b->string } @conds;
+  $self->{'conds'} = address@hidden;
   return @conds;
 }
 
-=item C<$cond = $set-$<gt>one_cond>
+=item C<$cond = $set-E<gt>one_cond>
 
 Return one C<Conditional> object involved in C<$set>.
 
@@ -187,7 +171,7 @@
   return (%{$self->{'hash'}},)[1];
 }
 
-=item C<$et = $set-$<gt>false>
+=item C<$et = $set-E<gt>false>
 
 Return 1 iff the C<ConditionalSet> object is always false (i.e., if it
 is empty, or if it contains only false C<Conditional>s). Return 0
@@ -201,7 +185,7 @@
   return 0 == keys %{$self->{'hash'}};
 }
 
-=item C<$et = $set-$<gt>true>
+=item C<$et = $set-E<gt>true>
 
 Return 1 iff the C<ConditionalSet> object is always true (i.e. covers all
 conditions). Return 0 otherwise.
@@ -233,7 +217,7 @@
     }
   else
     {
-      $res = join (',', $self->conds);
+      $res = join (' | ', map { $_->string } $self->conds);
     }
 
   $self->{'string'} = $res;
@@ -279,7 +263,7 @@
     (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE"),
      new Automake::Conditional ("COND3_FALSE", "COND2_TRUE"));
 
-Calling $<$set-E<gt>permutations> will return the following Conditional set.
+Calling C<$set-E<gt>permutations> will return the following Conditional set.
 
   new Automake::ConditionalSet
     (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND3_TRUE"),
Index: lib/Automake/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- lib/Automake/Makefile.am    14 Nov 2002 16:12:00 -0000      1.7
+++ lib/Automake/Makefile.am    18 Nov 2002 12:02:38 -0000
@@ -1,5 +1,7 @@
 ## Process this file with automake to create Makefile.in
 
+SUBDIRS = tests
+
 perllibdir = $(pkgvdatadir)/Automake
 dist_perllib_DATA = \
   Channels.pm \
Index: lib/Automake/tests/Conditional.pl
===================================================================
RCS file: lib/Automake/tests/Conditional.pl
diff -N lib/Automake/tests/Conditional.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/Automake/tests/Conditional.pl   18 Nov 2002 12:02:39 -0000
@@ -0,0 +1,184 @@
+# Copyright (C) 2001, 2002  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 autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+use Automake::Conditional 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::Conditional @{$_->[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-Conditionals],
+              #  [Not-Implied-Conditionals]]
+              [['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::Conditional @{$t->[0]};
+      for my $u (@{$t->[1]})
+       {
+         my $b = new Automake::Conditional @$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::Conditional @$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 ()
+{
+  my @tests = (# If no conditions are given, TRUE should be returned
+              [[""], ["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 conditionals 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 condionals should be removed
+              [["FOO", "BAR", "BAR"], ["BAR,FOO"]],
+
+              # Equivalent conditionals 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::Conditional $_ } @$inref;
+      my @outconds = map { (new Automake::Conditional $_)->string } @$outref;
+      my @res =
+       map { $_->string } (Automake::Conditional::reduce (@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);
+
+### 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: lib/Automake/tests/ConditionalSet.pl
===================================================================
RCS file: lib/Automake/tests/ConditionalSet.pl
diff -N lib/Automake/tests/ConditionalSet.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/Automake/tests/ConditionalSet.pl        18 Nov 2002 12:02:39 -0000
@@ -0,0 +1,164 @@
+# Copyright (C) 2001, 2002  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 autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+use Automake::Conditional qw/TRUE FALSE/;
+use Automake::ConditionalSet;
+
+sub test_basics ()
+{
+  my $cond = new Automake::Conditional "COND1_TRUE", "COND2_FALSE";
+  my $other = new Automake::Conditional "COND3_FALSE";
+  my $set1 = new Automake::ConditionalSet $cond, $other;
+  my $set2 = new Automake::ConditionalSet $other, $cond;
+  return 1 unless $set1 == $set2;
+  return 1 if $set1->false;
+  return 1 if $set1->true;
+  return 1 unless (new Automake::ConditionalSet)->false;
+  return 1 if (new Automake::ConditionalSet)->true;
+}
+
+sub build_set (@)
+{
+  my @conds = @_;
+  my @set = ();
+  for my $cond (@conds)
+    {
+      push @set, new Automake::Conditional @$cond;
+    }
+  return new Automake::ConditionalSet @set;
+}
+
+sub test_permutations ()
+{
+  my @tests = ([[["FALSE"]],
+               [["TRUE"]]],
+
+              [[["TRUE"]],
+               [["TRUE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["COND3_FALSE", "COND2_TRUE"]],
+               [["COND1_FALSE","COND2_FALSE","COND3_FALSE"],
+                ["COND1_TRUE", "COND2_FALSE","COND3_FALSE"],
+                ["COND1_FALSE","COND2_TRUE", "COND3_FALSE"],
+                ["COND1_TRUE", "COND2_TRUE", "COND3_FALSE"],
+                ["COND1_FALSE","COND2_FALSE","COND3_TRUE"],
+                ["COND1_TRUE", "COND2_FALSE","COND3_TRUE"],
+                ["COND1_FALSE","COND2_TRUE", "COND3_TRUE"],
+                ["COND1_TRUE", "COND2_TRUE", "COND3_TRUE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["TRUE"]],
+               [["COND1_TRUE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_FALSE"],
+                ["COND1_TRUE", "COND2_FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["FALSE"]],
+               [["COND1_TRUE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_FALSE"],
+                ["COND1_TRUE", "COND2_FALSE"]]],
+
+              [[["COND1_TRUE"],
+                ["COND2_FALSE"]],
+               [["COND1_TRUE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_FALSE"],
+                ["COND1_TRUE", "COND2_FALSE"]]]
+              );
+
+  for my $t (@tests)
+    {
+      my $set = build_set @{$t->[0]};
+      my $res = build_set @{$t->[1]};
+      my $per = $set->permutations;
+      if ($per != $res)
+       {
+         print $per->string . ' != ' . $res->string . "\n";
+         return 1;
+       }
+    }
+  return 0;
+}
+
+sub test_invert ()
+{
+  my @tests = ([[["FALSE"]],
+               [["TRUE"]]],
+
+              [[["TRUE"]],
+               [["FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["COND3_FALSE", "COND2_TRUE"]],
+               [["COND1_FALSE","COND2_FALSE","COND3_FALSE"],
+                ["COND1_TRUE", "COND2_FALSE","COND3_FALSE"],
+                ["COND1_FALSE","COND2_FALSE","COND3_TRUE"],
+                ["COND1_TRUE", "COND2_FALSE","COND3_TRUE"],
+                ["COND1_FALSE","COND2_TRUE", "COND3_TRUE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["TRUE"]],
+               [["FALSE"]]],
+
+              [[["COND1_TRUE", "COND2_TRUE"],
+                ["FALSE"]],
+               [["COND1_FALSE", "COND2_TRUE"],
+                ["COND1_FALSE", "COND2_FALSE"],
+                ["COND1_TRUE", "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 $inv->string . ' != ' . $res->string . "\n";
+         return 1;
+       }
+    }
+  return 0;
+}
+
+exit (test_basics || test_permutations || test_invert);
+
+### 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: lib/Automake/tests/Makefile.am
===================================================================
RCS file: lib/Automake/tests/Makefile.am
diff -N lib/Automake/tests/Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/Automake/tests/Makefile.am      18 Nov 2002 12:02:39 -0000
@@ -0,0 +1,25 @@
+## Process this file with automake to create Makefile.in
+
+## Copyright (C) 2002  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, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+TESTS_ENVIRONMENT = $(PERL) -Mstrict -I $(top_srcdir)/lib -w
+TESTS = \
+Conditional.pl \
+ConditionalSet.pl
+
+EXTRA_DIST = $(TESTS)
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.452
diff -u -r1.452 Makefile.am
--- tests/Makefile.am   10 Nov 2002 14:25:16 -0000      1.452
+++ tests/Makefile.am   18 Nov 2002 12:02:40 -0000
@@ -79,7 +79,6 @@
 cond9.test \
 cond10.test \
 cond11.test \
-cond12.test \
 cond13.test \
 cond14.test \
 cond15.test \
Index: tests/cond12.test
===================================================================
RCS file: tests/cond12.test
diff -N tests/cond12.test
--- tests/cond12.test   13 Nov 2002 20:11:32 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,102 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001, 2002  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 autoconf; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# This checks the result of Automake::Conditional::reduce() for
-# a wide variety of cases.
-
-. ./defs || exit 1
-
-set -e
-
-cat << 'END' > run
-use Automake::Conditional;
-
-my $failed = 0;
-sub check_reduce($$) {
- my ($inref, $outref) = @_;
- my @inconds = map { new Automake::Conditional $_ } @$inref;
- my @outconds = map { (new Automake::Conditional $_)->string } @$outref;
- my @res =
-    map { $_->string } (Automake::Conditional::reduce (@inconds));
- my $result = join (",", sort @res);
- my $exresult = join (",", @outconds);
-
- if ($result ne $exresult)
- {
-   print '"'.join(",", @$inref) . '" => "' .
-        $result . '" expected "' .
-        $exresult . '"' . "\n";
-   $failed = 1;
- }
-}
-
-# If no conditions are given, TRUE should be returned
-check_reduce([""], ["TRUE"]);
-# A single condition should be passed through unchanged
-check_reduce(["FOO"], ["FOO"]);
-check_reduce(["FALSE"], ["FALSE"]);
-check_reduce(["TRUE"], ["TRUE"]);
-
-# TRUE and false should be discarded and overwhelm the result, respectively
-check_reduce(["FOO", "TRUE"], ["FOO"]);
-check_reduce(["FOO", "FALSE"], ["FALSE"]);
-
-# Repetitions should be removed
-check_reduce(["FOO", "FOO"], ["FOO"]);
-check_reduce(["TRUE", "FOO", "FOO"], ["FOO"]);
-check_reduce(["FOO", "TRUE", "FOO"], ["FOO"]);
-check_reduce(["FOO", "FOO", "TRUE"], ["FOO"]);
-
-# Two different conditions should be preserved, but TRUEs should be removed
-check_reduce(["FOO", "BAR"], ["BAR,FOO"]);
-check_reduce(["TRUE", "FOO", "BAR"], ["BAR,FOO"]);
-check_reduce(["FOO", "TRUE", "BAR"], ["BAR,FOO"]);
-check_reduce(["FOO", "BAR", "TRUE"], ["BAR,FOO"]);
-
-# A condition implied by another condition should be removed.
-check_reduce(["FOO BAR", "BAR"], ["FOO BAR"]);
-check_reduce(["BAR", "FOO BAR"], ["FOO BAR"]);
-check_reduce(["TRUE", "FOO BAR", "BAR"], ["FOO BAR"]);
-check_reduce(["FOO BAR", "TRUE", "BAR"], ["FOO BAR"]);
-check_reduce(["FOO BAR", "BAR", "TRUE"], ["FOO BAR"]);
-
-check_reduce(["BAR FOO", "BAR"], ["BAR FOO"]);
-check_reduce(["BAR", "BAR FOO"], ["BAR FOO"]);
-check_reduce(["TRUE", "BAR FOO", "BAR"], ["BAR FOO"]);
-check_reduce(["BAR FOO", "TRUE", "BAR"], ["BAR FOO"]);
-check_reduce(["BAR FOO", "BAR", "TRUE"], ["BAR FOO"]);
-
-# Check that reduction happens even when there are two conditionals to remove.
-check_reduce(["FOO", "FOO BAR", "BAR"], ["FOO BAR"]);
-check_reduce(["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["FOO BAR", "FOO BAZ"]);
-check_reduce(["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"], ["FOO BAZ 
BAR"]);
-
-# Duplicated condionals should be removed
-check_reduce(["FOO", "BAR", "BAR"], ["BAR,FOO"]);
-
-# Equivalent conditionals in different forms should be reduced: which one is
-# left is unfortunately order dependent.
-check_reduce(["BAR FOO", "FOO BAR"], ["FOO BAR"]);
-check_reduce(["FOO BAR", "BAR FOO"], ["BAR FOO"]);
-
-exit $failed;
-END
-chmod +x run
-$PERL -w -I $perllibdir ./run
Index: tests/cond3.test
===================================================================
RCS file: /cvs/automake/automake/tests/cond3.test,v
retrieving revision 1.12
diff -u -r1.12 cond3.test
--- tests/cond3.test    8 Sep 2002 13:07:55 -0000       1.12
+++ tests/cond3.test    18 Nov 2002 12:02:40 -0000
@@ -73,12 +73,12 @@
 }' Makefile.in >produced
 
 cat >expected << 'EOF'
address@hidden@am__objects_1 = one.$(OBJEXT)
 @address@hidden =
address@hidden@am__objects_2 = two.$(OBJEXT)
address@hidden@am__objects_1 = one.$(OBJEXT)
 @address@hidden =
address@hidden@am__objects_3 = three.$(OBJEXT)
address@hidden@am__objects_2 = two.$(OBJEXT)
 @address@hidden =
address@hidden@am__objects_3 = three.$(OBJEXT)
 am_targ_OBJECTS = $(am__objects_1) $(am__objects_2) $(am__objects_3)
 targ_OBJECTS = $(am_targ_OBJECTS)
 EOF
-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]