-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rs
45 lines (36 loc) · 959 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
mod module;
mod pulse;
mod state;
mod system;
use module::modules::Modules;
use pulse::Pulses;
use state::records::Records;
use state::State;
pub fn main() {
let data = include_str!("input.txt");
println!("Part 1: {}", part_one::<59>(data));
println!("Part 2: {}", part_two::<59>(data));
}
fn part_one<const N: usize>(data: &'static str) -> usize {
let mut system = system::System::<N>::new(data);
system.run()
}
fn part_two<const N: usize>(data: &'static str) -> usize {
let mut system = system::System::<N>::new(data);
system.find_output_cycle()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn one_a() {
let data = include_str!("test_a.txt");
assert_eq!(32_000_000, part_one::<6>(data));
}
#[test]
fn one_b() {
let data = include_str!("test_b.txt");
assert_eq!(11_687_500, part_one::<6>(data));
}
}