public void TestingAddingThreeNodesTree() { Hashtree hashtree = BuildTree(3); Assert.Equal(1, hashtree.Read(1)); Assert.Equal(2, hashtree.Read(2)); Assert.Equal(3, hashtree.Read(3)); }
public void TestingUpdateOnThreeNodeTree() { Hashtree hashtree = BuildTree(3); Assert.Equal(2, hashtree.Read(2)); hashtree.Update(2, "Bar"); Assert.Equal("Bar", hashtree.Read(2)); }
public void TestingSizeOnHashtreeAfterRemovingNodeFromEmptyTree() { Hashtree hashtree = new Hashtree(); hashtree.Remove(1); Assert.Equal(0, hashtree.Size); }
public void TestingSizeOnHashtreeAfterAddingOneNode() { Hashtree hashtree = new Hashtree(); hashtree.Add(1); Assert.Equal(1, hashtree.Size); }
public void TestingUpdateOnOneNodeTree() { Hashtree hashtree = BuildTree(1); Assert.Equal(1, hashtree.Read(1)); hashtree.Update(1, "Foo"); Assert.Equal("Foo", hashtree.Read(1)); }
public void TestingAddingThreeNodesRemovingOneNodeTree() { Hashtree hashtree = BuildTree(3); Assert.Equal(2, hashtree.Read(2)); hashtree.Remove(2); Assert.Null(hashtree.Read(2)); }
public void TestingAddingOneNodeRemovingOneNodeTree() { Hashtree hashtree = BuildTree(1); Assert.Equal(1, hashtree.Read(1)); hashtree.Remove(1); Assert.Equal(1, hashtree.Read(1)); }
public void TestingSizeOnHashtreeAfterAddingMultipleNodes() { Hashtree hashtree = new Hashtree(); hashtree.Add(1); hashtree.Add(2); Assert.Equal(2, hashtree.Size); }
public Hashtree BuildTree(int numNodes) { Hashtree hashtree = new Hashtree(); for (int i = 1; i <= numNodes + 1; i++) { hashtree.Add(i); } return(hashtree); }
static void Main(string[] args) { Stopwatch stopwatch = new Stopwatch(); Hashtree test = new Hashtree(); List <object> result; int numNodesAdd = 50000000; int numNodesRemove = numNodesAdd; Console.WriteLine($"Adding {numNodesAdd} nodes."); stopwatch.Start(); for (int i = 1; i <= numNodesAdd; i++) { test.Add(i); } stopwatch.Stop(); Console.WriteLine($"Add Complete +{stopwatch.Elapsed}"); stopwatch.Reset(); Console.WriteLine($"Removing {numNodesRemove} nodes."); stopwatch.Start(); for (int i = numNodesRemove; i > 1; i--) { test.Remove(i); } result = test.ReadAll(); stopwatch.Stop(); result = test.ReadAll(); Console.WriteLine($"Remove Complete +{stopwatch.Elapsed}"); }
public void TestingAddingSingleNodeTree() { Hashtree hashtree = BuildTree(1); Assert.Equal(1, hashtree.Read(1)); }
public void TestingRootOfAnThreeNodeTree() { Hashtree hashtree = BuildTree(3); Assert.Equal(1, hashtree.Root); }
public void TestingRootOfAnEmptyTree() { Hashtree hashtree = new Hashtree(); Assert.Equal(0, hashtree.Root); }
public void TestingSizeOnHashtreeCreation() { Hashtree hashtree = new Hashtree(); Assert.Equal(0, hashtree.Size); }