use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testDeleteShortString1.
@Test
public void testDeleteShortString1() {
String ROOT_HASH_BEFORE = "a9539c810cc2e8fa20785bdd78ec36cc1dab4b41f0d531e80a5e5fd25c3037ee";
String ROOT_HASH_AFTER = "fc5120b4a711bca1f5bb54769525b11b3fb9a8d6ac0b8bf08cbb248770521758";
TrieImpl trie = new TrieImpl(mockDb);
trie.update(cat, dog);
assertEquals(dog, new String(trie.get(cat)));
trie.update(ca, dude);
assertEquals(dude, new String(trie.get(ca)));
assertEquals(ROOT_HASH_BEFORE, Hex.toHexString(trie.getRootHash()));
trie.delete(ca);
assertEquals("", new String(trie.get(ca)));
assertEquals(ROOT_HASH_AFTER, Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testDogs.
@Test
public void testDogs() {
TrieImpl trie = new TrieImpl(null);
trie.update("doe", "reindeer");
assertEquals("11a0327cfcc5b7689b6b6d727e1f5f8846c1137caaa9fc871ba31b7cce1b703e", Hex.toHexString(trie.getRootHash()));
trie.update("dog", "puppy");
assertEquals("05ae693aac2107336a79309e0c60b24a7aac6aa3edecaef593921500d33c63c4", Hex.toHexString(trie.getRootHash()));
trie.update("dogglesworth", "cat");
assertEquals("8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3", Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testDeleteShortString2.
@Test
public void testDeleteShortString2() {
String ROOT_HASH_BEFORE = "a9539c810cc2e8fa20785bdd78ec36cc1dab4b41f0d531e80a5e5fd25c3037ee";
String ROOT_HASH_AFTER = "b25e1b5be78dbadf6c4e817c6d170bbb47e9916f8f6cc4607c5f3819ce98497b";
TrieImpl trie = new TrieImpl(mockDb);
trie.update(ca, dude);
assertEquals(dude, new String(trie.get(ca)));
trie.update(cat, dog);
assertEquals(dog, new String(trie.get(cat)));
assertEquals(ROOT_HASH_BEFORE, Hex.toHexString(trie.getRootHash()));
trie.delete(cat);
assertEquals("", new String(trie.get(cat)));
assertEquals(ROOT_HASH_AFTER, Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testEmptyValues.
@Test
public void testEmptyValues() {
TrieImpl trie = new TrieImpl(null);
trie.update("do", "verb");
trie.update("ether", "wookiedoo");
trie.update("horse", "stallion");
trie.update("shaman", "horse");
trie.update("doge", "coin");
trie.update("ether", "");
trie.update("dog", "puppy");
trie.update("shaman", "");
assertEquals("5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84", Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testSmallValues.
@Test
public void testSmallValues() {
TrieImpl trie = new TrieImpl(null);
trie.update("be", "e");
trie.update("dog", "puppy");
trie.update("bed", "d");
assertEquals("3f67c7a47520f79faa29255d2d3c084a7a6df0453116ed7232ff10277a8be68b", Hex.toHexString(trie.getRootHash()));
}
Aggregations