import java.util.Random;
import junit.framework.TestCase;
import dijjer.util.VeryLongInteger;
/*
* Created on Dec 21, 2004
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
/**
* @author ian
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class VeryLongIntegerTest extends TestCase {
public void testCloserTo() {
VeryLongInteger vli1 = new VeryLongInteger(10, 0);
VeryLongInteger vli2 = new VeryLongInteger(20, 0);
VeryLongInteger vli3 = new VeryLongInteger(25, 0);
assertTrue(vli1.closerTo(vli2, vli3));
assertFalse(vli1.closerTo(vli3, vli2));
assertTrue(vli2.closerTo(vli3, vli1));
assertFalse(vli2.closerTo(vli1, vli3));
Random r = new Random(0);
for (int x=0; x<100; x++) {
vli1 = new VeryLongInteger(r.nextLong(), r.nextLong());
vli2 = new VeryLongInteger(r.nextLong(), r.nextLong());
vli3 = new VeryLongInteger(r.nextLong(), r.nextLong());
assertTrue(vli1.closerTo(vli1, vli2) != vli1.closerTo(vli2, vli1));
}
}
}