different_singulars_not_equal
All checks were successful
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-10-15 13:13:13 +00:00
parent 32a89e4105
commit 89af9d1084

View File

@ -261,16 +261,24 @@ mod tests {
fn singular_node(
trees: &BalancedTrees<Trees>,
key: u64,
) -> Node<'static, TestContextPlain, AtomicObject<u64>> {
trees
.try_join(trees.empty(), 0.into(), trees.empty())
.try_join(trees.empty(), key.into(), trees.empty())
.unwrap()
}
fn singular_keyed(
trees: &BalancedTrees<Trees>,
key: u64,
) -> Tree<'static, TestContextPlain, AtomicObject<u64>> {
trees.tree_of(singular_node(trees, key)).unwrap()
}
fn singular_tree(
trees: &BalancedTrees<Trees>,
) -> Tree<'static, TestContextPlain, AtomicObject<u64>> {
trees.tree_of(singular_node(trees)).unwrap()
singular_keyed(trees, 0)
}
#[test]
@ -304,4 +312,12 @@ mod tests {
let reference = trees.refer(&singular_tree(&trees)).unwrap();
assert!(trees.equal(&reference, &reference));
}
#[test]
fn different_singulars_not_equal() {
let trees = BalancedTrees::new(new_trees());
let reference1 = trees.refer(&singular_keyed(&trees, 1)).unwrap();
let reference2 = trees.refer(&singular_keyed(&trees, 2)).unwrap();
assert!(!trees.equal(&reference1, &reference2));
}
}