public void Insert_without_recalculating_hashes_with_starting_index(uint nodesCount, uint startCalculatingHashes) { BaselineTree withHashesTree = BuildATree(); BaselineTree withoutHashesTree = BuildATree(); for (int i = 0; i < nodesCount; i++) { withHashesTree.Insert(_testLeaves[i]); if (i < startCalculatingHashes) { withoutHashesTree.Insert(_testLeaves[i]); Assert.AreEqual(withHashesTree.Root, withoutHashesTree.Root); } else { withoutHashesTree.Insert(_testLeaves[i], false); Assert.AreNotEqual(withHashesTree.Root, withoutHashesTree.Root); } Assert.AreEqual(withHashesTree.Count, withoutHashesTree.Count); } withoutHashesTree.CalculateHashes(startCalculatingHashes); Assert.AreEqual(withHashesTree.Root, withoutHashesTree.Root); Assert.AreEqual(withHashesTree.Count, withoutHashesTree.Count); }
public void Insert_without_recalculating_hashes(uint nodesCount) { BaselineTree withHashesTree = BuildATree(); BaselineTree withoutHashesTree = BuildATree(); for (int i = 0; i < nodesCount; i++) { withHashesTree.Insert(_testLeaves[i]); withoutHashesTree.Insert(_testLeaves[i], false); Assert.AreNotEqual(withHashesTree.Root, withoutHashesTree.Root); Assert.AreEqual(withHashesTree.Count, withoutHashesTree.Count); } withoutHashesTree.CalculateHashes(); Assert.AreEqual(withHashesTree.Root, withoutHashesTree.Root); Assert.AreEqual(withHashesTree.Count, withoutHashesTree.Count); }