/// <summary> /// Only used for the UnitTests. /// </summary> public void Validate() { if (head != null) { AVLNode.CheckNodes(head); int size = AVLNode.GetCount(head); System.Diagnostics.Debug.Assert(size == count, "The elementCount is " + count + " but should be " + size); } else { System.Diagnostics.Debug.Assert(count == 0, "The elementCount is " + count + " but should be 0"); } }
/// <summary> /// Used for UnitTests. /// </summary> public void Validate() { int size = 0; for (int i = 0; i < HashMap.Length; i++) { if (HashMap[i] is AVLNode) { AVLNode.CheckNodes((AVLNode)HashMap[i]); size += AVLNode.GetCount((AVLNode)HashMap[i]); } else if (HashMap[i] != null) { System.Diagnostics.Debug.Assert(Math.Abs(((KeyValuePair <TKey, TValue>)HashMap[i]).Key.GetHashCode()) % this._size == i, "The InnerSerializableKeyValuePair hash would resolve to a different spot than it lives in."); size++; } } System.Diagnostics.Debug.Assert(size == _elementCount, "The elementCount is " + _elementCount + " but should be " + size); }
/// <summary> /// Used for UnitTests. /// </summary> public void Validate() { if (head != null) { AVLNode.CheckNodes(head); int size = AVLNode.GetCount(head); System.Diagnostics.Debug.Assert(size == queue.ValidateCount(), "The queue and tree sizes are not equal."); System.Diagnostics.Debug.Assert(size == count, "The elementCount is " + count + " but should be " + size); System.Diagnostics.Debug.Assert(size == queue.size, "The queue size is " + queue.size + " but should be " + size); } else { System.Diagnostics.Debug.Assert(count == queue.ValidateCount(), "The queue and tree sizes are not equal."); System.Diagnostics.Debug.Assert(count == 0, "The elementCount is " + count + " but should be 0"); System.Diagnostics.Debug.Assert(queue.size == 0, "The queue size is " + queue.size + " but should be 0"); } }