public void EmptyTree_ContainsKey_ReturnsFalse() { RBTree <int> tree = new RBTree <int>(intComparison); int notInserted = 5; bool containsResult = tree.Contains(notInserted); Assert.IsFalse(containsResult); }
public void InsertKey_ContainsThisKey_ReturnsTrue() { RBTree <int> tree = new RBTree <int>(intComparison); int key = 0; tree.Insert(key); bool containsResult = tree.Contains(key); Assert.IsTrue(containsResult); }
public void InsertOneKey_ContainsAnotherKey_ReturnsFalse() { RBTree <int> tree = new RBTree <int>(intComparison); int addedKey = 0; int notAddedKey = -1; tree.Insert(addedKey); bool containsResult = tree.Contains(notAddedKey); Assert.IsFalse(containsResult); }
public void Insert10Keys_ContainsNonExistentKey_ReturnsFalse() { RBTree <int> tree = new RBTree <int>(intComparison); int size = 10; int[] keys = new int[size]; for (int i = 0; i < size; i++) { keys[i] = i; tree.Insert(keys[i]); } int notExistKey = int.MinValue; bool containsResult = tree.Contains(notExistKey); Assert.IsFalse(containsResult); }
public void Insert100Keys_ContainsKeys_ReturnTrue() { RBTree <int> tree = new RBTree <int>(intComparison); int size = 100; int[] keys = new int[size]; for (int i = 0; i < size; i++) { keys[i] = i; tree.Insert(keys[i]); } bool containsAll = true; for (int i = 0; i < size; i++) { containsAll = containsAll && tree.Contains(keys[i]); } }