empty_has_height_0
All checks were successful
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.
buildbot/cargo clippy (1.65) Build done.

This commit is contained in:
AF 2023-10-15 12:13:37 +00:00
parent bc3d33673f
commit 16fbbbd16d
2 changed files with 28 additions and 2 deletions

View File

@ -231,3 +231,29 @@ impl<'a, Ctx: Context<'a>, A: MentionableBase<'a> + Clone> Clone for Tree<'a, Ct
} }
} }
} }
#[cfg(test)]
mod tests {
use std::convert::Infallible;
use crate::{
flow::{binary::*, comparator::*},
rstd::atomic_object::*,
testing::TestContextPlain,
};
use super::context::*;
type Trees =
TreeContext2<'static, TestContextPlain, AtomicObject<u64>, DefaultComparator, Infallible>;
fn new_trees() -> Trees {
Trees::new((DefaultComparator.into(), u64::f()))
}
#[test]
fn empty_has_height_0() {
let trees = new_trees();
assert_eq!(trees.height(&trees.empty()), 0);
}
}

View File

@ -15,8 +15,8 @@ use super::*;
pub struct TreeContext<Cl, T>(Cl, PhantomData<T>); pub struct TreeContext<Cl, T>(Cl, PhantomData<T>);
impl<Cl: Clone, T> TreeContext<Cl, T> { impl<Cl: Clone, T> TreeContext<Cl, T> {
fn new(comparator: Cl) -> Self { pub fn new(cl: Cl) -> Self {
Self(comparator, PhantomData) Self(cl, PhantomData)
} }
} }