1
0
Fork 0

day(01): convert sample tests to unit tests

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-12-01 11:24:03 +01:00
parent 0f6c1af251
commit 1d5c91536c
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -78,12 +78,25 @@ fn main() {
.compact()
.init();
let sample = parse_input("samples/day01.txt");
let input = parse_input("inputs/day01.txt");
assert_eq!(part_1(&sample), 24000);
info!("Part 1: {}", part_1(&input));
assert_eq!(part_2(&sample), 45000);
info!("Part 2: {}", part_2(&input));
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_part_1() {
let sample = parse_input("samples/day01.txt");
assert_eq!(part_1(&sample), 24000);
}
#[test]
fn test_part_2() {
let sample = parse_input("samples/day01.txt");
assert_eq!(part_2(&sample), 45000);
}
}