chore: fix lints
This commit is contained in:
parent
78e32a3824
commit
51dbc61583
4 changed files with 34 additions and 32 deletions
|
@ -497,12 +497,14 @@ fn test_bit_position_iterator() {
|
||||||
assert_eq!(TrueBitPositionIterator::new(3).collect::<Vec<u32>>(), vec![0, 1],);
|
assert_eq!(TrueBitPositionIterator::new(3).collect::<Vec<u32>>(), vec![0, 1],);
|
||||||
assert_eq!(TrueBitPositionIterator::new(3).rev().collect::<Vec<u32>>(), vec![1, 0],);
|
assert_eq!(TrueBitPositionIterator::new(3).rev().collect::<Vec<u32>>(), vec![1, 0],);
|
||||||
|
|
||||||
assert_eq!(TrueBitPositionIterator::new(0b11010101).collect::<Vec<u32>>(), vec![
|
assert_eq!(
|
||||||
0, 2, 4, 6, 7
|
TrueBitPositionIterator::new(0b11010101).collect::<Vec<u32>>(),
|
||||||
],);
|
vec![0, 2, 4, 6, 7],
|
||||||
assert_eq!(TrueBitPositionIterator::new(0b11010101).rev().collect::<Vec<u32>>(), vec![
|
);
|
||||||
7, 6, 4, 2, 0
|
assert_eq!(
|
||||||
],);
|
TrueBitPositionIterator::new(0b11010101).rev().collect::<Vec<u32>>(),
|
||||||
|
vec![7, 6, 4, 2, 0],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -200,10 +200,13 @@ impl PartialMerkleTree {
|
||||||
pub fn to_paths(&self) -> Vec<(NodeIndex, ValuePath)> {
|
pub fn to_paths(&self) -> Vec<(NodeIndex, ValuePath)> {
|
||||||
let mut paths = Vec::new();
|
let mut paths = Vec::new();
|
||||||
self.leaves.iter().for_each(|&leaf| {
|
self.leaves.iter().for_each(|&leaf| {
|
||||||
paths.push((leaf, ValuePath {
|
paths.push((
|
||||||
value: self.get_node(leaf).expect("Failed to get leaf node"),
|
leaf,
|
||||||
path: self.get_path(leaf).expect("Failed to get path"),
|
ValuePath {
|
||||||
}));
|
value: self.get_node(leaf).expect("Failed to get leaf node"),
|
||||||
|
path: self.get_path(leaf).expect("Failed to get path"),
|
||||||
|
},
|
||||||
|
));
|
||||||
});
|
});
|
||||||
paths
|
paths
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,10 +215,13 @@ fn get_paths() {
|
||||||
let expected_paths: Vec<(NodeIndex, ValuePath)> = leaves
|
let expected_paths: Vec<(NodeIndex, ValuePath)> = leaves
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&leaf| {
|
.map(|&leaf| {
|
||||||
(leaf, ValuePath {
|
(
|
||||||
value: mt.get_node(leaf).unwrap(),
|
leaf,
|
||||||
path: mt.get_path(leaf).unwrap(),
|
ValuePath {
|
||||||
})
|
value: mt.get_node(leaf).unwrap(),
|
||||||
|
path: mt.get_path(leaf).unwrap(),
|
||||||
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
|
@ -661,12 +661,10 @@ fn test_empty_smt_leaf_serialization() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_single_smt_leaf_serialization() {
|
fn test_single_smt_leaf_serialization() {
|
||||||
let single_leaf = SmtLeaf::new_single(RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]), [
|
let single_leaf = SmtLeaf::new_single(
|
||||||
1_u32.into(),
|
RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]),
|
||||||
2_u32.into(),
|
[1_u32.into(), 2_u32.into(), 3_u32.into(), 4_u32.into()],
|
||||||
3_u32.into(),
|
);
|
||||||
4_u32.into(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let mut serialized = single_leaf.to_bytes();
|
let mut serialized = single_leaf.to_bytes();
|
||||||
// extend buffer with random bytes
|
// extend buffer with random bytes
|
||||||
|
@ -679,18 +677,14 @@ fn test_single_smt_leaf_serialization() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multiple_smt_leaf_serialization_success() {
|
fn test_multiple_smt_leaf_serialization_success() {
|
||||||
let multiple_leaf = SmtLeaf::new_multiple(vec![
|
let multiple_leaf = SmtLeaf::new_multiple(vec![
|
||||||
(RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]), [
|
(
|
||||||
1_u32.into(),
|
RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]),
|
||||||
2_u32.into(),
|
[1_u32.into(), 2_u32.into(), 3_u32.into(), 4_u32.into()],
|
||||||
3_u32.into(),
|
),
|
||||||
4_u32.into(),
|
(
|
||||||
]),
|
RpoDigest::from([100_u32, 101_u32, 102_u32, 13_u32]),
|
||||||
(RpoDigest::from([100_u32, 101_u32, 102_u32, 13_u32]), [
|
[11_u32.into(), 12_u32.into(), 13_u32.into(), 14_u32.into()],
|
||||||
11_u32.into(),
|
),
|
||||||
12_u32.into(),
|
|
||||||
13_u32.into(),
|
|
||||||
14_u32.into(),
|
|
||||||
]),
|
|
||||||
])
|
])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue