pub in heighted
Some checks failed
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo clippy (1.65) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.

This commit is contained in:
AF 2023-08-31 20:13:23 +00:00
parent d77491188b
commit 820298737e

View File

@ -7,7 +7,7 @@ use crate::flow::{
use crate::func::{context::*, *};
#[derive(Clone)]
struct Node<A> {
pub struct Node<A> {
l: Tree<A>,
r: Tree<A>,
key: A,
@ -19,7 +19,7 @@ impl<A: Display> Display for Node<A> {
}
}
struct Reference<A> {
pub struct Reference<A> {
node: Arc<Node<A>>,
}
@ -37,7 +37,7 @@ impl<A: Display> Display for Reference<A> {
}
}
struct Tree<A> {
pub struct Tree<A> {
reference: Option<Reference<A>>,
height: u64,
}
@ -60,12 +60,12 @@ impl<A: Display> Display for Tree<A> {
}
}
struct Trees<A> {
pub struct Trees<A> {
_a: PhantomData<A>,
}
impl<A> Trees<A> {
fn new() -> Self {
pub fn new() -> Self {
Self { _a: PhantomData }
}
}
@ -217,16 +217,13 @@ mod tests {
] {
tree = trees.clone().add_tree(tree, i);
assert!(tree.balanced());
// println!("{} {}", tree.height, tree);
}
for i in [
2, 9, 4, 7, 8, 10, 17, 1, 13, 15, 18, 12, 5, 0, 3, 6, 16, 19, 14, 11,
] {
tree = trees.clone().remove(tree, i);
assert!(tree.balanced());
// println!("{} {}", tree.height, tree);
}
// assert!(false);
}
#[test]
@ -238,15 +235,12 @@ mod tests {
] {
tree = trees.clone().add_tree(tree, i);
assert!(tree.balanced());
// println!("{} {}", tree.height, tree);
}
for i in [
2, 9, 4, 7, 8, 10, 17, 1, 13, 15, 18, 12, 5, 0, 3, 6, 16, 19, 14, 11,
] {
tree = trees.clone().remove(tree, i);
assert!(tree.balanced());
// println!("{} {}", tree.height, tree);
}
// assert!(false);
}
}
}