//add test code here (main class was getting to be a mess)

import java.util.*;

public class Test {
	//Constructor
	Test () {}
	
	//run all tests
	public void testAll() {
		System.out.println("Testing All Classes...");
		System.out.println();
		testTruthRow();
		
		System.out.println("All tests completed.");
		
	}
	
	void testTruthRow () {
		System.out.println("Initializing TruthRow test...");
		TruthRow two			= new TruthRow (0,0,1);
		
		//bitAt()
		if (two.bitAt(0) == 0 &&
			two.bitAt(1) == 0 &&
			two.bitAt(2) == 1) {
			System.out.println("bitAt(int zeroOneTwo): Passed!");
		}
		else System.out.println("bitAt(int zeroOneTwo): Failed!");
		
		//end test
		System.out.println("TruthRow: test completed.");
		System.out.println();
	}
	
	void testTruthTable () {
		System.out.println("Initializing TruthTable test...");
		TruthTable tt = new TruthTable();
		
		TruthRow one			= new TruthRow (0,0,0);
		TruthRow two			= new TruthRow (0,0,1);
		TruthRow four			= new TruthRow (0,1,0);
		TruthRow eight			= new TruthRow (0,1,1);
		TruthRow sixteen		= new TruthRow (1,0,0);
		TruthRow thirtyTwo		= new TruthRow (1,0,1);
		TruthRow sixtyFour		= new TruthRow (1,1,0);
		TruthRow oneTwentyEight	= new TruthRow (1,1,1);
		
		ArrayList <TruthRow> temp = new ArrayList <TruthRow> (0);
		
		RelationTable a0 = new RelationTable (temp);
		
		temp.add(one);
		RelationTable a1 = new RelationTable (temp);
		temp.clear();
		
		temp.add(two);
		RelationTable a2 = new RelationTable (temp);
		temp.clear();
		
		temp.add(two);
		temp.add(one);
		RelationTable a3 = new RelationTable (temp);
		temp.clear();
		
		temp.add(sixteen);
		temp.add(four);
		temp.add(two);
		RelationTable a22 = new RelationTable (temp);
		temp.clear();
		
		temp.add(oneTwentyEight);
		temp.add(sixtyFour);
		temp.add(thirtyTwo);
		temp.add(sixteen);
		temp.add(eight);
		temp.add(four);
		temp.add(two);
		temp.add(one);
		RelationTable a255 = new RelationTable (temp);
				
		//
		if(		(tt.getRelationTable(0) == a0) &&
				(tt.getRelationTable(1) == a1) &&
				(tt.getRelationTable(2) == a2) && 
				(tt.getRelationTable(3) == a3) &&
				(tt.getRelationTable(22) == a22) && 
				(tt.getRelationTable(255) == a255)) {
			System.out.println("getRelationTable(int relationID): Passed!");
		}
		else System.out.println("getRelationTable(int relationID): Failed!");
		
		//end test
		System.out.println("TruthTable: test completed.");
		System.out.println();
	}
	/*
	void testRelationTable () {
		System.out.println("Initializing RelationTable test...");
		RelationTable rt = new RelationTable ();
		TruthRow four			= new TruthRow (0,1,0);
		TruthRow eight			= new TruthRow (0,1,1);
		
		rt.add(four);
		rt.add(eight);
		
		//add()
		if ((rt.relationTable.get(0).bitAt(0) == 0) &&
			(rt.relationTable.get(0).bitAt(1) == 1) &&
			(rt.relationTable.get(0).bitAt(2) == 0) &&
			(rt.relationTable.get(1).bitAt(0) == 0) &&
			(rt.relationTable.get(1).bitAt(1) == 1) &&
			(rt.relationTable.get(1).bitAt(2) == 1)) {
			System.out.println("add(TruthRow truthTableRow): Passed!");
		}
		else System.out.println("add(TruthRow truthTableRow): Failed!");
		
		//start();
		rt.start();
		if (rt.tableIndex == 0) {
			System.out.println("start(): Passed!");
		}
		else System.out.println("start(): Failed!");
		
		
	}
	*/
}