Пример #1
0
        public void Search_RootIsNull_ReturnsNull()
        {
            var tree = new ScapegoatTree <int>();

            var result = tree.Search(1);

            Assert.IsNull(result);
        }
Пример #2
0
        public void Search_KeyIsPresent_ReturnsKey()
        {
            var tree = new ScapegoatTree <int>(key: 1);

            var result = tree.Search(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result !.Key);
        }
Пример #3
0
        public void Search_KeyIsNotPresent_ReturnsNull(int key)
        {
            var root = new Node <int>(1, new Node <int>(2), new Node <int>(-1));

            var tree = new ScapegoatTree <int>(root, 0.5);

            var result = tree.Search(key);

            Assert.IsNull(result);
        }