예제 #1
0
 public static void AssertSingleElement(Transaction trans, BTree btree, object element
     )
 {
     Assert.AreEqual(1, btree.Size(trans));
     var result = btree.SearchRange(trans, element);
     var expectingVisitor = new ExpectingVisitor(new[] {element}
         );
     TraverseKeys(result, expectingVisitor);
     expectingVisitor.AssertExpectations();
     expectingVisitor = new ExpectingVisitor(new[] {element});
     btree.TraverseKeys(trans, expectingVisitor);
     expectingVisitor.AssertExpectations();
 }
예제 #2
0
		private void ExpectKeysSearch(Transaction trans, BTree btree, int[] keys)
		{
			int lastValue = int.MinValue;
			for (int i = 0; i < keys.Length; i++)
			{
				if (keys[i] != lastValue)
				{
					ExpectingVisitor expectingVisitor = ExpectingVisitor.CreateExpectingVisitor(keys[
						i], IntArrays4.Occurences(keys, keys[i]));
					IBTreeRange range = btree.SearchRange(trans, keys[i]);
					BTreeAssert.TraverseKeys(range, expectingVisitor);
					expectingVisitor.AssertExpectations();
					lastValue = keys[i];
				}
			}
		}