Skip to main content

classify

Function classify 

Source
pub fn classify(stdout: &str) -> Outcome
Expand description

Classifies a solution’s standard output.

One or two non-blank lines are answers; zero, three or more lines - or any blank line - is ordinary output.

use aoc_runtime::answer::{classify, Outcome};

let Outcome::Answers(answers) = classify("1227\n23262\n") else {
    panic!("two lines are answers");
};
assert_eq!(answers.part1, "1227");
assert_eq!(answers.part2.as_deref(), Some("23262"));

assert_eq!(classify("running...\n1227\n23262\n"), Outcome::Raw);