uploading 2022 where i left it

This commit is contained in:
Dylan Thies
2023-12-07 08:24:18 -05:00
parent 2d37c34122
commit 6eaaa4630e
5 changed files with 126 additions and 0 deletions
+46
View File
@@ -119,6 +119,14 @@ fn recurse_part1(collector: &mut Vec<usize>, cwd: &MyDir) -> usize {
cwd_size
}
fn process_part1(input: &str) -> String {
todo!()
}
fn process_part2(input: &str) -> String {
todo!()
}
fn main() -> std::io::Result<()> {
//Read in file
let file = File::open("input")?;
@@ -172,3 +180,41 @@ fn main() -> std::io::Result<()> {
println!("Part 2: {}", part2.unwrap());
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
const INPUT: &str = "$ cd /
$ ls
dir a
14848514 b.txt
8504156 c.dat
dir d
$ cd a
$ ls
dir e
29116 f
2557 g
62596 h.lst
$ cd e
$ ls
584 i
$ cd ..
$ cd ..
$ cd d
$ ls
4060174 j
8033020 d.log
5626152 d.ext
7214296 k";
#[test]
fn part1_works() {
assert_eq!(process_part1(INPUT), "95437");
}
#[test]
fn part2_works() {
assert_eq!(process_part2(INPUT), "24933642");
}
}