day(01): convert sample tests to unit tests
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
0f6c1af251
commit
1d5c91536c
1 changed files with 17 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue