public void IterateNodes() { var merkleTrie = new MerkleTrie(new MemoryKeyValueStore()); // There is nothing. Assert.Empty(merkleTrie.IterateNodes()); merkleTrie = (MerkleTrie)merkleTrie.Set( new KeyBytes(0xbe, 0xef), Dictionary.Empty.Add(GetRandomBytes(32), Null.Value)); // There are (ShortNode, ValueNode) Assert.Equal(2, merkleTrie.IterateNodes().Count()); merkleTrie = (MerkleTrie)merkleTrie.Commit(); // There are (HashNode, ShortNode, HashNode, ValueNode) Assert.Equal(4, merkleTrie.IterateNodes().Count()); }
public void IterateNodes() { var merkleTrie = new MerkleTrie(new MemoryKeyValueStore()); // There is nothing. Assert.Empty(merkleTrie.IterateNodes()); merkleTrie = (MerkleTrie)merkleTrie.Set( new byte[] { 0xbe, 0xef, }, Dictionary.Empty.Add(TestUtils.GetRandomBytes(32), default(Null))); // There are (ShortNode, ValueNode) Assert.Equal(2, merkleTrie.IterateNodes().Count()); merkleTrie = (MerkleTrie)merkleTrie.Commit(); // There are (HashNode, ShortNode, HashNode, ValueNode) Assert.Equal(4, merkleTrie.IterateNodes().Count()); }