tetsy_trie_root_test/
lib.rs

1// Copyright 2017, 2020 Parity Technologies
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Test for trie-root crate.
16
17#[cfg(test)]
18mod test {
19	use hex_literal::hex;
20	use tetsy_trie_root::{sec_tetsy_trie_root, tetsy_trie_root};
21	use tetsy_keccak_hasher::KeccakHasher;
22	use tetsy_reference_trie::ReferenceTrieStream;
23
24	#[test]
25	fn previous_doc_test_1() {
26		let v = vec![
27			("doe", "reindeer"),
28			("dog", "puppy"),
29			("dogglesworth", "cat"),
30		];
31
32		let root = hex!["d6e02b2bd48aa04fd2ad87cfac1144a29ca7f7dc60f4526c7b7040763abe3d43"];
33		assert_eq!(sec_tetsy_trie_root::<KeccakHasher, ReferenceTrieStream, _, _, _>(v), root);
34	}
35
36	#[test]
37	fn previous_doc_test_2() {
38		let v = vec![
39				("doe", "reindeer"),
40				("dog", "puppy"),
41				("dogglesworth", "cat"),
42		];
43
44		let root = hex!["0807d5393ae7f349481063ebb5dbaf6bda58db282a385ca97f37dccba717cb79"];
45		assert_eq!(tetsy_trie_root::<KeccakHasher, ReferenceTrieStream, _, _, _>(v), root);
46	}
47}