Files
advent-of-code-2023/day_09/src/main.rs
2023-12-11 00:39:11 -07:00

29 lines
604 B
Rust

use day_09::prelude::*;
fn main() {
let input = include_str!("../input.txt");
println!("{}", part1(input));
println!("{}", part2(input));
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_part1() {
let test_input = "0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45";
assert_eq!(part1(test_input), "114".to_string());
}
#[test]
fn test_part2() {
assert_eq!(part2("0 3 6 9 12 15"), "-3".to_string());
assert_eq!(part2("1 3 6 10 15 21"), "0".to_string());
assert_eq!(part2("10 13 16 21 30 45"), "5".to_string());
}
}