chore(box1): moved main to tests module

This commit is contained in:
Hudson C. Dalpra 2023-12-23 22:53:41 +13:00
parent 88b583f2bb
commit 7a6c439939
No known key found for this signature in database

View file

@ -26,14 +26,6 @@ pub enum List {
Nil, Nil,
} }
fn main() {
println!("This is an empty cons list: {:?}", create_empty_list());
println!(
"This is a non-empty cons list: {:?}",
create_non_empty_list()
);
}
pub fn create_empty_list() -> List { pub fn create_empty_list() -> List {
todo!() todo!()
} }
@ -46,6 +38,15 @@ pub fn create_non_empty_list() -> List {
mod tests { mod tests {
use super::*; use super::*;
#[test]
fn main() {
println!("This is an empty cons list: {:?}", create_empty_list());
println!(
"This is a non-empty cons list: {:?}",
create_non_empty_list()
);
}
#[test] #[test]
fn test_create_empty_list() { fn test_create_empty_list() {
assert_eq!(List::Nil, create_empty_list()) assert_eq!(List::Nil, create_empty_list())