public void TestAdd2() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); full.Add(1); Assert.AreEqual(3, full.Size()); }
public void TestClear() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); full.Clear(); Assert.AreEqual(0, full.Size()); }
public void TestSize() { CopyOnWriteArraySet <Object> empty = new CopyOnWriteArraySet <Object>(); CopyOnWriteArraySet <Object> full = PopulatedSet(3); Assert.AreEqual(3, full.Size()); Assert.AreEqual(0, empty.Size()); }
public void TestRemove() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); full.Remove(1); Assert.IsFalse(full.Contains(one)); Assert.AreEqual(2, full.Size()); }
public void TestRemoveAll() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); ArrayList <Object> v = new ArrayList <Object>(); v.Add(1); v.Add(2); full.RemoveAll(v); Assert.AreEqual(1, full.Size()); }
public void TestAddAll2() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); ArrayList <Object> v = new ArrayList <Object>(); v.Add(3); v.Add(4); v.Add(1); // will not add this element full.AddAll(v); Assert.AreEqual(5, full.Size()); }
public void TestAddAll() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); ArrayList <Object> v = new ArrayList <Object>(); v.Add(three); v.Add(four); v.Add(five); full.AddAll(v); Assert.AreEqual(6, full.Size()); }
static CopyOnWriteArraySet <Object> PopulatedSet(int n) { CopyOnWriteArraySet <Object> a = new CopyOnWriteArraySet <Object>(); Assert.IsTrue(a.IsEmpty()); for (int i = 0; i < n; ++i) { a.Add(i); } Assert.IsFalse(a.IsEmpty()); Assert.AreEqual(n, a.Size()); return(a); }