*.json test files

This commit is contained in:
debris 2015-12-02 22:49:47 +01:00
parent 51bd813734
commit b9181b42bc
8 changed files with 373 additions and 34 deletions

View File

@ -0,0 +1,229 @@
{
"input": [
{
"operation": "insert",
"key": "0x04110d816c380812a427968ece99b1c963dfbce6",
"value": "something"
},
{
"operation": "insert",
"key": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value": "something"
},
{
"operation": "insert",
"key": "0x0a517d755cebbf66312b30fff713666a9cb917e0",
"value": "something"
},
{
"operation": "insert",
"key": "0x24dd378f51adc67a50e339e8031fe9bd4aafab36",
"value": "something"
},
{
"operation": "insert",
"key": "0x293f982d000532a7861ab122bdc4bbfd26bf9030",
"value": "something"
},
{
"operation": "insert",
"key": "0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5",
"value": "something"
},
{
"operation": "insert",
"key": "0x31c640b92c21a1f1465c91070b4b3b4d6854195f",
"value": "something"
},
{
"operation": "insert",
"key": "0x37f998764813b136ddf5a754f34063fd03065e36",
"value": "something"
},
{
"operation": "insert",
"key": "0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a",
"value": "something"
},
{
"operation": "insert",
"key": "0x4f36659fa632310b6ec438dea4085b522a2dd077",
"value": "something"
},
{
"operation": "insert",
"key": "0x62c01474f089b07dae603491675dc5b5748f7049",
"value": "something"
},
{
"operation": "insert",
"key": "0x729af7294be595a0efd7d891c9e51f89c07950c7",
"value": "something"
},
{
"operation": "insert",
"key": "0x83e3e5a16d3b696a0314b30b2534804dd5e11197",
"value": "something"
},
{
"operation": "insert",
"key": "0x8703df2417e0d7c59d063caa9583cb10a4d20532",
"value": "something"
},
{
"operation": "insert",
"key": "0x8dffcd74e5b5923512916c6a64b502689cfa65e1",
"value": "something"
},
{
"operation": "insert",
"key": "0x95a4d7cccb5204733874fa87285a176fe1e9e240",
"value": "something"
},
{
"operation": "insert",
"key": "0x99b2fcba8120bedd048fe79f5262a6690ed38c39",
"value": "something"
},
{
"operation": "insert",
"key": "0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf",
"value": "something"
},
{
"operation": "insert",
"key": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value": "something"
},
{
"operation": "insert",
"key": "0xa9647f4a0a14042d91dc33c0328030a7157c93ae",
"value": "something"
},
{
"operation": "insert",
"key": "0xaa6cffe5185732689c18f37a7f86170cb7304c2a",
"value": "something"
},
{
"operation": "insert",
"key": "0xaae4a2e3c51c04606dcb3723456e58f3ed214f45",
"value": "something"
},
{
"operation": "insert",
"key": "0xc37a43e940dfb5baf581a0b82b351d48305fc885",
"value": "something"
},
{
"operation": "insert",
"key": "0xd2571607e241ecf590ed94b12d87c94babe36db6",
"value": "something"
},
{
"operation": "insert",
"key": "0xf735071cbee190d76b704ce68384fc21e389fbe7",
"value": "something"
},
{
"operation": "remove",
"key": "0x04110d816c380812a427968ece99b1c963dfbce6"
},
{
"operation": "remove",
"key": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87"
},
{
"operation": "remove",
"key": "0x0a517d755cebbf66312b30fff713666a9cb917e0"
},
{
"operation": "remove",
"key": "0x24dd378f51adc67a50e339e8031fe9bd4aafab36"
},
{
"operation": "remove",
"key": "0x293f982d000532a7861ab122bdc4bbfd26bf9030"
},
{
"operation": "remove",
"key": "0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5"
},
{
"operation": "remove",
"key": "0x31c640b92c21a1f1465c91070b4b3b4d6854195f"
},
{
"operation": "remove",
"key": "0x37f998764813b136ddf5a754f34063fd03065e36"
},
{
"operation": "remove",
"key": "0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a"
},
{
"operation": "remove",
"key": "0x4f36659fa632310b6ec438dea4085b522a2dd077"
},
{
"operation": "remove",
"key": "0x62c01474f089b07dae603491675dc5b5748f7049"
},
{
"operation": "remove",
"key": "0x729af7294be595a0efd7d891c9e51f89c07950c7"
},
{
"operation": "remove",
"key": "0x83e3e5a16d3b696a0314b30b2534804dd5e11197"
},
{
"operation": "remove",
"key": "0x8703df2417e0d7c59d063caa9583cb10a4d20532"
},
{
"operation": "remove",
"key": "0x8dffcd74e5b5923512916c6a64b502689cfa65e1"
},
{
"operation": "remove",
"key": "0x95a4d7cccb5204733874fa87285a176fe1e9e240"
},
{
"operation": "remove",
"key": "0x99b2fcba8120bedd048fe79f5262a6690ed38c39"
},
{
"operation": "remove",
"key": "0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf"
},
{
"operation": "remove",
"key": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
},
{
"operation": "remove",
"key": "0xa9647f4a0a14042d91dc33c0328030a7157c93ae"
},
{
"operation": "remove",
"key": "0xaa6cffe5185732689c18f37a7f86170cb7304c2a"
},
{
"operation": "remove",
"key": "0xaae4a2e3c51c04606dcb3723456e58f3ed214f45"
},
{
"operation": "remove",
"key": "0xc37a43e940dfb5baf581a0b82b351d48305fc885"
},
{
"operation": "remove",
"key": "0xd2571607e241ecf590ed94b12d87c94babe36db6"
},
{
"operation": "remove",
"key": "0xf735071cbee190d76b704ce68384fc21e389fbe7"
}],
"output": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

View File

@ -0,0 +1,21 @@
{
"input":
[
{
"operation": "insert",
"key": "doe",
"value": "reindeer"
},
{
"operation": "insert",
"key": "dogglesworth",
"value": "cat"
},
{
"operation": "insert",
"key": "dog",
"value": "puppy"
}
],
"output": "0x8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3"
}

View File

@ -0,0 +1,4 @@
{
"input": [],
"output": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

View File

@ -0,0 +1,44 @@
{
"input":
[
{
"operation": "insert",
"key": "do",
"value": "verb"
},
{
"operation": "insert",
"key": "ether",
"value": "wookiedoo"
},
{
"operation": "insert",
"key": "horse",
"value": "stallion"
},
{
"operation": "insert",
"key": "shaman",
"value": "horse"
},
{
"operation": "insert",
"key": "doge",
"value": "coin"
},
{
"operation": "remove",
"key": "ether"
},
{
"operation": "insert",
"key": "dog",
"value": "puppy"
},
{
"operation": "remove",
"key": "shaman"
}
],
"output": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84"
}

View File

@ -0,0 +1,16 @@
{
"input":
[
{
"operation": "insert",
"key": "foo",
"value": "bar"
},
{
"operation": "insert",
"key": "food",
"value": "bass"
}
],
"output": "0x17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3"
}

View File

@ -0,0 +1,58 @@
{
"input": [
{
"operation": "insert",
"key": "0x0000000000000000000000000000000000000000000000000000000000000045",
"value": "0x22b224a1420a802ab51d326e29fa98e34c4f24ea"
},
{
"operation": "insert",
"key": "0x0000000000000000000000000000000000000000000000000000000000000046",
"value": "0x67706c2076330000000000000000000000000000000000000000000000000000"
},
{
"operation": "insert",
"key": "0x0000000000000000000000000000000000000000000000000000001234567890",
"value": "0x697c7b8c961b56f675d570498424ac8de1a918f6"
},
{
"operation": "insert",
"key": "0x000000000000000000000000697c7b8c961b56f675d570498424ac8de1a918f6",
"value": "0x1234567890"
},
{
"operation": "insert",
"key": "0x0000000000000000000000007ef9e639e2733cb34e4dfc576d4b23f72db776b2",
"value": "0x4655474156000000000000000000000000000000000000000000000000000000"
},
{
"operation": "insert",
"key": "0x000000000000000000000000ec4f34c97e43fbb2816cfd95e388353c7181dab1",
"value": "0x4e616d6552656700000000000000000000000000000000000000000000000000"
},
{
"operation": "insert",
"key": "0x4655474156000000000000000000000000000000000000000000000000000000",
"value": "0x7ef9e639e2733cb34e4dfc576d4b23f72db776b2"
},
{
"operation": "insert",
"key": "0x4e616d6552656700000000000000000000000000000000000000000000000000",
"value": "0xec4f34c97e43fbb2816cfd95e388353c7181dab1"
},
{
"operation": "remove",
"key": "0x0000000000000000000000000000000000000000000000000000001234567890"
},
{
"operation": "insert",
"key": "0x000000000000000000000000697c7b8c961b56f675d570498424ac8de1a918f6",
"value": "0x6f6f6f6820736f2067726561742c207265616c6c6c793f000000000000000000"
},
{
"operation": "insert",
"key": "0x6f6f6f6820736f2067726561742c207265616c6c6c793f000000000000000000",
"value": "0x697c7b8c961b56f675d570498424ac8de1a918f6"
}],
"output": "0x9f6221ebb8efe7cff60a716ecb886e67dd042014be444669f0159d8e68b42100"
}

View File

@ -72,6 +72,7 @@ impl JsonTest for TrieTest {
.map(|i| i.into())
.collect()
}
fn output(&self) -> Self::Output {
hex_or_string(self.loader.output().as_string().unwrap())
}

View File

@ -285,40 +285,6 @@ mod tests {
use hash::*;
use triehash::*;
#[test]
fn empty_trie_root() {
assert_eq!(trie_root(vec![]), H256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap());
}
#[test]
fn single_trie_item() {
let v = vec![(From::from("A"), From::from("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))];
assert_eq!(trie_root(v), H256::from_str("d23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab").unwrap());
}
#[test]
fn foo_trie_item() {
let v = vec![
(From::from("foo"), From::from("bar")),
(From::from("food"), From::from("bass"))
];
assert_eq!(trie_root(v), H256::from_str("17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3").unwrap());
}
#[test]
fn dogs_trie_item() {
let v = vec![
(From::from("doe"), From::from("reindeer")),
(From::from("dog"), From::from("puppy")),
(From::from("dogglesworth"), From::from("cat")),
];
assert_eq!(trie_root(v), H256::from_str("8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3").unwrap());
}
#[test]
fn puppy_trie_items() {