1 9 package test.ozoneDB.DxLib; 10 11 import org.ozoneDB.DxLib.DxSet; 12 import org.ozoneDB.DxLib.DxHashSet; 13 import org.ozoneDB.DxLib.DxTreeSet; 14 15 21 public class SetTest extends AbstractTest { 22 23 24 public SetTest() { 25 super("testDxSet"); 26 } 27 28 public SetTest(String name) { 29 super(name); 30 } 31 32 public void testDxSet() throws Exception { 33 Class [] setFactories = {DxHashSet.class, DxTreeSet.class}; 34 35 for (int i = 0; i < setFactories.length; i++) { 37 retainsAll((DxSet) setFactories[i].newInstance(), CollectionTest.newDxStrings()); 38 } 39 } 40 41 43 public void retainsAll(DxSet set, Object [] objs) throws Exception { 44 set.addAll(objs); 45 DxSet set2 = (DxSet) set.clone(); 46 startTimer(set.getClass().getName(), "retainsAll"); 47 48 set.retainAll(set2); 49 assertEquals(set, set2); 50 assertTrue(set.count() > 0); 51 52 set2.clear(); 53 set.retainAll(set2); 54 assertTrue(set.isEmpty()); 55 56 stopTimer(); 57 } 58 59 } 60 | Popular Tags |