import junit.framework.Assert;
import junit.framework.TestCase;
import csce913proj1.*;

public class Test extends TestCase{
	
	ABMatrix dm = new ABMatrix();
	ABMatrix am = new ABMatrix();
	ABMatrix mm = new ABMatrix();
	
	public void testSatSimple() {
		dm.matrix = new double[5][5];
		am.matrix = new double[5][5];
		mm.matrix = new double[5][5];
		for (int i=0; i<5; i++) {
			for (int j=0; j<5; j++)
			{
				dm.matrix[i][j] = Double.NEGATIVE_INFINITY;
			}
		}
		dm.matrix[1][0] = 5; // x-y >= 5
		dm.matrix[0][1] = -10; // -x+y >= -10
		dm.M = 5;
		
		csce913proj1.CdbTuple t = new csce913proj1.CdbTuple(dm, am, mm, new String[] {"x", "y", "z", "x1", "z1"});
		boolean flag = t.satisfiable();
		Assert.assertTrue(flag);
	}
	
	public void testUnsatSimple()
	{
		dm.matrix = new double[5][5];
		am.matrix = new double[5][5];
		mm.matrix = new double[5][5];
		//unsat testing
		for (int i=0; i<5; i++)
			for (int j=0; j<5; j++)
			{
				dm.matrix[i][j] = Double.NEGATIVE_INFINITY;
			}
		dm.matrix[1][0] = 12; // x-y >= 12
		dm.matrix[0][1] = -10; // -x+y >= -10
		dm.M = 5;
		
		CdbTuple t = new CdbTuple(dm, am, mm, new String[] {"x", "y", "z", "x1", "z1"});
		boolean flag = t.satisfiable();
		Assert.assertTrue(!flag);
	}

}
