Ejemplo n.º 1
0
 public void AppendLeafAndDraw(DemoMerkleTree tree, int content)
 {
     Output.WriteLine($"Append {content}");
     tree.AppendLeaf(DemoMerkleNode.Create(content.ToString()).SetText(content.AsAlphaChar()));
     tree.BuildTree();
     DrawNode(tree.RootNode);
     Output.WriteLine("");
 }
Ejemplo n.º 2
0
        public void TreeTest(int nodeCount)
        {
            var demo = new Demo();
            var tree = new DemoMerkleTree();

            demo.CreateTree(tree, nodeCount);
            DrawNode(tree.RootNode);
            Assert.True(true);
        }
Ejemplo n.º 3
0
        public void TreeIncrementalPersistTest()
        {
            var tree = new DemoMerkleTree();

            for (int i = 0; i <= 64; i++)
            {
                AppendLeafAndDraw(tree, i);
            }
            Assert.True(true);
        }
        public void CompareCliftonMerkleToDebugEventMerkle_Test(int leafCount)
        {
            var demo        = new Demo();
            var cliftonTree = new DemoMerkleTree();

            demo.CreateTree(cliftonTree, leafCount);

            var appendTree = new EventMerkleTree();

            for (int i = 0; i < leafCount; i++)
            {
                var newLeafNode = EventMerkleNode.Create(i.ToString()).SetText(i.ToString("X"));
                appendTree.AppendLeaf(newLeafNode);
            }

            Assert.Equal(cliftonTree.RootNode.Hash.ToString(), appendTree.RootNode.Hash.ToString());
            if (leafCount > 1)
            {
                Assert.Equal(((DemoMerkleNode)cliftonTree.RootNode).Text, ((EventMerkleNode)appendTree.RootNode).Text);
            }
        }