| 1 | # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
|---|
| 2 | #
|
|---|
| 3 | # This file is part of GNU Automake.
|
|---|
| 4 | #
|
|---|
| 5 | # GNU Automake is free software; you can redistribute it and/or modify
|
|---|
| 6 | # it under the terms of the GNU General Public License as published by
|
|---|
| 7 | # the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 8 | # any later version.
|
|---|
| 9 | #
|
|---|
| 10 | # GNU Automake is distributed in the hope that it will be useful,
|
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | # GNU General Public License for more details.
|
|---|
| 14 | #
|
|---|
| 15 | # You should have received a copy of the GNU General Public License
|
|---|
| 16 | # along with autoconf; see the file COPYING. If not, write to
|
|---|
| 17 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|---|
| 18 | # Boston, MA 02110-1301, USA.
|
|---|
| 19 |
|
|---|
| 20 | use Automake::Condition qw/TRUE FALSE/;
|
|---|
| 21 | use Automake::DisjConditions;
|
|---|
| 22 |
|
|---|
| 23 | sub test_basics ()
|
|---|
| 24 | {
|
|---|
| 25 | my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
|
|---|
| 26 | my $other = new Automake::Condition "COND3_FALSE";
|
|---|
| 27 | my $set1 = new Automake::DisjConditions $cond, $other;
|
|---|
| 28 | my $set2 = new Automake::DisjConditions $other, $cond;
|
|---|
| 29 | return 1 unless $set1 == $set2;
|
|---|
| 30 | return 1 if $set1->false;
|
|---|
| 31 | return 1 if $set1->true;
|
|---|
| 32 | return 1 unless (new Automake::DisjConditions)->false;
|
|---|
| 33 | return 1 if (new Automake::DisjConditions)->true;
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | sub build_set (@)
|
|---|
| 37 | {
|
|---|
| 38 | my @conds = @_;
|
|---|
| 39 | my @set = ();
|
|---|
| 40 | for my $cond (@conds)
|
|---|
| 41 | {
|
|---|
| 42 | push @set, new Automake::Condition @$cond;
|
|---|
| 43 | }
|
|---|
| 44 | return new Automake::DisjConditions @set;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | sub test_invert ()
|
|---|
| 48 | {
|
|---|
| 49 | my @tests = ([[["FALSE"]],
|
|---|
| 50 | [["TRUE"]]],
|
|---|
| 51 |
|
|---|
| 52 | [[["TRUE"]],
|
|---|
| 53 | [["FALSE"]]],
|
|---|
| 54 |
|
|---|
| 55 | [[["COND1_TRUE", "COND2_TRUE"],
|
|---|
| 56 | ["COND3_FALSE", "COND2_TRUE"]],
|
|---|
| 57 | [["COND2_FALSE"],
|
|---|
| 58 | ["COND1_FALSE", "COND3_TRUE"]]],
|
|---|
| 59 |
|
|---|
| 60 | [[["COND1_TRUE", "COND2_TRUE"],
|
|---|
| 61 | ["TRUE"]],
|
|---|
| 62 | [["FALSE"]]],
|
|---|
| 63 |
|
|---|
| 64 | [[["COND1_TRUE", "COND2_TRUE"],
|
|---|
| 65 | ["FALSE"]],
|
|---|
| 66 | [["COND1_FALSE"],
|
|---|
| 67 | ["COND2_FALSE"]]],
|
|---|
| 68 |
|
|---|
| 69 | [[["COND1_TRUE"],
|
|---|
| 70 | ["COND2_FALSE"]],
|
|---|
| 71 | [["COND1_FALSE", "COND2_TRUE"]]]
|
|---|
| 72 | );
|
|---|
| 73 |
|
|---|
| 74 | for my $t (@tests)
|
|---|
| 75 | {
|
|---|
| 76 | my $set = build_set @{$t->[0]};
|
|---|
| 77 | my $res = build_set @{$t->[1]};
|
|---|
| 78 | my $inv = $set->invert;
|
|---|
| 79 | if ($inv != $res)
|
|---|
| 80 | {
|
|---|
| 81 | print " (I) " . $set->string . "\n\t"
|
|---|
| 82 | . $inv->string . ' != ' . $res->string . "\n";
|
|---|
| 83 | return 1;
|
|---|
| 84 | }
|
|---|
| 85 | }
|
|---|
| 86 | return 0;
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | sub test_simplify ()
|
|---|
| 90 | {
|
|---|
| 91 | my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 92 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"]],
|
|---|
| 93 | [["FOO_TRUE", "BAR_FALSE"]]],
|
|---|
| 94 |
|
|---|
| 95 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 96 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 97 | ["FOO_TRUE", "BAR_TRUE"]],
|
|---|
| 98 | [["FOO_TRUE"]]],
|
|---|
| 99 |
|
|---|
| 100 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 101 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 102 | ["FOO_TRUE", "BAR_TRUE"],
|
|---|
| 103 | ["FOO_FALSE"]],
|
|---|
| 104 | [["TRUE"]]],
|
|---|
| 105 |
|
|---|
| 106 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 107 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 108 | ["BAR_TRUE", "BAZ_TRUE"],
|
|---|
| 109 | ["BAR_FALSE", "BAZ_TRUE"]],
|
|---|
| 110 | [["BAZ_TRUE"], ["FOO_TRUE", "BAR_FALSE"]]],
|
|---|
| 111 |
|
|---|
| 112 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 113 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 114 | ["BAR_TRUE", "BAZ_TRUE"],
|
|---|
| 115 | ["BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 116 | ["FOO_FALSE"]],
|
|---|
| 117 | [["FOO_FALSE"], ["BAZ_TRUE"], ["BAR_FALSE"]]],
|
|---|
| 118 |
|
|---|
| 119 | [[["B_TRUE"],
|
|---|
| 120 | ["A_FALSE", "B_TRUE"]],
|
|---|
| 121 | [["B_TRUE"]]],
|
|---|
| 122 |
|
|---|
| 123 | [[["B_TRUE"],
|
|---|
| 124 | ["A_FALSE", "B_FALSE", "C_TRUE"],
|
|---|
| 125 | ["A_FALSE", "B_FALSE", "C_FALSE"]],
|
|---|
| 126 | [["A_FALSE"], ["B_TRUE"]]],
|
|---|
| 127 |
|
|---|
| 128 | [[["B_TRUE"],
|
|---|
| 129 | ["A_FALSE", "B_FALSE", "C_TRUE"],
|
|---|
| 130 | ["A_FALSE", "B_FALSE", "C_FALSE"],
|
|---|
| 131 | ["A_TRUE", "B_FALSE"]],
|
|---|
| 132 | [["TRUE"]]],
|
|---|
| 133 |
|
|---|
| 134 | [[["A_TRUE", "B_TRUE"],
|
|---|
| 135 | ["A_TRUE", "B_FALSE"],
|
|---|
| 136 | ["A_TRUE", "C_FALSE", "D_FALSE"]],
|
|---|
| 137 | [["A_TRUE"]]],
|
|---|
| 138 |
|
|---|
| 139 | [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE", "E_FALSE"],
|
|---|
| 140 | ["A_FALSE", "B_FALSE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 141 | ["A_FALSE", "B_TRUE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 142 | ["A_FALSE", "B_TRUE", "C_FALSE", "D_FALSE", "E_FALSE"],
|
|---|
| 143 | ["A_TRUE", "B_TRUE", "C_FALSE", "D_FALSE", "E_FALSE"],
|
|---|
| 144 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 145 | ["A_TRUE", "B_FALSE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 146 | ["A_TRUE", "B_FALSE", "C_FALSE", "D_TRUE", "E_FALSE"]],
|
|---|
| 147 | [ ["B_FALSE", "C_FALSE", "D_TRUE", "E_FALSE"],
|
|---|
| 148 | ["B_FALSE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 149 | ["B_TRUE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 150 | ["B_TRUE", "C_FALSE", "D_FALSE", "E_FALSE"]]],
|
|---|
| 151 |
|
|---|
| 152 | [[["A_FALSE", "B_FALSE", "C_FALSE", "D_TRUE", "E_FALSE"],
|
|---|
| 153 | ["A_FALSE", "B_FALSE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 154 | ["A_FALSE", "B_TRUE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 155 | ["A_FALSE", "B_TRUE", "C_FALSE", "D_FALSE", "E_FALSE"],
|
|---|
| 156 | ["A_TRUE", "B_TRUE", "C_FALSE", "D_FALSE", "E_FALSE"],
|
|---|
| 157 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 158 | ["A_TRUE", "B_FALSE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 159 | ["A_TRUE", "B_FALSE", "C_FALSE", "D_TRUE", "E_FALSE"],
|
|---|
| 160 | ["A_FALSE", "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"],
|
|---|
| 161 | ["A_FALSE", "B_FALSE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 162 | ["A_FALSE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 163 | ["A_FALSE", "B_TRUE", "C_FALSE", "D_TRUE", "E_FALSE"],
|
|---|
| 164 | ["A_TRUE", "B_TRUE", "C_FALSE", "D_TRUE", "E_FALSE"],
|
|---|
| 165 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"],
|
|---|
| 166 | ["A_TRUE", "B_FALSE", "C_TRUE", "D_FALSE", "E_TRUE"],
|
|---|
| 167 | ["A_TRUE", "B_FALSE", "C_FALSE", "D_FALSE", "E_FALSE"]],
|
|---|
| 168 | [["C_FALSE", "E_FALSE"],
|
|---|
| 169 | ["C_TRUE", "E_TRUE"]]],
|
|---|
| 170 |
|
|---|
| 171 | [[["A_FALSE"],
|
|---|
| 172 | ["A_TRUE", "B_FALSE"],
|
|---|
| 173 | ["A_TRUE", "B_TRUE", "C_FALSE"],
|
|---|
| 174 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_FALSE"],
|
|---|
| 175 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_FALSE"],
|
|---|
| 176 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE", "F_FALSE"],
|
|---|
| 177 | ["A_TRUE", "B_TRUE", "C_TRUE", "D_TRUE", "E_TRUE"]],
|
|---|
| 178 | [["TRUE"]]],
|
|---|
| 179 |
|
|---|
| 180 | # Simplify should work with up to 31 variables.
|
|---|
| 181 | [[["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
|
|---|
| 182 | "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
|
|---|
| 183 | "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
|
|---|
| 184 | "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
|
|---|
| 185 | "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
|
|---|
| 186 | "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
|
|---|
| 187 | "V31_TRUE"],
|
|---|
| 188 | ["V01_TRUE", "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
|
|---|
| 189 | "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
|
|---|
| 190 | "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
|
|---|
| 191 | "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
|
|---|
| 192 | "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
|
|---|
| 193 | "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
|
|---|
| 194 | "V31_FALSE"],
|
|---|
| 195 | ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
|
|---|
| 196 | "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
|
|---|
| 197 | "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
|
|---|
| 198 | "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
|
|---|
| 199 | "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
|
|---|
| 200 | "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
|
|---|
| 201 | "V31_TRUE"],
|
|---|
| 202 | ["V01_FALSE","V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
|
|---|
| 203 | "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
|
|---|
| 204 | "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
|
|---|
| 205 | "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
|
|---|
| 206 | "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
|
|---|
| 207 | "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE",
|
|---|
| 208 | "V31_FALSE"]],
|
|---|
| 209 | [[ "V02_TRUE", "V03_TRUE", "V04_TRUE", "V05_TRUE",
|
|---|
| 210 | "V06_TRUE", "V07_TRUE", "V08_TRUE", "V09_TRUE", "V10_TRUE",
|
|---|
| 211 | "V11_TRUE", "V12_TRUE", "V13_TRUE", "V14_TRUE", "V15_TRUE",
|
|---|
| 212 | "V16_TRUE", "V17_TRUE", "V18_TRUE", "V19_TRUE", "V20_TRUE",
|
|---|
| 213 | "V21_TRUE", "V22_TRUE", "V23_TRUE", "V24_TRUE", "V25_TRUE",
|
|---|
| 214 | "V26_TRUE", "V27_TRUE", "V28_TRUE", "V29_TRUE", "V30_TRUE"
|
|---|
| 215 | ]]]);
|
|---|
| 216 |
|
|---|
| 217 | for my $t (@tests)
|
|---|
| 218 | {
|
|---|
| 219 | my $set = build_set @{$t->[0]};
|
|---|
| 220 | my $res = build_set @{$t->[1]};
|
|---|
| 221 |
|
|---|
| 222 | # Make sure simplify() yields the expected result.
|
|---|
| 223 | my $sim = $set->simplify;
|
|---|
| 224 | if ($sim != $res)
|
|---|
| 225 | {
|
|---|
| 226 | print " (S1) " . $set->string . "\n\t"
|
|---|
| 227 | . $sim->string . ' != ' . $res->string . "\n";
|
|---|
| 228 | return 1;
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | # Make sure simplify() is idempotent.
|
|---|
| 232 | my $sim2 = $sim->simplify;
|
|---|
| 233 | if ($sim2 != $sim)
|
|---|
| 234 | {
|
|---|
| 235 | print " (S2) " . $sim->string . "\n\t"
|
|---|
| 236 | . $sim2->string . ' != ' . $sim->string . "\n";
|
|---|
| 237 | return 1;
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| 240 | # Also exercize invert() while we are at it.
|
|---|
| 241 |
|
|---|
| 242 | my $inv1 = $set->invert->simplify;
|
|---|
| 243 | my $inv2 = $sim->invert->simplify;
|
|---|
| 244 | if ($inv1 != $inv2)
|
|---|
| 245 | {
|
|---|
| 246 | print " (S3) " . $set->string . ", " . $sim->string . "\n\t"
|
|---|
| 247 | . $inv1->string . ' != ' . $inv2->string . "\n";
|
|---|
| 248 | return 1;
|
|---|
| 249 | }
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | return 0;
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| 255 | sub test_sub_conditions ()
|
|---|
| 256 | {
|
|---|
| 257 | my @tests = ([[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 258 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 259 | ["FOO_FALSE"]],
|
|---|
| 260 | ["FOO_TRUE"],
|
|---|
| 261 | [["BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 262 | ["BAR_FALSE", "BAZ_TRUE"]]],
|
|---|
| 263 |
|
|---|
| 264 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 265 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 266 | ["FOO_FALSE"]],
|
|---|
| 267 | ["FOO_TRUE", "BAR_FALSE"],
|
|---|
| 268 | [["BAZ_FALSE"],
|
|---|
| 269 | ["BAZ_TRUE"]]],
|
|---|
| 270 |
|
|---|
| 271 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 272 | ["FOO_TRUE", "BAR_FALSE", "BAZ_TRUE"],
|
|---|
| 273 | ["FOO_FALSE"]],
|
|---|
| 274 | ["FOO_TRUE", "BAR_TRUE"],
|
|---|
| 275 | [["FALSE"]]],
|
|---|
| 276 |
|
|---|
| 277 | [[["FOO_TRUE", "BAR_FALSE", "BAZ_FALSE"],
|
|---|
| 278 | ["FOO_TRUE", "BAZ_TRUE"],
|
|---|
| 279 | ["FOO_FALSE"]],
|
|---|
| 280 | ["FOO_TRUE", "BAR_TRUE"],
|
|---|
| 281 | [["BAZ_TRUE"]]],
|
|---|
| 282 |
|
|---|
| 283 | [[["FOO_TRUE", "BAR_FALSE"],
|
|---|
| 284 | ["FOO_TRUE", "BAR_TRUE"]],
|
|---|
| 285 | ["FOO_TRUE", "BAR_TRUE"],
|
|---|
| 286 | [["TRUE"]]],
|
|---|
| 287 |
|
|---|
| 288 | [[["TRUE"]],
|
|---|
| 289 | ["TRUE"],
|
|---|
| 290 | [["TRUE"]]],
|
|---|
| 291 |
|
|---|
| 292 | [[["FALSE"]],
|
|---|
| 293 | ["TRUE"],
|
|---|
| 294 | [["FALSE"]]],
|
|---|
| 295 |
|
|---|
| 296 | [[["FALSE"]],
|
|---|
| 297 | ["FALSE"],
|
|---|
| 298 | [["FALSE"]]]);
|
|---|
| 299 |
|
|---|
| 300 | for my $t (@tests)
|
|---|
| 301 | {
|
|---|
| 302 | my $t1 = build_set @{$t->[0]};
|
|---|
| 303 | my $t2 = new Automake::Condition @{$t->[1]};
|
|---|
| 304 | my $t3 = build_set @{$t->[2]};
|
|---|
| 305 |
|
|---|
| 306 | # Make sure sub_conditions() yields the expected result.
|
|---|
| 307 | my $s = $t1->sub_conditions ($t2);
|
|---|
| 308 | if ($s != $t3)
|
|---|
| 309 | {
|
|---|
| 310 | print " (SC) " . $t1->string . "\n\t"
|
|---|
| 311 | . $s->string . ' != ' . $t3->string . "\n";
|
|---|
| 312 | return 1;
|
|---|
| 313 | }
|
|---|
| 314 | }
|
|---|
| 315 | }
|
|---|
| 316 |
|
|---|
| 317 | sub test_ambig ()
|
|---|
| 318 | {
|
|---|
| 319 | my @tests = ([[["TRUE"]],
|
|---|
| 320 | ["TRUE"],
|
|---|
| 321 | "multiply defined"],
|
|---|
| 322 | [[["C1_TRUE"]],
|
|---|
| 323 | ["C1_TRUE"],
|
|---|
| 324 | "multiply defined"],
|
|---|
| 325 | [[["TRUE"]],
|
|---|
| 326 | ["C1_FALSE"],
|
|---|
| 327 | "which includes"],
|
|---|
| 328 | [[["C1_TRUE"]],
|
|---|
| 329 | ["C1_TRUE", "C2_TRUE"],
|
|---|
| 330 | "which includes"],
|
|---|
| 331 | [[["C1_TRUE", "C2_TRUE"]],
|
|---|
| 332 | ["C2_TRUE"],
|
|---|
| 333 | "which is included in"],
|
|---|
| 334 | [[["C1_TRUE"]],
|
|---|
| 335 | ["C2_TRUE"],
|
|---|
| 336 | ''],
|
|---|
| 337 | [[["C1_TRUE"],
|
|---|
| 338 | ["C2_FALSE"]],
|
|---|
| 339 | ["C1_FALSE", "C2_TRUE"],
|
|---|
| 340 | '']);
|
|---|
| 341 |
|
|---|
| 342 | for my $t (@tests)
|
|---|
| 343 | {
|
|---|
| 344 | my $t1 = build_set @{$t->[0]};
|
|---|
| 345 | my $t2 = new Automake::Condition @{$t->[1]};
|
|---|
| 346 | my $t3 = $t->[2];
|
|---|
| 347 | my ($ans, $cond) = $t1->ambiguous_p ("FOO", $t2);
|
|---|
| 348 | if ($t3 && $ans !~ /FOO.*$t3/)
|
|---|
| 349 | {
|
|---|
| 350 | print " (A1) " . $t1->string . " vs. " . $t2->string . "\n\t"
|
|---|
| 351 | . "Error message '$ans' does not match '$t3'\n";
|
|---|
| 352 | return 1;
|
|---|
| 353 | }
|
|---|
| 354 | if (!$t3 && $ans ne '')
|
|---|
| 355 | {
|
|---|
| 356 | print " (A2) " . $t1->string . " vs. " . $t2->string . "\n\t"
|
|---|
| 357 | . "Unexpected error message: $ans\n";
|
|---|
| 358 | return 1;
|
|---|
| 359 | }
|
|---|
| 360 | }
|
|---|
| 361 | return 0;
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | exit (test_basics
|
|---|
| 365 | || test_invert
|
|---|
| 366 | || test_simplify
|
|---|
| 367 | || test_sub_conditions
|
|---|
| 368 | || test_ambig);
|
|---|
| 369 |
|
|---|
| 370 | ### Setup "GNU" style for perl-mode and cperl-mode.
|
|---|
| 371 | ## Local Variables:
|
|---|
| 372 | ## perl-indent-level: 2
|
|---|
| 373 | ## perl-continued-statement-offset: 2
|
|---|
| 374 | ## perl-continued-brace-offset: 0
|
|---|
| 375 | ## perl-brace-offset: 0
|
|---|
| 376 | ## perl-brace-imaginary-offset: 0
|
|---|
| 377 | ## perl-label-offset: -2
|
|---|
| 378 | ## cperl-indent-level: 2
|
|---|
| 379 | ## cperl-brace-offset: 0
|
|---|
| 380 | ## cperl-continued-brace-offset: 0
|
|---|
| 381 | ## cperl-label-offset: -2
|
|---|
| 382 | ## cperl-extra-newline-before-brace: t
|
|---|
| 383 | ## cperl-merge-trailing-else: nil
|
|---|
| 384 | ## cperl-continued-statement-offset: 2
|
|---|
| 385 | ## End:
|
|---|