Function iodyn::level_tree::good_levels [] [src]

pub fn good_levels<E: Debug + Clone + Eq + Hash + 'static>(
    tree: &Tree<E>
) -> bool

Use good_levels to verify level consistency when debugging

This is an O(n) operation, so it shouldn't be used in release mode

use iodyn::level_tree::{good_levels,Tree};

let tree = Tree::new(4,None,(),None,Tree::new(1,None,(),None,None)).unwrap();
debug_assert!(good_levels(&tree),"this section of code has a problem");

checks that the levels of the tree follow the convention of non-increasing to the left branch and decreasing to the right branch

also prints the levels of the failing trees and branches