diff --git a/y2024/src/days/d21.rs b/y2024/src/days/d21.rs index a2baabe..eba4346 100644 --- a/y2024/src/days/d21.rs +++ b/y2024/src/days/d21.rs @@ -396,8 +396,6 @@ impl From<&str> for Keypad { #[cfg(test)] mod tests { - use rayon::result; - use super::*; const INPUT_1: &str = "029A"; @@ -406,12 +404,12 @@ mod tests { const INPUT_4: &str = "456A"; const INPUT_5: &str = "379A"; - //const INPUT_1_BACK: &str = - // ">^AvAA<^A>A>^AvA^A^A^A>AAvA^AA>^AAAvA<^A>A"; - //const INPUT_2_BACK: &str = ">^AAAvA^A>^AvAA<^A>AA>^AAAvA<^A>A^AA"; - //const INPUT_3_BACK: &str = - // ">^A>^AAvAA<^A>A>^AAvA^A^AAAA>^AAAvA<^A>A"; - //const INPUT_4_BACK: &str = ">^AA>^AAvAA<^A>A^AA^AAA>^AAvA<^A>A"; + const INPUT_1_BACK: &str = + ">^AvAA<^A>A>^AvA^A^A^A>AAvA^AA>^AAAvA<^A>A"; + const INPUT_2_BACK: &str = ">^AAAvA^A>^AvAA<^A>AA>^AAAvA<^A>A^AA"; + const INPUT_3_BACK: &str = + ">^A>^AAvAA<^A>A>^AAvA^A^AAAA>^AAAvA<^A>A"; + const INPUT_4_BACK: &str = ">^AA>^AAvAA<^A>A^AA^AAA>^AAvA<^A>A"; const INPUT_5_BACK: &str = ">^AvA^A>^AAvA<^A>AAvA^A^AAAA>^AAAvA<^A>A"; #[test] @@ -459,37 +457,45 @@ mod tests { assert_eq!(keypad_1.sequence, ">^A"); } - //#[test] - //fn part1_1_back() { - // let result = Keypad::revert_from(INPUT_1_BACK); - // let result = Keypad::revert_from(&result); - // let result = Numpad::revert_from(&result); - // assert_eq!(result, "029A"); - //} + #[test] + fn part1_1_back() { + let result = Keypad::revert_from(INPUT_1_BACK); + println!("back 1 {result}"); + let result = Keypad::revert_from(&result); + println!("back 2 {result}"); + let result = Numpad::revert_from(&result); + assert_eq!(result, "029A"); + } - //#[test] - //fn part1_2_back() { - // let result = Keypad::revert_from(INPUT_2_BACK); - // let result = Keypad::revert_from(&result); - // let result = Numpad::revert_from(&result); - // assert_eq!(result, "980A"); - //} + #[test] + fn part1_2_back() { + let result = Keypad::revert_from(INPUT_2_BACK); + println!("back 1 {result}"); + let result = Keypad::revert_from(&result); + println!("back 2 {result}"); + let result = Numpad::revert_from(&result); + assert_eq!(result, "980A"); + } - //#[test] - //fn part1_3_back() { - // let result = Keypad::revert_from(INPUT_3_BACK); - // let result = Keypad::revert_from(&result); - // let result = Numpad::revert_from(&result); - // assert_eq!(result, "179A"); - //} + #[test] + fn part1_3_back() { + let result = Keypad::revert_from(INPUT_3_BACK); + println!("back 1 {result}"); + let result = Keypad::revert_from(&result); + println!("back 2 {result}"); + let result = Numpad::revert_from(&result); + assert_eq!(result, "179A"); + } - //#[test] - //fn part1_4_back() { - // let result = Keypad::revert_from(INPUT_4_BACK); - // let result = Keypad::revert_from(&result); - // let result = Numpad::revert_from(&result); - // assert_eq!(result, "456A"); - //} + #[test] + fn part1_4_back() { + let result = Keypad::revert_from(INPUT_4_BACK); + println!("back 1 {result}"); + let result = Keypad::revert_from(&result); + println!("back 2 {result}"); + let result = Numpad::revert_from(&result); + assert_eq!(result, "456A"); + } #[test] fn part1_5_back() {