public static void CanCloneTree() { const int treeSize = 500; Node root = TreeGenerator.GenerateTree(treeSize); Node cloned = TreeGenerator.CloneTree(root); Assert.True(MerkleExercise.CompareTrees(root, cloned)); }
public static void CanDetectSubtrees() { const int treeSize = 500; Node bigTreeRoot = TreeGenerator.GenerateTree(treeSize); Node randomBigTreeNode = TreeGenerator.PickRandomNode(bigTreeRoot); Node subtree = TreeGenerator.CloneTree(randomBigTreeNode); Assert.True(MerkleExercise.IsSubtree(bigTreeRoot, subtree)); }
public static void CanFiddleWithTree() { const int treeSize = 500; Node root = TreeGenerator.GenerateTree(treeSize); Node cloned = TreeGenerator.CloneTree(root); TreeGenerator.FiddleWithTree(cloned); // a fiddled tree should never be identical Assert.False(MerkleExercise.CompareTrees(root, cloned)); }