Skip to content

Commit

Permalink
feat: updated github workflow to run in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jortrr committed Nov 28, 2024
1 parent 6cf8c48 commit 5d5ded7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- name: Run tests
run: cargo test --verbose -- --nocapture
- name: Run all
run: cargo run
run: cargo run --release
14 changes: 6 additions & 8 deletions src/solution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,28 +176,26 @@ pub trait Solution {

/// Run all given examples
fn run_examples(&self) -> bool {
static NAME_ONE: &str = "example_part_one()";
static NAME_TWO: &str = "example_part_two()";
let format = |part: &str, i: usize| {
format!("{} [{}/{}]", part, i + 1, self.define_examples().len(),)
let format = |part: usize| {
format!("[Ex] [{}] [{}] [{}]", self.year(), self.day(), part)
};

for (i, example) in self.define_examples().iter().enumerate() {
let input = trim_example_input(example.input);
match example.expect {
Expect::PartOne(one) => {
test!(one, self.solve_part_one(input, true), format(NAME_ONE, i));
test!(one, self.solve_part_one(input, true), format(1));
}
Expect::PartTwo(two) => {
test!(two, self.solve_part_two(input, true), format(NAME_TWO, i));
test!(two, self.solve_part_two(input, true), format(2));
}
Expect::PartsOneAndTwo(one, two) => {
test!(
one,
self.solve_part_one(input.clone(), true),
format(NAME_ONE, i)
format(1)
);
test!(two, self.solve_part_two(input, true), format(NAME_TWO, i));
test!(two, self.solve_part_two(input, true), format(2));
}
Expect::Any => (),
}
Expand Down

0 comments on commit 5d5ded7

Please sign in to comment.