r#"xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))"#;
#[test]
- fn test_part1() {
+ fn part1() {
let v = execute_corrupted_program(CORRUPTED_PROGRAM_PART1);
assert_eq!(v, 161);
}
r#"xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))"#;
#[test]
- fn test_part2() {
+ fn part2() {
let v = execute_corrupted_program_dodont(CORRUPTED_PROGRAM_PART2);
assert_eq!(v, 48);
}
MXMXAXMASX";
#[test]
- fn test_part1() {
+ fn part1() {
let word_search = read_word_search(&mut WORD_SEARCH.as_bytes());
let n = nb_of_word_occurences(&word_search, "XMAS");
assert_eq!(n, 18);
}
#[test]
- fn test_part2() {
+ fn part2() {
let word_search = read_word_search(&mut WORD_SEARCH.as_bytes());
let n = nb_of_mas_cross(&word_search);
assert_eq!(n, 9);
97,13,75,29,47";
#[test]
- fn test_part1() {
+ fn part1() {
let (ordering, updates) =
read_ordering_and_updates(&mut PAGE_ORDERING_AND_UPDATES.as_bytes());
let s = sum_of_mid_page_from_valid_updates(&ordering, &updates);
}
#[test]
- fn test_part2() {
+ fn part2() {
let (ordering, updates) =
read_ordering_and_updates(&mut PAGE_ORDERING_AND_UPDATES.as_bytes());
let s = sum_of_mid_page_from_corrected_updates(&ordering, &updates);
......#...";
#[test]
- fn test_part1() {
+ fn part1() {
let (map, guard_pos) = read_map(&mut MAP.as_bytes());
let n = nb_position_visited_by_guard(&map, guard_pos);
assert_eq!(n, 41);
}
#[test]
- fn test_part2() {
+ fn part2() {
let (map, guard_pos) = read_map(&mut MAP.as_bytes());
let n = nb_possible_obstruction_position(&map, guard_pos);
assert_eq!(n, 6);
.#.";
#[test]
- fn test_part2_tiny_maps() {
+ fn part2_tiny_maps() {
let (map, guard_pos) = read_map(&mut MAP2.as_bytes());
assert_eq!(nb_possible_obstruction_position(&map, guard_pos), 1);
292: 11 6 16 20";
#[test]
- fn test_part1() {
+ fn part1() {
let equations = read(&mut EQUATIONS.as_bytes());
let sum = sum_valid_equations(&equations);
assert_eq!(sum, 3749);
}
#[test]
- fn test_part2() {
+ fn part2() {
let equations = read(&mut EQUATIONS.as_bytes());
let sum = sum_valid_equations_with_concat(&equations);
assert_eq!(sum, 11387);
............";
#[test]
- fn test_part1() {
+ fn part1() {
let antennae = read(&mut ANTENNAE.as_bytes());
let n = nb_antinodes(&antennae, AntinodeMode::TwoPerPair);
assert_eq!(n, 14);
}
#[test]
- fn test_part2() {
+ fn part2() {
let antennae = read(&mut ANTENNAE.as_bytes());
let n = nb_antinodes(&antennae, AntinodeMode::Unlimited);
assert_eq!(n, 34);
static DISK_MAP: &str = "2333133121414131402";
#[test]
- fn test_part1() {
+ fn part1() {
let memory = read(&mut DISK_MAP.as_bytes());
let memory = defrag_v1(memory);
let checksum = checksum(&memory);
}
#[test]
- fn test_part2() {
+ fn part2() {
let memory = read(&mut DISK_MAP.as_bytes());
let memory = defrag_v2(memory);
let checksum = checksum(&memory);
10456732";
#[test]
- fn test_part1() {
+ fn part1() {
let (map, start_positions) = read_map(&mut MAP.as_bytes());
let score = score(&map, &start_positions, false);
assert_eq!(score, 36);
}
#[test]
- fn test_part2() {
+ fn part2() {
let (map, start_positions) = read_map(&mut MAP.as_bytes());
let score = score(&map, &start_positions, true);
assert_eq!(score, 81);
static STONES: &str = "125 17";
#[test]
- fn test_part1_and_part2() {
+ fn part1_and_part2() {
let stones = read(&mut STONES.as_bytes());
let stones_after_6 = blink(stones.clone(), 6);
let stones_after_25 = blink(stones, 25);