Example #1
0
        public void TestDontCountTwice()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(1);
            set.Add(1);

            Assert.AreEqual(1, set.Count);
        }
Example #2
0
        public void TestReturnList()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(1);
            set.Add(2);
            set.Add(3);

            CollectionAssert.AreEqual(new[] { 1, 2, 3 }, set.ToList());
        }
Example #3
0
        public void TestCount()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(1);
            set.Add(2);
            set.Add(3);

            Assert.AreEqual(3, set.Count);
        }
Example #4
0
        public void TestAddMultipleAndGet()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(8);
            set.Add(3);
            set.Add(6);
            set.Add(4);

            Assert.IsTrue(set.Contains(4));
        }
Example #5
0
        public void TestIntersects()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(1);
            set.Add(2);
            set.Add(3);

            set.IntersectWith(new[] { 2, 3, 4, 5 });

            CollectionAssert.AreEqual(new[] { 2, 3 }, set.ToList());
        }
        public void Init()
        {
            _intSet = new BinaryTreeSet <int>();

            _filledIntSet = new BinaryTreeSet <int>();
            _filledIntSet.Add(57);
        }
Example #7
0
        public void TestAddAndGet()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(1);

            Assert.IsTrue(set.Contains(1));
        }
Example #8
0
        public void TestRemoves()
        {
            var set = new BinaryTreeSet <int>();

            set.Add(1);

            Assert.IsTrue(set.Remove(1));;
            Assert.AreEqual(0, set.Count);;
        }
Example #9
0
        public void TestRemovesWihDeepTree()
        {
            var set = new BinaryTreeSet <string>();

            set.Add("D");
            set.Add("C");
            set.Add("B");
            set.Add("G");
            set.Add("E");
            set.Add("F");

            Assert.IsTrue(set.Remove("D"));;
            Assert.AreEqual(5, set.Count);;
        }
        public bool Add_SameIntValues_CorrectInserting(int value)
        {
            _intSet.Add(value);

            return(_intSet.Add(value));
        }