Beispiel #1
0
 public void Test_Tree_Double_Add()
 {
     Set s = new Set(SetImplementation.Tree);
     Assert.AreEqual(0, s.Count);
     s.Add("one");
     Assert.AreEqual(1, s.Count);
     s.Add("one");
 }
Beispiel #2
0
 //[ExpectedException(typeof(ArgumentException))]
 [Test] public void Test_SkipList_Double_Add()
 {
     Set s = new Set(SetImplementation.SkipList);
     Assert.AreEqual(0, s.Count);
     s.Add("one");
     Assert.AreEqual(1, s.Count);
     s.Add("one");
 }
Beispiel #3
0
        private void all(SetImplementation i)
        {
            Set s = new Set(i);
            Assert.AreEqual(0, s.Count);

            s.Add("one");
            Assert.AreEqual(1, s.Count);
            Assert.IsTrue(s.Contains("one"));
            Assert.IsTrue(!s.Contains("two"));
            Assert.IsTrue(!s.Contains("three"));

            s.Add("two");
            Assert.AreEqual(2, s.Count);
            Assert.IsTrue(s.Contains("one"));
            Assert.IsTrue(s.Contains("two"));
            Assert.IsTrue(!s.Contains("three"));

            s.Remove("one");
            Assert.AreEqual(1, s.Count);
            Assert.IsTrue(!s.Contains("one"));
            Assert.IsTrue(s.Contains("two"));
            Assert.IsTrue(!s.Contains("three"));

            s.Add("one");
            Assert.AreEqual(2, s.Count);
            Assert.IsTrue(s.Contains("one"));
            Assert.IsTrue(s.Contains("two"));
            Assert.IsTrue(!s.Contains("three"));

            s.Add("one");
            Assert.AreEqual(2, s.Count);
            Assert.IsTrue(s.Contains("one"));
            Assert.IsTrue(s.Contains("two"));
            Assert.IsTrue(!s.Contains("three"));

            int count = 0;
            foreach (string str in s)
            {
                count++;
                Assert.AreEqual(3, str.Length);
            }
            Assert.AreEqual(2, count);
        }