100-days-of-rust/Week-07/Day-48_Christmas-Tree/day48/tests/examples.rs

34 lines
563 B
Rust

#[cfg(test)]
mod examples {
use day48::tree;
#[test]
fn test1() {
assert_eq!(tree(1), vec!["#"]);
}
#[test]
fn test2() {
assert_eq!(tree(2), vec![" # ", "###"]);
}
#[test]
fn test3() {
assert_eq!(
tree(5),
vec![
" # ",
" ### ",
" ##### ",
" ####### ",
"#########"
]
);
}
#[test]
fn test4() {
assert_eq!(tree(0), Vec::<String>::new());
}
}