Example #1
0
 @Test
 public void symmetricUnionTest() {
   int number = 10;
   QuickFind quickFind = new QuickFind(number);
   Assert.assertFalse(quickFind.areConnected(0, 1));
   quickFind.union(0, 1);
   Assert.assertTrue(quickFind.areConnected(0, 1));
   Assert.assertTrue(quickFind.areConnected(1, 1));
 }
Example #2
0
 @Test
 public void transitiveUnionTest() {
   int number = 10;
   QuickFind quickFind = new QuickFind(number);
   Assert.assertFalse(quickFind.areConnected(1, 8));
   quickFind.union(0, 1);
   quickFind.union(8, 9);
   quickFind.union(0, 9);
   Assert.assertTrue(quickFind.areConnected(1, 8));
   super.printArray(quickFind.getId());
 }
Example #3
0
 @Test
 public void reflexiveUnionTest() {
   int number = 10;
   QuickFind quickFind = new QuickFind(number);
   Assert.assertTrue(quickFind.areConnected(0, 0));
 }
Example #4
0
 @Test
 public void simpleTest() {
   int number = 10;
   QuickFind quickFind = new QuickFind(number);
   Assert.assertEquals(number, quickFind.getId().length);
 }