mirror of https://github.com/sgoudham/bst-rs.git
FEAT(macro): Add bst! macro that act like vec!
This macro uses the `IterativeBST` to create a new tree with the given elements, either creating just and empty tree with `IterativeBST::new()` or using a combination of `IterativeBST::from_iter()` and `vec![]` if given any elementspull/4/head
parent
f85b449e66
commit
63a3190084
@ -0,0 +1,17 @@
|
||||
use bst_rs::bst;
|
||||
|
||||
#[test]
|
||||
fn successfully_construct_bst_from_macro() {
|
||||
let mut actual_bst = IterativeBST::new();
|
||||
actual_bst.insert(3);
|
||||
actual_bst.insert(2);
|
||||
let expected_bst = bst![3,2];
|
||||
assert_eq!(actual_bst, expected_bst);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verify_permutations_produce_same_tree() {
|
||||
let expected_bst = bst![2,3];
|
||||
let expected_bst = bst![3,2];
|
||||
assert_eq!(actual_bst, expected_bst);
|
||||
}
|
Loading…
Reference in New Issue