// Path: 3-sat-core/src/main/java/com/anjlab/sat3/Helper.java
// public static ITabularFormula createFormula(int... values)
// {
//     if (values.length%3 != 0)
//     {
//         throw new IllegalArgumentException("Number of values must be a multiple of 3");
//     }
//     ITabularFormula formula = new SimpleFormula();
//     for (int i = 0; i < values.length; i +=3)
//     {
//         SimpleTriplet triplet = new SimpleTriplet(values[i], values[i + 1], values[i + 2]);
//         formula.unionOrAdd(triplet);
//     }
//     return formula;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimplePermutation.java
// public static IPermutation createPermutation(int... variables)
// {
//     IPermutation permutation = new SimplePermutation();
//         
//     for (int varName : variables)
//     {
//         permutation.add(varName);
//     }
//         
//     return permutation;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _101_instance = new _101();
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _000_instance = new _000();


import org.junit.BeforeClass;
import org.junit.Test;
import static com.anjlab.sat3.Helper.createFormula;
import static com.anjlab.sat3.SimplePermutation.createPermutation;
import static com.anjlab.sat3.SimpleTripletValueFactory._101_instance;
import static com.anjlab.sat3.SimpleTripletValueFactory._000_instance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/*
 * Copyright (c) 2010 AnjLab
 * 
 * This file is part of 
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem.
 * 
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem 
 * is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem
 * 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 Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem.
 * If not, see <http://www.gnu.org/licenses/>.
 */
package com.anjlab.sat3;



public class TestJoinMethods
{
    @BeforeClass
    public static void setup()
    {
        Helper.UsePrettyPrint = true;
        Helper.EnableAssertions = true;
        Helper.UseUniversalVarNames = true;
        System.out.println(TestJoinMethods.class.getName());
    }

    @Test
    public void testJoin2BetweenTiers() throws Throwable
    {
        for (int a1 = 1; a1 <= 3; a1++)
        for (int b1 = 1; b1 <= 3; b1++)
        for (int c1 = 1; c1 <= 3; c1++)
            for (int a2 = 3; a2 <= 5; a2++)
            for (int b2 = 3; b2 <= 5; b2++)
            for (int c2 = 3; c2 <= 5; c2++)
                for (int a3 = 5; a3 <= 7; a3++)
                for (int b3 = 5; b3 <= 7; b3++)
                for (int c3 = 5; c3 <= 7; c3++)
                {
                    if (a1 == b1 || a1 == c1 || b1 == c1) continue;
                    if (a2 == b2 || a2 == c2 || b2 == c2) continue;
                    if (a3 == b3 || a3 == c3 || b3 == c3) continue;
                    
                    Join2BetweenTiers method = new Join2BetweenTiers();

// Path: 3-sat-core/src/main/java/com/anjlab/sat3/Helper.java
// public static ITabularFormula createFormula(int... values)
// {
//     if (values.length%3 != 0)
//     {
//         throw new IllegalArgumentException("Number of values must be a multiple of 3");
//     }
//     ITabularFormula formula = new SimpleFormula();
//     for (int i = 0; i < values.length; i +=3)
//     {
//         SimpleTriplet triplet = new SimpleTriplet(values[i], values[i + 1], values[i + 2]);
//         formula.unionOrAdd(triplet);
//     }
//     return formula;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimplePermutation.java
// public static IPermutation createPermutation(int... variables)
// {
//     IPermutation permutation = new SimplePermutation();
//         
//     for (int varName : variables)
//     {
//         permutation.add(varName);
//     }
//         
//     return permutation;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _101_instance = new _101();
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _000_instance = new _000();


// Path: 3-sat-core/src/test/java/com/anjlab/sat3/TestJoinMethods.java
import org.junit.BeforeClass;
import org.junit.Test;
import static com.anjlab.sat3.Helper.createFormula;
import static com.anjlab.sat3.SimplePermutation.createPermutation;
import static com.anjlab.sat3.SimpleTripletValueFactory._101_instance;
import static com.anjlab.sat3.SimpleTripletValueFactory._000_instance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/*
 * Copyright (c) 2010 AnjLab
 * 
 * This file is part of 
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem.
 * 
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem 
 * is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem
 * 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 Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with
 * Reference Implementation of Romanov's Polynomial Algorithm for 3-SAT Problem.
 * If not, see <http://www.gnu.org/licenses/>.
 */
package com.anjlab.sat3;



public class TestJoinMethods
{
    @BeforeClass
    public static void setup()
    {
        Helper.UsePrettyPrint = true;
        Helper.EnableAssertions = true;
        Helper.UseUniversalVarNames = true;
        System.out.println(TestJoinMethods.class.getName());
    }

    @Test
    public void testJoin2BetweenTiers() throws Throwable
    {
        for (int a1 = 1; a1 <= 3; a1++)
        for (int b1 = 1; b1 <= 3; b1++)
        for (int c1 = 1; c1 <= 3; c1++)
            for (int a2 = 3; a2 <= 5; a2++)
            for (int b2 = 3; b2 <= 5; b2++)
            for (int c2 = 3; c2 <= 5; c2++)
                for (int a3 = 5; a3 <= 7; a3++)
                for (int b3 = 5; b3 <= 7; b3++)
                for (int c3 = 5; c3 <= 7; c3++)
                {
                    if (a1 == b1 || a1 == c1 || b1 == c1) continue;
                    if (a2 == b2 || a2 == c2 || b2 == c2) continue;
                    if (a3 == b3 || a3 == c3 || b3 == c3) continue;
                    
                    Join2BetweenTiers method = new Join2BetweenTiers();

                    ITabularFormula formula = createFormula(a1, b1, c1, a3, b3, c3);
