Skip to content

Commit

Permalink
Autoformat cmd.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Dec 24, 2023
1 parent 7027836 commit ceee304
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions 2023/cmd/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
namespace app {

std::optional<xmas::solution::duration> solve_day(
std::map<const int, std::unique_ptr<xmas::solution>>::value_type const&
solution,
std::map<const int, std::unique_ptr<xmas::solution>>::value_type const& solution,
bool verbose);

solution_vector select_all_days() {
Expand Down Expand Up @@ -80,8 +79,8 @@ bool execute_days(app&, solution_vector const& days) {
}

xlog::info("DONE");
xlog::info("Total time was {} ms",
std::chrono::duration_cast<std::chrono::milliseconds>(total).count());
xlog::info(
"Total time was {} ms", std::chrono::duration_cast<std::chrono::milliseconds>(total).count());

return total_success;
}
Expand All @@ -90,9 +89,7 @@ std::int64_t microseconds(xmas::solution::duration d) {
return std::chrono::duration_cast<std::chrono::microseconds>(d).count();
}

bool time_days(app&,
solution_vector const& days,
xmas::solution::duration timeout) {
bool time_days(app&, solution_vector const& days, xmas::solution::duration timeout) {
xmas::solution::duration total{};
bool total_success = true;

Expand Down Expand Up @@ -145,8 +142,7 @@ bool time_days(app&,

// Average
const auto mean =
std::chrono::duration_cast<std::chrono::microseconds>(daily_total / iter)
.count();
std::chrono::duration_cast<std::chrono::microseconds>(daily_total / iter).count();
const auto dev = static_cast<std::int64_t>(std::sqrt(S / iter));

// Report
Expand All @@ -155,26 +151,20 @@ bool time_days(app&,
total += daily_total / iter;
}

xlog::info(fmt,
"TOTAL",
"-",
std::chrono::duration_cast<std::chrono::microseconds>(total).count(),
"-");
xlog::info(
fmt, "TOTAL", "-", std::chrono::duration_cast<std::chrono::microseconds>(total).count(), "-");

return total_success;
}

std::optional<xmas::solution::duration> solve_day(
std::map<const int, std::unique_ptr<xmas::solution>>::value_type const&
solution,
std::map<const int, std::unique_ptr<xmas::solution>>::value_type const& solution,
bool verbose) {

try {
solution.second->set_input(
std::format("./data/{:02d}/input.txt", solution.second->day()));
solution.second->set_input(std::format("./data/{:02d}/input.txt", solution.second->day()));
} catch (std::runtime_error& e) {
xlog::error(
"day {} could not load: {}\n", solution.second->day(), e.what());
xlog::error("day {} could not load: {}\n", solution.second->day(), e.what());
return {};
}

Expand Down

0 comments on commit ceee304

Please sign in to comment.