empty_has_height_0
This commit is contained in:
parent
bc3d33673f
commit
16fbbbd16d
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user